public ActionResult Delete(int id, int fpt, int sp) { ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType = new ClientDetailSubProductFormOfPaymentType(); clientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentTypeRepository.GetClientDetailSubProductFormOfPaymentType(sp, id); //Check Exists if (clientDetailSubProductFormOfPaymentType == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType(); clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(id); //Check Exists if (clientDetailClientSubUnitTravelerType == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } string csu = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid; string tt = clientDetailClientSubUnitTravelerType.TravelerTypeGuid; ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); //Access Rights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(csu)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM = new ClientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM(); clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientSubUnit = clientSubUnit; clientDetailSubProductFormOfPaymentTypeRepository.EditForDisplay(clientDetailSubProductFormOfPaymentType); clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentType; TravelerType travelerType = new TravelerType(); travelerType = travelerTypeRepository.GetTravelerType(tt); clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.TravelerType = travelerType; ClientDetail clientDetail = new ClientDetail(); clientDetail = clientDetailRepository.GetGroup(id); clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientDetail = clientDetail; return(View(clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM)); }
// GET: /Create public ActionResult Create(int id) { ClientDetail clientDetail = new ClientDetail(); clientDetail = clientDetailRepository.GetGroup(id); //Check Exists if (clientDetail == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } ClientDetailClientAccount clientDetailClientAccount = new ClientDetailClientAccount(); clientDetailClientAccount = clientDetailClientAccountRepository.GetClientDetailClientAccount(id); //Check Exists if (clientDetailClientAccount == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } string can = clientDetailClientAccount.ClientAccountNumber; string ssc = clientDetailClientAccount.SourceSystemCode; ClientAccount clientAccount = new ClientAccount(); clientAccount = clientAccountRepository.GetClientAccount(can, ssc); //Access Rights ViewData["Access"] = ""; RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToClientSubUnit(can)) { ViewData["Access"] = "WriteAccess"; } ClientAccountSubProductFormOfPaymentTypeVM clientAccountSubProductFormOfPaymentTypeVM = new ClientAccountSubProductFormOfPaymentTypeVM(); clientAccountSubProductFormOfPaymentTypeVM.ClientAccount = clientAccount; clientAccountSubProductFormOfPaymentTypeVM.ClientDetail = clientDetail; ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType = new ClientDetailSubProductFormOfPaymentType(); clientAccountSubProductFormOfPaymentTypeVM.ClientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentType; FormOfPaymentTypeRepository formOfPaymentTypeRepository = new FormOfPaymentTypeRepository(); clientAccountSubProductFormOfPaymentTypeVM.FormOfPaymentTypes = new SelectList(formOfPaymentTypeRepository.GetAllFormOfPaymentTypes().ToList(), "FormOfPaymentTypeId", "FormOfPaymentTypeDescription"); clientAccountSubProductFormOfPaymentTypeVM.SubProducts = new SelectList(clientDetailSubProductFormOfPaymentTypeRepository.GetUnUsedSubProducts(id).ToList(), "SubProductId", "SubProductName"); return(View(clientAccountSubProductFormOfPaymentTypeVM)); }
//Add ClientDetail Contact public void Add(ClientDetail clientDetail, ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_InsertClientDetailSubProductFormOfPaymentType_v1( clientDetail.ClientDetailId, clientDetailSubProductFormOfPaymentType.SubProductId, clientDetailSubProductFormOfPaymentType.FormOfPaymentTypeId, adminUserGuid ); }
public ActionResult Delete(int id, int fpt, int sp) { ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType = new ClientDetailSubProductFormOfPaymentType(); clientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentTypeRepository.GetClientDetailSubProductFormOfPaymentType(sp, id); //Check Exists if (clientDetailSubProductFormOfPaymentType == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } ClientDetailClientAccount clientDetailClientAccount = new ClientDetailClientAccount(); clientDetailClientAccount = clientDetailClientAccountRepository.GetClientDetailClientAccount(id); //Check Exists if (clientDetailClientAccount == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } string can = clientDetailClientAccount.ClientAccountNumber; string ssc = clientDetailClientAccount.SourceSystemCode; ClientAccount clientAccount = new ClientAccount(); clientAccount = clientAccountRepository.GetClientAccount(can, ssc); //Access Rights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(can)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientAccountSubProductFormOfPaymentTypeVM clientAccountSubProductFormOfPaymentTypeVM = new ClientAccountSubProductFormOfPaymentTypeVM(); clientAccountSubProductFormOfPaymentTypeVM.ClientAccount = clientAccount; clientDetailSubProductFormOfPaymentTypeRepository.EditForDisplay(clientDetailSubProductFormOfPaymentType); clientAccountSubProductFormOfPaymentTypeVM.ClientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentType; ClientDetail clientDetail = new ClientDetail(); clientDetail = clientDetailRepository.GetGroup(id); clientAccountSubProductFormOfPaymentTypeVM.ClientDetail = clientDetail; return(View(clientAccountSubProductFormOfPaymentTypeVM)); }
//Add ClientDetail ESCInformation public void Delete(ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType) { string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0]; db.spDesktopDataAdmin_DeleteClientDetailSubProductFormOfPaymentType_v1( clientDetailSubProductFormOfPaymentType.ClientDetailId, clientDetailSubProductFormOfPaymentType.SubProductId, clientDetailSubProductFormOfPaymentType.FormOfPaymentTypeId, adminUserGuid, clientDetailSubProductFormOfPaymentType.VersionNumber ); }
public ClientAccountSubProductFormOfPaymentTypeVM( ClientAccount clientAccount, ClientDetail clientDetail, ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType, IEnumerable <SelectListItem> subProducts, IEnumerable <SelectListItem> formOfPaymentTypes) { ClientAccount = clientAccount; ClientDetail = clientDetail; ClientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentType; FormOfPaymentTypes = formOfPaymentTypes; SubProducts = subProducts; }
public TravelerTypeSubProductFormOfPaymentTypeVM( ClientSubUnit clientSubUnit, TravelerType travelerType, ClientDetail clientDetail, ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType, IEnumerable <SelectListItem> subProducts, IEnumerable <SelectListItem> formOfPaymentTypes) { ClientSubUnit = clientSubUnit; TravelerType = travelerType; ClientDetail = clientDetail; ClientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentType; FormOfPaymentTypes = formOfPaymentTypes; SubProducts = subProducts; }
//Add Data From Linked Tables for Display public void EditForDisplay(ClientDetailSubProductFormOfPaymentType subProductFormOfPaymentType) { FormOfPaymentTypeRepository formOfPaymentTypeRepository = new FormOfPaymentTypeRepository(); FormOfPaymentType formOfPaymentType = new FormOfPaymentType(); formOfPaymentType = formOfPaymentTypeRepository.GetFormOfPaymentType(subProductFormOfPaymentType.FormOfPaymentTypeId); if (formOfPaymentType != null) { subProductFormOfPaymentType.FormOfPaymentTypeDescription = formOfPaymentType.FormOfPaymentTypeDescription; } SubProductRepository subProductRepository = new SubProductRepository(); SubProduct subProduct = new SubProduct(); subProduct = subProductRepository.GetSubProduct(subProductFormOfPaymentType.SubProductId); if (subProduct != null) { subProductFormOfPaymentType.SubProductName = subProduct.SubProductName; } }
// GET: /Create public ActionResult Create(int id) { ClientDetail clientDetail = new ClientDetail(); clientDetail = clientDetailRepository.GetGroup(id); //Check Exists if (clientDetail == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType(); clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(id); //Check Exists if (clientDetailClientSubUnitTravelerType == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } string csu = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid; string tt = clientDetailClientSubUnitTravelerType.TravelerTypeGuid; ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); //Access Rights ViewData["Access"] = ""; RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToClientSubUnit(csu)) { ViewData["Access"] = "WriteAccess"; } ClientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM = new ClientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM(); clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientSubUnit = clientSubUnit; clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientDetail = clientDetail; TravelerType travelerType = new TravelerType(); travelerType = travelerTypeRepository.GetTravelerType(tt); clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.TravelerType = travelerType; ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType = new ClientDetailSubProductFormOfPaymentType(); clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.ClientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentType; FormOfPaymentTypeRepository formOfPaymentTypeRepository = new FormOfPaymentTypeRepository(); clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.FormOfPaymentTypes = new SelectList(formOfPaymentTypeRepository.GetAllFormOfPaymentTypes().ToList(), "FormOfPaymentTypeId", "FormOfPaymentTypeDescription"); clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM.SubProducts = new SelectList(clientDetailSubProductFormOfPaymentTypeRepository.GetUnUsedSubProducts(id).ToList(), "SubProductId", "SubProductName"); return(View(clientSubUnitTravelerTypeSubProductFormOfPaymentTypeVM)); }
public ActionResult Delete(int id, int fpt, int sp, FormCollection collection) { ClientDetailSubProductFormOfPaymentType clientDetailSubProductFormOfPaymentType = new ClientDetailSubProductFormOfPaymentType(); clientDetailSubProductFormOfPaymentType = clientDetailSubProductFormOfPaymentTypeRepository.GetClientDetailSubProductFormOfPaymentType(sp, id); //Check Exists if (clientDetailSubProductFormOfPaymentType == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } int clientDetailId = clientDetailSubProductFormOfPaymentType.ClientDetailId; ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType(); clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(clientDetailId); //Check Exists if (clientDetailClientSubUnitTravelerType == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } string csu = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid; string tt = clientDetailClientSubUnitTravelerType.TravelerTypeGuid; ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); //Access Rights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(csu)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Delete Item try { clientDetailSubProductFormOfPaymentType.VersionNumber = Int32.Parse(collection["ClientDetailSubProductFormOfPaymentType.VersionNumber"]); clientDetailSubProductFormOfPaymentTypeRepository.Delete(clientDetailSubProductFormOfPaymentType); } catch (SqlException ex) { //Versioning Error - go to standard versionError page if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/ClientSubUnitTravelerTypeSubProductFormOfPaymentType.mvc/Delete/?id=" + id.ToString() + "&sp=" + sp.ToString() + "&fpt=" + fpt.ToString(); return(View("VersionError")); } //Generic Error 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", new { id = clientDetailId })); }