Exemple #1
0
        private Tbl_Wf_CuttingOrder DeleteCuttingOrder(Tbl_Wf_CuttingOrder order)
        {
            using (var entities = new WorkFlowManagerDBEntities())
            {
                var cuttingOrderQuery = (from c in entities.Tbl_Wf_CuttingOrder.Include("tbl_MarkerDetail.TblColor")
                                         where c.MarkerIserial == order.MarkerIserial &&
                                         c.InspectionIserial == order.InspectionIserial
                                         select c).FirstOrDefault();
                if (cuttingOrderQuery != null)
                {
                    //var inspection =
                    //    entities.Tbl_fabricInspectionDetail.FirstOrDefault(x => x.Iserial == order.InspectionIserial);

                    //if (inspection != null)
                    //{
                    //    inspection.RemainingMarkerRollQty = (float)(inspection.RemainingMarkerRollQty +
                    //                                                     cuttingOrderQuery.RollAssignedQty);
                    //}
                    var reservationLines = entities.Tbl_ReservationRec.Include("Tbl_ReservationDetails1").FirstOrDefault(x => x.Tbl_FabricInspectionDetails == order.InspectionIserial &&
                                                                                                                         x.Tbl_ReservationDetails1.SalesOrder == cuttingOrderQuery.tbl_MarkerDetail.SalesOrder && x.Tbl_ReservationDetails1.SalesOrderColor == cuttingOrderQuery.tbl_MarkerDetail.TblColor.Code);
                    if (reservationLines != null)
                    {
                        entities.DeleteObject(reservationLines);
                    }
                    entities.DeleteObject(cuttingOrderQuery);
                    entities.SaveChanges();
                    return(order);
                }
            }
            return(null);
        }
Exemple #2
0
        public void DeletePurchaseOrder(tbl_PurchaseOrderHeader _Header, List <tbl_PurchaseOrderDetails> _Details)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                try
                {
                    var rch = (from x in context.tbl_PurchaseOrderHeader.ToList()
                               where x.TransID == _Header.TransID
                               select x).FirstOrDefault();

                    context.DeleteObject(rch);

                    foreach (var item in context.tbl_PurchaseOrderDetails
                             .Where
                             (
                                 x => x.Trans_TransactionHeader == rch.TransID
                             ).ToList())
                    {
                        context.DeleteObject(item);
                    }
                    context.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Exemple #3
0
        public void DeleteDyeingOrderAcc(int dyeingHeaderIserial)
        {
            using (var entities = new WorkFlowManagerDBEntities())
            {
                var detailsList = entities.TblDyeingOrdersDetailsAccs.Include("DyeingOrderDetailsServicesAccs").Where(x => x.DyeingProductionOrder == dyeingHeaderIserial);

                foreach (var item in detailsList)
                {
                    foreach (var service in item.DyeingOrderDetailsServicesAccs.ToList())
                    {
                        entities.DeleteObject(service);
                    }

                    entities.DeleteObject(item);
                }

                var mainDetailsList = entities.TblDyeingOrdersMainDetailsACCs.Where(x => x.DyeingProductionOrder == dyeingHeaderIserial);

                foreach (var item in mainDetailsList)
                {
                    entities.DeleteObject(item);
                }

                var header = entities.TblDyeingOrdersHeaderAccs.SingleOrDefault(x => x.DyeingProductionOrder == dyeingHeaderIserial);

                entities.DeleteObject(header);

                entities.SaveChanges();
            }
        }
Exemple #4
0
        private int DeleteSml(TblSeasonalMasterList row)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                var oldRow = (from e in context.TblSeasonalMasterLists
                              where e.Iserial == row.Iserial
                              select e).SingleOrDefault();
                if (oldRow != null)
                {
                    context.DeleteObject(oldRow);
                }



                //Delete from [TblTechPackBOMStyleColor]
                try
                {
                    var oldTechPackBOMStyleColorRow = (from e in context.TblTechPackBOMStyleColors
                                                       where e.TechPackBOM1.TblStyle == row.TblStyle && e.StyleColor == row.TblColor
                                                       select e).ToList();

                    foreach (var item in oldTechPackBOMStyleColorRow)
                    {
                        context.DeleteObject(item);
                    }
                } catch { }


                context.SaveChanges();
            }
            return(row.Iserial);
        }
