// GET: /ExportErrors public ActionResult ExportErrors() { var preImportCheckResultVM = (ClientSubUnitContactImportStep1VM)TempData["ErrorMessages"]; if (preImportCheckResultVM == null) { ViewData["ActionMethod"] = "ExportGet"; return(View("RecordDoesNotExistError")); } var errors = preImportCheckResultVM.ImportStep2VM.ReturnMessages; ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(preImportCheckResultVM.ClientSubUnit.ClientSubUnitGuid); //Check Exists if (clientSubUnit == null) { ViewData["ActionMethod"] = "List"; return(View("RecordDoesNotExistError")); } //Remove special characters for filename string clientSubUnitName = Regex.Replace(clientSubUnit.ClientSubUnitName, "[^a-zA-Z0-9]+", "", RegexOptions.Compiled); //Get CSV Data var combinedErrors = errors.Aggregate((current, next) => current + "\r\n" + next); byte[] csvData = Encoding.ASCII.GetBytes(combinedErrors); return(File(csvData, "text/plain", string.Format("{0}Contacts.txt", clientSubUnitName))); }
// GET: /ExportErrors public ActionResult ExportErrors() { var preImportCheckResultVM = (BookingChannelImportStep1VM)TempData["ErrorMessages"]; if (preImportCheckResultVM == null) { ViewData["ActionMethod"] = "ExportGet"; return(View("RecordDoesNotExistError")); } if (preImportCheckResultVM.ClientSubUnit == null) { ViewData["ActionMethod"] = "ExportGet"; return(View("RecordDoesNotExistError")); } //Check Exists ClientSubUnit clientSubUnit = clientSubUnitRepository.GetClientSubUnit(preImportCheckResultVM.ClientSubUnit.ClientSubUnitGuid); if (clientSubUnit == null) { ViewData["ActionMethod"] = "ExportGet"; return(View("RecordDoesNotExistError")); } //Get CSV Data var errors = preImportCheckResultVM.ImportStep2VM.ReturnMessages; var combinedErrors = errors.Aggregate((current, next) => current + "\r\n" + next); byte[] csvData = Encoding.ASCII.GetBytes(combinedErrors); return(File(csvData, "text/plain", string.Format("{0}-{1}-BookingChannels Error Summary.txt", CWTStringHelpers.AlphaNumericOnly(clientSubUnit.ClientTopUnit.ClientTopUnitName), CWTStringHelpers.AlphaNumericOnly(clientSubUnit.ClientSubUnitName)))); }
// GET: /List public ActionResult List(int?page, string id, string sortField, int?sortOrder) { //Set Access Rights ViewData["Access"] = ""; RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToClientSubUnit(id)) { ViewData["Access"] = "WriteAccess"; } ViewData["CurrentSortField"] = "Name"; ViewData["CurrentSortOrder"] = 0; ClientSubUnitTelephoniesVM clientSubUnitTelephoniesVM = new ClientSubUnitTelephoniesVM(); clientSubUnitTelephoniesVM.Telephonies = clientSubUnitTelephonyRepository.PageClientSubUnitTelephonies(page ?? 1, id, sortField, sortOrder); ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id); //Check clientSubUnit if (clientSubUnit == null) { ViewData["ActionMethod"] = "List"; return(View("RecordDoesNotExistError")); } clientSubUnitTelephoniesVM.ClientSubUnit = clientSubUnit; //return items return(View(clientSubUnitTelephoniesVM)); }
//Add Data From Linked Tables for Display public void EditForDisplay(ClientTelephony clientTelephony) { //Hierarchy if (clientTelephony.HierarchyType == "ClientTopUnit") { ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository(); ClientTopUnit clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientTelephony.HierarchyItem); if (clientTopUnit != null) { clientTelephony.HierarchyName = clientTopUnit.ClientTopUnitName; } } else if (clientTelephony.HierarchyType == "ClientSubUnit") { ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository(); ClientSubUnit clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientTelephony.HierarchyItem); if (clientSubUnit != null) { clientTelephony.HierarchyName = clientSubUnit.ClientSubUnitName; } } //MainNumberFlag clientTelephony.MainNumberFlagNullable = (clientTelephony.MainNumberFlag == true) ? true : false; }
public ActionResult Delete(string id, string csu) { //Check Exists ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem(); clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(id); if (clientDefinedReferenceItem == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } ClientDefinedReferenceItemVM clientDefinedReferenceItemVM = new ClientDefinedReferenceItemVM(); clientDefinedReferenceItemRepository.EditForDisplay(clientDefinedReferenceItem); clientDefinedReferenceItemVM.ClientDefinedReferenceItem = clientDefinedReferenceItem; //Check Exists CSU for VM ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); if (clientSubUnit != null) { clientSubUnitRepository.EditGroupForDisplay(clientSubUnit); clientDefinedReferenceItemVM.ClientSubUnit = clientSubUnit; ViewData["ClientTopUnitGuid"] = clientSubUnit.ClientTopUnitGuid; ViewData["ClientTopUnitName"] = clientSubUnit.ClientTopUnitName; ViewData["ClientSubUnitGuid"] = clientSubUnit.ClientSubUnitGuid; ViewData["ClientSubUnitName"] = clientSubUnit.ClientSubUnitName; } return(View(clientDefinedReferenceItemVM)); }
// GET: /ListSubMenu public ActionResult ListSubMenu(int id) { ClientDetail clientDetail = new ClientDetail(); clientDetail = clientDetailRepository.GetGroup(id); //Check Exists if (clientDetail == null) { ViewData["ActionMethod"] = "ListSubMenu"; return(View("RecordDoesNotExistError")); } ClientDetailClientSubUnit clientDetailClientSubUnit = new ClientDetailClientSubUnit(); clientDetailClientSubUnit = clientDetailClientSubUnitRepository.GetClientDetailClientSubUnit(id); //Check Exists if (clientDetailClientSubUnit == null) { ViewData["ActionMethod"] = "ListSubMenu"; return(View("RecordDoesNotExistError")); } ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientDetailClientSubUnit.ClientSubUnitGuid); ClientSubUnitClientDetailVM clientAccountClientDetailVM = new ClientSubUnitClientDetailVM(); clientAccountClientDetailVM.ClientSubUnit = clientSubUnit; clientAccountClientDetailVM.ClientDetail = clientDetail; return(View(clientAccountClientDetailVM)); }
public TravelerTypeClientDetailVM(TravelerType travelerType, ClientSubUnit clientSubUnit, ClientDetail clientDetail, IEnumerable <SelectListItem> tripTypes) { TravelerType = travelerType; ClientSubUnit = clientSubUnit; ClientDetail = clientDetail; TripTypes = tripTypes; }
public PNRNameStatementInformationVM( PNRNameStatementInformation _PNRNameStatementInformation, ClientSubUnit clientSubUnit) { PNRNameStatementInformation = _PNRNameStatementInformation; ClientSubUnit = clientSubUnit; }
public TravelerTypeAddressesVM(TravelerType travelerType, ClientSubUnit clientSubUnit, ClientDetail clientDetail, CWTPaginatedList <spDesktopDataAdmin_SelectClientDetailAddresses_v1Result> addresses) { TravelerType = travelerType; ClientSubUnit = clientSubUnit; ClientDetail = clientDetail; Addresses = addresses; }
//Shows SubUnit.ClientAccounts and their associated data public ActionResult ClientAccountsMatrix(string id, int?page, string filter) { ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id); if (clientSubUnit == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } ViewData["ClientSubUnitGuid"] = id; ViewData["ClientSubUnitName"] = clientSubUnit.ClientSubUnitName; ClientTopUnit clientTopUnit = new ClientTopUnit(); clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientSubUnit.ClientTopUnitGuid); ViewData["ClientTopUnitGuid"] = id; ViewData["ClientTopUnitName"] = clientTopUnit.ClientTopUnitName; if (page < 0) { page = 1; } ViewData["filter"] = filter; var items = clientSummaryRepository.GetClientSummaryClientAccountMatrix(id, page ?? 1); return(View(items)); }
public ClientSubUnitContactVM(ClientSubUnit clientSubUnit, ClientDetail clientDetail, Contact contact, IEnumerable <SelectListItem> contactTypes) { ClientSubUnit = clientSubUnit; ClientDetail = clientDetail; Contact = contact; ContactTypes = contactTypes; }
// GET: /Create public ActionResult Create(int id, string csu, string tt) { ClientDetailTravelerType clientDetailTravelerType = new ClientDetailTravelerType(); clientDetailTravelerType = clientDetailTravelerTypeRepository.GetClientDetailTravelerType(id); //Check Exists if (clientDetailTravelerType == null) { ViewData["ActionMethod"] = "ListSubMenu"; return(View("RecordDoesNotExistError")); } ClientSubUnitTravelerType clientSubUnitTravelerType = new ClientSubUnitTravelerType(); clientSubUnitTravelerType = clientSubUnitTravelerTypeRepository.GetClientSubUnitTravelerType(csu, tt); //Check Exists if (clientDetailTravelerType == null) { ViewData["ActionMethod"] = "ListSubMenu"; return(View("RecordDoesNotExistError")); } //Access Rights ViewData["Access"] = ""; RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToClientSubUnit(csu)) { ViewData["Access"] = "WriteAccess"; } TravelerTypeContactVM travelerTypeContactVM = new TravelerTypeContactVM(); ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); travelerTypeContactVM.ClientSubUnit = clientSubUnit; ClientDetail clientDetail = new ClientDetail(); clientDetail = clientDetailRepository.GetGroup(id); travelerTypeContactVM.ClientDetail = clientDetail; TravelerType travelerType = new TravelerType(); travelerType = travelerTypeRepository.GetTravelerType(tt); travelerTypeContactVM.TravelerType = travelerType; Contact contact = new Contact(); travelerTypeContactVM.Contact = contact; ContactTypeRepository contactTypeRepository = new ContactTypeRepository(); travelerTypeContactVM.ContactTypes = new SelectList(contactTypeRepository.GetAllContactTypes().ToList(), "ContactTypeId", "ContactTypeName", contact.ContactTypeId); return(View(travelerTypeContactVM)); }
// GET: /ViewItem/ public ActionResult ViewItem(string id, string csu) { TravelerType travelerType = new TravelerType(); travelerType = travelerTypeRepository.GetTravelerType(id); //Check Exists if (travelerType == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } travelerTypeRepository.EditForDisplay(travelerType); ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); travelerType.ClientSubUnit = clientSubUnit; ClientTopUnit clientTopUnit = clientSubUnit.ClientTopUnit; travelerType.ClientTopUnit = clientTopUnit; return(View(travelerType)); }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(ClientProfileGroup clientProfileGroup) { //Set Hierarchy if ClientTopUnit ClientProfileGroupClientTopUnit clientProfileGroupClientTopUnit = clientProfileGroup.ClientProfileGroupClientTopUnits.SingleOrDefault(); if (clientProfileGroupClientTopUnit != null) { ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository(); ClientTopUnit clientTopUnit = new ClientTopUnit(); clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientProfileGroupClientTopUnit.ClientTopUnitGuid); if (clientTopUnit != null) { clientProfileGroup.HierarchyItem = clientTopUnit.ClientTopUnitName; clientProfileGroup.HierarchyCode = clientTopUnit.ClientTopUnitGuid; clientProfileGroup.HierarchyType = "ClientTopUnit"; } } //Set Hierarchy if ClientSubUnit ClientProfileGroupClientSubUnit clientProfileGroupClientSubUnit = clientProfileGroup.ClientProfileGroupClientSubUnits.SingleOrDefault(); if (clientProfileGroupClientSubUnit != null) { ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository(); ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientProfileGroupClientSubUnit.ClientSubUnitGuid); if (clientSubUnit != null) { clientProfileGroup.HierarchyItem = clientSubUnit.ClientSubUnitName; clientProfileGroup.HierarchyCode = clientSubUnit.ClientSubUnitGuid; clientProfileGroup.HierarchyType = "ClientSubUnit"; } } }
public ActionResult Delete(int id, int pid, string sc, FormCollection collection) { ClientDetailSupplierProduct clientDetailSupplierProduct = new ClientDetailSupplierProduct(); clientDetailSupplierProduct = clientDetailSupplierProductRepository.GetClientDetailSupplierProduct(id, pid, sc); //Check Exists if (clientDetailSupplierProduct == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } ClientDetailClientSubUnit clientDetailClientSubUnit = new ClientDetailClientSubUnit(); clientDetailClientSubUnit = clientDetailClientSubUnitRepository.GetClientDetailClientSubUnit(id); //Check Exists if (clientDetailClientSubUnit == null) { ViewData["ActionMethod"] = "DeletePost"; return(View("RecordDoesNotExistError")); } string clientTopUnitGuid = clientDetailClientSubUnit.ClientSubUnitGuid; ClientSubUnit clientTopUnit = new ClientSubUnit(); clientTopUnit = clientTopUnitRepository.GetClientSubUnit(clientTopUnitGuid); //Access Rights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(clientTopUnitGuid)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Delete Item try { clientDetailSupplierProduct.VersionNumber = Int32.Parse(collection["SupplierProduct.VersionNumber"]); clientDetailSupplierProductRepository.Delete(clientDetailSupplierProduct); } catch (SqlException ex) { //Versioning Error - go to standard versionError page if (ex.Message == "SQLVersioningError") { ViewData["ReturnURL"] = "/ClientSubUnitSupplierProduct.mvc/Delete?id=" + id.ToString() + "&sc=" + sc + "&pid=" + pid; 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 = id })); }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(ClientSubUnit clientSubUnit) { //PortraitStatusRepository portraitStatusRepository = new PortraitStatusRepository(); //PortraitStatus portraitStatus = new PortraitStatus(); //portraitStatus = portraitStatusRepository.GetPortraitStatus(clientSubUnit.PortraitStatusId); //if (portraitStatus != null) //{ // clientSubUnit.PortraitStatus = portraitStatus.PortraitStatusDescription; //} CountryRepository countryRepository = new CountryRepository(); Country country = new Country(); country = countryRepository.GetCountry(clientSubUnit.CountryCode); if (country != null) { clientSubUnit.CountryName = country.CountryName; } ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository(); ClientTopUnit clientTopUnit = new ClientTopUnit(); clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientSubUnit.ClientTopUnitGuid); if (clientTopUnit != null) { clientSubUnit.ClientTopUnitName = clientTopUnit.ClientTopUnitName; } }
// GET: /Create public ActionResult Create(string id) { ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id); //Check Exists if (clientSubUnit == null) { ViewData["ActionMethod"] = "ListUnDeleted"; return(View("RecordDoesNotExistError")); } //Access Rights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(id)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientSubUnitClientDetailVM clientAccountClientDetailVM = new ClientSubUnitClientDetailVM(); TripTypeRepository tripTypeRepository = new TripTypeRepository(); clientAccountClientDetailVM.TripTypes = new SelectList(tripTypeRepository.GetAllTripTypes().ToList(), "TripTypeId", "TripTypeDescription"); clientAccountClientDetailVM.ClientSubUnit = clientSubUnit; return(View(clientAccountClientDetailVM)); }
public AdditionalBookingCommentVM( ClientSubUnit clientSubUnit, AdditionalBookingComment additionalBookingComment) { ClientSubUnit = clientSubUnit; AdditionalBookingComment = additionalBookingComment; }
// GET: /View public ActionResult View(int id) { //Get Item ClientDetail clientDetail = new ClientDetail(); clientDetail = clientDetailRepository.GetGroup(id); //Check Exists if (clientDetail == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } clientDetailRepository.EditGroupForDisplay(clientDetail); string csu = clientDetail.HierarchyCode; //Check Exists ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); if (clientSubUnit == null) { ViewData["ActionMethod"] = "ViewGet"; return(View("RecordDoesNotExistError")); } ClientSubUnitClientDetailVM clientSubUnitClientDetailVM = new ClientSubUnitClientDetailVM(); clientSubUnitClientDetailVM.ClientDetail = clientDetail; return(View(clientSubUnitClientDetailVM)); }
// GET: /Edit public ActionResult Edit(string id, string languageCode) { //Get Item ClientSubUnitCreateProfileAdvice clientSubUnitCreateProfileAdvice = new ClientSubUnitCreateProfileAdvice(); clientSubUnitCreateProfileAdvice = clientSubUnitCreateProfileAdviceRepository.GetItem(id, languageCode); //Check Exists if (clientSubUnitCreateProfileAdvice == null) { return(View("Error")); } //Get ClientSubUnit ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientSubUnitCreateProfileAdvice.ClientSubUnitGuid); //AccessRights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(clientSubUnit.ClientSubUnitGuid)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Language SelectList SelectList languageList = new SelectList(clientSubUnitCreateProfileAdviceRepository.GetUnUsedLanguages(id).ToList(), "LanguageCode", "LanguageName"); ViewData["Languages"] = languageList; clientSubUnitCreateProfileAdviceRepository.EditItemForDisplay(clientSubUnitCreateProfileAdvice); return(View(clientSubUnitCreateProfileAdvice)); }
public ClientSubUnitReasonCodesVM(ClientSubUnit clientSubUnit, bool inherited, List <spDDAWizard_SelectClientSubUnitReasonCodes_v1Result> clientSubUnitReasonCodes, bool policyGroupWriteAccess, bool reasonCodeGroupWriteAccess) { ClientSubUnit = clientSubUnit; Inherited = inherited; PolicyGroupWriteAccess = policyGroupWriteAccess; ReasonCodeGroupWriteAccess = reasonCodeGroupWriteAccess; }
public ActionResult Delete(string id, string languageCode) { //Get Item ClientSubUnitCreateProfileAdvice clientSubUnitCreateProfileAdvice = new ClientSubUnitCreateProfileAdvice(); clientSubUnitCreateProfileAdvice = clientSubUnitCreateProfileAdviceRepository.GetItem(id, languageCode); //Check Exists if (clientSubUnitCreateProfileAdvice == null) { return(View("Error")); } //Get ClientSubUnit ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientSubUnitCreateProfileAdvice.ClientSubUnitGuid); //AccessRights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(clientSubUnit.ClientSubUnitGuid)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Add Linked Information clientSubUnitCreateProfileAdviceRepository.EditItemForDisplay(clientSubUnitCreateProfileAdvice); //Return View return(View(clientSubUnitCreateProfileAdvice)); }
public ClientSubUnitTravelerTypeSubProductFormOfPaymentTypesVM(ClientSubUnit clientSubUnit, TravelerType travelerType, ClientDetail clientDetail, CWTPaginatedList <spDesktopDataAdmin_SelectClientDetailSubProductFormOfPaymentTypes_v1Result> subProductFormOfPaymentTypes) { ClientSubUnit = clientSubUnit; TravelerType = travelerType; ClientDetail = clientDetail; SubProductFormOfPaymentTypes = subProductFormOfPaymentTypes; }
public TravelerTypeVM(TravelerType travelerType, TravelerTypeSponsor travelerTypeSponsor, ClientTopUnit clientTopUnit, ClientSubUnit clientSubUnit) { TravelerType = travelerType; TravelerTypeSponsor = travelerTypeSponsor; ClientSubUnit = clientSubUnit; ClientTopUnit = clientTopUnit; }
// GET: /Export public ActionResult Export(string id) { //Get ClientSubUnit ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id); //Check Exists if (clientSubUnit == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } //Access Rights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(id) || !hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } string filename = string.Format("{0}-{1}-BookingChannels Export.csv", CWTStringHelpers.AlphaNumericOnly(clientSubUnit.ClientTopUnit.ClientTopUnitName), CWTStringHelpers.AlphaNumericOnly(clientSubUnit.ClientSubUnitName)); //Get CSV Data byte[] csvData = bookingChannelRepository.Export(id); return(File(csvData, "text/csv", filename)); }
public ActionResult Create(int id, string csu, string relatedToDisplayName) { //AccessRights RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToClientSubUnit(csu)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientSubUnitCDRItemVM clientSubUnitCDRItemVM = new ClientSubUnitCDRItemVM(); //ClientSubUnit ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu); if (clientSubUnit == null) { ViewData["ActionMethod"] = "List"; return(View("RecordDoesNotExistError")); } clientSubUnitCDRItemVM.ClientSubUnit = clientSubUnit; ClientSubUnitClientDefinedReferenceItem clientSubUnitClientDefinedReferenceItem = new ClientSubUnitClientDefinedReferenceItem(); clientSubUnitClientDefinedReferenceItem.ClientSubUnitClientDefinedReferenceId = id; clientSubUnitCDRItemVM.ClientSubUnitClientDefinedReferenceItem = clientSubUnitClientDefinedReferenceItem; return(View(clientSubUnitCDRItemVM)); }
public TravelerTypeContactsVM(ClientSubUnit clientSubUnit, TravelerType travelerType, ClientDetail clientDetail, CWTPaginatedList <spDesktopDataAdmin_SelectClientDetailContacts_v1Result> contacts) { ClientSubUnit = clientSubUnit; TravelerType = travelerType; ClientDetail = clientDetail; Contacts = contacts; }
// GET: /ListByClientSubUnit/ public ActionResult ListByClientSubUnit(string id, int?page) { ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id); //Check Exists if (clientSubUnit == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } //Access Rights ViewData["Access"] = ""; RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToClientSubUnit(id)) { ViewData["Access"] = "WriteAccess"; } ClientSubUnitTravelerTypesVM clientSubUnitTravelerTypesVM = new ClientSubUnitTravelerTypesVM(); clientSubUnitTravelerTypesVM.ClientSubUnit = clientSubUnit; var items = clientSubUnitTravelerTypeRepository.GetClientSubUnitTravelerTypes(clientSubUnit.ClientSubUnitGuid, page ?? 1); clientSubUnitTravelerTypesVM.TravelerTypes = items; return(View(clientSubUnitTravelerTypesVM)); }
public ClientSubUnitTravelerTypeSupplierProductsVM(ClientSubUnit clientSubUnit, TravelerType travelerType, ClientDetail clientDetail, CWTPaginatedList <spDesktopDataAdmin_SelectClientDetailSupplierProducts_v1Result> supplierProducts) { ClientSubUnit = clientSubUnit; TravelerType = travelerType; ClientDetail = clientDetail; SupplierProducts = supplierProducts; }
public ActionResult Create(ContactVM contactVM) { string id = contactVM.ClientSubUnit.ClientSubUnitGuid; ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id); //Check Exists if (clientSubUnit == null) { ViewData["ActionMethod"] = "List"; return(View("RecordDoesNotExistError")); } clientSubUnitRepository.EditGroupForDisplay(clientSubUnit); //Access Rights ViewData["Access"] = ""; RolesRepository rolesRepository = new RolesRepository(); if (rolesRepository.HasWriteAccessToClientSubUnit(id)) { ViewData["Access"] = "WriteAccess"; } //Update Model from Form try { TryUpdateModel <Contact>(contactVM.Contact, "Contact"); } 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")); } try { clientSubUnitContactRepository.Add(contactVM); } 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", new { id = id })); }