This commit is contained in:
mmrbnjd
2024-06-30 19:57:32 +03:30
parent cf521860cf
commit 3702145d02
11 changed files with 214 additions and 150 deletions

View File

@@ -1,4 +1,5 @@
using Back.Common; using Back.Common;
using Back.Data.Contracts;
using Back.Data.Models; using Back.Data.Models;
using Back.Services; using Back.Services;
using Back.Validations; using Back.Validations;
@@ -23,11 +24,14 @@ namespace Back.Controllers
private readonly ServValidatinMsg _servValidatinMsg; private readonly ServValidatinMsg _servValidatinMsg;
private readonly servSendMsg _servSendMsg; private readonly servSendMsg _servSendMsg;
private readonly CompanyRegistrationValidation _companyRegistrationValidation; private readonly CompanyRegistrationValidation _companyRegistrationValidation;
private readonly IAsyncRepository<Ulr> _ulrRepo;
public BaseController(ServBase sBase, MobileValidation mobilevalidation public BaseController(ServBase sBase, MobileValidation mobilevalidation
, servCompany servCompany, servUser servUser , servCompany servCompany, servUser servUser
, servPermission servPermission, ServValidatinMsg servValidatinMsg , servPermission servPermission, ServValidatinMsg servValidatinMsg
, servSendMsg servSendMsg, CompanyRegistrationValidation companyRegistrationValidation) , servSendMsg servSendMsg, CompanyRegistrationValidation companyRegistrationValidation
, IAsyncRepository<Ulr> ulrRepo)
{ {
_ulrRepo = ulrRepo;
_sBase = sBase; _sBase = sBase;
_mobilevalidation = mobilevalidation; _mobilevalidation = mobilevalidation;
_servCompany = servCompany; _servCompany = servCompany;
@@ -186,5 +190,21 @@ namespace Back.Controllers
_servSendMsg.toContinue(modelvc.Code.ToString(),Item.Username, "فراموشی کلمه عبور"); _servSendMsg.toContinue(modelvc.Code.ToString(),Item.Username, "فراموشی کلمه عبور");
return Ok(modelvc.ID); return Ok(modelvc.ID);
} }
[HttpPost("Ulr")]
[AllowAnonymous]
public async Task<ActionResult> Ulr(UlrDto Item)
{
if (Item.Type=="Panel" || Item.Type == "Main")
{
await _ulrRepo.AddBoolResultAsync(new Data.Models.Ulr
{
Type = Item.Type,
Date=DateTime.Now.ConvertMiladiToShamsi(),
Time=DateTime.Now.Hour.ToString("00")+ DateTime.Now.Minute.ToString("00"),
Ip= HttpContext.Connection.RemoteIpAddress?.ToString()
});
}
return Ok();
}
} }
} }

View File

@@ -45,6 +45,7 @@ namespace TaxPayer.Infrastructure.Persistence
public DbSet<SaleLead> SaleLeads { get; set; } public DbSet<SaleLead> SaleLeads { get; set; }
public DbSet<UserNotfi> UserNotifis { get; set; } public DbSet<UserNotfi> UserNotifis { get; set; }
public DbSet<stuff> Stuffs { get; set; } public DbSet<stuff> Stuffs { get; set; }
public DbSet<Ulr> Ulrs { get; set; }
#endregion #endregion
//public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken()) //public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
//{ //{

12
Back/Data/Models/Ulr.cs Normal file
View File

@@ -0,0 +1,12 @@
namespace Back.Data.Models
{
//User login report
public class Ulr
{
public int ID { get; set; }
public string Ip { get; set; }
public string Type { get; set; } //Panel or Main
public string Date { get; set; }
public string Time { get; set; }
}
}

View File

@@ -85,7 +85,7 @@ builder.Services.AddCors(options =>
options.AddPolicy(origins, options.AddPolicy(origins,
policy => policy =>
{ {
policy.WithOrigins("https://localhost:7224", "http://localhost:5107") policy.WithOrigins("https://localhost:7224", "http://localhost:5107", "http://195.88.208.142")
.AllowAnyHeader() .AllowAnyHeader()
.WithHeaders(HeaderNames.ContentType) .WithHeaders(HeaderNames.ContentType)
.AllowAnyMethod(); .AllowAnyMethod();

13
Shared/DTOs/UlrDto.cs Normal file
View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shared.DTOs
{
public class UlrDto
{
public string Type { get; set; }
}
}

View File

@@ -102,6 +102,13 @@ namespace Front
} }
} }
return Units; return Units;
}
public async Task SetUlr(string Type)
{
await _hc.Post<UlrDto>("Base/Ulr",new UlrDto { Type=Type});
} }
} }