Exemple #5
0
        public void DeleteDyeingMainDetailsAcc(TblDyeingOrdersMainDetailsACC maindetails)
        {
            using (var entities = new WorkFlowManagerDBEntities())
            {
                var detailsList = entities.TblDyeingOrdersDetailsAccs.Include("DyeingOrderDetailsServicesAccs").Where(x => x.DyeingProductionOrder == maindetails.DyeingProductionOrder &&
                                                                                                                      x.TransactionType == maindetails.TransactionType && x.TransId == maindetails.TransId);

                foreach (var item in detailsList)
                {
                    foreach (var service in item.DyeingOrderDetailsServicesAccs.ToList())
                    {
                        entities.DeleteObject(service);
                    }

                    entities.DeleteObject(item);
                }

                var mainDet = entities.TblDyeingOrdersMainDetailsACCs.SingleOrDefault(x => x.DyeingProductionOrder == maindetails.DyeingProductionOrder &&
                                                                                      x.TransactionType == maindetails.TransactionType && x.TransId == maindetails.TransId);

                entities.DeleteObject(mainDet);

                entities.SaveChanges();
            }
        }
        private int FamilyCategory_UpdateOrDeleteTblStyleCategoryLink(string brand, int section, int direction, int category, bool save)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                if (save)
                {
                    TblStyleCategoryLink newRow = new TblStyleCategoryLink();
                    newRow.TblBrand           = brand;
                    newRow.TblLkpBrandSection = section;
                    newRow.TblLkpDirection    = direction;
                    newRow.TblStyleCategory   = category;
                    context.TblStyleCategoryLinks.AddObject(newRow);
                }
                else
                {
                    //Delete From TblLkpstyleCategoryLink
                    var oldCategoryRow = (from e in context.TblStyleCategoryLinks
                                          where e.TblLkpBrandSection == section &&
                                          e.TblBrand == brand && e.TblLkpDirection == direction && e.TblStyleCategory == category
                                          select e).SingleOrDefault();

                    if (oldCategoryRow != null)
                    {
                        context.DeleteObject(oldCategoryRow);
                    }
                    context.SaveChanges();

                    //Delete From TblLkpFamilyCategoryLink
                    var oldFamilyRow = (from e in context.TblFamilyCategoryLinks
                                        where e.TblLkpBrandSection == section &&
                                        e.TblBrand == brand && e.TblLkpDirection == direction && e.TblStyleCategory == category
                                        select e);

                    foreach (var row in oldFamilyRow)
                    {
                        if (row != null)
                        {
                            context.DeleteObject(row);
                        }
                    }
                    context.SaveChanges();

                    //Delete From TblLkpFamilyCategoryLink
                    var oldSubFamilyRow = (from e in context.TblSubFamilyCategoryLinks
                                           where e.TblLkpBrandSection == section &&
                                           e.TblBrand == brand && e.TblLkpDirection == direction && e.TblStyleCategory == category
                                           select e);

                    foreach (var row in oldSubFamilyRow)
                    {
                        if (row != null)
                        {
                            context.DeleteObject(row);
                        }
                    }
                    context.SaveChanges();
                }
                return(context.SaveChanges());
            }
        }
        private int FamilyCategory_UpdateOrDeleteTblStyleTNARoute(int tblstyle, int TblStyleTNA, bool save)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                if (save)
                {
                    TblStyleTNARoute newRow = new TblStyleTNARoute();
                    newRow.TblStyle    = tblstyle;
                    newRow.TblStyleTNA = TblStyleTNA;
                    context.TblStyleTNARoutes.AddObject(newRow);
                    return(context.SaveChanges());
                }
                else
                {
                    //Delete From TblStyleTNARoute
                    var oldStyleTNARouteRow = (from e in context.TblStyleTNARoutes
                                               where e.TblStyle == tblstyle &&
                                               e.TblStyleTNA == TblStyleTNA
                                               select e).SingleOrDefault();

                    if (oldStyleTNARouteRow != null)
                    {
                        context.DeleteObject(oldStyleTNARouteRow);
                    }
                    return(context.SaveChanges());
                }
            }
        }
