Esempio n. 1
0
        /// <summary>
        /// Save Box information to the database
        /// </summary>
        /// <param name="lsBoxpackage">list of information of box</param>
        /// <returns>Guid of New Box Id</returns>
        public Guid SaveBoxPackage(List <cstBoxPackage> lsBoxpackage)
        {
            Guid _return = Guid.Empty;

            try
            {
                foreach (var _boxitem in lsBoxpackage)
                {
                    BoxPackage _boxPackage = new BoxPackage();

                    _boxPackage.BoxID          = Guid.NewGuid();
                    _boxPackage.PackingID      = _boxitem.PackingID;
                    _boxPackage.BoxType        = _boxitem.BoxType;
                    _boxPackage.BoxWeight      = _boxitem.BoxWeight;
                    _boxPackage.BoxLength      = _boxitem.BoxLength;
                    _boxPackage.BoxHeight      = _boxitem.BoxHeight;
                    _boxPackage.BoxWidth       = _boxitem.BoxWidth;
                    _boxPackage.BoxCreatedTime = _boxitem.BoxCreatedTime;
                    if (_boxitem.BoxMeasurementTime.Date != Convert.ToDateTime("01/01/001").Date)
                    {
                        _boxPackage.BoxMeasurementTime = _boxitem.BoxMeasurementTime;
                    }
                    entx3v6.AddToBoxPackages(_boxPackage);
                    _return = _boxPackage.BoxID;
                }
                entx3v6.SaveChanges();
            }
            catch (Exception)
            {}
            return(_return);
        }