// GET: Create A Single ClientFee public ActionResult Create() { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientFeeVM clientFeeVM = new ClientFeeVM(); ClientFee clientFee = new ClientFee(); FeeType feeType = new FeeType(); clientFee.FeeType = feeType; clientFeeVM.ClientFee = clientFee; FeeTypeRepository feeTypeRepository = new FeeTypeRepository(); clientFeeVM.FeeTypes = feeTypeRepository.GetAllFeeTypes().ToList(); GDSRepository gdsRepository = new GDSRepository(); clientFeeVM.GDSs = new SelectList(gdsRepository.GetAllGDSs().ToList(), "GDSCode", "GDSName"); ContextRepository contextRepository = new ContextRepository(); clientFeeVM.Contexts = new SelectList(contextRepository.GetAllContexts().ToList(), "ContextId", "ContextName"); return(View(clientFeeVM)); }
// GET: Edit A Single ClientFee public ActionResult Edit(int id) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientFee clientFee = new ClientFee(); clientFee = clientFeeRepository.GetItem(id); //Check Exists if (clientFee == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Change DisplayText for Transaction Fees FeeType feeType = new FeeType(); feeType = clientFee.FeeType; if (feeType.FeeTypeDescription == "Client Fee") { feeType.FeeTypeDescription = "Transaction Fee"; } ClientFeeVM clientFeeVM = new ClientFeeVM(); clientFeeVM.ClientFee = clientFee; GDSRepository gdsRepository = new GDSRepository(); clientFeeVM.GDSs = new SelectList(gdsRepository.GetAllGDSs().ToList(), "GDSCode", "GDSName", clientFee.GDSCode); ContextRepository contextRepository = new ContextRepository(); clientFeeVM.Contexts = new SelectList(contextRepository.GetAllContexts().ToList(), "ContextId", "ContextName", clientFee.ContextId); //Check for missing GDS if (clientFee.GDS == null) { GDS gds = new GDS(); clientFee.GDS = gds; } ClientFeeOutput clientFeeOutput = new ClientFeeOutput(); if (clientFee.ClientFeeOutputs.Count > 0) { clientFeeOutput = clientFeeOutputRepository.GetItem(clientFee.ClientFeeOutputs[0].ClientFeeOutputId); } clientFeeVM.ClientFeeOutput = clientFeeOutput; return(View(clientFeeVM)); }
public ActionResult Edit(ClientFeeVM clientFeeVM) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientFee clientFee = new ClientFee(); clientFee = clientFeeRepository.GetItem(clientFeeVM.ClientFee.ClientFeeId); //Check Exists if (clientFee == null) { ViewData["ActionMethod"] = "EditPost"; return(View("RecordDoesNotExistError")); } //Update Model from Form try { UpdateModel(clientFeeVM); } catch { string n = ""; foreach (ModelState modelState in ViewData.ModelState.Values) { foreach (ModelError error in modelState.Errors) { n += error.ErrorMessage; } } ViewData["Message"] = "ValidationError : " + n; return(View("Error")); } //Database Update try { clientFeeRepository.Update(clientFeeVM); } catch (SqlException ex) { LogRepository logRepository = new LogRepository(); logRepository.LogError(ex.Message); ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details"; return(View("Error")); } return(RedirectToAction("List")); }
//Add to DB public void Add(ClientFeeVM clientFeeVM) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_InsertClientFee_v1( clientFeeVM.ClientFee.ClientFeeDescription, clientFeeVM.ClientFee.FeeTypeId, clientFeeVM.ClientFee.ContextId, clientFeeVM.ClientFee.GDSCode, clientFeeVM.ClientFeeOutput.OutputFormat, clientFeeVM.ClientFeeOutput.OutputDescription, clientFeeVM.ClientFeeOutput.OutputPlaceholder, adminUserGuid ); }
//Update in DB public void Update(ClientFeeVM clientFeeVM) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_UpdateClientFee_v1( clientFeeVM.ClientFee.ClientFeeId, clientFeeVM.ClientFee.ClientFeeDescription, clientFeeVM.ClientFee.ContextId, clientFeeVM.ClientFee.GDSCode, clientFeeVM.ClientFeeOutput.OutputFormat, clientFeeVM.ClientFeeOutput.OutputDescription, clientFeeVM.ClientFeeOutput.OutputPlaceholder, adminUserGuid, clientFeeVM.ClientFee.VersionNumber ); }
// GET: View A Single ClientFee public ActionResult View(int id) { ClientFee clientFee = new ClientFee(); clientFee = clientFeeRepository.GetItem(id); //Check Exists if (clientFee == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } //Check for missing GDS if (clientFee.GDS == null) { GDS gds = new GDS(); clientFee.GDS = gds; } //Change DisplayText for Transaction Fees FeeType feeType = new FeeType(); feeType = clientFee.FeeType; if (feeType.FeeTypeDescription == "Client Fee") { feeType.FeeTypeDescription = "Transaction Fee"; } ClientFeeVM clientFeeVM = new ClientFeeVM(); clientFeeVM.ClientFee = clientFee; ClientFeeOutput clientFeeOutput = new ClientFeeOutput(); if (clientFee.ClientFeeOutputs.Count > 0) { clientFeeOutput = clientFeeOutputRepository.GetItem(clientFee.ClientFeeOutputs[0].ClientFeeOutputId); } clientFeeVM.ClientFeeOutput = clientFeeOutput; return(View(clientFeeVM)); }
public ActionResult Delete(int id) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientFee clientFee = new ClientFee(); clientFee = clientFeeRepository.GetItem(id); //Check Exists if (clientFee == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } //Check for missing GDS if (clientFee.GDS == null) { GDS gds = new GDS(); clientFee.GDS = gds; } ClientFeeVM clientFeeVM = new ClientFeeVM(); clientFeeVM.ClientFee = clientFee; ClientFeeOutput clientFeeOutput = new ClientFeeOutput(); if (clientFee.ClientFeeOutputs.Count > 0) { clientFeeOutput = clientFeeOutputRepository.GetItem(clientFee.ClientFeeOutputs[0].ClientFeeOutputId); } clientFeeVM.ClientFeeOutput = clientFeeOutput; return(View(clientFeeVM)); }