private int DeleteTblAccessoriesGroup(tbl_lkp_AccessoryGroup row) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.tbl_lkp_AccessoryGroup where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
private DateTime RequestStyleTna(int tblStyle, bool RequestTna) { using (var context = new WorkFlowManagerDBEntities()) { var oldrow = context.TblStyles.FirstOrDefault(w => w.Iserial == tblStyle); if (RequestTna || oldrow.TNACreationDate == null) { oldrow.TNACreationDate = DateTime.Now; } oldrow.RequestTna = RequestTna; context.SaveChanges(); return(oldrow.TNACreationDate.Value); //return query.ToList(); } }
private int UpdateSalesOrderColorCancelRequest(int tblSalesOrderColor, bool RequestForCancel) { using (var context = new WorkFlowManagerDBEntities()) { var color = context.TblSalesOrderColors.Where(x => x.Iserial == tblSalesOrderColor).FirstOrDefault(); if (RequestForCancel) { color.RequestForCancel = 1; } else { color.RequestForCancel = 0; } return(context.SaveChanges()); } }
private int DeleteTblBrandSectionPermission(TblBrandSectionPermission row) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.TblBrandSectionPermissions where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
private int DeleteTblFabricStructure(tbl_lkp_FabricStructure row) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.tbl_lkp_FabricStructure where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
private int DeleteTblRequestForSampleItem(TblRequestForSampleItem row) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.TblRequestForSampleItems where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
private int DeleteTblPaymentScheduleSettings(TblPaymentScheduleSetting row) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.TblPaymentScheduleSettings where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
private int DeleteTblSequenceProduction(TblSequenceProduction row, int index, string company) { using (var entity = new WorkFlowManagerDBEntities()) { var query = (from e in entity.TblSequenceProductions where e.Iserial == row.Iserial select e).SingleOrDefault(); if (query != null) { entity.DeleteObject(query); } entity.SaveChanges(); } return(row.Iserial); }
private void DeleteMarkerTransaction(int iserialHeader) { using (var entities = new WorkFlowManagerDBEntities()) { var headerTransaction = (from h in entities.tbl_MarkerTransactionHeader where h.Iserial == iserialHeader select h).SingleOrDefault(); if (headerTransaction != null) { entities.DeleteObject(headerTransaction); } entities.SaveChanges(); } }
private int DeleteMarker(int iserial) { using (var entities = new WorkFlowManagerDBEntities()) { var markerQuery = (from m in entities.tbl_MarkerDetail where m.Iserial == iserial select m).SingleOrDefault(); if (markerQuery != null) { entities.DeleteObject(markerQuery); } entities.SaveChanges(); return(iserial); } }
private int DeleteDyeingOrderInvoiceDetail(TblDyeingOrderInvoiceDetail row) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.TblDyeingOrderInvoiceDetails where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
private int DeleteTblGlobalRetailBusinessBudgetMainDetail(TblGlobalRetailBusinessBudgetMainDetail row) { using (var db = new WorkFlowManagerDBEntities()) { var oldRow = (from e in db.TblGlobalRetailBusinessBudgetMainDetails where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { db.DeleteObject(oldRow); } db.SaveChanges(); } return(row.Iserial); }
private int DeleteReservationDetails(int iserial) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.Tbl_ReservationDetails where e.Iserial == iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(iserial); }
private TblSalesOrderNote DeleteTblSalesOrderNotes(TblSalesOrderNote row) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.TblSalesOrderNotes where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row); }
private int DeleteRouteCardInvoiceHeader(RouteCardInvoiceHeader row) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.RouteCardInvoiceHeaders where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
private int DeleteBomFabricBom(BomFabricBom row) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.BomFabricBoms where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
private int DeleteTblUsersStyleTNAStatus(TblUsersStyleTNAStatu row) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.TblUsersStyleTNAStatus where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
public void DeleteReservationOrder(Tbl_ReservationHeader reservationHeader, int userIserial) { var axapta = new Axapta();//Ready To be Dependent from Ax if (SharedOperation.UseAx()) { var credential = new NetworkCredential("bcproxy", "around1"); TblAuthUser userToLogin; using (var model = new WorkFlowManagerDBEntities()) { userToLogin = model.TblAuthUsers.SingleOrDefault(x => x.Iserial == userIserial); } axapta.LogonAs(userToLogin.User_Win_Login, userToLogin.User_Domain, credential, "Ccm", null, null, null); } using (var entities = new WorkFlowManagerDBEntities()) { var headerRow = entities.Tbl_ReservationHeader.SingleOrDefault(x => x.Iserial == reservationHeader.Iserial); var rows = entities.Tbl_ReservationMainDetails.Include("Tbl_ReservationDetails").Include("Tbl_ReservationHeader1").Where(x => x.Tbl_ReservationHeader == reservationHeader.Iserial); foreach (var mainRow in rows) { foreach (var detailsRow in mainRow.Tbl_ReservationDetails.ToList()) { entities.DeleteObject(detailsRow); if (SharedOperation.UseAx()) { var importNew = axapta.CreateAxaptaObject("CreateProductionJournals"); if (detailsRow.AxPicklingListJournal != null) { importNew.Call("deletejournal", 0, detailsRow.AxPicklingListJournal, 0); } } } entities.DeleteObject(mainRow); } entities.DeleteObject(headerRow); entities.SaveChanges(); } if (SharedOperation.UseAx()) { axapta.Logoff(); } }
private TblRecInvDetailProd DeleteTblRecInvDetailProd(TblRecInvDetailProd row, int index, string company) { using (var entity = new WorkFlowManagerDBEntities()) { var query = (from e in entity.TblRecInvDetailProds where e.Glserial == row.Glserial && e.Dserial == row.Dserial select e).SingleOrDefault(); if (query != null) { entity.DeleteObject(query); } entity.SaveChanges(); } return(row); }
private void CreateTblItemCombined(string code, int tblColor, string batch, string size) { using (var context = new WorkFlowManagerDBEntities()) { var query = context.TblItemCombineds.Where( x => x.Code == code && x.TblColor == tblColor && x.Batch == batch && x.Size == size); if (!query.Any()) { var row = new TblItemCombined { Code = code, TblColor = tblColor, Batch = batch, Size = size }; context.TblItemCombineds.AddObject(row); context.SaveChanges(); } } }
private void DeleteAdjustmentByIserial(int headerIserial, int CountingHeaderIserial) { using (var entities = new WorkFlowManagerDBEntities()) { var temp = entities.TblAdjustmentHeaders.FirstOrDefault(ah => ah.Iserial == headerIserial); var countingTemp = entities.TblAdjustmentHeaders.FirstOrDefault(ah => ah.Iserial == CountingHeaderIserial); if (temp != null) { entities.DeleteObject(temp); } if (countingTemp != null) { entities.DeleteObject(countingTemp); } entities.SaveChanges(); } }
public bool DeleteRFQ(tbl_RFQHeader ObjectToBeDeleted) { using (var context = new WorkFlowManagerDBEntities()) { try { var temp = context.RFQByDocNum(ObjectToBeDeleted.DocNumber); context.DeleteObject(temp); context.SaveChanges(); return(true); } catch (System.Exception ex) { throw ex; } } }
public void AddAccType(tbl_lkp_AccessoryItemType _ObjectToAdd) { try { using (var context = new WorkFlowManagerDBEntities()) { if (!context.tbl_lkp_AccessoryItemType.Contains(_ObjectToAdd)) { context.tbl_lkp_AccessoryItemType.AddObject(_ObjectToAdd); context.SaveChanges(); } } } catch (Exception ex) { throw ex; } }
public void DeleteDyeingDetailsAcc(int iserial) { using (var entities = new WorkFlowManagerDBEntities()) { var details = entities.TblDyeingOrdersDetailsAccs.Include("DyeingOrderDetailsServicesAccs").SingleOrDefault(x => x.Iserial == iserial); if (details != null) { foreach (var service in details.DyeingOrderDetailsServicesAccs.ToList()) { entities.DeleteObject(service); } entities.DeleteObject(details); } entities.SaveChanges(); } }
public void AddFabWFCompositions(List <WF_FabricContentsComposition> FabricAttrCompositionObj) { using (var context = new WorkFlowManagerDBEntities()) { try { foreach (var item in FabricAttrCompositionObj) { context.WF_FabricContentsComposition.AddObject(item); } context.SaveChanges(); } catch (Exception ex) { throw ex; } } }
private TblPaymentSchedule UpdateOrInsertTblPaymentSchedule(TblPaymentSchedule newRow, bool save, int index, out int outindex) { outindex = index; using (var context = new WorkFlowManagerDBEntities()) { if (save) { foreach (var row in newRow.TblPaymentScheduleDetails.ToList()) { row.TblPaymentScheduleSetting = null; } context.TblPaymentSchedules.AddObject(newRow); } else { var oldRow = (from e in context.TblPaymentSchedules where e.Iserial == newRow.Iserial select e).SingleOrDefault(); if (oldRow != null) { GenericUpdate(oldRow, newRow, context); } foreach (var row in newRow.TblPaymentScheduleDetails.ToList()) { var oldDetailRow = (from e in context.TblPaymentScheduleDetails where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldDetailRow != null) { GenericUpdate(oldDetailRow, row, context); } else { row.TblPaymentSchedule1 = null; row.TblPaymentScheduleSetting = null; context.TblPaymentScheduleDetails.AddObject(row); } } } context.SaveChanges(); return(newRow); } }
public void AddFabricGalary(List <tbl_FabricImage> _ObjToAdd) { using (var context = new WorkFlowManagerDBEntities()) { try { foreach (var item in _ObjToAdd) { context.tbl_FabricImage.AddObject(item); } context.SaveChanges(); } catch (Exception ex) { throw new Exception("There was an error, Galary was not Saved!\nError Details: " + ex.Message); } } }
private bool UpdateOrDeletetblFormLayoutUsers(int User, string FormCode, List <tblFormLayoutUser> UserLayouts) { using (var context = new WorkFlowManagerDBEntities()) { var Query = context.tblFormLayoutUsers.Where(x => x.tblUser == User && x.tblFormLayout1.ID == FormCode); //Delete foreach (var item in Query) { context.tblFormLayoutUsers.DeleteObject(item); } //Save foreach (var newItem in UserLayouts) { context.tblFormLayoutUsers.AddObject(newItem); } context.SaveChanges(); } return(false); }
private int DeleteAttachment(TblAttachment row) { using (var context = new WorkFlowManagerDBEntities()) { var temp = context.TblAttachments.FirstOrDefault(ah => ah.Iserial == row.Iserial); if (temp != null) { context.DeleteObject(temp); } if (context.SaveChanges() > 0) { if (File.Exists(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + temp.Path)) { File.Delete(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + temp.Path); } } } return(row.Iserial); }
public void AddPurchaseOrder(tbl_PurchaseOrderHeader _Header, List <tbl_PurchaseOrderDetails> _Details) { using (var context = new WorkFlowManagerDBEntities()) { try { context.tbl_PurchaseOrderHeader.AddObject(_Header); foreach (var item in _Details) { context.tbl_PurchaseOrderDetails.AddObject(item); } context.SaveChanges(); } catch (Exception ex) { throw ex; } } }