// GET: /Edit public ActionResult Edit(string id, string languageCode) { //Get Item CityLanguage cityLanguage = new CityLanguage(); cityLanguage = cityLanguageRepository.GetItem(id, languageCode); //Check Exists if (cityLanguage == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //AccessRights HierarchyRepository hierarchyRepository = new HierarchyRepository(); if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Parent data ViewData["CityCode"] = id; ViewData["CityName"] = cityLanguage.City.Name; //Language SelectList SelectList languageList = new SelectList(cityLanguageRepository.GetUnUsedLanguages(id).ToList(), "LanguageCode", "LanguageName"); ViewData["Languages"] = languageList; cityLanguageRepository.EditItemForDisplay(cityLanguage); return(View(cityLanguage)); }
// GET: /Edit public ActionResult Edit(string id, int travelPortTypeId, string languageCode) { //Get Item TravelPortLanguage travelPortLanguage = new TravelPortLanguage(); travelPortLanguage = travelPortLanguageRepository.GetTravelPortLanguage(id, travelPortTypeId, languageCode); //Check Exists if (travelPortLanguage == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } //AccessRights HierarchyRepository hierarchyRepository = new HierarchyRepository(); if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Return View travelPortLanguageRepository.EditForDisplay(travelPortLanguage); return(View(travelPortLanguage)); }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(OptionalFieldGroup group) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); List <fnDesktopDataAdmin_SelectOptionalFieldGroupHierarchy_v1Result> hierarchy = new List <fnDesktopDataAdmin_SelectOptionalFieldGroupHierarchy_v1Result>(); hierarchy = GetGroupHierarchy(group.OptionalFieldGroupId); group.OptionalFieldGroupName = Regex.Replace(group.OptionalFieldGroupName, @"[^\w\-()*]", "-"); if (hierarchy.Count > 0) { if (hierarchy.Count == 1) { group.HierarchyCode = hierarchy[0].HierarchyCode; group.HierarchyItem = hierarchy[0].HierarchyName.Trim(); group.HierarchyType = hierarchy[0].HierarchyType; } else { group.HierarchyCode = "Multiple"; //Placeholder group.HierarchyItem = "Multiple"; //Placeholder group.HierarchyType = "Multiple"; } } group.IsMultipleHierarchy = (hierarchy.Count > 1); }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(ClientDetail group) { TripTypeRepository tripTypeRepository = new TripTypeRepository(); TripType tripType = new TripType(); tripType = tripTypeRepository.GetTripType(group.TripTypeId); if (tripType != null) { group.TripType = tripType.TripTypeDescription; } HierarchyRepository hierarchyRepository = new HierarchyRepository(); fnDesktopDataAdmin_SelectClientDetailHierarchy_v1Result hierarchy = new fnDesktopDataAdmin_SelectClientDetailHierarchy_v1Result(); hierarchy = GetGroupHierarchy(group.ClientDetailId); group.HierarchyType = hierarchy.HierarchyType; group.HierarchyCode = hierarchy.HierarchyCode.ToString(); group.HierarchyItem = hierarchy.HierarchyName.Trim(); group.SourceSystemCode = hierarchy.SourceSystemCode; group.ClientDetailName = Regex.Replace(group.ClientDetailName, @"[^\w\s\-()*]", "-"); if (hierarchy.HierarchyType == "ClientSubUnitTravelerType") { group.ClientSubUnitGuid = hierarchy.HierarchyCode.ToString(); group.ClientSubUnitName = hierarchy.HierarchyName.Trim(); group.TravelerTypeGuid = hierarchy.TravelerTypeGuid; group.TravelerTypeName = hierarchy.TravelerTypeName.Trim(); } }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(LocalOperatingHoursGroup group) { group.LocalOperatingHoursGroupName = Regex.Replace(group.LocalOperatingHoursGroupName, @"[^\w\-()*]", "-"); fnDesktopDataAdmin_SelectLocalOperatingHoursGroupHierarchy_v1Result hierarchy = GetGroupHierarchy(group.LocalOperatingHoursGroupId); if (hierarchy != null) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); HierarchyGroup hierarchyGroup = hierarchyRepository.GetHierarchyGroup( hierarchy.HierarchyType ?? "", hierarchy.HierarchyCode ?? "", hierarchy.HierarchyName ?? "", hierarchy.TravelerTypeGuid ?? "", hierarchy.TravelerTypeName ?? "", hierarchy.SourceSystemCode ?? "" ); if (hierarchyGroup != null) { group.HierarchyType = hierarchyGroup.HierarchyType; group.HierarchyCode = hierarchyGroup.HierarchyCode; group.HierarchyItem = hierarchyGroup.HierarchyItem; group.ClientSubUnitGuid = hierarchyGroup.ClientSubUnitGuid; group.ClientSubUnitName = hierarchyGroup.ClientSubUnitName; group.TravelerTypeGuid = hierarchyGroup.TravelerTypeGuid; group.TravelerTypeName = hierarchyGroup.TravelerTypeName; group.ClientTopUnitName = hierarchyGroup.ClientTopUnitName; group.SourceSystemCode = hierarchyGroup.SourceSystemCode; } } }
//USed for AUthentication?? /*public List<SystemUserRole> GetSystemUserRoles(string username) * { * return (from u in db.spAdmin_SelectSystemUserRoles(username)orderby u.RoleName * select * new SystemUserRole * { * RoleName = u.RoleName.Trim(), * HierarchyLevelTypeDescription = u.HierarchyLevelTypeDescription.ToString() * }).ToList(); * } */ //Used for Authentication?? //Commented out v3.2.3 //public static bool ValidateUser(string username) //{ // var systemUserRepository = new SystemUserRepository(); // SystemUser systemUser = systemUserRepository.GetUserByUsername(username); // if (systemUser == null) // { // return false; // } // var authTicket = new FormsAuthenticationTicket(1, username, DateTime.Now, // DateTime.Now.AddMinutes(30), true, ""); // string cookieContents = FormsAuthentication.Encrypt(authTicket); // var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, cookieContents) // { // Expires = authTicket.Expiration, // Path = FormsAuthentication.FormsCookiePath, // Secure = Helpers.Security.IsHttps() // }; // if (HttpContext.Current != null) // { // HttpContext.Current.Response.Cookies.Add(cookie); // } // return true; //} //Add Data From Linked Tables for Display public void EditForDisplay(SystemUser systemUser) { //Add LanguageName if (systemUser.LanguageCode != null) { LanguageRepository languageRepository = new LanguageRepository(); Language language = new Language(); language = languageRepository.GetLanguage(systemUser.LanguageCode); if (language != null) { systemUser.LanguageName = language.LanguageName; } } SystemUserLocationRepository systemUserLocationRepository = new SystemUserLocationRepository(); SystemUserLocation systemUserLocation = new SystemUserLocation(); systemUserLocation = systemUserLocationRepository.GetSystemUserLocation(systemUser.SystemUserGuid); if (systemUserLocation != null) { systemUser.LocationId = systemUserLocation.LocationId; HierarchyRepository hierarchyRepository = new HierarchyRepository(); Location location = new Location(); location = hierarchyRepository.GetLocation(systemUser.LocationId); if (location != null) { systemUser.LocationName = location.LocationName; } } }
// GET: /Edit public ActionResult Edit(int id) { //Get Item From Database FormOfPaymentAdviceMessageGroup group = new FormOfPaymentAdviceMessageGroup(); group = formOfPaymentAdviceMessageGroupRepository.GetGroup(id); //Check Exists if (group == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Check Access HierarchyRepository hierarchyRepository = new HierarchyRepository(); if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository(); SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchies(groupName).ToList(), "HierarchyLevelTableName", "HierarchyLevelTableName"); ViewData["HierarchyTypes"] = hierarchyTypesList; formOfPaymentAdviceMessageGroupRepository.EditGroupForDisplay(group); return(View(group)); }
public City EditItemForDisplay(City city) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); Country country = new Country(); country = hierarchyRepository.GetCountry(city.CountryCode); if (country != null) { city.CountryName = country.CountryName; } city.LatitudeDecimal = Convert.ToDecimal(city.Latitude); city.LongitudeDecimal = Convert.ToDecimal(city.Longitude); TimeZoneRuleRepository timeZoneRuleRepository = new TimeZoneRuleRepository(); TimeZoneRule timeZoneRule = timeZoneRuleRepository.GetTimeZoneRule(city.TimeZoneRuleCode); if (timeZoneRule != null) { city.TimeZoneRule = timeZoneRule; } return(city); }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(TeamOutOfOfficeGroup group) { //group.TeamOutOfOfficeGroupName = Regex.Replace(group.TeamOutOfOfficeGroupName, @"[^\w\-()*]", "-"); List <fnDesktopDataAdmin_SelectTeamOutOfOfficeGroupHierarchy_v1Result> hierarchy = new List <fnDesktopDataAdmin_SelectTeamOutOfOfficeGroupHierarchy_v1Result>(); hierarchy = GetGroupHierarchy(group.TeamOutOfOfficeGroupId); if (hierarchy.Count > 0) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); HierarchyGroup hierarchyGroup = hierarchyRepository.GetHierarchyGroup( hierarchy[0].HierarchyType ?? "", hierarchy[0].HierarchyCode ?? "", hierarchy[0].HierarchyName ?? "", hierarchy[0].TravelerTypeGuid ?? "", hierarchy[0].TravelerTypeName ?? "", hierarchy[0].SourceSystemCode ?? "" ); if (hierarchyGroup != null) { group.HierarchyType = hierarchyGroup.HierarchyType; group.HierarchyCode = hierarchyGroup.HierarchyCode; group.HierarchyItem = hierarchyGroup.HierarchyItem; group.ClientTopUnitName = hierarchyGroup.ClientTopUnitName; } } }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(GDSAdditionalEntry group) { TripTypeRepository tripTypeRepository = new TripTypeRepository(); TripType tripType = new TripType(); tripType = tripTypeRepository.GetTripType(group.TripTypeId); if (tripType != null) { group.TripType = tripType.TripTypeDescription; } GDSRepository gDSRepository = new GDSRepository(); GDS gds = new GDS(); gds = gDSRepository.GetGDS(group.GDSCode); if (gds != null) { group.GDSName = gds.GDSName; } SubProductRepository subProductRepository = new SubProductRepository(); SubProduct subProduct = new SubProduct(); subProduct = subProductRepository.GetSubProduct(group.SubProductId); if (subProduct != null) { group.SubProductName = subProduct.SubProductName; Product product = new Product(); product = subProductRepository.GetSubProductProduct(group.SubProductId); group.ProductId = product.ProductId; group.ProductName = product.ProductName; } HierarchyRepository hierarchyRepository = new HierarchyRepository(); fnDesktopDataAdmin_SelectGDSAdditionalEntryHierarchy_v1Result hierarchy = new fnDesktopDataAdmin_SelectGDSAdditionalEntryHierarchy_v1Result(); hierarchy = GetGroupHierarchy(group.GDSAdditionalEntryId); group.GDSAdditionalEntryValue = Regex.Replace(group.GDSAdditionalEntryValue, @"[^\w\-()*]", "-"); if (hierarchy != null) { group.HierarchyType = hierarchy.HierarchyType; group.HierarchyCode = hierarchy.HierarchyCode.ToString(); group.HierarchyItem = hierarchy.HierarchyName.Trim(); if (hierarchy.HierarchyType == "ClientSubUnitTravelerType") { group.ClientSubUnitGuid = hierarchy.HierarchyCode.ToString(); group.ClientSubUnitName = hierarchy.HierarchyName.Trim(); group.TravelerTypeGuid = hierarchy.TravelerTypeGuid; group.TravelerTypeName = hierarchy.TravelerTypeName.Trim(); } } }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(PriceTrackingHandlingFeeGroup group) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); List <fnDesktopDataAdmin_SelectPriceTrackingHandlingFeeGroupHierarchy_v1Result> hierarchy = new List <fnDesktopDataAdmin_SelectPriceTrackingHandlingFeeGroupHierarchy_v1Result>(); hierarchy = GetGroupHierarchy(group.PriceTrackingHandlingFeeGroupId); group.PriceTrackingHandlingFeeGroupName = Regex.Replace(group.PriceTrackingHandlingFeeGroupName, @"[^\w\-()*]", "-"); if (hierarchy.Count > 0) { group.HierarchyType = hierarchy[0].HierarchyType; group.HierarchyCode = hierarchy[0].HierarchyCode.ToString(); group.HierarchyItem = hierarchy[0].HierarchyName.Trim(); if (hierarchy[0].HierarchyType == "ClientSubUnitTravelerType") { group.ClientSubUnitGuid = hierarchy[0].HierarchyCode.ToString(); group.ClientSubUnitName = hierarchy[0].HierarchyName.Trim(); group.TravelerTypeGuid = hierarchy[0].TravelerTypeGuid; group.TravelerTypeName = hierarchy[0].TravelerTypeName.Trim(); if (!string.IsNullOrEmpty(group.ClientSubUnitGuid)) { ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository(); ClientSubUnit clientSubUnit = clientSubUnitRepository.GetClientSubUnit(group.ClientSubUnitGuid); if (clientSubUnit != null && clientSubUnit.ClientTopUnit != null) { group.ClientTopUnitName = clientSubUnit.ClientTopUnit.ClientTopUnitName; } } } if (hierarchy[0].HierarchyType == "ClientSubUnit" || hierarchy[0].HierarchyType == "TravelerType") { if (hierarchy[0].ClientTopUnitName != null) { group.ClientTopUnitName = hierarchy[0].ClientTopUnitName.Trim(); } } if (hierarchy[0].HierarchyType == "ClientAccount") { group.SourceSystemCode = hierarchy[0].SourceSystemCode; } } if (hierarchy.Count > 1) { group.IsMultipleHierarchy = true; group.HierarchyType = "Multiple"; group.HierarchyItem = "Multiple"; group.HierarchyCode = "Multiple"; } else { group.IsMultipleHierarchy = false; } }
public JsonResult AutoCompleteCountries(string searchText) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); int maxResults = 15; var result = hierarchyRepository.LookUpCountries(searchText, maxResults); return(Json(result)); }
public async Task <IActionResult> CreateHierarchyMulti(int number, string prefix) { System.Console.WriteLine("Adding number of accounts: " + number); var dataSeeder = new HierarchyRepository(_dbContext); await dataSeeder.SeedMultiple(number, prefix); System.Console.WriteLine("Done."); return(RedirectToAction("Index")); }
public JsonResult AutoCompleteHierarchies(string searchText, string hierarchyItem) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); int maxResults = 15; var result = hierarchyRepository.LookUpSystemUserHierarchies(searchText, hierarchyItem, maxResults, groupName, true); return(Json(result)); }
public ActionResult Delete(int id, string languageCode) { //Get Item ChatFAQResponseItemLanguage chatFAQResponseItemLanguage = new ChatFAQResponseItemLanguage(); chatFAQResponseItemLanguage = chatFAQResponseItemLanguageRepository.GetItem(id, languageCode); //Check Exists if (chatFAQResponseItemLanguage == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } //AccessRights HierarchyRepository hierarchyRepository = new HierarchyRepository(); if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Get ChatFAQResponseItem ChatFAQResponseItem chatFAQResponseItem = new ChatFAQResponseItem(); chatFAQResponseItem = chatFAQResponseItemRepository.GetItem(chatFAQResponseItemLanguage.ChatFAQResponseItemId); //Check Exists if (chatFAQResponseItem == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } //ChatFAQResponseItem chatFAQResponseItemRepository.EditItemForDisplay(chatFAQResponseItem); //ChatFAQResponseItemLanguage chatFAQResponseItemLanguage.ChatFAQResponseItemId = id; chatFAQResponseItemLanguage.ChatFAQResponseItem = chatFAQResponseItem; chatFAQResponseItemLanguageRepository.EditItemForDisplay(chatFAQResponseItemLanguage); //Language SelectList SelectList languageList = new SelectList(chatFAQResponseItemLanguageRepository.GetUnUsedLanguages(id).ToList(), "LanguageCode", "LanguageName"); ViewData["Languages"] = languageList; //View data ViewData["ChatFAQResponseItemId"] = id; ViewData["ChatFAQResponseItemDescription"] = chatFAQResponseItem.ChatFAQResponseItemDescription; ViewData["ChatFAQResponseGroupId"] = chatFAQResponseItem.ChatFAQResponseGroup.ChatFAQResponseGroupId; ViewData["ChatFAQResponseGroupName"] = chatFAQResponseItem.ChatFAQResponseGroup.ChatFAQResponseGroupName; ViewData["ChatMessageFAQName"] = chatFAQResponseItem.ChatMessageFAQName; return(View(chatFAQResponseItemLanguage)); }
//GET:List public ActionResult List(int id, int?page, string sortField, int?sortOrder) { //Get ChatFAQResponseItem ChatFAQResponseItem chatFAQResponseItem = new ChatFAQResponseItem(); chatFAQResponseItem = chatFAQResponseItemRepository.GetItem(id); //Check Exists if (chatFAQResponseItem == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } //Set Access Rights HierarchyRepository hierarchyRepository = new HierarchyRepository(); ViewData["Access"] = ""; if (hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Access"] = "WriteAccess"; } //SortField+SortOrder settings if (string.IsNullOrEmpty(sortField)) { sortField = "LanguageName"; } ViewData["CurrentSortField"] = sortField; if (sortOrder == 1) { ViewData["NewSortOrder"] = 0; ViewData["CurrentSortOrder"] = 1; } else { ViewData["NewSortOrder"] = 1; ViewData["CurrentSortOrder"] = 0; sortOrder = 0; } //ChatFAQResponseItem chatFAQResponseItemRepository.EditItemForDisplay(chatFAQResponseItem); //View data ViewData["ChatFAQResponseItemId"] = id; ViewData["ChatFAQResponseItemDescription"] = chatFAQResponseItem.ChatFAQResponseItemDescription; ViewData["ChatFAQResponseGroupId"] = chatFAQResponseItem.ChatFAQResponseGroup.ChatFAQResponseGroupId; ViewData["ChatFAQResponseGroupName"] = chatFAQResponseItem.ChatFAQResponseGroup.ChatFAQResponseGroupName; ViewData["ChatMessageFAQName"] = chatFAQResponseItem.ChatMessageFAQName; //Get data var cwtPaginatedList = chatFAQResponseItemLanguageRepository.PageChatFAQResponseItemLanguages(id, page ?? 1, sortField, sortOrder ?? 0); return(View(cwtPaginatedList)); }
public JsonResult AutoCompleteClientTopUnitTravelerTypes(string searchText, string clientTopUnitGuid) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); int maxResults = 15; var result = hierarchyRepository.LookUpSystemUserClientTopUnitTravelerTypes(searchText, maxResults, clientTopUnitGuid, groupName); return(Json(result)); }
public JsonResult AutoCompleteClientSubUnitTravelerTypes(string searchText, string hierarchyItem, string filterText) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); int maxResults = 15; var result = hierarchyRepository.LookUpSystemUserClientSubUnitTravelerTypes(searchText, hierarchyItem, maxResults, groupName, filterText); return(Json(result)); }
//GET:List public ActionResult List(int id, int?page, string sortField, int?sortOrder) { //Get FormOfPaymentAdviceMessageGroupItem FormOfPaymentAdviceMessageGroupItem formOfPaymentAdviceMessageItem = new FormOfPaymentAdviceMessageGroupItem(); formOfPaymentAdviceMessageItem = formOfPaymentAdviceMessageItemRepository.GetItem(id); //Check Exists if (formOfPaymentAdviceMessageItem == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } //Set Access Rights HierarchyRepository hierarchyRepository = new HierarchyRepository(); ViewData["Access"] = ""; if (hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Access"] = "WriteAccess"; } //SortField+SortOrder settings if (string.IsNullOrEmpty(sortField)) { sortField = "LanguageName"; } ViewData["CurrentSortField"] = sortField; if (sortOrder == 1) { ViewData["NewSortOrder"] = 0; ViewData["CurrentSortOrder"] = 1; } else { ViewData["NewSortOrder"] = 1; ViewData["CurrentSortOrder"] = 0; sortOrder = 0; } //FormOfPaymentAdviceMessageGroupItem formOfPaymentAdviceMessageItemRepository.EditItemForDisplay(formOfPaymentAdviceMessageItem); //View data ViewData["FormOfPaymentAdviceMessageGroupItemId"] = id; ViewData["FormOfPaymentAdviceMessage"] = formOfPaymentAdviceMessageItem.FormOfPaymentAdviceMessage; ViewData["FormOfPaymentAdviceMessageGroupID"] = formOfPaymentAdviceMessageItem.FormOfPaymentAdviceMessageGroup.FormOfPaymentAdviceMessageGroupID; ViewData["FormOfPaymentAdviceMessageGroupName"] = formOfPaymentAdviceMessageItem.FormOfPaymentAdviceMessageGroup.FormOfPaymentAdviceMessageGroupName; //Get data var cwtPaginatedList = formOfPaymentAdviceMessageGroupItemTranslationRepository.PageFormOfPaymentAdviceMessageGroupItemTranslations(id, page ?? 1, sortField, sortOrder ?? 0); return(View(cwtPaginatedList)); }
public ActionResult Delete(int id, string languageCode) { //Get Item FormOfPaymentAdviceMessageGroupItemTranslation formOfPaymentAdviceMessageGroupItemTranslation = new FormOfPaymentAdviceMessageGroupItemTranslation(); formOfPaymentAdviceMessageGroupItemTranslation = formOfPaymentAdviceMessageGroupItemTranslationRepository.GetItem(id, languageCode); //Check Exists if (formOfPaymentAdviceMessageGroupItemTranslation == null) { ViewData["ActionMethod"] = "DeleteGet"; return(View("RecordDoesNotExistError")); } //AccessRights HierarchyRepository hierarchyRepository = new HierarchyRepository(); if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } //Get FormOfPaymentAdviceMessageGroupItem FormOfPaymentAdviceMessageGroupItem formOfPaymentAdviceMessageItem = new FormOfPaymentAdviceMessageGroupItem(); formOfPaymentAdviceMessageItem = formOfPaymentAdviceMessageItemRepository.GetItem(formOfPaymentAdviceMessageGroupItemTranslation.FormOfPaymentAdviceMessageGroupItemId); //Check Exists if (formOfPaymentAdviceMessageItem == null) { ViewData["ActionMethod"] = "ListGet"; return(View("RecordDoesNotExistError")); } //FormOfPaymentAdviceMessageGroupItem formOfPaymentAdviceMessageItemRepository.EditItemForDisplay(formOfPaymentAdviceMessageItem); //FormOfPaymentAdviceMessageGroupItemTranslation formOfPaymentAdviceMessageGroupItemTranslation.FormOfPaymentAdviceMessageGroupItemId = id; formOfPaymentAdviceMessageGroupItemTranslation.FormOfPaymentAdviceMessageGroupItem = formOfPaymentAdviceMessageItem; formOfPaymentAdviceMessageGroupItemTranslationRepository.EditItemForDisplay(formOfPaymentAdviceMessageGroupItemTranslation); //Language SelectList SelectList languageList = new SelectList(formOfPaymentAdviceMessageGroupItemTranslationRepository.GetUnUsedLanguages(id).ToList(), "LanguageCode", "LanguageName"); ViewData["Languages"] = languageList; //View data ViewData["FormOfPaymentAdviceMessageGroupItemId"] = id; ViewData["FormOfPaymentAdviceMessage"] = formOfPaymentAdviceMessageItem.FormOfPaymentAdviceMessage; ViewData["FormOfPaymentAdviceMessageGroupID"] = formOfPaymentAdviceMessageItem.FormOfPaymentAdviceMessageGroup.FormOfPaymentAdviceMessageGroupID; ViewData["FormOfPaymentAdviceMessageGroupName"] = formOfPaymentAdviceMessageItem.FormOfPaymentAdviceMessageGroup.FormOfPaymentAdviceMessageGroupName; return(View(formOfPaymentAdviceMessageGroupItemTranslation)); }
public JsonResult AutoCompleteClientSubUnits(string searchText) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); string roleName = "Client Detail"; int maxResults = 15; var result = hierarchyRepository.LookUpSystemUserClientSubUnits(searchText, maxResults, roleName); return(Json(result)); }
public JsonResult AutoCompleteClientTopUnitClientSubUnits(string searchText, string clientTopUnitGuid) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); string roleName = "GDS Third Party Administrator"; int maxResults = 1000; var result = hierarchyRepository.LookUpSystemUserClientTopUnitClientSubUnits(searchText, maxResults, clientTopUnitGuid, roleName); return(Json(result)); }
public void Throw_If_Requested_Parser_Is_Not_Found() { // arrange var repo = new HierarchyRepository(); Action mightThrow = () => repo.GetChildren("doesntexist"); // act // assert mightThrow.Should().Throw <KeyNotFoundException>(); }
public JsonResult Hierarchies(string searchText, string hierarchyItem, string domainName, int resultCount = 15) { if (hierarchyItem == "ClientAccount") { return(Json(autoCompleteRepository.AutoCompleteClientAccounts(searchText, domainName))); } HierarchyRepository hierarchyRepository = new HierarchyRepository(); return(Json(hierarchyRepository.LookUpSystemUserHierarchies(searchText, hierarchyItem, resultCount, domainName, true))); }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(CommissionableRouteGroup group) { TripTypeRepository tripTypeRepository = new TripTypeRepository(); TripType tripType = new TripType(); tripType = tripTypeRepository.GetTripType(group.TripTypeId); if (tripType != null) { group.TripType = tripType; } group.CommissionableRouteGroupName = Regex.Replace(group.CommissionableRouteGroupName, @"[^\w\-()*]", "-"); List <fnDesktopDataAdmin_SelectCommissionableRouteGroupHierarchy_v1Result> hierarchy = new List <fnDesktopDataAdmin_SelectCommissionableRouteGroupHierarchy_v1Result>(); hierarchy = GetGroupHierarchy(group.CommissionableRouteGroupId); if (hierarchy.Count > 0) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); HierarchyGroup hierarchyGroup = hierarchyRepository.GetHierarchyGroup( hierarchy[0].HierarchyType ?? "", hierarchy[0].HierarchyCode ?? "", hierarchy[0].HierarchyName ?? "", hierarchy[0].TravelerTypeGuid ?? "", hierarchy[0].TravelerTypeName ?? "", hierarchy[0].SourceSystemCode ?? "" ); if (hierarchyGroup != null) { group.HierarchyType = hierarchyGroup.HierarchyType; group.HierarchyCode = hierarchyGroup.HierarchyCode; group.HierarchyItem = hierarchyGroup.HierarchyItem; group.ClientSubUnitGuid = hierarchyGroup.ClientSubUnitGuid; group.ClientSubUnitName = hierarchyGroup.ClientSubUnitName; group.TravelerTypeGuid = hierarchyGroup.TravelerTypeGuid; group.TravelerTypeName = hierarchyGroup.TravelerTypeName; group.ClientTopUnitName = hierarchyGroup.ClientTopUnitName; group.SourceSystemCode = hierarchyGroup.SourceSystemCode; } } if (hierarchy.Count > 1) { group.IsMultipleHierarchy = true; group.HierarchyType = "Multiple"; group.HierarchyItem = "Multiple"; group.HierarchyCode = "Multiple"; } else { group.IsMultipleHierarchy = false; } }
public JsonResult AvailableHierarchies(string searchText, string hierarchyItem, string domainName, int resultCount = 15) { //only used for Productgroups which has no ClientAccount Hierarchies //if (hierarchyItem == "ClientAccount") //{ // return Json(autoCompleteRepository.AutoCompleteClientAccounts(searchText, domainName)); //} HierarchyRepository hierarchyRepository = new HierarchyRepository(); return(Json(hierarchyRepository.LookUpSystemUserHierarchies(searchText, hierarchyItem, resultCount, domainName, false))); }
public void Only_Create_A_Parser_Once() { // arrange var repo = new HierarchyRepository(); // act repo.AddParser("base"); repo.AddParser("base"); // assert repo.Nodes.Should().HaveCount(1); }
//Get single item public PolicyLocation GetPolicyLocation(int policyLocationId) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); CountryRepository countryRepository = new CountryRepository(); CityRepository cityRepository = new CityRepository(); PolicyLocation policyLocation = new PolicyLocation(); policyLocation = db.PolicyLocations.SingleOrDefault(c => c.PolicyLocationId == policyLocationId); if (policyLocation != null) { if (policyLocation.GlobalFlag) { policyLocation.LocationType = "Global"; } else if (policyLocation.CityCode != null) { policyLocation.LocationType = "City"; City city = cityRepository.GetCity(policyLocation.CityCode); Country country = countryRepository.GetCountry(city.CountryCode); policyLocation.ParentName = country.CountryName; } else if (policyLocation.CountryCode != null) { policyLocation.LocationType = "Country"; Country country = countryRepository.GetCountry(policyLocation.CountryCode); GlobalSubRegion globalSubRegion = hierarchyRepository.GetGlobalSubRegion(country.GlobalSubRegionCode); policyLocation.ParentName = globalSubRegion.GlobalSubRegionName; } else if (policyLocation.GlobalSubRegionCode != null) { policyLocation.ParentName = "GlobalSubRegion"; GlobalSubRegion globalSubRegion = hierarchyRepository.GetGlobalSubRegion(policyLocation.GlobalSubRegionCode); GlobalRegion globalRegion = hierarchyRepository.GetGlobalRegion(globalSubRegion.GlobalRegionCode); policyLocation.ParentName = globalRegion.GlobalRegionName; } else if (policyLocation.GlobalRegionCode != null) { policyLocation.LocationType = "GlobalRegion"; GlobalRegion globalRegion = hierarchyRepository.GetGlobalRegion(policyLocation.GlobalRegionCode); policyLocation.ParentName = globalRegion.Global.GlobalName; } } return(policyLocation); }
//Add Data From Linked Tables for Display public void EditGroupForDisplay(ExternalSystemParameter group) { TripTypeRepository tripTypeRepository = new TripTypeRepository(); TripType tripType = new TripType(); tripType = tripTypeRepository.GetTripType(group.TripTypeId); if (tripType != null) { group.TripType = tripType.TripTypeDescription; } ExternalSystemParameterTypeRepository externalSystemParameterTypeRepository = new ExternalSystemParameterTypeRepository(); ExternalSystemParameterType externalSystemParameterType = new ExternalSystemParameterType(); externalSystemParameterType = externalSystemParameterTypeRepository.GetExternalSystemParameterType(group.ExternalSystemParameterTypeId); if (externalSystemParameterType != null) { group.ExternalSystemParameterType = externalSystemParameterType.ExternalSystemParameterTypeName; } fnDesktopDataAdmin_SelectExternalSystemParameterHierarchy_v1Result hierarchy = new fnDesktopDataAdmin_SelectExternalSystemParameterHierarchy_v1Result(); hierarchy = GetGroupHierarchy(group.ExternalSystemParameterId); if (hierarchy != null) { HierarchyRepository hierarchyRepository = new HierarchyRepository(); HierarchyGroup hierarchyGroup = hierarchyRepository.GetHierarchyGroup( hierarchy.HierarchyType ?? "", hierarchy.HierarchyCode ?? "", hierarchy.HierarchyName ?? "", hierarchy.TravelerTypeGuid ?? "", hierarchy.TravelerTypeName ?? "", hierarchy.SourceSystemCode ?? "" ); if (hierarchyGroup != null) { group.HierarchyType = hierarchyGroup.HierarchyType; group.HierarchyCode = hierarchyGroup.HierarchyCode; group.HierarchyItem = hierarchyGroup.HierarchyItem; group.ClientSubUnitGuid = hierarchyGroup.ClientSubUnitGuid; group.ClientSubUnitName = hierarchyGroup.ClientSubUnitName; group.TravelerTypeGuid = hierarchyGroup.TravelerTypeGuid; group.TravelerTypeName = hierarchyGroup.TravelerTypeName; group.ClientTopUnitName = hierarchyGroup.ClientTopUnitName; group.SourceSystemCode = hierarchyGroup.SourceSystemCode; } } }
public void Only_Create_A_Relationship_Once() { // arrange var repo = new HierarchyRepository(); // act repo.AddParser("base"); repo.AddParser("child"); repo.EstablishParentChildRelationship("base", "child"); repo.EstablishParentChildRelationship("base", "child"); // assert repo.Nodes["base"].Children.Should().HaveCount(1); }