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