public ActionResult EditCustomerService(LoanViewModel lvm) { try { GLobalClient gc = new GLobalClient(); ViewBag.listMerchant = gc.findAllMerchant(); //lvm.CustomerServices = gc.FindCustomerService(lvm); CustomerService _cs = new CustomerService(); _cs.ID = lvm.CustomerServices.ID; _cs.CustomerID = lvm.CustomerServices.CustomerID; _cs.CustomerIDLabel = lvm.CustomerServices.CustomerIDLabel; _cs.PackageTypeIDLabel = lvm.CustomerServices.PackageTypeIDLabel; _cs.PackageType = lvm.CustomerServices.PackageType; _cs.OtherLabel = lvm.CustomerServices.OtherLabel; _cs.OtherLabelID = lvm.CustomerServices.OtherLabelID; var UpdateCustomerService = DataCreators.UpdateCustomerService(_cs); // return View("AllCustomerService"); return(RedirectToAction("AllCustomerService", "Customer", new { area = "" })); } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(null); } }
public ActionResult CreatePage(LoanViewModel lvm) { GLobalClient cc = new GLobalClient(); if (lvm != null) { string value = lvm.PageModel.PageName; bool val = DataReaders.ValidatePage(value); if (val == true) { TempData["Message"] = "Page Already Exist"; return(RedirectToAction("Page", "index", new { area = "" })); } else if (val == false) { lvm.PageModel.isvisible = 1; lvm.PageModel.pageHeader = 1; cc.CreatePage(lvm.PageModel); TempData["Message"] = "Page Created Succesfully"; return(RedirectToAction("Page", "index", new { area = "" })); } } else { TempData["Message"] = "Error Creating Page"; } return(RedirectToAction("Page", "index", new { area = "" })); }
public ActionResult AllCustomerService(string search, int?i) { try { // search = "12"; // int i = 0; string user = LoggedInuser.LoggedInUser(); if (user != null) { int userid = DataReaders.GetUserIdByEmail(user); GLobalClient gc = new GLobalClient(); //ViewBag.listCustomerService = gc.GetCustomerSevicesByUser(userid); // List<CustomerService> listCustomer = (db.CustomerServices.Where(x => x.CustomerID.StartsWith(search) || search == null && x.Customer_FK == userid && x.isVissible==1).ToList()); List <CustomerService> listCustomer = (db.CustomerServices.ToList()); int pageSize = 2; int pageNumber = (i ?? 1); ViewBag.listCustomerService = listCustomer; var onePageOfCustomers = listCustomer.ToPagedList(pageNumber, pageSize); ViewBag.onePageOfCustomers = onePageOfCustomers; // return View(listCustomer.ToPagedList(pageNumber,pageSize)); // return View("AllCustomerService"); var query = (db.CustomerServices.Where(x => x.CustomerID.StartsWith(search) || search == null && x.Customer_FK == userid && x.isVissible == 1). Select(t => new CustomerServices { CustomerID = t.CustomerID, CustomerIDLabel = t.CustomerIDLabel, PackageTypeIDLabel = t.PackageTypeIDLabel, PackageType = t.PackageType, OtherLabelID = t.OtherLabelID }).OrderBy(t => t.CustomerID).ToPagedList(pageNumber, pageSize)); return(View(query)); } else { return(RedirectToAction("index", "index", new { area = "" })); } } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { Exception raise = dbEx; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { string message = string.Format("{0}:{1}", validationErrors.Entry.Entity.ToString(), validationError.ErrorMessage); //raise a new exception inserting the current one as the InnerException raise = new InvalidOperationException(message, raise); } } // WebLog.Log(ex.Message.ToString()); return(null); } }
// GET: Loan public ActionResult Index() { GLobalClient gc = new GLobalClient(); ViewBag.listLoan = gc.findAll(); return(View()); }
public ActionResult Delete(int Id) { GLobalClient cc = new GLobalClient(); cc.Delete(Id); return(RedirectToAction("Index")); }
public ActionResult CreateService(LoanViewModel lvm, FormCollection form) { try { var LoggedInuser = new LogginHelper(); string user = LoggedInuser.LoggedInUser(); if (user != "") { var userid = DataReaders.GetUserIdByEmail(user); GLobalClient gc = new GLobalClient(); ViewBag.listMerchant = gc.findAllMerchant(); lvm.CustomerServices.Customer_FK = userid; lvm.CustomerServices.DateCreated = DateTime.Now; lvm.CustomerServices.ValueDate = DateTime.Now.ToString(); lvm.CustomerServices.Merchant_Fk = Convert.ToInt16(form["ID"]); lvm.CustomerServices.ValueTime = "1"; lvm.CustomerServices.isVissible = 1; lvm.CustomerServices.OtherLabel = "other"; gc.CreateCustomerService(lvm.CustomerServices); TempData["Message"] = "New Service Added"; return(View("CreateService")); } else { return(View("CreateService")); } } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(null); } }
public ActionResult Edit(LoanViewModel cvm) { GLobalClient gc = new GLobalClient(); gc.Edit(cvm.LoanModel); return(RedirectToAction("Index")); }
public ActionResult CreateRole(LoanViewModel lvm) { GLobalClient cc = new GLobalClient(); if (lvm != null) { string value = lvm.RoleModel.RoleName; bool val = DataReaders.ValidateRole(value); if (val == true) { TempData["Message"] = "Role Already Exist"; return(RedirectToAction("Roles", "index", new { area = "" })); } else if (val == false) { lvm.RoleModel.Date = DateTime.Now; cc.CreateRole(lvm.RoleModel); TempData["Message"] = "Role Created Succesfully"; return(RedirectToAction("Roles", "index", new { area = "" })); } } else { TempData["Message"] = "Error Creating Role"; } return(RedirectToAction("Roles", "index", new { area = "" })); }
public ActionResult Create(LoanViewModel lvm) { GLobalClient cc = new GLobalClient(); if (lvm != null) { lo.ContactAddress = lvm.LoanModel.ContactAddress; /*gte.Loans.Add(lo); * gte.SaveChanges(); * int id = lo.ID;*/ cc.Create(lvm.LoanModel); lvm.LoanModel.ID = ln.ID; lvm.LoanModel.ID = 1; lvm.LoanBankModel.Loan_Fk = lvm.LoanModel.ID; lvm.LoanEmployeeModel.Loan_Fk = lvm.LoanModel.ID; lvm.LoanSocialModel.Loan_Fk = lvm.LoanModel.ID; cc.CreateBank(lvm.LoanBankModel); cc.CreateLoanEmployee(lvm.LoanEmployeeModel); cc.CreateSocail(lvm.LoanSocialModel); using (GlobalTransactEntitiesData g = new GlobalTransactEntitiesData()) { List <DataAccess.Loan> Loan = g.Loans.ToList(); } TempData["Message"] = "Loan Application Succesful"; // return RedirectToAction("Apply"); } else { TempData["Message"] = "loan Application Failed"; } return(View("Apply", lvm)); }
public ActionResult PageRole() { try { var value = ""; string Pageid = Request.QueryString["value"]; if (Pageid == "" || Pageid == null) { Pageid = "2016"; } GLobalClient gc = new GLobalClient(); ViewBag.listPage = gc.findAllPages(); //var value = 2016; value = Pageid; pages.id = Convert.ToInt16(value); var pag = ""; var selectedItem = DataReaders.getSelectedPage(pages.id); if (selectedItem != null) { pag = selectedItem; pages.PageName = pag; } var result = (from a in db.PageAuthentications join c in db.Roles on a.RoleId equals c.RoleId join b in db.Pags on a.PageName equals b.PageName // where b.id == pages.id where b.id == pages.id select new Models.GetAssignPages { pageid = b.id, Roleid = c.RoleId.ToString(), Rolename = c.RoleName }).ToList(); var pageroles = DataReaders.buildPagesList(pages); var roles = DataReaders.buildAllRoleList(); List <int> pagerole = pageroles; List <int> role = roles; var newList = roles.Except(pageroles); var pageurl = (from p in db.Roles where newList.Contains((int)(p.RoleId)) select new Models.UnGetAssignRoles { Roleid = p.RoleId, Rolename = p.RoleName }).ToList(); var model = new LoanViewModel { GetAssignPagess = result.ToList(), UnGetAssignRoless = pageurl.ToList(), }; return(View(model)); } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(null); } }
public ActionResult Edit(int Id) { GLobalClient cc = new GLobalClient(); LoanViewModel cvm = new LoanViewModel(); cvm.LoanModel = cc.find(Id); return(View("Edit", cvm)); }
public ActionResult CreateService() { try { GLobalClient gc = new GLobalClient(); ViewBag.listMerchant = gc.findAllMerchant(); return(View("CreateService")); } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(null); } }
public ActionResult EditCustomerService(int id) { try { GLobalClient gc = new GLobalClient(); ViewBag.listMerchant = gc.findAllMerchant(); LoanViewModel lvm = new LoanViewModel(); lvm.CustomerServices = gc.FindCustomerService(id); return(View("EditCustomerService", lvm)); } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(null); } }
public ActionResult UserRole() { try { var value = 13; users.id = value; GLobalClient gc = new GLobalClient(); ViewBag.listUser = gc.findAllUser(); //getAllUsersRoles(value); var result = (from a in db.UserRoles join c in db.Roles on a.RoleId equals c.RoleId join b in db.Users on a.UserId equals b.id where a.UserId == users.id select new Models.GetAssignRoles { userid = b.id, Roleid = c.RoleId.ToString(), Rolename = c.RoleName, email = b.Email }).ToList(); var userroles = DataReaders.buildNamesList(users); var roles = DataReaders.buildAllRoleList(); List <int> userrole = userroles; List <int> role = roles; var newList = roles.Except(userroles); var pageurl = (from p in db.Roles where newList.Contains((int)(p.RoleId)) select new Models.UnGetAssignRoles { Roleid = p.RoleId, Rolename = p.RoleName }).ToList(); var model = new LoanViewModel { GetAssignRoless = result.ToList(), UnGetAssignRoless = pageurl.ToList(), }; return(View(model)); } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(null); } }
public ActionResult DeleteCustomerService(int Id, LoanViewModel lvm) { try { CustomerServices cs = new CustomerServices(); GLobalClient gc = new GLobalClient(); //This is for The Api //gc.DeleteCustomerService(_cs, Id); _cs.isVissible = 0; DataCreators.ArchieveCustomerServices(Id); return(RedirectToAction("AllCustomerService")); } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(null); } }
public ActionResult CreateUser(LoanViewModel lvm) { GLobalClient cc = new GLobalClient(); if (lvm != null) { string value = lvm.AccountsModel.Email; string password = lvm.AccountsModel.pasword; string confirmpass = lvm.AccountsModel.confirmPassword; bool validatePass = ValidatePassword(password, confirmpass); var EncrypPassword = new CryptographyManager().ComputeHash(password, HashName.SHA256); password = EncrypPassword; lvm.AccountsModel.confirmPassword = password; lvm.AccountsModel.pasword = password; lvm.AccountsModel.Email = value; if (validatePass == false) { TempData["Message"] = "Password And Confirm Password Must Match"; } else if (validatePass == true) { bool val = DataReaders.Validate(value); if (val == true) { TempData["Message"] = "User Already Exist"; return(RedirectToAction("Signup", "index", new { area = "" })); } else if (val == false) { lvm.AccountsModel.Date = DateTime.Now; lvm.AccountsModel.DateTim = DateTime.Today; cc.CreateUser(lvm.AccountsModel); TempData["Message"] = "User Created Succesfully"; return(RedirectToAction("Signup", "index", new { area = "" })); } } } else { TempData["Message"] = "Error Creating User"; } return(RedirectToAction("Signup", "index", new { area = "" })); }
public ActionResult CreateUser(LoanViewModel lvm, FormCollection form) { GLobalClient cc = new GLobalClient(); try { if (lvm != null) { string value = lvm.AccountsModel.Email; string password = lvm.AccountsModel.pasword; string confirmpass = lvm.AccountsModel.confirmPassword; bool validatePass = ValidatePassword(password, confirmpass); var EncrypPassword = new CryptographyManager().ComputeHash(password, HashName.SHA256); password = EncrypPassword; lvm.AccountsModel.confirmPassword = password; lvm.AccountsModel.pasword = password; lvm.AccountsModel.Email = value; lvm.AccountsModel.Referal = Convert.ToString(form["Referal"]); if (validatePass == false) { TempData["Message"] = "Password And Confirm Password Must Match"; } else if (validatePass == true) { bool val = DataReaders.Validate(value); if (val == true) { TempData["Message"] = "User Already Exist"; // return RedirectToAction("Signup", "Home", new { area = "" }); ViewBag.channel = db.MarketingChannels; return(View("Signup")); } else if (val == false) { lvm.AccountsModel.Date = DateTime.Now; lvm.AccountsModel.DateTim = DateTime.Today; lvm.AccountsModel.isVissibles = 1; // This is For the Api // cc.CreateUser(lvm.AccountsModel); User users = new DataAccess.User(); users.confirmPassword = lvm.AccountsModel.confirmPassword; users.pasword = lvm.AccountsModel.pasword; users.Email = lvm.AccountsModel.Email; users.Date = lvm.AccountsModel.Date; users.DateTim = lvm.AccountsModel.DateTim; users.isVissibles = lvm.AccountsModel.isVissibles; users.firstname = lvm.AccountsModel.firstname; users.lastname = lvm.AccountsModel.lastname; users.Phone = lvm.AccountsModel.Phone; users.Referal = lvm.AccountsModel.Referal; //string lastid = "0"; //users.MyReferalCode = MyUtility.getReferralCode(lastid); users.ReferralLevel = MyUtility.getRefferalLevel(users.Referal); // users.MyReferalCode = int id = DataCreators.CreateUser(users); var channellist = Request["checkboxName"]; if (channellist != null) { string[] arr = channellist.Split(','); var chanList = removestring(arr); if (arr.Length > 0) { for (var i = 0; i < arr.Length; i++) { string arrc = Convert.ToString(arr[i]); insertMarketChannel(arrc, id); } } } if (id != 0) { string lastid = id.ToString(); users.MyReferalCode = MyUtility.getReferralCode(lastid); DataCreators.updatelastID(users); DataAccess.UserRole userroles = new DataAccess.UserRole(); userroles.UserId = id; userroles.RoleId = Convert.ToInt16(ConfigurationManager.AppSettings["DefaultUser"]); userroles.IsVissible = 1; userroles.dates = DateTime.Now; DataCreators.InsertUserRoles(userroles); TempData["Message"] = "User Created Succesfully"; //For LoggedIn User Session["id"] = lvm.AccountsModel.Email; Session["User"] = Session["id"]; var LoggedInuser = new LogginHelper(); user = LoggedInuser.LoggedInUser(); SendEmail(lvm); string Regpage = ConfigurationManager.AppSettings["DefaultRegister"]; return(Redirect(Regpage)); //return RedirectToAction("Index", "Dashboard"); // return RedirectToAction("Dashboard", "Dashboard"); } else { TempData["Message"] = "Registration Not Succesful Please Try Again!"; ViewBag.channel = db.MarketingChannels; } } } } else { TempData["Message"] = "Error Creating User"; ViewBag.channel = db.MarketingChannels; } return(RedirectToAction("Signup", "Home", new { area = "" })); } catch (Exception ex) { WebLog.Log(ex.Message.ToString()); return(null); } }