public void SaveLiftingLimit(LiftingLimitDTO liftingLimitDetails)
        {
            liftinglimit liftinglimitEntity = new liftinglimit();
            AutoMapper.Mapper.Map(liftingLimitDetails, liftinglimitEntity);
            if (liftingLimitDetails.LiftingLimit_ID == 0)
            {
                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, TimeSpan.MaxValue))
                {
                    ESalesUnityContainer.Container.Resolve<IGenericRepository<liftinglimit>>().Save(liftinglimitEntity);
                    IList<LiftingLimitDTO> lifitinglimitActivelist = GetLimitList();
                    if (lifitinglimitActivelist.Count > 0)
                    {
                        foreach (LiftingLimitDTO liftinglimitdata in lifitinglimitActivelist)
                        {
                            if (liftinglimitdata.LiftingLimit_ID != liftinglimitEntity.LiftingLimit_ID && liftinglimitdata.LiftingLimit_BusinessTypeID == liftinglimitEntity.LiftingLimit_BusinessTypeID)
                            {
                                liftinglimit limitEntity = new liftinglimit();
                                liftinglimitdata.LiftingLimit_IsActive = false;
                                AutoMapper.Mapper.Map(liftinglimitdata, limitEntity);
                                ESalesUnityContainer.Container.Resolve<IGenericRepository<liftinglimit>>().TransactionalUpdate<liftinglimit>(limitEntity);
                            }
                        }
                        ESalesUnityContainer.Container.Resolve<IGenericRepository<liftinglimit>>().SaveChanges();
                    }

                    List<customermaterialmap> custmoerlist = ESalesUnityContainer.Container.Resolve<IGenericRepository<customermaterialmap>>()
                    .GetQuery().Where(data => data.customer.Cust_BusinessType == liftingLimitDetails.LiftingLimit_BusinessTypeID).ToList();

                    if (custmoerlist.Count > 0)
                    {
                        foreach (customermaterialmap customermaterialdata in custmoerlist)
                        {
                            customermaterialdata.Cust_Mat_LiftingLimit = liftingLimitDetails.LiftingLimit_Limit;
                            customermaterialdata.Cust_Mat_Timeinterval = liftingLimitDetails.LiftingLimit_Timeinterval;
                            ESalesUnityContainer.Container.Resolve<IGenericRepository<customermaterialmap>>().TransactionalUpdate<customermaterialmap>(customermaterialdata);
                        }
                        ESalesUnityContainer.Container.Resolve<IGenericRepository<customermaterialmap>>().SaveChanges();
                    }
                    ts.Complete();
                }
            }
        }
        public int UpdateLiftingLimit(LiftingLimitDTO liftingLimitDetails)
        {
            liftinglimit LiftingLimitEntity = new liftinglimit();
            liftinglimit_history LiftingLimithistoryEntity = new liftinglimit_history();
            int LiftingLimitid;
            
            using (TransactionScope transactionScope = new TransactionScope())
            {
                AutoMapper.Mapper.Map(liftingLimitDetails, LiftingLimitEntity);
                ESalesUnityContainer.Container.Resolve<IGenericRepository<liftinglimit>>().Update(LiftingLimitEntity);
                LiftingLimitid = liftingLimitDetails.LiftingLimit_ID;

                liftingLimitDetails.LiftingLimit_ID = 0;
                AutoMapper.Mapper.Map(liftingLimitDetails, LiftingLimithistoryEntity);
                ESalesUnityContainer.Container.Resolve<IGenericRepository<liftinglimit_history>>().Save(LiftingLimithistoryEntity);
                transactionScope.Complete();
            }
            return LiftingLimitid;
        }