public tblModulesPayment GetModulesAndPayments(int GroupId)
        {
            tblModulesPayment objModulesPayment = new tblModulesPayment();

            using (var context = new CommonDBContext())
            {
                objModulesPayment = context.tblModulesPayments.Where(x => x.GroupId == GroupId).FirstOrDefault();
            }
            return(objModulesPayment);
        }
Exemplo n.º 2
0
        public ActionResult AddNewCustomer(string ProductType, string groupId)
        {
            CustomerViewModel objCustomerViewModel = new CustomerViewModel();

            try
            {
                tblGroupDetail    objGroupDetail    = new tblGroupDetail();
                tblModulesPayment objModulesPayment = new tblModulesPayment();

                if (!string.IsNullOrEmpty(groupId))
                {
                    CommonFunctions common = new CommonFunctions();
                    groupId        = common.DecryptString(groupId);
                    objGroupDetail = CR.GetGroupDetails(Convert.ToInt32(groupId));
                    var LogoURL = System.Configuration.ConfigurationManager.AppSettings["LogoURL"];
                    objGroupDetail.Logo = LogoURL + objGroupDetail.Logo;

                    objModulesPayment         = CR.GetModulesAndPayments(Convert.ToInt32(groupId));
                    objModulesPayment.GroupId = Convert.ToInt32(groupId);
                }
                if (!string.IsNullOrEmpty(ProductType))
                {
                    objGroupDetail.ProductType = Convert.ToInt32(ProductType);
                }
                objCustomerViewModel.objGroupData      = objGroupDetail;
                objCustomerViewModel.objModulesPayment = objModulesPayment;

                objCustomerViewModel.lstRetailCategory = CR.GetRetailCategory();
                objCustomerViewModel.lstCity           = CR.GetCity();
                objCustomerViewModel.lstSourcedBy      = CR.GetSourcedBy();
                objCustomerViewModel.lstRMAssigned     = CR.GetRMAssigned();
                objCustomerViewModel.lstBillingPartner = CR.GetBillingPartner();
            }
            catch (Exception ex)
            {
                newexception.AddException(ex, groupId);
            }
            return(View(objCustomerViewModel));
        }
        public bool AddModulesAndPayments(tblModulesPayment objModulesPayment)
        {
            bool status = false;

            using (var context = new CommonDBContext())
            {
                using (DbContextTransaction transaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        context.tblModulesPayments.AddOrUpdate(objModulesPayment);
                        context.SaveChanges();
                        transaction.Commit();
                        status = true;
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        throw ex;
                    }
                }
            }
            return(status);
        }