Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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();
            }
        }
Esempio n. 3
0
 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());
     }
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        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();
            }
        }
Esempio n. 10
0
        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);
        }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
        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);
        }
Esempio n. 14
0
        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);
        }
Esempio n. 15
0
        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);
        }
Esempio n. 16
0
        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);
        }
Esempio n. 17
0
        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);
        }
Esempio n. 18
0
        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();
            }
        }
Esempio n. 19
0
        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);
        }
Esempio n. 20
0
        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();
                }
            }
        }
Esempio n. 21
0
 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();
     }
 }
Esempio n. 22
0
 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;
         }
     }
 }
Esempio n. 23
0
 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;
     }
 }
Esempio n. 24
0
        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();
            }
        }
Esempio n. 25
0
 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;
         }
     }
 }
Esempio n. 26
0
        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);
            }
        }
Esempio n. 27
0
        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);
                }
            }
        }
Esempio n. 28
0
 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);
 }
Esempio n. 29
0
 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);
 }
Esempio n. 30
0
 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;
         }
     }
 }