public ActionResult Delete(string can, string ssc, string clientSubUnitId) { //Check Exists ClientSubUnitClientAccount clientSubUnitClientAccount = new ClientSubUnitClientAccount(); clientSubUnitClientAccount = clientSubUnitClientAccountRepository.GetClientSubUnitClientAccount(can, ssc, clientSubUnitId); if (clientSubUnitClientAccount == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } //Access Rights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(clientSubUnitClientAccount.ClientSubUnitGuid)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } if (!rolesRepository.HasWriteAccessToClientAccount(clientSubUnitClientAccount.ClientAccountNumber, clientSubUnitClientAccount.SourceSystemCode)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } clientSubUnitClientAccountRepository.EditForDisplay(clientSubUnitClientAccount); return(View(clientSubUnitClientAccount)); }
// GET: /Create public ActionResult Create(string id, string can, string ssc) { ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id); //Check Exists if (clientSubUnit == null) { ViewData["ActionMethod"] = "ListBySubUnitGet"; return(View("RecordDoesNotExistError")); } //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientDefinedReferenceItemVM clientDefinedReferenceItemVM = new ClientDefinedReferenceItemVM(); ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem(); clientDefinedReferenceItemRepository.EditForDisplay(clientDefinedReferenceItem); if (can != null && ssc != null) { ClientSubUnitClientAccount clientSubUnitClientAccount = new ClientSubUnitClientAccount(); clientSubUnitClientAccount = clientSubUnitClientAccountRepository.GetClientSubUnitClientAccount(can, ssc, clientSubUnit.ClientSubUnitGuid); if (clientSubUnitClientAccount != null) { ViewData["ClientSubUnitClientAccountClientAccountName"] = clientSubUnitClientAccount.ClientAccount.ClientAccountName; } clientDefinedReferenceItem.ClientAccountNumber = can; clientDefinedReferenceItem.SourceSystemCode = ssc; } //Products ProductRepository productRepository = new ProductRepository(); clientDefinedReferenceItemVM.Products = new SelectList(productRepository.GetAllProducts().ToList(), "ProductId", "ProductName"); //Contexts ContextRepository contextRepository = new ContextRepository(); clientDefinedReferenceItemVM.Contexts = new SelectList(contextRepository.GetAllContexts().ToList(), "ContextId", "ContextName"); clientDefinedReferenceItem.ClientSubUnitGuid = clientSubUnit.ClientSubUnitGuid; clientDefinedReferenceItemVM.ClientDefinedReferenceItem = clientDefinedReferenceItem; clientDefinedReferenceItemVM.ClientSubUnit = clientSubUnit; return(View(clientDefinedReferenceItemVM)); }
// GET: /Create public ActionResult Create(string id, string csu, string can, string ssc) { ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); //Check Exists if (clientSubUnit == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientDefinedReferenceItemPNROutputVM clientDefinedReferenceItemPNROutputVM = new ClientDefinedReferenceItemPNROutputVM(); ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem(); clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(id); ClientDefinedReferenceItemPNROutput clientDefinedReferenceItemPNROutput = new ClientDefinedReferenceItemPNROutput(); //ClientDefinedReferenceItem if (clientDefinedReferenceItem == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } clientDefinedReferenceItem.ClientSubUnitGuid = clientSubUnit.ClientSubUnitGuid; clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItem = clientDefinedReferenceItem; clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemId = clientDefinedReferenceItem.ClientDefinedReferenceItemId; clientDefinedReferenceItemPNROutputVM.ClientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutput; ViewData["DsplayName"] = !string.IsNullOrEmpty(clientDefinedReferenceItem.DisplayNameAlias) ? clientDefinedReferenceItem.DisplayNameAlias : clientDefinedReferenceItem.DisplayName; if (can != null && ssc != null) { ClientSubUnitClientAccount clientSubUnitClientAccount = new ClientSubUnitClientAccount(); clientSubUnitClientAccount = clientSubUnitClientAccountRepository.GetClientSubUnitClientAccount(can, ssc, clientSubUnit.ClientSubUnitGuid); if (clientSubUnitClientAccount != null) { ViewData["ClientSubUnitClientAccountClientAccountName"] = clientSubUnitClientAccount.ClientAccount.ClientAccountName; } clientDefinedReferenceItem.ClientAccountNumber = can; clientDefinedReferenceItem.SourceSystemCode = ssc; ViewData["ClientDefinedReferenceItemId"] = clientDefinedReferenceItem.ClientDefinedReferenceItemId; ViewData["ClientAccountNumber"] = can; ViewData["SourceSystemCode"] = ssc; } //ClientSubUnit clientDefinedReferenceItemPNROutputVM.ClientSubUnit = clientSubUnit; //GDS GDSRepository GDSRepository = new GDSRepository(); clientDefinedReferenceItemPNROutputVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName"); //PNR Output Remark Types PNROutputRemarkTypeRepository PNROutputRemarkTypeRepository = new PNROutputRemarkTypeRepository(); clientDefinedReferenceItemPNROutputVM.PNROutputRemarkTypeCodes = new SelectList(PNROutputRemarkTypeRepository.GetPNROutputRemarkTypes(), "PNROutputRemarkTypeCode", "PNROutputRemarkTypeName", ""); //Languages LanguageRepository languageRepository = new LanguageRepository(); clientDefinedReferenceItemPNROutputVM.Languages = new SelectList(languageRepository.GetAllLanguages().ToList(), "LanguageCode", "LanguageName"); return(View(clientDefinedReferenceItemPNROutputVM)); }
// GET: /Create public ActionResult Create(string id, string csu, string can, string ssc) { //Check Exists ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem(); clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(id); if (clientDefinedReferenceItem == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); //Check Exists if (clientSubUnit == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientDefinedReferenceItemValueVM clientDefinedReferenceItemValueVM = new ClientDefinedReferenceItemValueVM(); ClientDefinedReferenceItemValue clientDefinedReferenceItemValue = new ClientDefinedReferenceItemValue(); clientDefinedReferenceItemValue.ClientDefinedReferenceItemId = clientDefinedReferenceItem.ClientDefinedReferenceItemId; clientDefinedReferenceItemValueVM.ClientDefinedReferenceItemValue = clientDefinedReferenceItemValue; ClientSubUnitClientAccount clientSubUnitClientAccount = new ClientSubUnitClientAccount(); clientSubUnitClientAccount = clientSubUnitClientAccountRepository.GetClientSubUnitClientAccount(clientDefinedReferenceItem.ClientAccountNumber, clientDefinedReferenceItem.SourceSystemCode, clientSubUnit.ClientSubUnitGuid); if (clientSubUnitClientAccount != null) { clientDefinedReferenceItemValueVM.ClientSubUnitClientAccount = clientSubUnitClientAccount; ViewData["ClientSubUnitClientAccountClientAccountName"] = clientSubUnitClientAccount.ClientAccount.ClientAccountName; } clientDefinedReferenceItemValueVM.ClientDefinedReferenceItem = clientDefinedReferenceItem; clientDefinedReferenceItemValueVM.ClientSubUnit = clientSubUnit; if (can != null && ssc != null) { ClientAccount clientAccount = new ClientAccount(); ClientAccountRepository clientAccountRepository = new ClientAccountRepository(); clientAccount = clientAccountRepository.GetClientAccount(can, ssc); if (clientAccount != null) { ViewData["ClientAccountName"] = clientAccount.ClientAccountName; ViewData["ClientAccountNumber"] = clientDefinedReferenceItem.ClientAccountNumber; ViewData["SourceSystemCode"] = clientDefinedReferenceItem.SourceSystemCode; } } return(View(clientDefinedReferenceItemValueVM)); }