コード例 #1
0
        private static void GetSADQuantity(QuantityDescription[] document, Entities edc, SADGood entry)
        {
            if (document.NullOrEmpty <QuantityDescription>())
            {
                return;
            }
            List <SADQuantity> rows = new List <SADQuantity>();

            try
            {
                foreach (QuantityDescription quantity in document)
                {
                    SADQuantity newRow = new SADQuantity()
                    {
                        SADQuantity2SADGoodID = entry,
                        Title   = String.Format("{0}: {1}", quantity.GetNetMass(), quantity.GetUnits()),
                        ItemNo  = quantity.GetItemNo(),
                        NetMass = quantity.GetNetMass(),
                        Units   = quantity.GetUnits()
                    };
                    rows.Add(newRow);
                }
                if (rows.Count == 0)
                {
                    return;
                }
                edc.SADQuantity.InsertAllOnSubmit(rows);
                edc.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw new IPRDataConsistencyException("GetSADQuantity", ex.Message, ex, "Quantity analysis problem");
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets the net mass.
        /// </summary>
        /// <param name="edc">The <see cref="Entities" /> instance</param>
        /// <param name="good">The good.</param>
        protected internal override void GetNetMass(Entities edc, SADGood good)
        {
            SADQuantity _quantity = good.SADQuantity(edc).FirstOrDefault();

            NetMass = _quantity == null ? 0 : _quantity.NetMass.GetValueOrDefault(0);
        }