// 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: /Edit public ActionResult Edit(int id, string csu, string can, string ssc) { ClientDefinedReferenceItemPNROutputVM clientDefinedReferenceItemPNROutputVM = new ClientDefinedReferenceItemPNROutputVM(); ClientDefinedReferenceItemPNROutput clientDefinedReferenceItemPNROutput = new ClientDefinedReferenceItemPNROutput(); clientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutputRepository.GetClientDefinedReferenceItemPNROutput(id); if (clientDefinedReferenceItemPNROutput == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } clientDefinedReferenceItemPNROutputVM.ClientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutput; //Check Exists ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem(); clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemId); if (clientDefinedReferenceItem == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } ViewData["DsplayName"] = !string.IsNullOrEmpty(clientDefinedReferenceItem.DisplayNameAlias) ? clientDefinedReferenceItem.DisplayNameAlias : clientDefinedReferenceItem.DisplayName; //Check Exists CSU for VM ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); if (clientSubUnit != null) { clientSubUnitRepository.EditGroupForDisplay(clientSubUnit); clientDefinedReferenceItemPNROutputVM.ClientSubUnit = clientSubUnit; } // Check Exists CDR CSU (can be null) ClientSubUnit clientSubUnitCDR = new ClientSubUnit(); if (clientDefinedReferenceItem.ClientSubUnitGuid != null) { clientSubUnitCDR = clientSubUnitRepository.GetClientSubUnit(clientDefinedReferenceItem.ClientSubUnitGuid); if (clientSubUnit != null) { clientSubUnitRepository.EditGroupForDisplay(clientSubUnitCDR); clientDefinedReferenceItem.ClientSubUnitGuid = clientSubUnitCDR.ClientSubUnitGuid; } } if (can != null && ssc != null) { ClientSubUnitClientAccount clientSubUnitClientAccount = new ClientSubUnitClientAccount(); clientSubUnitClientAccount = clientSubUnitClientAccountRepository.GetClientSubUnitClientAccount(can, ssc, csu); if (clientSubUnitClientAccount != null) { ViewData["ClientSubUnitClientAccountClientAccountName"] = clientSubUnitClientAccount.ClientAccount.ClientAccountName; } clientDefinedReferenceItem.ClientAccountNumber = clientDefinedReferenceItem.ClientAccountNumber; clientDefinedReferenceItem.SourceSystemCode = clientDefinedReferenceItem.SourceSystemCode; } 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; } clientDefinedReferenceItem.ClientAccountNumber = can; clientDefinedReferenceItem.SourceSystemCode = ssc; ViewData["ClientDefinedReferenceItemId"] = clientDefinedReferenceItem.ClientDefinedReferenceItemId; ViewData["ClientAccountNumber"] = can; ViewData["SourceSystemCode"] = ssc; } //ClientDefinedReferenceItem clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItem = clientDefinedReferenceItem; clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemId = clientDefinedReferenceItem.ClientDefinedReferenceItemId; //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: /Edit public ActionResult Edit(int id, string csu, string can, string ssc) { ClientDefinedReferenceItemPNROutputVM clientDefinedReferenceItemPNROutputVM = new ClientDefinedReferenceItemPNROutputVM(); ClientDefinedReferenceItemPNROutput clientDefinedReferenceItemPNROutput = new ClientDefinedReferenceItemPNROutput(); clientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutputRepository.GetClientDefinedReferenceItemPNROutput(id); if (clientDefinedReferenceItemPNROutput == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } clientDefinedReferenceItemPNROutputVM.ClientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutput; //Check Exists ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem(); clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemId); if (clientDefinedReferenceItem == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } //Check Exists CSU for VM ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); if (clientSubUnit != null) { clientSubUnitRepository.EditGroupForDisplay(clientSubUnit); clientDefinedReferenceItemPNROutputVM.ClientSubUnit = clientSubUnit; } clientSubUnitRepository.EditGroupForDisplay(clientSubUnit); ViewData["ClientTopUnitGuid"] = clientSubUnit.ClientTopUnitGuid; ViewData["ClientTopUnitName"] = clientSubUnit.ClientTopUnitName; ViewData["ClientSubUnitGuid"] = clientSubUnit.ClientSubUnitGuid; ViewData["ClientSubUnitName"] = clientSubUnit.ClientSubUnitName; ViewData["ClientDefinedReferenceItemId"] = clientDefinedReferenceItem.ClientDefinedReferenceItemId; ViewData["DisplayNameAlias"] = clientDefinedReferenceItem.DisplayNameAlias != null ? clientDefinedReferenceItem.DisplayNameAlias : clientDefinedReferenceItem.DisplayName; clientDefinedReferenceItemPNROutputVM.ClientSubUnit = clientSubUnit; clientDefinedReferenceItem.ClientSubUnitGuid = clientSubUnit.ClientSubUnitGuid; //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)); }