Exemple #8
0
        public void UpdateRFQSubHeader(List <tbl_RFQDetail> _RFQObjToUpdate, List <tbl_RFQDetail> _RFQObjToADD, List <tbl_RFQDetail> _RFQObjToDelete)
        {
            using (var contex = new WorkFlowManagerDBEntities())
            {
                foreach (var item in _RFQObjToADD)
                {
                    contex.tbl_RFQDetail.AddObject(item);
                }
                foreach (var item in _RFQObjToUpdate)
                {
                    var temp = (from x in contex.tbl_RFQDetail
                                where x.SubHeaderID == item.SubHeaderID
                                select x).SingleOrDefault();

                    GenerUpdate(temp, item, contex);
                }
                foreach (var temp in _RFQObjToDelete.Select(item => (from x in contex.tbl_RFQDetail
                                                                     where x.SubHeaderID == item.SubHeaderID
                                                                     select x).SingleOrDefault()))
                {
                    contex.DeleteObject(temp);
                }
                contex.SaveChanges();
            }
        }
Exemple #9
0
        private TblCheckListLink UpdateOrDeleteTblCheckListLink(TblCheckListLink newRow, bool save, int index, out int outindex)
        {
            outindex = index;
            using (var context = new WorkFlowManagerDBEntities())
            {
                if (save)
                {
                    context.TblCheckListLinks.AddObject(newRow);
                }
                else
                {
                    var oldRow = (from e in context.TblCheckListLinks
                                  where e.TblCheckListGroup == newRow.TblCheckListGroup &&
                                  e.TblCheckListItem == newRow.TblCheckListItem

                                  select e).SingleOrDefault();
                    if (oldRow != null)
                    {
                        context.DeleteObject(oldRow);
                    }
                }
                context.SaveChanges();
                return(newRow);
            }
        }
Exemple #10
0
 public void SaveAuthWarehouses(int userIserial, short PermissionIserial,
                                List <Models.Inv.AuthWarehouseModel> authList)
 {
     using (var context = new WorkFlowManagerDBEntities())
     {
         // Add Items
         var curruntAuthList = context.TblAuthWarehouses.Where(aw =>
                                                               aw.AuthUserIserial == userIserial &&
                                                               aw.PermissionType == PermissionIserial).ToList();
         foreach (var item in curruntAuthList)
         {
             context.DeleteObject(item);
         }
         var itemsToAdd = authList.Where(a => a.IsGranted);// &&
         foreach (var item in itemsToAdd)
         {
             context.TblAuthWarehouses.AddObject(new TblAuthWarehouse()
             {
                 WarehouseIserial = item.WarehouseIserial,
                 AuthUserIserial  = userIserial,
                 PermissionType   = PermissionIserial
             });
         }
         context.SaveChanges();
     }
 }
