using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using System;

namespace FAS_LIB
{
    public class scOrderData
    {
        private int _PlantId;
        private int _AssemLineId;
        private string _AssemLineAbbrv;
        private int _OrderId;
        private string _OrderFO;
        private string _OrderJobName;
        private int _OrderLineId;
        private string _OrderLineNum;
        private string _OrderLineSS;
        private string _OrderLineSL;
        private DateTime _OrderLineTargetDt;
        private DateTime _OrderLineShipDt;
        private bool _OrderLineShipped;
        private DateTime _OrderLineAssyStartDt;

        public int PlantId
        {
            get
            {
                return this._PlantId;
            }
            set
            {
                this._PlantId = value;
            }
        }

        public int AssemblyLineId
        {
            get
            {
                return this._AssemLineId;
            }
            set
            {
                this._AssemLineId = value;
            }
        }

        public string AssemLineAbbrv
        {
            get
            {
                return this._AssemLineAbbrv;
            }
            set
            {
                this._AssemLineAbbrv = value;
            }
        }

        public int OrderId
        {
            get
            {
                return this._OrderId;
            }
            set
            {
                this._OrderId = value;
            }
        }

        public string OrderFO
        {
            get
            {
                return this._OrderFO;
            }
            set
            {
                this._OrderFO = value;
            }
        }

        public string OrderJobName
        {
            get
            {
                return this._OrderJobName;
            }
            set
            {
                this._OrderJobName = value;
            }
        }

        public int OrderLineId
        {
            get
            {
                return this._OrderLineId;
            }
            set
            {
                this._OrderLineId = value;
            }
        }

        public string OrderLineNum
        {
            get
            {
                return this._OrderLineNum;
            }
            set
            {
                this._OrderLineNum = value;
            }
        }

        public string OrderLineSL
        {
            get
            {
                return this._OrderLineSL;
            }
            set
            {
                this._OrderLineSL = value;
            }
        }

        public string OrderLineSS
        {
            get
            {
                return this._OrderLineSS;
            }
            set
            {
                this._OrderLineSS = value;
            }
        }

        public DateTime OrderLineTargetDt
        {
            get
            {
                return this._OrderLineTargetDt;
            }
            set
            {
                this._OrderLineTargetDt = value;
            }
        }

        public DateTime OrderLineShipDt
        {
            get
            {
                return this._OrderLineShipDt;
            }
            set
            {
                this._OrderLineShipDt = value;
            }
        }

        public byte OrderLineShipped
        {
            get
            {
                return this._OrderLineShipped ? (byte)1 : (byte)0;
            }
            set
            {
                if ((int)value > 0)
                    this._OrderLineShipped = true;
                else
                    this._OrderLineShipped = false;
            }
        }

        public bool OrderLineShippedbln
        {
            get
            {
                return this._OrderLineShipped;
            }
            set
            {
                this._OrderLineShipped = value;
            }
        }

        public DateTime OrderLineAssyStartDt
        {
            get
            {
                return this._OrderLineAssyStartDt;
            }
            set
            {
                this._OrderLineAssyStartDt = value;
            }
        }

        public string FactoryOrder
        {
            get
            {
                string str;
                if (this._OrderFO.Length == 8 & this._OrderLineNum.Length == 3 & this._OrderLineSL.Length == 2 & this._OrderLineSS.Length == 2)
                {
                    try
                    {
                        str = Strings.Trim(this._OrderFO) + "-" + Strings.Trim(this._OrderLineNum) + "-" + Strings.Trim(this._OrderLineSL) + "-" + Strings.Trim(this._OrderLineSS);
                    }
                    catch (Exception ex)
                    {
                        ProjectData.SetProjectError(ex);
                        str = "";
                        ProjectData.ClearProjectError();
                    }
                }
                else
                    str = "";
                return str;
            }
            set
            {
                string str1 = value.Trim();
                if (str1.Length == 15)
                {
                    try
                    {
                        string str2 = str1.Substring(0, 8);
                        string str3 = str1.Substring(8, 3);
                        string str4 = str1.Substring(11, 2);
                        string str5 = str1.Substring(13, 2);
                        this._OrderFO = str2;
                        this._OrderLineNum = str3;
                        this._OrderLineSL = str4;
                        this._OrderLineSS = str5;
                    }
                    catch (Exception ex)
                    {
                        ProjectData.SetProjectError(ex);
                        this._OrderFO = "";
                        this._OrderLineNum = "";
                        this._OrderLineSL = "";
                        this._OrderLineSS = "";
                        ProjectData.ClearProjectError();
                    }
                }
            }
        }

