This commit is contained in:
mmrbnjd
2024-06-10 17:26:31 +03:30
parent 82bcfc1ffe
commit 2db5daa9b8
14 changed files with 953 additions and 469 deletions

View File

@@ -3,7 +3,6 @@ using Back.Data.Contracts;
using Back.Data.Models;
using Microsoft.EntityFrameworkCore;
using Back.Common;
using Shared;
using Microsoft.OpenApi.Extensions;
using Shared.DTOs.Serch;
@@ -77,6 +76,14 @@ namespace Back.Services
.ThenInclude(inc => inc.CODUnit)
.FirstOrDefaultAsync();
}
public async Task<SentTax> GetSentTax(int CompanyID, int ID)
{
return await _repoSentTax.Get(w=>w.ID== ID && w.invoice.CompanyID==CompanyID).FirstOrDefaultAsync();
}
public async Task<bool> UpdateSentTax(SentTax sent)
{
return await _repoSentTax.UpdateAsync(sent);
}
public async Task<bool> AddSentTax(SentTax sentTax)
{
return await _repoSentTax.AddBoolResultAsync(sentTax);
@@ -221,13 +228,13 @@ namespace Back.Services
return await request.OrderByDescending(o=>o.ID)
.Select(s => new SentTaxDto
{
Date = s.Date.ShamciToFormatShamciinFront(),
Date = s.Date.ShamciToFormatShamci(),
Time = s.Time,
ID = s.ID,
InvoiceID = s.InvoiceID,
SentStatus=s.SentStatus,
msgInvoiceType = s.InvoiceType.GetDisplayName(),
msgSentStatus = s.SentStatus.GetDisplayName()
msgInvoiceType = s.InvoiceType.GetEnumDisplayName(),
msgSentStatus = s.SentStatus.GetEnumDisplayName()
}).Paging(itemSerchGetSentTax.PageIndex, itemSerchGetSentTax.PageSize);
}

View File

@@ -188,11 +188,15 @@ namespace Back.Services
user.Password = newpassword.encrypted();
return await _RepoUser.UpdateAsync(user);
}
public async Task<DashBoardDTO> GetDashBoard(int CompanyID, int UserID)
public async Task<DashBoardDTO> GetDashBoard(int UserID)
{
var user = await GetUserByUserID(UserID);
DashBoardDTO request = new DashBoardDTO();
var period = await _RepoPermissionPeriod
.Get(w => w.CompanyID == CompanyID && (!w.IsLocked.HasValue || !w.IsLocked.Value)).ToListAsync();
.Get(w => w.CompanyID == user.RolUsers.First().CompanyID && (!w.IsLocked.HasValue || !w.IsLocked.Value))
.Include(inc=>inc.CalculationType)
.Include(inc => inc.Permission)
.ToListAsync();
foreach (var item in period)
{
request.AlistofServices.Add(new ServiceInDashBoardDTO
@@ -210,16 +214,16 @@ namespace Back.Services
if (!string.IsNullOrEmpty(request.LastLoginDate))
request.LastLoginDate.ShamciToFormatShamci();
var user = await GetUserByUserID(UserID);
if (user.Mobile == user.Username)
request.Warning.Add(new AlertDTO { Status = 0, Message = "موبایل و نام کاربری بهتر است شبیه هم نباشند" });
//if (user.Mobile == user.Username)
// request.Warning.Add(new AlertDTO { Status = 0, Message = "موبایل و نام کاربری بهتر است شبیه هم نباشند" });
if (user.Mobile.encrypted() == user.Password)
request.Warning.Add(new AlertDTO { Status = 0, Message = "موبایل و کلمه عبور بهتر است شبیه هم نباشند" });
var Company = user.RolUsers.Where(w => w.CompanyID == CompanyID).Select(s => s.Company).FirstOrDefault();
var Company = user.RolUsers.Where(w => w.CompanyID == user.RolUsers.First().CompanyID).Select(s => s.Company).FirstOrDefault();
if (Company != null)
{
if (string.IsNullOrEmpty(Company.Email) || string.IsNullOrEmpty(Company.Phone)
|| string.IsNullOrEmpty(Company.EconomicCode) || string.IsNullOrEmpty(Company.UniqeMemory)
if (/*string.IsNullOrEmpty(Company.Email) || string.IsNullOrEmpty(Company.Phone) || */
string.IsNullOrEmpty(Company.EconomicCode) || string.IsNullOrEmpty(Company.UniqeMemory)
|| string.IsNullOrEmpty(Company.PrivateKey))
{
request.Warning.Add(new AlertDTO { Status = 0, Message = "بهتر است اطلاعات شرکت بروزرسانی شود" });