Exemple #11
0
        private TblUserBrandSection UpdateOrDeleteTblUserBrandSection(TblUserBrandSection newRow, bool save, int index, out int outindex)
        {
            outindex = index;
            using (var context = new WorkFlowManagerDBEntities())
            {
                if (save)
                {
                    context.TblUserBrandSections.AddObject(newRow);
                }
                else
                {
                    var oldRow = (from e in context.TblUserBrandSections
                                  where e.TblLkpBrandSection == newRow.TblLkpBrandSection &&
                                  e.BrandCode == newRow.BrandCode && e.TblAuthUser == newRow.TblAuthUser

                                  select e).SingleOrDefault();
                    if (oldRow != null)
                    {
                        context.DeleteObject(oldRow);
                    }
                }
                context.SaveChanges();
                return(newRow);
            }
        }
 private void UpdateOrDeletedAccSubGroupSizeLink(TblAccSubGroupSizeLink newRow, bool save, int index, out int outindex)
 {
     outindex = index;
     using (var context = new WorkFlowManagerDBEntities())
     {
         if (save)
         {
             var oldRow = (from e in context.TblAccSubGroupSizeLinks
                           where e.TblAccSize == newRow.TblAccSize &&
                           e.tbl_AccessoriesSubGroup == newRow.tbl_AccessoriesSubGroup
                           select e).SingleOrDefault();
             if (oldRow == null)
             {
                 context.TblAccSubGroupSizeLinks.AddObject(newRow);
             }
         }
         else
         {
             var oldRow = (from e in context.TblAccSubGroupSizeLinks
                           where e.TblAccSize == newRow.TblAccSize &&
                           e.tbl_AccessoriesSubGroup == newRow.tbl_AccessoriesSubGroup
                           select e).SingleOrDefault();
             if (oldRow != null)
             {
                 context.DeleteObject(oldRow);
             }
         }
         context.SaveChanges();
     }
 }
Exemple #13
0
        private int DeleteTblRecInvHeaderProd(TblRecInvHeaderProd row, int index, string company)
        {
            using (var entity = new WorkFlowManagerDBEntities())
            {
                var query = (from e in entity.TblRecInvHeaderProds
                             where e.Iserial == row.Iserial
                             select e).SingleOrDefault();
                entity.CommandTimeout = 0;
                if (query != null)
                {
                    entity.DeleteObject(query);

                    using (var context = new ccnewEntities(GetSqlConnectionString(company)))
                    {
                        var ledgerheader = context.TblLedgerHeaders.FirstOrDefault(w => w.TblJournalLink == query.Iserial && w.TblTransactionType == 100);

                        if (ledgerheader != null)
                        {
                            context.DeleteObject(ledgerheader);
                        }
                    }
                }
                entity.SaveChanges();
            }
            return(row.Iserial);
        }
Exemple #14
0
        public void UpdateRFQFollowUps(List <tbl_RFQFollowup> _RFQObjToUpdate, List <tbl_RFQFollowup> _RFQObjToADD, List <tbl_RFQFollowup> _RFQObjToDelete)
        {
            using (var contex = new WorkFlowManagerDBEntities())
            {
                foreach (var item in _RFQObjToADD)
                {
                    contex.tbl_RFQFollowup.AddObject(item);
                }
                foreach (var item in _RFQObjToUpdate)
                {
                    var temp = (from x in contex.tbl_RFQFollowup
                                where x.Iserial == item.Iserial
                                select x).SingleOrDefault();

                    GenerUpdate(temp, item, contex);
                }
                foreach (var temp in _RFQObjToDelete.Select(item => (from x in contex.tbl_RFQFollowup
                                                                     where x.Iserial == item.Iserial
                                                                     select x).SingleOrDefault()))
                {
                    contex.DeleteObject(temp);
                }
                contex.SaveChanges();
            }
        }
