Esempio n. 1
0
        private static MV_LstItems_CLkOrder GetMVRecord(string[] reg, string[] regI, int mvNumber)
        {
            MV_LstItems_CLkOrder mvorder = new MV_LstItems_CLkOrder();

            //Fill the class Multivalue properties
            mvorder.Item             = LinkarDataTypes.GetAlpha(reg[2], mvNumber);
            mvorder.Qty              = LinkarDataTypes.GetDecimal(reg[3], mvNumber);
            mvorder.Price            = LinkarDataTypes.GetDecimal(reg[4], mvNumber);
            mvorder.ITotalLine       = LinkarDataTypes.GetDecimal(regI[3], mvNumber);
            mvorder.IItemDescription = LinkarDataTypes.GetAlpha(regI[1], mvNumber);
            mvorder.IItemStock       = LinkarDataTypes.GetDecimal(regI[2], mvNumber);

            #region Subvalues

            //Get the max number of subvalues dinamically
            int numSV_LstPartial      = 0;
            int tmpCountSV_LstPartial = 0;
            tmpCountSV_LstPartial = MvFunctions.LkDCount(reg[5].Split(DBMV_Mark.VM)[mvNumber], DBMV_Mark.SM_str);
            if (tmpCountSV_LstPartial > numSV_LstPartial)
            {
                numSV_LstPartial = tmpCountSV_LstPartial;
            }
            tmpCountSV_LstPartial = MvFunctions.LkDCount(reg[6].Split(DBMV_Mark.VM)[mvNumber], DBMV_Mark.SM_str);
            if (tmpCountSV_LstPartial > numSV_LstPartial)
            {
                numSV_LstPartial = tmpCountSV_LstPartial;
            }

            if (mvorder.LstLstPartial == null)
            {
                mvorder.LstLstPartial = new List <SV_LstPartial_CLkOrder>();
            }

            //Iterate subvalues
            for (int i = 0; i < numSV_LstPartial; i++)
            {
                if (i < mvorder.LstLstPartial.Count())
                {
                    mvorder.LstLstPartial[i] = GetSVRecord(reg, regI, mvNumber, i);
                }
                else
                {
                    SV_LstPartial_CLkOrder regsv = new SV_LstPartial_CLkOrder();
                    regsv = GetSVRecord(reg, regI, mvNumber, i);
                    mvorder.LstLstPartial.Add(regsv);
                }
            }
            if (numSV_LstPartial < mvorder.LstLstPartial.Count())
            {
                int offset = mvorder.LstLstPartial.Count() - numSV_LstPartial;
                for (int i = 0; i < offset; i++)
                {
                    mvorder.LstLstPartial.RemoveAt(mvorder.LstLstPartial.Count() - 1);
                }
            }

            #endregion

            return(mvorder);
        }
Esempio n. 2
0
        private static SV_LstPartial_CLkOrder GetSVRecord(string[] reg, string[] regI, int mvNumber, int svNumber)
        {
            SV_LstPartial_CLkOrder svorder = new SV_LstPartial_CLkOrder();
            //Fill the class Multivalue properties
            string _DeliveryDateTime = LinkarDataTypes.GetDateTime(reg[5], mvNumber, svNumber);

            if (!string.IsNullOrWhiteSpace(_DeliveryDateTime))
            {
                int dias;
                int.TryParse(_DeliveryDateTime, out dias);
                svorder.DeliveryDateTime = new DateTime(1967, 12, 31).AddDays(dias);
            }
            else
            {
                svorder.DeliveryDateTime = null;
            }
            svorder.PartialQuantity = LinkarDataTypes.GetDecimal(reg[6], mvNumber, svNumber);
            return(svorder);
        }