/// <summary> /// Save data to the paking table. /// </summary> /// <param name="lsPackingObj">list of values for the packing table.</param> /// <returns>New Guid</returns> public Guid setPacking(List <cstPackageTbl> lsPackingObj) { Guid Retuen = Guid.Empty; try { foreach (var Pckitems in lsPackingObj) { Package _packing = new Package(); _packing.PackingId = Guid.NewGuid(); _packing.ShippingID = entx3v6.Shippings.SingleOrDefault(i => i.ShippingNum == Pckitems.ShippingNum).ShippingID; _packing.UserId = Pckitems.UserID; _packing.ShippingNum = Pckitems.ShippingNum; _packing.StartTime = Pckitems.StartTime; _packing.EndTime = Pckitems.EndTime; _packing.StationID = Pckitems.StationID; _packing.PackingStatus = Pckitems.PackingStatus; _packing.ShipmentLocation = Pckitems.ShipmentLocation; _packing.CreatedBy = GlobalClasses.ClGlobal.UserID; _packing.CreatedDateTime = DateTime.UtcNow; _packing.ManagerOverride = Pckitems.MangerOverride; entx3v6.AddToPackages(_packing); Retuen = _packing.PackingId; } entx3v6.SaveChanges(); } catch (Exception Ex) { Error_Loger.elAction.save("UpdatePackingCommand.Execute()", Ex.Message.ToString()); } return(Retuen); }