Exemple #15
0
        public void UpdateNewPurchDetails(List <tblNewRFQPurchLine> purchToAdd,
                                          List <tblNewRFQPurchLine> purchToUpdate, List <tblNewRFQPurchLine> purchToDelete)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                foreach (var orderDetail in purchToAdd)
                {
                    context.tblNewRFQPurchLines.AddObject(orderDetail);
                }

                foreach (var orderDetail in purchToUpdate)
                {
                    var temp = (from x in context.tblNewRFQPurchLines
                                where x.Iserial == orderDetail.Iserial
                                select x).SingleOrDefault();

                    GenerUpdate(temp, orderDetail, context);
                }

                foreach (var purh in purchToDelete)
                {
                    context.DeleteObject(purchToDelete);
                }
                try
                {
                    var saveChanges = context.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Exemple #16
0
        public void UpdateRFQSubHeaderServices(List <tbl_RFQDetailService> rfqObjToUpdate,
                                               List <tbl_RFQDetailService> rfqObjToAdd, List <tbl_RFQDetailService> rfqObjToDelete)
        {
            using (var contex = new WorkFlowManagerDBEntities())
            {
                foreach (var item in rfqObjToAdd)
                {
                    contex.tbl_RFQDetailService.AddObject(item);
                }
                foreach (var item in rfqObjToUpdate)
                {
                    var temp = (from x in contex.tbl_RFQDetailService
                                where x.Iserial == item.Iserial
                                select x).SingleOrDefault();

                    GenerUpdate(temp, item, contex);
                }
                foreach (var temp in rfqObjToDelete.Select(item => (from x in contex.tbl_RFQDetailService
                                                                    where x.Iserial == item.Iserial
                                                                    select x).SingleOrDefault()))
                {
                    contex.DeleteObject(temp);
                }
                contex.SaveChanges();
            }
        }
Exemple #17
0
 private TblFamilyLink UpdateOrDeleteTblFamilyLink(TblFamilyLink newRow, bool save, int index, out int outindex)
 {
     outindex = index;
     using (var context = new WorkFlowManagerDBEntities())
     {
         if (save)
         {
             context.TblFamilyLinks.AddObject(newRow);
         }
         else
         {
             var oldRow = (from e in context.TblFamilyLinks
                           where e.TblFamily == newRow.TblFamily &&
                           e.TblBrand == newRow.TblBrand &&
                           e.TblLkpBrandSection == newRow.TblLkpBrandSection
                           select e).SingleOrDefault();
             if (oldRow != null)
             {
                 context.DeleteObject(oldRow);
             }
         }
         context.SaveChanges();
         return(newRow);
     }
 }
Exemple #18
0
 public List <tblNewRFQSizeDetail> UpdateOrInsertNewRfqSizeDetail(List <tblNewRFQSizeDetail> newRows, List <tblNewRFQSizeDetail> deletedRows)
 {
     using (var context = new WorkFlowManagerDBEntities())
     {
         foreach (var newRow in newRows)
         {
             var oldRow = (from e in context.tblNewRFQSizeDetails
                           where e.Iserial == newRow.Iserial
                           select e).SingleOrDefault();
             if (oldRow != null)
             {
                 GenericUpdate(oldRow, newRow, context);
             }
             else
             {
                 context.tblNewRFQSizeDetails.AddObject(newRow);
             }
         }
         foreach (var TblRFSDetail in deletedRows)
         {
             context.DeleteObject(TblRFSDetail);
         }
         context.SaveChanges();
     }
     return(newRows);
 }
Exemple #19
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();
     }
 }
Exemple #20
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();
            }
        }
Exemple #21
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();
            }
        }
Exemple #22
0
 public void RouteCardFabric(int iserial)
 {
     using (var context = new WorkFlowManagerDBEntities())
     {
         var rch = (context.RouteCardFabrics.SingleOrDefault(x => x.Iserial == iserial));
         context.DeleteObject(rch);
         context.SaveChanges();
     }
 }
Exemple #23
0
        public void DeleteUser(int Iserial)
        {
            using (WorkFlowManagerDBEntities context = new WorkFlowManagerDBEntities())
            {
                tbl_Auth_User user = context.tbl_Auth_User.Where(x => x.iserial == Iserial).Single();

                context.DeleteObject(user);
                context.SaveChanges();
            }
        }
Exemple #24
0
        public void DeleteRoutCard(int routeHeader, int userIserial)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                var rch = (context.RouteCardHeaders.SingleOrDefault(x => x.Iserial == routeHeader));

                var det = context.RouteCardDetails.Where(x => x.Direction == rch.Direction && x.RoutGroupID == rch.RoutGroupID &&
                                                         x.Trans_TransactionHeader == rch.TransID);
                foreach (var item in det)
                {
                    context.DeleteObject(item);
                }
                if (SharedOperation.UseAx())
                {
                    DeleteAXroute(rch, userIserial);
                }
                context.DeleteObject(rch);
                context.SaveChanges();
            }
        }