View File

@@ -9,7 +9,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Stimulsoft.Reports.Blazor" Version="2024.2.5" />
<PackageReference Include="Blazor.Bootstrap" Version="2.2.0" /> <PackageReference Include="Blazor.Bootstrap" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.3" PrivateAssets="all" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.3" PrivateAssets="all" />

View File

@@ -1,5 +1,5 @@
@inherits LayoutComponentBase @inherits LayoutComponentBase
@inject Fixedvalues fv;
<HeadContent> <HeadContent>
<!-- Place favicon.ico in the root directory --> <!-- Place favicon.ico in the root directory -->
<link rel="icon" type="image/png" href="img/logo/siyahe.png" /> <link rel="icon" type="image/png" href="img/logo/siyahe.png" />
@@ -27,5 +27,11 @@
</div> </div>
</div> </div>
@code{
protected override async Task OnInitializedAsync()
{
await fv.SetUlr("Main");
await base.OnInitializedAsync();
}
}

View File

@@ -194,6 +194,8 @@
public DashBoardDTO? dashBoard { get; set; } public DashBoardDTO? dashBoard { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await fv.SetUlr("Panel");
if (!await localserv.OnlineUser()) if (!await localserv.OnlineUser())
nav.NavigateTo("/"); nav.NavigateTo("/");

View File

@@ -1,186 +1,186 @@
<PageTitle>صورتحساب</PageTitle> <PageTitle>صورتحساب</PageTitle>
@using Front.Services @* @using Front.Services
@using Shared.DTOs @using Shared.DTOs
@using Stimulsoft.Base @using Stimulsoft.Base
@using Stimulsoft.Report @using Stimulsoft.Report
@using Stimulsoft.Report.Blazor @using Stimulsoft.Report.Blazor
@inject Fixedvalues fv; @inject Fixedvalues fv;
@inject HttpClientController hc; @inject HttpClientController hc;
@layout EmptyLayout @layout EmptyLayout *@
@page "/InvoiceReport/{InvoiceID:int}" @page "/InvoiceReport/{InvoiceID:int}"
<StiBlazorViewer Report="@Report" /> @* <StiBlazorViewer Report="@Report" /> *@
@code { @code {
public CompanyDTO? company { get; set; } // public CompanyDTO? company { get; set; }
private StiReport Report; // private StiReport Report;
[Parameter] public int InvoiceID { get; set; } // [Parameter] public int InvoiceID { get; set; }
private int[] NoArray = default; // private int[] NoArray = default;
private int[] ItemArray = new int[] { 1011, 1012 }; // private int[] ItemArray = new int[] { 1011, 1012 };
private string[] ItemNArray = new string[] { "کالا 1", "کالا 2" }; // private string[] ItemNArray = new string[] { "کالا 1", "کالا 2" };
private int[] amArray = new int[] { 1, 2 }; // private int[] amArray = new int[] { 1, 2 };
private string[] UnitNArray = new string[] { "1011", "1012" }; // private string[] UnitNArray = new string[] { "1011", "1012" };
private string[] feeArray = new string[] { "کالا 1", "کالا 2" }; // private string[] feeArray = new string[] { "کالا 1", "کالا 2" };
private string[] prdisArray = new string[] { "", "" }; // private string[] prdisArray = new string[] { "", "" };
private string[] disArray = new string[] { "1011", "1012" }; // private string[] disArray = new string[] { "1011", "1012" };
private string[] adisArray = new string[] { "کالا 1", "کالا 2" }; // private string[] adisArray = new string[] { "کالا 1", "کالا 2" };
private string[] vamArray = new string[] { " 1, 2" }; // private string[] vamArray = new string[] { " 1, 2" };
private string[] tsstamArray = new string[] { "1011", "1012" }; // private string[] tsstamArray = new string[] { "1011", "1012" };
private string[] vraArray = new string[] { "کالا 1", "کالا 2" }; // private string[] vraArray = new string[] { "کالا 1", "کالا 2" };
protected async override Task OnParametersSetAsync() // protected async override Task OnParametersSetAsync()
{ // {
if (fv.invoice==null) // if (fv.invoice==null)
{ // {
hc._nav.NavigateTo($"InvoiceDetails/{InvoiceID}"); // hc._nav.NavigateTo($"InvoiceDetails/{InvoiceID}");
} // }
string CustomerName = ""; // string CustomerName = "";
string CustomerEconomicCode = ""; // string CustomerEconomicCode = "";
string CustomerPhone = ""; // string CustomerPhone = "";
string CompanyName = ""; // string CompanyName = "";
string CompanyEconomicCode = ""; // string CompanyEconomicCode = "";
string CompanyPhone = ""; // string CompanyPhone = "";
var cus =await GetCus(); // var cus =await GetCus();
if (cus!=null) // if (cus!=null)
{ // {
CustomerName = cus?.FullName; // CustomerName = cus?.FullName;
CustomerEconomicCode = cus?.EconomicCode; // CustomerEconomicCode = cus?.EconomicCode;
CustomerPhone = cus?.Phone; // CustomerPhone = cus?.Phone;
} // }
var company =await GetCompany(); // var company =await GetCompany();
if (company != null) // if (company != null)
{ // {
CompanyName = company?.Name; // CompanyName = company?.Name;
CompanyEconomicCode = company?.EconomicCode; // CompanyEconomicCode = company?.EconomicCode;
CompanyPhone = company?.Phone; // CompanyPhone = company?.Phone;
} // }
//datasource // //datasource
NoArray = Enumerable // NoArray = Enumerable
.Repeat(1, (int)((fv.invoice.items.Count() - 1) / 1) + 1) // .Repeat(1, (int)((fv.invoice.items.Count() - 1) / 1) + 1)
.Select((tr, ti) => Convert.ToInt32(tr + (1 * ti))) // .Select((tr, ti) => Convert.ToInt32(tr + (1 * ti)))
.ToArray(); // .ToArray();
ItemArray = fv.invoice.items.Select(s => s.CODID).ToArray(); // ItemArray = fv.invoice.items.Select(s => s.CODID).ToArray();
ItemNArray = fv.invoice.items.Select(s => s.sstt).ToArray(); // ItemNArray = fv.invoice.items.Select(s => s.sstt).ToArray();
amArray = fv.invoice.items.Select(s => Convert.ToInt32(s.am)).ToArray(); // amArray = fv.invoice.items.Select(s => Convert.ToInt32(s.am)).ToArray();
UnitNArray= fv.invoice.items.Select(s => s.mu).ToArray(); // UnitNArray= fv.invoice.items.Select(s => s.mu).ToArray();
feeArray = fv.invoice.items.Select(s => s.fee.ToString("N0")).ToArray(); // feeArray = fv.invoice.items.Select(s => s.fee.ToString("N0")).ToArray();
prdisArray = fv.invoice.items.Select(s => s.prdis?.ToString("N0")).ToArray(); // prdisArray = fv.invoice.items.Select(s => s.prdis?.ToString("N0")).ToArray();
disArray = fv.invoice.items.Select(s => s.dis?.ToString("N0")).ToArray(); // disArray = fv.invoice.items.Select(s => s.dis?.ToString("N0")).ToArray();
adisArray = fv.invoice.items.Select(s => s.adis?.ToString("N0")).ToArray(); // adisArray = fv.invoice.items.Select(s => s.adis?.ToString("N0")).ToArray();
vamArray = fv.invoice.items.Select(s => s.vam?.ToString("N0")).ToArray(); // vamArray = fv.invoice.items.Select(s => s.vam?.ToString("N0")).ToArray();
tsstamArray = fv.invoice.items.Select(s => s.tsstam?.ToString("N0")).ToArray(); // tsstamArray = fv.invoice.items.Select(s => s.tsstam?.ToString("N0")).ToArray();
vraArray = fv.invoice.items.Select(s => s.vra?.ToString("N0")).ToArray(); // vraArray = fv.invoice.items.Select(s => s.vra?.ToString("N0")).ToArray();
// //How to activate // // //How to activate
// Stimulsoft.Base.StiLicense.Key = // // Stimulsoft.Base.StiLicense.Key =
// "6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k" + // // "6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k" +
// "4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Ux" + // // "4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Ux" +
// "a30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1" + // // "a30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1" +
// "xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/C" + // // "xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/C" +
// "jX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLr" + // // "jX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLr" +
// "pU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0" + // // "pU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0" +
// "Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dw" + // // "Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dw" +
// "Ms2fQ0yOUG/xornE"; // // "Ms2fQ0yOUG/xornE";
//var licenseStream = await Http.GetStreamAsync("Secret/license.key"); // //var licenseStream = await Http.GetStreamAsync("Secret/license.key");
//Stimulsoft.Base.StiLicense.LoadFromStream(licenseStream); // //Stimulsoft.Base.StiLicense.LoadFromStream(licenseStream);
//Create empty report object // //Create empty report object
this.Report = new StiReport(); // this.Report = new StiReport();
//Load report template // //Load report template
var reportBytes = await hc._hc.GetByteArrayAsync($"Invoice/GetReport/{InvoiceID}"); // var reportBytes = await hc._hc.GetByteArrayAsync($"Invoice/GetReport/{InvoiceID}");
//Set value // //Set value
Report["InvoiceID"] = fv.invoice?.ID; // Report["InvoiceID"] = fv.invoice?.ID;
Report["invoicedate"] = fv.invoice?.InvoiceDate; // Report["invoicedate"] = fv.invoice?.InvoiceDate;
Report["CusName"] = CustomerName; // Report["CusName"] = CustomerName;
Report["CusEconomicCode"] = CustomerEconomicCode; // Report["CusEconomicCode"] = CustomerEconomicCode;
Report["CusPhone"] = CustomerPhone; // Report["CusPhone"] = CustomerPhone;
Report["CompanyName"] = CompanyName; // Report["CompanyName"] = CompanyName;
Report["CompanyEconomicCode"] = CompanyEconomicCode; // Report["CompanyEconomicCode"] = CompanyEconomicCode;
Report["CompanyPhone"] = CompanyPhone; // Report["CompanyPhone"] = CompanyPhone;
// var rspCustomer = await hc.Get($"Customer/GetCustomer/{fv.invoice?.CustomerID}"); // // var rspCustomer = await hc.Get($"Customer/GetCustomer/{fv.invoice?.CustomerID}");
// if (rspCustomer.IsSuccessStatusCode) // // if (rspCustomer.IsSuccessStatusCode)
// Cus = await rspCustomer.Content.ReadFromJsonAsync<RCustomer>(); // // Cus = await rspCustomer.Content.ReadFromJsonAsync<RCustomer>();
// var rspCompany = await hc.Get($"Company/GetCompany"); // // var rspCompany = await hc.Get($"Company/GetCompany");
// if (rspCompany.IsSuccessStatusCode) // // if (rspCompany.IsSuccessStatusCode)
// company = await rspCompany.Content.ReadFromJsonAsync<CompanyDTO>(); // // company = await rspCompany.Content.ReadFromJsonAsync<CompanyDTO>();
// Report["cusname"] = CustomerName; // // Report["cusname"] = CustomerName;
this.Report.Load(reportBytes); // this.Report.Load(reportBytes);
//Create User Data // //Create User Data
var stiUserData1 = new Stimulsoft.Report.Dictionary.StiUserData(); // var stiUserData1 = new Stimulsoft.Report.Dictionary.StiUserData();
stiUserData1.Columns.AddRange(new Stimulsoft.Report.Dictionary.StiDataColumn[] { // stiUserData1.Columns.AddRange(new Stimulsoft.Report.Dictionary.StiDataColumn[] {
new Stimulsoft.Report.Dictionary.StiDataColumn("No", "No", "No", typeof(int), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("No", "No", "No", typeof(int), null),
new Stimulsoft.Report.Dictionary.StiDataColumn("Item", "Item", "Item", typeof(int), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("Item", "Item", "Item", typeof(int), null),
new Stimulsoft.Report.Dictionary.StiDataColumn("ItemN", "ItemN", "ItemN", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("ItemN", "ItemN", "ItemN", typeof(string), null),
new Stimulsoft.Report.Dictionary.StiDataColumn("am", "am", "am", typeof(int), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("am", "am", "am", typeof(int), null),
new Stimulsoft.Report.Dictionary.StiDataColumn("UnitN", "UnitN", "UnitN", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("UnitN", "UnitN", "UnitN", typeof(string), null),
new Stimulsoft.Report.Dictionary.StiDataColumn("fee", "fee", "fee", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("fee", "fee", "fee", typeof(string), null),
new Stimulsoft.Report.Dictionary.StiDataColumn("prdis", "prdis", "prdis", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("prdis", "prdis", "prdis", typeof(string), null),
new Stimulsoft.Report.Dictionary.StiDataColumn("dis", "dis", "dis", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("dis", "dis", "dis", typeof(string), null),
new Stimulsoft.Report.Dictionary.StiDataColumn("adis", "adis", "adis", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("adis", "adis", "adis", typeof(string), null),
new Stimulsoft.Report.Dictionary.StiDataColumn("vam", "vam", "vam", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("vam", "vam", "vam", typeof(string), null),
new Stimulsoft.Report.Dictionary.StiDataColumn("tsstam", "tsstam", "tsstam", typeof(string), null), // new Stimulsoft.Report.Dictionary.StiDataColumn("tsstam", "tsstam", "tsstam", typeof(string), null),
new Stimulsoft.Report.Dictionary.StiDataColumn("vra", "vra", "vra", typeof(string), null) // new Stimulsoft.Report.Dictionary.StiDataColumn("vra", "vra", "vra", typeof(string), null)
}); // });
stiUserData1.Count = fv.invoice.items.Count(); // stiUserData1.Count = fv.invoice.items.Count();
stiUserData1.GetData += new Stimulsoft.Report.Dictionary.StiUserGetDataEventHandler(stiUserData1_GetData); // stiUserData1.GetData += new Stimulsoft.Report.Dictionary.StiUserGetDataEventHandler(stiUserData1_GetData);
//Register new data in the report template // //Register new data in the report template
this.Report.RegData("Items", stiUserData1); // this.Report.RegData("Items", stiUserData1);
await base.OnParametersSetAsync(); // await base.OnParametersSetAsync();
} // }
private void stiUserData1_GetData(object sender, Stimulsoft.Report.Dictionary.StiUserGetDataEventArgs e) // private void stiUserData1_GetData(object sender, Stimulsoft.Report.Dictionary.StiUserGetDataEventArgs e)
{ // {
if (e.ColumnName == "No") e.Data = NoArray[e.Position]; // if (e.ColumnName == "No") e.Data = NoArray[e.Position];
if (e.ColumnName == "Item") e.Data = ItemArray[e.Position]; // if (e.ColumnName == "Item") e.Data = ItemArray[e.Position];
if (e.ColumnName == "ItemN") e.Data = ItemNArray[e.Position]; // if (e.ColumnName == "ItemN") e.Data = ItemNArray[e.Position];
if (e.ColumnName == "am") e.Data = amArray[e.Position]; // if (e.ColumnName == "am") e.Data = amArray[e.Position];
if (e.ColumnName == "UnitN") e.Data = UnitNArray[e.Position]; // if (e.ColumnName == "UnitN") e.Data = UnitNArray[e.Position];
if (e.ColumnName == "fee") e.Data = feeArray[e.Position]; // if (e.ColumnName == "fee") e.Data = feeArray[e.Position];
if (e.ColumnName == "prdis") e.Data = prdisArray[e.Position]; // if (e.ColumnName == "prdis") e.Data = prdisArray[e.Position];
if (e.ColumnName == "dis") e.Data = disArray[e.Position]; // if (e.ColumnName == "dis") e.Data = disArray[e.Position];
if (e.ColumnName == "adis") e.Data = adisArray[e.Position]; // if (e.ColumnName == "adis") e.Data = adisArray[e.Position];
if (e.ColumnName == "vam") e.Data = vamArray[e.Position]; // if (e.ColumnName == "vam") e.Data = vamArray[e.Position];
if (e.ColumnName == "tsstam") e.Data = tsstamArray[e.Position]; // if (e.ColumnName == "tsstam") e.Data = tsstamArray[e.Position];
if (e.ColumnName == "vra") e.Data = vraArray[e.Position]; // if (e.ColumnName == "vra") e.Data = vraArray[e.Position];
} // }
} }
@functions{ @functions{
private async Task<RCustomer?> GetCus() // private async Task<RCustomer?> GetCus()
{ // {
var rspCustomer = await hc.Get($"Customer/GetCustomer/{fv.invoice?.CustomerID}"); // var rspCustomer = await hc.Get($"Customer/GetCustomer/{fv.invoice?.CustomerID}");
if (rspCustomer.IsSuccessStatusCode) // if (rspCustomer.IsSuccessStatusCode)
return await rspCustomer.Content.ReadFromJsonAsync<RCustomer>(); // return await rspCustomer.Content.ReadFromJsonAsync<RCustomer>();
else return null; // else return null;
} // }
private async Task<CompanyDTO?> GetCompany() // private async Task<CompanyDTO?> GetCompany()
{ // {
var rspCompany = await hc.Get($"Company/GetCompany"); // var rspCompany = await hc.Get($"Company/GetCompany");
if (rspCompany.IsSuccessStatusCode) // if (rspCompany.IsSuccessStatusCode)
return await rspCompany.Content.ReadFromJsonAsync<CompanyDTO>(); // return await rspCompany.Content.ReadFromJsonAsync<CompanyDTO>();
else return null; // else return null;
} // }
} }

View File

@@ -33,9 +33,13 @@ builder.Services.AddScoped(sp => new UserAuthenticationDTO()
exitDate = new DateTime(), exitDate = new DateTime(),
}) ; }) ;
// Server
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://195.88.208.142:7075/api/") });
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") }); //Home
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
//farzan
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") }); //builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir"); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");