/// <summary> /// Метод очищает поиск по организациям /// </summary> public void ClearSearch() { OrganizationsViewModel orgsViewModelCash = ModelCash <OrganizationsViewModel> .GetViewModel(currentUser.Id, ORGANIZATIONS); orgsViewModelCash.SearchNameCash.AddOrReplace(currentUser.Id, default); ModelCash <OrganizationsViewModel> .SetViewModel(currentUser.Id, ORGANIZATIONS, orgsViewModelCash); }
/// <summary> /// Поиск по сделкам клиента /// </summary> /// <param name="accountViewModel"></param> public void SearchQuote(AccountViewModel accountViewModel) { //viewsInfo.Reset(ACC_QUOTES); AccountViewModel accountViewModelCash = ModelCash <AccountViewModel> .GetViewModel(currentUser.Id, ACC_QUOTES); ModelCash <AccountViewModel> .SetViewModel(currentUser.Id, ACC_QUOTES, accountViewModelCash); }
public override AccountViewModel UpdateViewModelFromCash(AccountViewModel accountViewModel) { AccountViewModel accContactsViewModel = ModelCash <AccountViewModel> .GetViewModel(currentUser.Id, ACC_CONTACTS); AccountViewModel accAddressesViewModel = ModelCash <AccountViewModel> .GetViewModel(currentUser.Id, ACC_ADDRESSES); AccountViewModel accInvoicesViewModel = ModelCash <AccountViewModel> .GetViewModel(currentUser.Id, ACC_INVOICES); AccountViewModel accQuotesViewModel = ModelCash <AccountViewModel> .GetViewModel(currentUser.Id, ACC_QUOTES); AccountViewModel accDocumentsViewModel = ModelCash <AccountViewModel> .GetViewModel(currentUser.Id, ACC_DOCS); accountViewModel.SearchContactFullName = accContactsViewModel.SearchContactFullNameCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchContactType = accContactsViewModel.SearchContactTypeCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchContactPhoneNumber = accContactsViewModel.SearchContactPhoneNumberCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchContactEmail = accContactsViewModel.SearchContactEmailCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchContactPrimary = accContactsViewModel.SearchContactPrimaryCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchAddressCountry = accAddressesViewModel.SearchAddressCountryCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchAddressRegion = accAddressesViewModel.SearchAddressRegionCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchAddressCity = accAddressesViewModel.SearchAddressCityCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchAddressStreet = accAddressesViewModel.SearchAddressStreetCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchAddressHouse = accAddressesViewModel.SearchAddressHouseCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchAddressType = accAddressesViewModel.SearchAddressTypeCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchInvoiceBankName = accInvoicesViewModel.SearchInvoiceBankNameCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchInvoiceCity = accInvoicesViewModel.SearchInvoiceCityCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchInvoiceCheckingAccount = accInvoicesViewModel.SearchInvoiceCheckingAccountCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchInvoiceCorrespondentAccount = accInvoicesViewModel.SearchInvoiceCorrespondentAccountCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchInvoiceBIC = accInvoicesViewModel.SearchInvoiceBICCash.GetValueOrDefault(currentUser.Id); accountViewModel.SearchInvoiceSWIFT = accInvoicesViewModel.SearchInvoiceSWIFTCash.GetValueOrDefault(currentUser.Id); return(accountViewModel); }
/// <summary> /// Метод очищает кеш для модели с полномочиями /// </summary> public void ClearResponsibilitySearch() { OrganizationViewModel orgViewModelCash = ModelCash <OrganizationViewModel> .GetViewModel(currentUser.Id, RESPONSIBILITIES); orgViewModelCash.SeacrhResponsibilityNameCash.AddOrReplace(currentUser.Id, default); ModelCash <OrganizationViewModel> .SetViewModel(currentUser.Id, RESPONSIBILITIES, orgViewModelCash); }
/// <summary> /// Метод очищает поиск по сотрудникам /// </summary> public void ClearSearchEmployee() { PositionViewModel posViewModelModelCash = ModelCash <PositionViewModel> .GetViewModel(currentUser.Id, POS_EMPLOYEES); posViewModelModelCash.SearchEmployeeInitialNameCash.AddOrReplace(currentUser.Id, default); ModelCash <PositionViewModel> .SetViewModel(currentUser.Id, POS_EMPLOYEES, posViewModelModelCash); }
public IActionResult GetPositions(string employeeId) { if (!string.IsNullOrEmpty(employeeId) && Guid.TryParse(employeeId, out Guid guid)) { User currentUser = context.Users.FirstOrDefault(n => n.UserName == User.Identity.Name); repository = new EmployeePositionRepository(context, viewsInfo, resManager, HttpContext); List <Position> allPositions = repository.GetAllPositions(guid); List <EmployeePosition> selectedPositions = repository.GetSelectedPositions(guid); List <EmployeePosition> selectedPositionsForTable = repository.GetSelectedPositionsForTable(guid); List <PositionViewModel> allPositionVMs = allPositions.GetViewModelsFromData <Position, PositionViewModel, PositionTransformer>(new PositionTransformer(context, resManager)); List <EmployeePositionViewModel> selectedPositionsVMs = selectedPositions.GetViewModelsFromData <EmployeePosition, EmployeePositionViewModel, EmployeePositionTransformer>(transformer); List <EmployeePositionViewModel> selectedPositionsForTableVMs = selectedPositionsForTable.GetViewModelsFromData <EmployeePosition, EmployeePositionViewModel, EmployeePositionTransformer>(transformer); Dictionary <string, object> result = new Dictionary <string, object>() { { "allPositions", allPositionVMs }, { "selectedPositions", selectedPositionsVMs }, { "positionsForTable", selectedPositionsForTableVMs }, { "allPositionsVM", ModelCash <EmployeeViewModel> .GetViewModel(currentUser.Id, ALL_EMP_POSS) }, { "selectedPositionsVM", ModelCash <EmployeeViewModel> .GetViewModel(currentUser.Id, SELECTED_EMP_POSS) } }; return(Json(result)); } else { return(BadRequest(resManager.GetString("PositionsExtractError"))); } }
/// <summary> /// Метод очищает поиск по подчиненным /// </summary> public void ClearSubordinateSearch() { EmployeeViewModel empViewModelCash = ModelCash <EmployeeViewModel> .GetViewModel(currentUser.Id, EMP_SUBS); empViewModelCash.SearchSubordinateFullNameCash.AddOrReplace(currentUser.Id, default); ModelCash <EmployeeViewModel> .SetViewModel(currentUser.Id, EMP_SUBS, empViewModelCash); }
/// <summary> /// Метод устанавливает значения для поиска по подчиненным /// </summary> /// <param name="empViewModelCash"></param> /// <returns></returns> public void SearchSubordinate(EmployeeViewModel employeeViewModel) { //viewsInfo.Reset(EMP_SUBS); EmployeeViewModel empViewModelCash = ModelCash <EmployeeViewModel> .GetViewModel(currentUser.Id, EMP_SUBS); empViewModelCash.SearchSubordinateFullNameCash.AddOrReplace(currentUser.Id, employeeViewModel.SearchSubordinateFullName?.ToLower().TrimStartAndEnd()); ModelCash <EmployeeViewModel> .SetViewModel(currentUser.Id, EMP_SUBS, empViewModelCash); }
/// <summary> /// Метод очищает поиск по должностям /// </summary> public void ClearPositionSearch() { EmployeeViewModel empViewModelCash = ModelCash <EmployeeViewModel> .GetViewModel(currentUser.Id, EMP_POSITIONS); empViewModelCash.SearchPosNameCash.AddOrReplace(currentUser.Id, default); empViewModelCash.SearchParentPosNameCash.AddOrReplace(currentUser.Id, default); ModelCash <EmployeeViewModel> .SetViewModel(currentUser.Id, EMP_POSITIONS, empViewModelCash); }
/// <summary> /// Метод устанавливает значения для поиска по сотрудникам /// </summary> /// <param name="empViewModelCash"></param> /// <returns></returns> public void SearchEmployee(PositionViewModel positionViewModel) { //viewsInfo.Reset(POS_EMPLOYEES); PositionViewModel posViewModelModelCash = ModelCash <PositionViewModel> .GetViewModel(currentUser.Id, POS_EMPLOYEES); posViewModelModelCash.SearchEmployeeInitialNameCash.AddOrReplace(currentUser.Id, positionViewModel.SearchEmployeeInitialName?.ToLower().TrimStartAndEnd()); ModelCash <PositionViewModel> .SetViewModel(currentUser.Id, POS_EMPLOYEES, posViewModelModelCash); }
/// <summary> /// Метод очищает поиск по выбранным должностям /// </summary> public void ClearSelectedPositionSearch() { EmployeeViewModel employeeViewModelCash = ModelCash <EmployeeViewModel> .GetViewModel(currentUser.Id, SELECTED_EMP_POSS); employeeViewModelCash.SearchSelectedPosNameCash.AddOrReplace(currentUser.Id, default); employeeViewModelCash.SearchSelectedParentPosNameCash.AddOrReplace(currentUser.Id, default); ModelCash <EmployeeViewModel> .SetViewModel(currentUser.Id, SELECTED_EMP_POSS, employeeViewModelCash); }
/// <summary> /// Метод очищает кеш для модели с подразделениями /// </summary> public void ClearDivisionSearch() { OrganizationViewModel orgViewModelCash = ModelCash <OrganizationViewModel> .GetViewModel(currentUser.Id, DIVISIONS); orgViewModelCash.SearchDivNameCash.AddOrReplace(currentUser.Id, default); orgViewModelCash.SearchParentDivNameCash.AddOrReplace(currentUser.Id, default); ModelCash <OrganizationViewModel> .SetViewModel(currentUser.Id, DIVISIONS, orgViewModelCash); }
/// <summary> /// Метод очищает поиск по всем должностям /// </summary> public void ClearAllPositionSearch() { EmployeeViewModel employeeViewModelCash = ModelCash <EmployeeViewModel> .GetViewModel(currentUser.Id, ALL_EMP_POSS); employeeViewModelCash.SearchAllPosNameCash.AddOrReplace(currentUser.Id, default); employeeViewModelCash.SearchAllParentPosNameCash.AddOrReplace(currentUser.Id, default); ModelCash <EmployeeViewModel> .SetViewModel(currentUser.Id, ALL_EMP_POSS, employeeViewModelCash); }
/// <summary> /// Метод очищает поиск по всем клиентам /// </summary> public void ClearAllAccountsSearch() { AccountsViewModel accountsViewModelCash = ModelCash <AccountsViewModel> .GetViewModel(currentUser.Id, ALL_ACCS); accountsViewModelCash.AllAccountsSearchNameCash.AddOrReplace(currentUser.Id, default); accountsViewModelCash.AllAccountsSearchTypeCash.AddOrReplace(currentUser.Id, default); ModelCash <AccountsViewModel> .SetViewModel(currentUser.Id, ALL_ACCS, accountsViewModelCash); }
/// <summary> /// Метод устанавливает значения для поиска по организациям /// </summary> /// <param name="orgsViewModel"></param> /// <returns></returns> public void Search(OrganizationsViewModel orgsViewModel) { //viewsInfo.Reset(ORGANIZATIONS); OrganizationsViewModel orgsViewModelCash = ModelCash <OrganizationsViewModel> .GetViewModel(currentUser.Id, ORGANIZATIONS); orgsViewModelCash.SearchNameCash.AddOrReplace(currentUser.Id, orgsViewModel.SearchName?.ToLower().TrimStartAndEnd()); ModelCash <OrganizationsViewModel> .SetViewModel(currentUser.Id, ORGANIZATIONS, orgsViewModelCash); }
/// <summary> /// Метод очищает кеш для модели с сотрудниками /// </summary> public void ClearEmployeeSearch() { OrganizationViewModel orgViewModelCash = ModelCash <OrganizationViewModel> .GetViewModel(currentUser.Id, EMPLOYEES); orgViewModelCash.SearchEmployeeNameCash.AddOrReplace(currentUser.Id, default); orgViewModelCash.SearchEmployeePrimaryPosNameCash.AddOrReplace(currentUser.Id, default); orgViewModelCash.SeacrhEmployeeDivNameCash.AddOrReplace(currentUser.Id, default); ModelCash <OrganizationViewModel> .SetViewModel(currentUser.Id, EMPLOYEES, orgViewModelCash); }
/// <summary> /// Метод очищает поиск по дочерним должностям /// </summary> public void ClearSearchSubPosition() { PositionViewModel posViewModelModelCash = ModelCash <PositionViewModel> .GetViewModel(currentUser.Id, POS_SUB_POSS); posViewModelModelCash.DivisionIdCash.AddOrReplace(currentUser.Id, default); posViewModelModelCash.SearchSubPositionNameCash.AddOrReplace(currentUser.Id, default); posViewModelModelCash.SearchSubPositionPrimaryEmployeeCash.AddOrReplace(currentUser.Id, default); ModelCash <PositionViewModel> .SetViewModel(currentUser.Id, POS_SUB_POSS, posViewModelModelCash); }
/// <summary> /// Метод устанавливает значения для поиска по клиентам основной организации пользователя /// </summary> /// <param name="accountsViewModel"></param> /// <returns></returns> public void SearchCurrentAccounts(AccountsViewModel accountsViewModel) { //viewsInfo.Reset(CURRENT_ACCS); AccountsViewModel accountsViewModelCash = ModelCash <AccountsViewModel> .GetViewModel(currentUser.Id, CURRENT_ACCS); accountsViewModelCash.CurrentAccountsSearchNameCash.AddOrReplace(currentUser.Id, accountsViewModel.CurrentAccountsSearchName?.ToLower().TrimStartAndEnd()); accountsViewModelCash.CurrentAccountsSearchTypeCash.AddOrReplace(currentUser.Id, accountsViewModel.CurrentAccountsSearchType); ModelCash <AccountsViewModel> .SetViewModel(currentUser.Id, CURRENT_ACCS, accountsViewModelCash); }
private List <AccountQuote> GetLimitedAccQuotesList(List <AccountQuote> accountQuotes) { AccountViewModel accountViewModelCash = ModelCash <AccountViewModel> .GetViewModel(currentUser.Id, ACC_QUOTES); List <AccountQuote> limitedAccQuotes = accountQuotes; LimitListByPageNumber(currentUser.Id, ACC_QUOTES, ref limitedAccQuotes); return(limitedAccQuotes); }
/// <summary> /// Метод сбрасывает фильтрацию для команды по клиенту /// </summary> public void ClearSelectedManagersSearch() { AccountViewModel accountViewModelCash = ModelCash <AccountViewModel> .GetViewModel(currentUser.Id, ACC_TEAM_SELECTED_EMPLOYEES); accountViewModelCash.SearchSelectedManagersName = default; accountViewModelCash.SearchSelectedManagersPhone = default; accountViewModelCash.SearchSelectedManagersPosition = default; ModelCash <AccountViewModel> .SetViewModel(currentUser.Id, ACC_TEAM_SELECTED_EMPLOYEES, accountViewModelCash); }
/// <summary> /// Метод очищает поиск по должностям /// </summary> public void ClearContactSearch() { EmployeeViewModel empViewModelCash = ModelCash <EmployeeViewModel> .GetViewModel(currentUser.Id, EMP_CONTACTS); empViewModelCash.SearchContactTypeCash.AddOrReplace(currentUser.Id, string.Empty); empViewModelCash.SearchContactPhoneCash.AddOrReplace(currentUser.Id, default); empViewModelCash.SearchContactEmailCash.AddOrReplace(currentUser.Id, default); ModelCash <EmployeeViewModel> .SetViewModel(currentUser.Id, EMP_CONTACTS, empViewModelCash); }
/// <summary> /// Метод для поиска полномочия /// </summary> /// <param name="orgViewModel"></param> public void SearchResponsibility(OrganizationViewModel orgViewModel) { //viewsInfo.Reset(RESPONSIBILITIES); OrganizationViewModel orgViewModelCash = ModelCash <OrganizationViewModel> .GetViewModel(currentUser.Id, RESPONSIBILITIES); orgViewModelCash.IdCash.AddOrReplace(currentUser.Id, orgViewModel.Id); orgViewModelCash.SeacrhResponsibilityNameCash.AddOrReplace(currentUser.Id, orgViewModel.SeacrhResponsibilityName?.ToLower().TrimStartAndEnd()); ModelCash <OrganizationViewModel> .SetViewModel(currentUser.Id, RESPONSIBILITIES, orgViewModelCash); }
/// <summary> /// Метод сбрасывает фильтрацию для списка всех сотрудников организации, создавшей клиента /// </summary> public void ClearAllManagersSearch() { AccountViewModel accountViewModelCash = ModelCash <AccountViewModel> .GetViewModel(currentUser.Id, ACC_TEAM_ALL_EMPLOYEES); accountViewModelCash.SearchAllManagersName = default; accountViewModelCash.SearchAllManagersDivision = default; accountViewModelCash.SearchAllManagersPosition = default; ModelCash <AccountViewModel> .SetViewModel(currentUser.Id, ACC_TEAM_ALL_EMPLOYEES, accountViewModelCash); }
private List <Employee> GetLimitedEmployeesList(List <Employee> employees) { PositionViewModel posViewModelCash = ModelCash <PositionViewModel> .GetViewModel(currentUser.Id, POS_EMPLOYEES); List <Employee> limitedEmployees = employees; LimitEmployeesByName(posViewModelCash, ref limitedEmployees); LimitListByPageNumber(currentUser.Id, POS_EMPLOYEES, ref limitedEmployees); return(limitedEmployees); }
/// <summary> /// Метод ограничивает список клиентов всех организаций /// </summary> /// <param name="accounts"></param> /// <returns></returns> private List <Account> GetLimitedAllAccountsList(List <Account> accounts) { List <Account> limitedAccounts = accounts; AccountsViewModel accountsViewModelCash = ModelCash <AccountsViewModel> .GetViewModel(currentUser.Id, ALL_ACCS); LimitAllAccsBySearchName(ref limitedAccounts, accountsViewModelCash); LimitAllAccsBySearchType(ref limitedAccounts, accountsViewModelCash); LimitListByPageNumber(currentUser.Id, ALL_ACCS, ref limitedAccounts); return(limitedAccounts); }
private List <Employee> GetLimitedSubordinatesList(List <Employee> employees) { EmployeeViewModel employeeViewModelCash = ModelCash <EmployeeViewModel> .GetViewModel(currentUser.Id, EMP_SUBS); List <Employee> limitedSubordinates = employees; LimitSubordinatesByFullName(employeeViewModelCash, ref limitedSubordinates); LimitListByPageNumber(currentUser.Id, EMP_SUBS, ref limitedSubordinates); return(limitedSubordinates); }
/// <summary> /// Метод для поиска подразделения /// </summary> /// <param name="orgViewModel"></param> public void SearchDivision(OrganizationViewModel orgViewModel) { //viewsInfo.Reset(DIVISIONS); OrganizationViewModel orgViewModelCash = ModelCash <OrganizationViewModel> .GetViewModel(currentUser.Id, DIVISIONS); orgViewModelCash.IdCash.AddOrReplace(currentUser.Id, orgViewModel.Id); orgViewModelCash.SearchDivNameCash.AddOrReplace(currentUser.Id, orgViewModel.SearchDivName?.ToLower().TrimStartAndEnd()); orgViewModelCash.SearchParentDivNameCash.AddOrReplace(currentUser.Id, orgViewModel.SearchParentDivName?.ToLower().TrimStartAndEnd()); ModelCash <OrganizationViewModel> .SetViewModel(currentUser.Id, DIVISIONS, orgViewModelCash); }
/// <summary> /// Метод устанавливает значения для поиска по должностям /// </summary> /// <param name="empViewModelCash"></param> /// <returns></returns> public void SearchPosition(EmployeeViewModel employeeViewModel) { //viewsInfo.Reset(EMP_POSITIONS); EmployeeViewModel empViewModelCash = ModelCash <EmployeeViewModel> .GetViewModel(currentUser.Id, EMP_POSITIONS); empViewModelCash.DivisionIdCash.AddOrReplace(currentUser.Id, employeeViewModel.DivisionId); empViewModelCash.SearchPosNameCash.AddOrReplace(currentUser.Id, employeeViewModel.SearchPosName?.ToLower().TrimStartAndEnd()); empViewModelCash.SearchParentPosNameCash.AddOrReplace(currentUser.Id, employeeViewModel.SearchParentPosName?.ToLower().TrimStartAndEnd()); ModelCash <EmployeeViewModel> .SetViewModel(currentUser.Id, EMP_POSITIONS, empViewModelCash); }
/// <summary> /// Метод ограничивает список клиентов основной организации пользователя /// </summary> /// <param name="accounts"></param> /// <returns></returns> private List <Account> GetLimitedCurrentAccountsList(List <Account> accounts) { List <Account> limitedAccounts = accounts.Where(orgId => orgId.OrganizationId == currentUser.PrimaryOrganizationId).ToList(); AccountsViewModel accountsViewModelCash = ModelCash <AccountsViewModel> .GetViewModel(currentUser.Id, CURRENT_ACCS); LimitCurrentAccsBySearchName(ref limitedAccounts, accountsViewModelCash); LimitCurrentAccsBySearchType(ref limitedAccounts, accountsViewModelCash); LimitListByPageNumber(currentUser.Id, CURRENT_ACCS, ref limitedAccounts); return(limitedAccounts); }
/// <summary> /// Метод очищает кеш для модели с должностями /// </summary> public void ClearPositionSearch() { OrganizationViewModel orgViewModelCash = ModelCash <OrganizationViewModel> .GetViewModel(currentUser.Id, POSITIONS); orgViewModelCash.SearchPosNameCash.AddOrReplace(currentUser.Id, default); orgViewModelCash.SeacrhPositionDivNameCash.AddOrReplace(currentUser.Id, default); orgViewModelCash.SearchPrimaryEmployeeNameCash.AddOrReplace(currentUser.Id, default); orgViewModelCash.SearchParentPosNameCash.AddOrReplace(currentUser.Id, default); ModelCash <OrganizationViewModel> .SetViewModel(currentUser.Id, POSITIONS, orgViewModelCash); }