/// <summary> /// Delte shipment Information from packingDetails table and Packing table /// </summary> /// <param name="ShippingNum">String ShipmentID</param> /// <returns>If sucess then true else false</returns> public Boolean DeleteShipment(Guid PackingID) { Boolean _return = false; try { //Delete from Packing Detail table first. var _PackingDetails = from _PckDetails in entx3v6.PackageDetails where _PckDetails.PackingId == PackingID select _PckDetails; foreach (var _PackingDetailsitem in _PackingDetails) { PackageDetail _packDetails = entx3v6.PackageDetails.SingleOrDefault(i => i.PackingDetailID == _PackingDetailsitem.PackingDetailID); entx3v6.PackageDetails.DeleteObject(_packDetails); } entx3v6.SaveChanges(); // delete from the Packing table Package _packing = entx3v6.Packages.SingleOrDefault(i => i.PackingId == PackingID); entx3v6.Packages.DeleteObject(_packing); entx3v6.SaveChanges(); _return = true; } catch (Exception Ex) { elAction.save("DeleteShipmentInfo.DeleteShipment()", Ex.ToString()); } return(_return); }
/// <summary> /// Save the User Information in UserMaster Table. /// </summary> /// <param name="lsUserMaster">List of User Information</param> /// <returns>If information saved Succesfuly then return True else False.</returns> public Boolean SetUserMaster(List <cstUserMasterTbl> lsUserMaster) { Boolean _return = false; try { foreach (var _userinfo in lsUserMaster) { //UserMaster Table Object from the Entity. User _UserMasterTbl = new User(); //add list values to the custom class boject _UserMasterTbl.UserID = Guid.NewGuid(); _UserMasterTbl.UserName = _userinfo.UserName; _UserMasterTbl.UserAddress = _userinfo.UserAddress; _UserMasterTbl.UserPassword = _userinfo.Password; _UserMasterTbl.UserJoiningDate = _userinfo.JoiningDate; _UserMasterTbl.UserFullName = _userinfo.UserFullName; _UserMasterTbl.RoleId = _userinfo.Role; _UserMasterTbl.CreatedBy = GlobalClasses.ClGlobal.UserID; _UserMasterTbl.CreatedDateTime = DateTime.UtcNow; //add Object to the entity. entx3v6.AddToUsers(_UserMasterTbl); } // save the changes to the Entity. entx3v6.SaveChanges(); _return = true; } catch (Exception Ex) { Error_Loger.elAction.save("SetUserInFormationCommand.Execute(0)", Ex.Message.ToString()); } return(_return); }
/// <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); }
/// <summary> /// UserLogs table Save method /// </summary> /// <param name="lsUserLog">list Of user Information(UserCustom)</param> /// <returns>Boolen true on success else false</returns> public Boolean SaveUserLog(List <cstAutditLog> lsUserLog) { Boolean _return = false; try { if (lsUserLog.Count > 0) { foreach (var _UserLogitem in lsUserLog) { Audit _Userlog = new Audit(); _Userlog.UserLogID = Guid.NewGuid(); _Userlog.UserID = _UserLogitem.UserID; _Userlog.ActionType = _UserLogitem.ActionType; _Userlog.ActionTime = Convert.ToDateTime(_UserLogitem.ActionTime); _Userlog.ActionValue = _UserLogitem.ActionValue; x3v6.AddToAudits(_Userlog); } x3v6.SaveChanges(); _return = true; } } catch (Exception Ex) { Error_Loger.elAction.save("UserLogAction.SaveUserLog()", Ex.Message.ToString()); } return(_return); }
public Guid SavePalletInfo(List <cstPalletInfo> lsPalletinfo) { Guid _return = Guid.Empty; try { foreach (var _palletitem in lsPalletinfo) { PalletInfo _pallet = new PalletInfo(); _pallet.PalletID = Guid.NewGuid(); _pallet.PalletType = _palletitem.PalletType; _pallet.PalletWeight = _palletitem.PalletWeight; _pallet.PalletHeight = _palletitem.PalletHeight; _pallet.PalletWidth = _palletitem.PalletWeight; _pallet.palletCreatedTime = _palletitem.palletCreatedTime; _pallet.PrintStatus = _palletitem.PrintStatus; //if (_palletitem.BoxMeasurementTime.Date != Convert.ToDateTime("01/01/001").Date) //{ // _boxPackage.BoxMeasurementTime = _palletitem.BoxMeasurementTime; //} entx3v6.AddToPalletInfoes(_pallet); _return = _pallet.PalletID; } entx3v6.SaveChanges(); } catch (Exception) { } return(_return); }
/// <summary> /// Save data to the StationMaster Table. /// </summary> /// <param name="lsStationMaster">List<cstStationMasterTbl></param> /// <returns>Boolean </returns> public Boolean SaveSationMaster(List <cstStationMasterTbl> lsStationMaster) { Boolean _return = false; try { foreach (var Stationitem in lsStationMaster) { Station _Station = new Station(); _Station.StationID = Guid.NewGuid(); _Station.StationName = Stationitem.StationName; _Station.DeviceNumber = Stationitem.DeviceNumber; _Station.RequestedUserID = Stationitem.RequestedUserID; _Station.StationAlive = Stationitem.StationAlive; _Station.StationLocation = Stationitem.StaionLocation; _Station.RegistrationDate = Stationitem.RegistrationDate; _Station.CreatedDateTime = DateTime.UtcNow; _Station.CreatedBy = GlobalClasses.ClGlobal.UserID; entx3v6.AddToStations(_Station); } entx3v6.SaveChanges(); _return = true; } catch (Exception) { } return(_return); }
public override List <cstRoleTbl> Execute() { List <cstRoleTbl> roleList = new List <cstRoleTbl>(); local_x3v6Entities context = new local_x3v6Entities(); switch (_action) { case csteActionenum.New: Role role = new Role(); role.RoleId = Guid.NewGuid(); role.Name = _role.Name; role.Action = _role.Action; role.CreatedBy = GlobalClasses.ClGlobal.UserID; role.CreatedDateTime = DateTime.UtcNow; context.AddToRoles(role); context.SaveChanges(); break; case csteActionenum.Update: Role roleTypeUpdate = context.Roles.First(i => i.RoleId == _role.RoleId); roleTypeUpdate.Name = _role.Name; roleTypeUpdate.Action = _role.Action; roleTypeUpdate.Updatedby = GlobalClasses.ClGlobal.UserID; roleTypeUpdate.UpdatedDateTime = DateTime.UtcNow; context.SaveChanges(); break; case csteActionenum.Delete: break; case csteActionenum.Get: var result = from r in context.Roles where r.RoleId == _id select r; foreach (var varRole in result) { cstRoleTbl objRole = new cstRoleTbl(); objRole.RoleId = varRole.RoleId; objRole.Name = varRole.Name; objRole.Action = varRole.Action; roleList.Add(objRole); } break; } return(roleList); }
/// <summary> /// Save Error log /// </summary> /// <param name="lsErrorlog">detail error log info</param> /// <returns>Boolean Value</returns> public Boolean SaveLog(List <cstErrorLog> lsErrorlog) { Boolean _return = false; try { if (lsErrorlog.Count > 0) { foreach (var _Erroritem in lsErrorlog) { ErrorLog _errorCustom = new ErrorLog(); _errorCustom.ErrorLogID = Guid.NewGuid(); _errorCustom.ErrorLocation = _Erroritem.ErrorLocation; _errorCustom.ErrorDesc = _Erroritem.ErrorDesc; _errorCustom.ErrorTime = Convert.ToDateTime(_Erroritem.ErrorTime); _errorCustom.UserID = _Erroritem.UserID; entX3v6.AddToErrorLogs(_errorCustom); entX3v6.SaveChanges(); _return = true; } } } catch (Exception) { ///Save the Exeption to the File Name Bellow String[] Lines = { "", "" };; Lines[0] = Environment.NewLine + "------------------------------------------------" + DateTime.UtcNow + "------------------------------------------------"; Lines[1] = "Internet Connection Fail == " + lsErrorlog[0].ErrorLocation.ToString() + " == " + DateTime.UtcNow; File.AppendAllLines("C:\\ShipmentManagerErrorLog.sys", Lines); } return(_return); }
/// <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); }
/// <summary> /// Update Role Permissons /// </summary> /// <param name="RoleID"> /// Guid RoleID to be update /// </param> /// <param name="RoleName"> /// </param> /// <param name="IsSuperUser"></param> /// <param name="View"></param> /// <param name="Scan"></param> /// <param name="Rescan"></param> /// <param name="Override"></param> /// <returns></returns> public Boolean SetRole(Guid RoleID, String RoleName, Boolean IsSuperUser, Boolean View, Boolean Scan, Boolean Rescan, Boolean Override) { Boolean _return = false; try { Role role = ent.Roles.FirstOrDefault(i => i.RoleId == RoleID); role.Name = RoleName; String permission = ""; if (IsSuperUser) { permission = "True-True-True-True&"; } else { permission = "False-False-False-False&"; } if (View) { permission = permission + "True"; } else { permission = permission + "False"; } if (Scan) { permission = permission + "-True"; } else { permission = permission + "-False"; } if (Rescan) { permission = permission + "-True"; } else { permission = permission + "-False"; } if (Override) { permission = permission + "-True"; } else { permission = permission + "-False"; } role.Action = permission; ent.SaveChanges(); _return = true; } catch (Exception) {} return(_return); }
/// <summary> /// Save Box information to the database /// </summary> /// <param name="lscartonInfo">list of information of box</param> /// <returns>Guid of New Box Id</returns> public Guid SaveCartonInfo(cstCartonInfo lscartonInfo) { Guid _return = Guid.Empty; try { CartonInfo _caton = new CartonInfo(); _caton.CartonID = lscartonInfo.CartonID; _caton.BOXNumber = lscartonInfo.BOXNumber; _caton.CartonNumber = lscartonInfo.CartonNumber; _caton.ShipmentNumber = lscartonInfo.ShipmentNumber; _caton.Printed = lscartonInfo.Printed; entx3v6.AddToCartonInfoes(_caton); entx3v6.SaveChanges(); _return = _caton.CartonID; } catch (Exception) { } return(_return); }
/// <summary> /// Save the list values to the packing Detail table. /// </summary> /// <param name="lsPackingOb">list of values of packing Detail </param> /// <returns>Success if transaction Success else Fail.</returns> public string savePackageDetails(List <cstPackageDetails> lsPackingOb) { string Retuen = "Fail"; try { foreach (var _PakingDetails in lsPackingOb) { PackageDetail _Packing = new PackageDetail(); _Packing.PackingDetailID = _PakingDetails.PackingDetailID; _Packing.PackingId = _PakingDetails.PackingId; _Packing.SKUNumber = _PakingDetails.SKUNumber; _Packing.SKUQuantity = _PakingDetails.SKUQuantity; _Packing.SKUScanDateTime = Convert.ToDateTime(_PakingDetails.PackingDetailStartDateTime); _Packing.BoxNumber = _PakingDetails.BoxNumber; _Packing.ShipmentLocation = _PakingDetails.ShipmentLocation; //view added extra _Packing.ItemName = _PakingDetails.ItemName; _Packing.ProductName = _PakingDetails.ProductName; _Packing.UnitOfMeasure = _PakingDetails.UnitOfMeasure; _Packing.CountryOfOrigin = _PakingDetails.CountryOfOrigin; _Packing.MAP_Price = _PakingDetails.MAP_Price; _Packing.TCLCOD_0 = _PakingDetails.TCLCOD_0; _Packing.TarrifCode = _PakingDetails.TarrifCode; //created Time set _Packing.CreatedDateTime = DateTime.UtcNow; _Packing.CreatedBy = GlobalClasses.ClGlobal.UserID; entx3v6.AddToPackageDetails(_Packing); } entx3v6.SaveChanges(); Retuen = "Success"; } catch (Exception Ex) { Error_Loger.elAction.save("SetPakingDetailsCommand.Execute()", Ex.Message.ToString()); } return(Retuen); }
public Boolean UpdateReadyTOExport(String TrackingNo, String BoxNumber, Boolean ReadyTOExportflag) { Boolean _retutn = false; try { Tracking tracking = lent.Trackings.FirstOrDefault(i => i.TrackingNum == TrackingNo && i.BOXNUM == BoxNumber); tracking.ReadyToExport = ReadyTOExportflag; lent.SaveChanges(); _retutn = true; } catch (Exception) {} return(_retutn); }
/// <summary> /// Save UserStation transaction Table. /// </summary> /// <param name="lsUserStation">List<cstUserStationTbl></param> /// <returns>Boolean</returns> public Boolean SaveUserStation(List <cstUserStationTbl> lsUserStation) { bool _return = false; try { foreach (var UserStationitem in lsUserStation) { UserStation _Ust = new UserStation(); _Ust.UserStationID = Guid.NewGuid(); _Ust.StationID = UserStationitem.StationID; _Ust.UserID = UserStationitem.UserID; _Ust.LoginDateTime = UserStationitem.LoginDateTime; _Ust.CreatedBy = GlobalClasses.ClGlobal.UserID; _Ust.CreatedDateTime = DateTime.UtcNow; ent.AddToUserStations(_Ust); } ent.SaveChanges(); _return = true; } catch (Exception) {} return(_return); }
public Boolean SaveShippingTbl(List <cstShippingTbl> lsShipping) { Boolean _return = false; try { if (lsShipping.Count() > 0) { foreach (cstShippingTbl _shippingInfo in lsShipping) { Guid _tShipID = Guid.Empty; try { _tShipID = entx3v6.Shippings.SingleOrDefault(i => i.ShippingNum == _shippingInfo.ShippingNum).ShippingID; } catch (Exception) { } //If shipping number is not saved previously then insert new record if (_tShipID == Guid.Empty) { Shipping Ship = new Shipping(); Ship.ShippingID = Guid.NewGuid(); Ship.ShippingNum = _shippingInfo.ShippingNum; Ship.ShippingStartTime = DateTime.UtcNow; Ship.ShippingEndTime = null; Ship.DeliveryProvider = _shippingInfo.DeliveryProvider; Ship.DeliveryMode = _shippingInfo.DeliveryMode; Ship.FromAddressLine1 = _shippingInfo.FromAddressLine1; Ship.FromAddressLine2 = _shippingInfo.FromAddressLine2; Ship.FromAddressLine3 = _shippingInfo.FromAddressLine3; Ship.FromAddressCity = _shippingInfo.FromAddressCity; Ship.FromAddressState = _shippingInfo.FromAddressState; Ship.FromAddressCountry = _shippingInfo.FromAddressCountry; Ship.FromAddressZipCode = _shippingInfo.FromAddressZipCode; Ship.ToAddressLine1 = _shippingInfo.ToAddressLine1; Ship.ToAddressLine2 = _shippingInfo.ToAddressLine2; Ship.ToAddressLine3 = _shippingInfo.ToAddressLine3; Ship.ToAddressCity = _shippingInfo.ToAddressCity; Ship.ToAddressState = _shippingInfo.ToAddressState; Ship.ToAddressCountry = _shippingInfo.ToAddressCountry; Ship.ToAddressZipCode = _shippingInfo.ToAddressZipCode; Ship.ShipmentStatus = _shippingInfo.ShipmentStatus; Ship.OrderID = _shippingInfo.OrderID; Ship.CustomerPO = _shippingInfo.CustomerPO; Ship.ShipToAddress = _shippingInfo.ShipToAddress; Ship.OurSupplierNo = _shippingInfo.OurSupplierNo; Ship.CustomerName1 = _shippingInfo.CustomerName1; Ship.CustomerName2 = _shippingInfo.CustomerName2; Ship.WebAddress = _shippingInfo.WebAddress; Ship.FreightTerms = _shippingInfo.FreightTerms; Ship.Carrier = _shippingInfo.Carrier; Ship.DeliveryContact = _shippingInfo.DeliveryContact; Ship.Indexcode = _shippingInfo.Indexcode; Ship.Contact = _shippingInfo.Contact; Ship.PaymentTerms = _shippingInfo.PaymentTerms; Ship.TotalPackages = _shippingInfo.TotalPackages; Ship.Fax = _shippingInfo.Fax; Ship.VendorName = _shippingInfo.VendorName; Ship.MDL_0 = _shippingInfo.MDL_0; Ship.XB_RESFLG_0 = _shippingInfo.XB_RESFLG_0; Ship.CODCHG_0 = _shippingInfo.CODCHG_0; Ship.INSVAL_0 = _shippingInfo.INSVAL_0; Ship.ADDCODFRT_0 = _shippingInfo.ADDCODFRT_0; Ship.BILLOPT_0 = _shippingInfo.BILLOPT_0; Ship.HDLCHG_0 = _shippingInfo.HDLCHG_0; Ship.DOWNFLG_0 = _shippingInfo.DOWNFLG_0; Ship.BACCT_0 = _shippingInfo.BACCT_0; Ship.TPBILL_0 = _shippingInfo.TPBILL_0; Ship.CUSTBILL_0 = _shippingInfo.CUSTBILL_0; Ship.CNTFULNAM_0 = _shippingInfo.CNTFULNAM_0; Ship.CreatedDateTime = DateTime.UtcNow; Ship.CreatedBy = GlobalClasses.ClGlobal.UserID; entx3v6.AddToShippings(Ship); } else //If shipping number is saved previously then updated old record { Shipping Ship = entx3v6.Shippings.SingleOrDefault(i => i.ShippingID == _tShipID); Ship.ShippingNum = _shippingInfo.ShippingNum; DateTime EndTime = DateTime.UtcNow; DateTime.TryParse(_shippingInfo.ShippingEndTime.ToString(), out EndTime); Ship.ShippingEndTime = null; if (EndTime.Date != Convert.ToDateTime("01/01/0001")) { Ship.ShippingEndTime = EndTime; } Ship.DeliveryProvider = _shippingInfo.DeliveryProvider; Ship.DeliveryMode = _shippingInfo.DeliveryMode; Ship.FromAddressLine1 = _shippingInfo.FromAddressLine1; Ship.FromAddressLine2 = _shippingInfo.FromAddressLine2; Ship.FromAddressLine3 = _shippingInfo.FromAddressLine3; Ship.FromAddressCity = _shippingInfo.FromAddressCity; Ship.FromAddressState = _shippingInfo.FromAddressState; Ship.FromAddressCountry = _shippingInfo.FromAddressCountry; Ship.FromAddressZipCode = _shippingInfo.FromAddressZipCode; Ship.ToAddressLine1 = _shippingInfo.ToAddressLine1; Ship.ToAddressLine2 = _shippingInfo.ToAddressLine2; Ship.ToAddressLine3 = _shippingInfo.ToAddressLine3; Ship.ToAddressCity = _shippingInfo.ToAddressCity; Ship.ToAddressState = _shippingInfo.ToAddressState; Ship.ToAddressCountry = _shippingInfo.ToAddressCountry; Ship.ToAddressZipCode = _shippingInfo.ToAddressZipCode; Ship.ShipmentStatus = _shippingInfo.ShipmentStatus; Ship.OrderID = _shippingInfo.OrderID; Ship.CustomerPO = _shippingInfo.CustomerPO; Ship.ShipToAddress = _shippingInfo.ShipToAddress; Ship.OurSupplierNo = _shippingInfo.OurSupplierNo; Ship.CustomerName1 = _shippingInfo.CustomerName1; Ship.CustomerName2 = _shippingInfo.CustomerName2; Ship.WebAddress = _shippingInfo.WebAddress; Ship.FreightTerms = _shippingInfo.FreightTerms; Ship.Carrier = _shippingInfo.Carrier; Ship.DeliveryContact = _shippingInfo.DeliveryContact; Ship.Indexcode = _shippingInfo.Indexcode; Ship.Contact = _shippingInfo.Contact; Ship.PaymentTerms = _shippingInfo.PaymentTerms; Ship.TotalPackages = _shippingInfo.TotalPackages; Ship.Fax = _shippingInfo.Fax; Ship.VendorName = _shippingInfo.VendorName; Ship.MDL_0 = _shippingInfo.MDL_0; Ship.XB_RESFLG_0 = _shippingInfo.XB_RESFLG_0; Ship.CODCHG_0 = _shippingInfo.CODCHG_0; Ship.INSVAL_0 = _shippingInfo.INSVAL_0; Ship.ADDCODFRT_0 = _shippingInfo.ADDCODFRT_0; Ship.BILLOPT_0 = _shippingInfo.BILLOPT_0; Ship.HDLCHG_0 = _shippingInfo.HDLCHG_0; Ship.DOWNFLG_0 = _shippingInfo.DOWNFLG_0; Ship.BACCT_0 = _shippingInfo.BACCT_0; Ship.TPBILL_0 = _shippingInfo.TPBILL_0; Ship.CUSTBILL_0 = _shippingInfo.CUSTBILL_0; Ship.CNTFULNAM_0 = _shippingInfo.CNTFULNAM_0; Ship.UpdatedDateTime = DateTime.UtcNow; Ship.Updatedby = GlobalClasses.ClGlobal.UserID; } } entx3v6.SaveChanges(); _return = true; } } catch (Exception) { } return(_return); }