Exemple #25
0
        public void DeletePurchDetail(int detailSerial)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                var temp = (from x in context.tbl_PurchaseOrderDetails
                            where x.Iserial == detailSerial
                            select x).SingleOrDefault();

                context.DeleteObject(temp);
                context.SaveChanges();
            }
        }
Exemple #26
0
 public void DeleteTechPackDesignDetails(int _tblTechPackDetail)
 {
     using (var context = new WorkFlowManagerDBEntities())
     {
         var oldRow = (from e in context.tblTechPackDetails
                       where e.Iserial == _tblTechPackDetail
                       select e).SingleOrDefault();
         if (oldRow != null)
         {
             //Delete Log
             var oldLogRow = (from e in context.tblTechPackLogs
                              where e.tblTechPackDetail == oldRow.Iserial
                              select e).ToList();
             foreach (var item in oldLogRow)
             {
                 context.DeleteObject(item);
             }
             context.DeleteObject(oldRow);
         }
         context.SaveChanges();
     }
 }
Exemple #27
0
        private int CheckApprovedSalesOrderColorCancelRequest(int tblSalesOrderColor)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                var color = context.TblSalesOrderColors.Where(x => x.Iserial == tblSalesOrderColor && x.RequestForCancel == 2);
                if (color != null)
                {
                    context.DeleteObject(color.FirstOrDefault());
                    return(context.SaveChanges());
                }

                return(0);
            }
        }
Exemple #28
0
        public void DeleteBarcodeDisplaySettingsHeader(int Iserial)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                var barcodeSettingRowQuery = (from h in context.BarcodeDisplaySettingsHeaders
                                              where h.Iserial == Iserial
                                              select h).SingleOrDefault();

                var HeaderIserial = barcodeSettingRowQuery.Iserial;

                var details = (from h in context.BarcodeDisplaySettingsDetails
                               where h.BarcodeDisplaySettingsHeader == HeaderIserial
                               select h).ToList();

                foreach (var item in details)
                {
                    context.DeleteObject(item);
                }

                context.DeleteObject(barcodeSettingRowQuery);
                context.SaveChanges();
            }
        }
Exemple #29
0
        public int DeleteUser(int Iserial)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                var user = context.TblAuthUsers.SingleOrDefault(x => x.Iserial == Iserial);

                if (user != null)
                {
                    context.DeleteObject(user);
                }
                context.SaveChanges();
            }
            return(Iserial);
        }
Exemple #30
0
        public void UpdatePurchlineAdditionalCosts(List <tbl_PurchaseOrder_AdditionalCost> rfqObjToUpdate)
        {
            try
            {
                using (var contex = new WorkFlowManagerDBEntities())
                {
                    foreach (var item in rfqObjToUpdate.Select(x => x.ParentPurchLineSerial).Distinct())
                    {
                        var item1 = item;
                        var temp  = (from x in rfqObjToUpdate
                                     let chk = CheckAdditionalCosts(x)
                                               where x.ParentPurchLineSerial == item1 &&
                                               !chk
                                               select x);

                        foreach (var tempd in temp.ToList())
                        {
                            contex.tbl_PurchaseOrder_AdditionalCost.AddObject(tempd);
                        }

                        var tempdlh = (from x in contex.tbl_PurchaseOrder_AdditionalCost
                                       .Where(z => z.ParentPurchLineSerial == item).ToList()
                                       where rfqObjToUpdate.Any(z => z.Iserial != x.Iserial)
                                       select x);

                        foreach (var tempdl in tempdlh)
                        {
                            contex.DeleteObject(tempdl);
                        }
                    }
                    foreach (var item in rfqObjToUpdate)
                    {
                        var temp = (from x in contex.tbl_PurchaseOrder_AdditionalCost
                                    where x.Iserial == item.Iserial
                                    select x).SingleOrDefault();

                        if (temp != null)
                        {
                            GenerUpdate(temp, item, contex);
                        }
                    }
                    contex.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }