...
This commit is contained in:
@@ -206,7 +206,7 @@ namespace Back.Services
|
||||
DashBoardDTO request = new DashBoardDTO();
|
||||
var period = await _RepoPermissionPeriod
|
||||
.Get(w => w.CompanyID == user.RolUsers.First().CompanyID && (!w.IsLocked.HasValue || !w.IsLocked.Value))
|
||||
.Include(inc=>inc.CalculationType)
|
||||
.Include(inc => inc.CalculationType)
|
||||
.Include(inc => inc.Permission)
|
||||
.ToListAsync();
|
||||
foreach (var item in period)
|
||||
@@ -255,17 +255,17 @@ namespace Back.Services
|
||||
#region LastActivitySevice
|
||||
//invoice
|
||||
var lastinv = await _RepoInvoice.Get(w => w.CompanyID == user.RolUsers.First().CompanyID && !w.IsDeleted)
|
||||
.Include(inc=>inc.Customer)
|
||||
.Select(s=>new LastActivitySevice
|
||||
.Include(inc => inc.Customer)
|
||||
.Select(s => new LastActivitySevice
|
||||
{
|
||||
ID = s.ID,
|
||||
Date=s.InvoiceDate.ShamciToFormatShamci(),
|
||||
Name=s.Customer.FullName,
|
||||
PermissionID=3,
|
||||
TypeTitle=s.invoiceType.GetEnumDisplayName()
|
||||
Date = s.InvoiceDate.ShamciToFormatShamci(),
|
||||
Name = s.Customer.FullName,
|
||||
PermissionID = 3,
|
||||
TypeTitle = s.invoiceType.GetEnumDisplayName()
|
||||
})
|
||||
.OrderByDescending(o => o.ID).FirstOrDefaultAsync();
|
||||
if (lastinv!=null)
|
||||
if (lastinv != null)
|
||||
request.lastActivitiesSevices.Add(lastinv);
|
||||
//cod
|
||||
var lastcod = await _RepoCODItem.Get(w => w.CompanyID == user.RolUsers.First().CompanyID && !w.IsDeleted)
|
||||
@@ -295,17 +295,29 @@ namespace Back.Services
|
||||
request.lastActivitiesSevices.Add(lastcus);
|
||||
#endregion
|
||||
|
||||
request.MostInvoicedProduct = await _invoiceitemRepo.Get(w => w.invoice.CompanyID == user.RolUsers.First().CompanyID
|
||||
&& (w.invoice.invoiceType==InvoiceType.Sale || w.invoice.invoiceType == InvoiceType.BackFrmSale
|
||||
|| w.invoice.invoiceType == InvoiceType.Repair) && !w.invoice.BillReference.HasValue)
|
||||
.Include(inc=>inc.cODItem)
|
||||
.GroupBy(g => g.CODID)
|
||||
.Select(s => new IdNameByCount<int>{
|
||||
ID= s.Key,
|
||||
Title=s.Select(s=>s.sstt).First(),
|
||||
count =Convert.ToInt32(s.Sum(s => s.am))
|
||||
}).OrderByDescending(o => o.count)
|
||||
|
||||
try
|
||||
{
|
||||
var MostInvoicedProduct = await _invoiceitemRepo.Get(w => w.invoice.CompanyID == user.RolUsers.First().CompanyID
|
||||
&& (w.invoice.invoiceType == InvoiceType.Sale || w.invoice.invoiceType == InvoiceType.BackFrmSale
|
||||
|| w.invoice.invoiceType == InvoiceType.Repair) && !w.invoice.BillReference.HasValue
|
||||
)
|
||||
//.Include(inc => inc.cODItem)
|
||||
// .GroupBy(g => g.CODID)
|
||||
// .Select(s => new IdNameByCount<int>
|
||||
// {
|
||||
// ID = s.Key,
|
||||
// Title = s.Select(s => s.sstt).First(),
|
||||
// count = Convert.ToInt32(s.Sum(s => s.am))
|
||||
// }).OrderByDescending(o => o.count)
|
||||
.ToListAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
|
||||
return request;
|
||||
}
|
||||
@@ -340,7 +352,7 @@ namespace Back.Services
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
using var transaction =await _RepoCompany._dbContext.Database.BeginTransactionAsync();
|
||||
using var transaction = await _RepoCompany._dbContext.Database.BeginTransactionAsync();
|
||||
var company = user.RolUsers.First().Company;
|
||||
company.Mobile = newUserName;
|
||||
if (await _RepoCompany.UpdateAsync(company))
|
||||
|
Reference in New Issue
Block a user