GetExpersCompany
GetGroupsCompany
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
@using HushianWebApp.Service
|
||||
@inject GroupService groupService;
|
||||
@inject UserService userService;
|
||||
@inject HushianWebApp.Services.ILocalStorageService localStorageService;
|
||||
@if (!Spinnervisible)
|
||||
{
|
||||
<div class="row">
|
||||
@@ -52,7 +53,7 @@
|
||||
@functions {
|
||||
private async Task<AutoCompleteDataProviderResult<Read_ExperDto>> DataProvider(AutoCompleteDataProviderRequest<Read_ExperDto> request)
|
||||
{
|
||||
CoExpers = await userService.GetExpersCompany(0, 0, 0);
|
||||
CoExpers = await userService.GetExpersCompany();
|
||||
return await Task.FromResult(new AutoCompleteDataProviderResult<Read_ExperDto> { Data = CoExpers.Where(w => w.FullName.Contains(request.Filter.Value)), TotalCount = CoExpers.Count() });
|
||||
}
|
||||
|
||||
|
@@ -76,7 +76,7 @@
|
||||
public string Username { get; set; }
|
||||
public string Fullname { get; set; }
|
||||
public byte[]? img { get; set; }
|
||||
public List<string> Roles { get; set; } = new();
|
||||
public string Role { get; set; }
|
||||
bool isonline = false;
|
||||
bool isAuthorizedCompanyUser = false;
|
||||
public string TitleRole { get; set; } = "";
|
||||
@@ -93,9 +93,9 @@
|
||||
}
|
||||
|
||||
|
||||
TitleRole = Roles.Any(a => a == "Company") ? "مدیر" : "کارشناس";
|
||||
TitleRole = Role == "Company" ? "مدیر" : "کارشناس";
|
||||
|
||||
isAuthorizedCompanyUser = Roles.Contains("Company") || (Roles.Contains("Exper") && await userService.CheckAvailableExperInCompany());
|
||||
isAuthorizedCompanyUser = Role=="Company" || Role=="Exper" && await userService.CheckAvailableExperInCompany();
|
||||
|
||||
string route = NavigationManager.Uri.Replace(NavigationManager.BaseUri, "").ToLower();
|
||||
if (route.Length > 0)
|
||||
@@ -170,7 +170,7 @@
|
||||
|
||||
async Task CheckOnline()
|
||||
{
|
||||
var token = await localStorageService.GetItem<string>("key");
|
||||
var token = await localStorageService.GetItem<string>("C/key");
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
isonline = false;
|
||||
@@ -188,8 +188,8 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
Roles = await localStorageService.GetItem<List<string>>("Role");
|
||||
if (Roles.Count == 1 && Roles.Contains("HushianUserCompany"))
|
||||
Role = await localStorageService.GetItem<string>("C/Role");
|
||||
if (Role=="User")
|
||||
{
|
||||
isonline = false;
|
||||
NavigationManager.NavigateTo("/NotFound");
|
||||
|
@@ -82,7 +82,7 @@
|
||||
{
|
||||
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create(this, CallBack));
|
||||
|
||||
if (!(await localStorageService.GetItem<List<string>>("Role")).Any(a => a == "HushianManagerCompany"))
|
||||
if (await localStorageService.GetItem<string>("C/Role") != "Company")
|
||||
navigationManager.NavigateTo("/NotFound");
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ AllowRowClick=true>
|
||||
@context.FullName
|
||||
</GridColumn>
|
||||
|
||||
|
||||
|
||||
|
||||
<GridColumn HeaderTextAlignment="Alignment.Center" TextAlignment="Alignment.Center" TItem="Read_ExperDto" HeaderText="وضعیت">
|
||||
<Switch Value="@context.Available" ValueExpression="() => context.Available" ValueChanged="async(v)=>await SwitchChanged(context,v)" />
|
||||
@@ -55,20 +55,25 @@ AllowRowClick=true>
|
||||
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
Grid<Read_ExperDto> grid = default!;
|
||||
public List<Read_ExperDto> list = new();
|
||||
private Modal modal = default!;
|
||||
string title = "کارشناس جدید";
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create(this, CallBack));
|
||||
|
||||
if (await localStorageService.GetItem<string>("Role")!= "Company" )
|
||||
if (await localStorageService.GetItem<string>("C/Role")!= "Company" )
|
||||
navigationManager.NavigateTo("/NotFound");
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
private async Task<GridDataProviderResult<Read_ExperDto>> DataProvider(GridDataProviderRequest<Read_ExperDto> request)
|
||||
{
|
||||
var employees = await userService.GetExpersCompany(0, request.PageNumber, request.PageSize);
|
||||
return await Task.FromResult(request.ApplyTo(employees != null ? employees : new()));
|
||||
if (list.Count <= 0)
|
||||
list = await userService.GetExpersCompany();
|
||||
|
||||
int skip = (request.PageNumber - 1) * request.PageSize;
|
||||
|
||||
return await Task.FromResult(request.ApplyTo(list != null ? list.Skip(skip).Take(request.PageSize).ToList() : new()));
|
||||
}
|
||||
async Task CallBack()
|
||||
{
|
||||
|
@@ -18,10 +18,10 @@ namespace HushianWebApp.Service
|
||||
var response = await _baseController.Post($"{BaseRoute}AddExper", request);
|
||||
return response.IsSuccessStatusCode;
|
||||
}
|
||||
public async Task<List<Read_ExperDto>?> GetExpersCompany(int CompanyID, int PageIndex = 1, int PageSize = 10)
|
||||
public async Task<List<Read_ExperDto>?> GetExpersCompany()
|
||||
{
|
||||
string route = $"{BaseRoute}GetExpersCompany/{CompanyID}&PageIndex={PageIndex}&PageSize={PageSize}";
|
||||
|
||||
string route = $"{BaseRoute}GetExpersCompany";
|
||||
//&PageIndex={PageIndex}&PageSize={PageSize}
|
||||
var response = await _baseController.Get(route);
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
@@ -29,7 +29,17 @@ namespace HushianWebApp.Service
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task<List<Read_ExperDto>?> GetExpersCompany(int CompanyID)
|
||||
{
|
||||
string route = $"{BaseRoute}GetExpersCompany?CompanyID={CompanyID}";
|
||||
var response = await _baseController.Get(route);
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
return await response.Content.ReadFromJsonAsync<List<Read_ExperDto>>();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
public async Task<bool> EditUserYourself(Update_ExperDto request) //ویرایش کاربران توسط خود
|
||||
{
|
||||
|
Reference in New Issue
Block a user