        public string FactoryOrderOE
        {
            get
            {
                string str;
                if (this._OrderFO.Length == 8 & this._OrderLineNum.Length == 3 & this._OrderLineSL.Length == 2 & this._OrderLineSS.Length == 2)
                {
                    try
                    {
                        str = Strings.Trim(this._OrderFO) + "-" + Strings.Trim(this._OrderLineNum) + "-" + Strings.Trim(this._OrderLineSL) + "-" + Strings.Trim(this._OrderLineSS);
                    }
                    catch (Exception ex)
                    {
                        ProjectData.SetProjectError(ex);
                        str = "";
                        ProjectData.ClearProjectError();
                    }
                }
                else
                    str = "";
                return str;
            }
            set
            {
                string str1 = !value.Trim().StartsWith("085-") ? value.Trim() : value.Trim().Remove(0, 4);
                char[] charArray = str1.ToCharArray();
                if (charArray.Length >= 18)
                {
                    if (Operators.CompareString(Conversions.ToString(charArray[8]), "-", false) == 0 & Operators.CompareString(Conversions.ToString(charArray[12]), "-", false) == 0 & Operators.CompareString(Conversions.ToString(charArray[15]), "-", false) == 0)
                    {
                        try
                        {
                            string str2 = str1.Substring(0, 8);
                            string str3 = str1.Substring(9, 3);
                            string str4 = str1.Substring(13, 2);
                            string str5 = str1.Substring(16, 2);
                            this._OrderFO = str2;
                            this._OrderLineNum = str3;
                            this._OrderLineSL = str4;
                            this._OrderLineSS = str5;
                        }
                        catch (Exception ex)
                        {
                            ProjectData.SetProjectError(ex);
                            this._OrderFO = "";
                            this._OrderLineNum = "";
                            this._OrderLineSL = "";
                            this._OrderLineSS = "";
                            ProjectData.ClearProjectError();
                        }
                    }
                }
            }
        }

        public string FOLineSLSS
        {
            get
            {
                return this._OrderFO + this._OrderLineNum + this._OrderLineSL + this._OrderLineSS;
            }
            set
            {
                string str1 = value.Trim();
                if (str1.Length == 15)
                {
                    try
                    {
                        string str2 = str1.Substring(0, 8);
                        string str3 = str1.Substring(8, 3);
                        string str4 = str1.Substring(11, 2);
                        string str5 = str1.Substring(13, 2);
                        this._OrderFO = str2;
                        this._OrderLineNum = str3;
                        this._OrderLineSL = str4;
                        this._OrderLineSS = str5;
                    }
                    catch (Exception ex)
                    {
                        ProjectData.SetProjectError(ex);
                        this._OrderFO = "";
                        this._OrderLineNum = "";
                        this._OrderLineSL = "";
                        this._OrderLineSS = "";
                        ProjectData.ClearProjectError();
                    }
                }
            }
        }

        public string FactoryOrderOEJobName
        {
            get
            {
                string str;
                if (this._OrderFO.Length == 8 & this._OrderLineNum.Length == 3 & this._OrderLineSL.Length == 2 & this._OrderLineSS.Length == 2)
                {
                    try
                    {
                        str = Strings.Trim(this._OrderFO) + "-" + Strings.Trim(this._OrderLineNum) + "-" + Strings.Trim(this._OrderLineSL) + "-" + Strings.Trim(this._OrderLineSS) + " " + Strings.Left(Strings.Trim(this._OrderJobName), 20);
                    }
                    catch (Exception ex)
                    {
                        ProjectData.SetProjectError(ex);
                        str = "";
                        ProjectData.ClearProjectError();
                    }
                }
                else
                    str = "";
                return str;
            }
        }

        public bool FOFormatValid
        {
            get
            {
                bool flag;
                try
                {
                    int num = 0;
                    if (this.FOLineSLSS.Length == 15)
                    {
                        char[] charArray = this.FOLineSLSS.ToCharArray();
                        int index = 0;
                        while (index < charArray.Length)
                        {
                            char String = charArray[index];
                            checked { ++num; }
                            if (num >= 9 & num <= 11)
                            {
                                if (!(48 <= Strings.Asc(String) & Strings.Asc(String) <= 57 | 65 <= Strings.Asc(String) & Strings.Asc(String) <= 90 | 97 <= Strings.Asc(String) & Strings.Asc(String) <= 122))
                                {
                                    flag = false;
                                    goto label_13;
                                }
                            }
                            else if (!(48 <= Strings.Asc(String) & Strings.Asc(String) <= 57))
                            {
                                flag = false;
                                goto label_13;
                            }
                            checked { ++index; }
                        }
                    }
                    else
                    {
                        flag = false;
                        goto label_13;
                    }
                }
                catch (Exception ex)
                {
                    ProjectData.SetProjectError(ex);
                    flag = false;
                    ProjectData.ClearProjectError();
                    goto label_13;
                }
                flag = true;
            label_13:
                return flag;
            }
        }

        public scOrderData()
        {
            this._PlantId = 0;
            this._AssemLineId = 0;
            this._AssemLineAbbrv = "";
            this._OrderId = 0;
            this._OrderFO = "";
            this._OrderJobName = "";
            this._OrderLineId = 0;
            this._OrderLineNum = "";
            this._OrderLineSL = "00";
            this._OrderLineSS = "01";
            this._OrderLineTargetDt = Conversions.ToDate("01/01/1901");
            this._OrderLineShipDt = Conversions.ToDate("01/01/1901");
            this._OrderLineShipped = false;
            this._OrderLineAssyStartDt = Conversions.ToDate("01/01/1901");
        }

        public override string ToString()
        {
            return this._OrderFO + this._OrderLineNum + this._OrderLineSL + this._OrderLineSS;
        }
    }
}
