...
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Service">
|
||||
<HintPath>..\..\Dlls\Service.dll</HintPath>
|
||||
<HintPath>..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
71
Back/Controllers/stuffController.cs
Normal file
71
Back/Controllers/stuffController.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using Back.Data.Models;
|
||||
using Back.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Shared.DTOs;
|
||||
|
||||
namespace Back.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[Authorize]
|
||||
[ApiController]
|
||||
public class stuffController : ControllerBase
|
||||
{
|
||||
private readonly Servstuff _Servstuff;
|
||||
public stuffController(Servstuff Servstuff)
|
||||
{
|
||||
_Servstuff = Servstuff;
|
||||
}
|
||||
[HttpGet("Getstuff/{value}")]
|
||||
public async Task<ActionResult> Getstuff(string value)
|
||||
{
|
||||
return Ok(await _Servstuff.Getstuff(value));
|
||||
}
|
||||
//[HttpPost("InitalInTb")]
|
||||
//public async Task<ActionResult> InitalInTb()
|
||||
//{
|
||||
// int countererror = 0;
|
||||
// List<stuff> stuffDtos = new List<stuff>();
|
||||
// //------
|
||||
// using (StreamReader sr = new StreamReader("C://AllserviceStuff.CSV"))
|
||||
// {
|
||||
// string line = "";
|
||||
// while ((line = sr.ReadLine()) != null)
|
||||
// {
|
||||
// string[] cells = line.Split(new char[] { '\r', '\n' }, StringSplitOptions.None);
|
||||
// if (cells.Length > 0)
|
||||
// {
|
||||
// var item = cells[0].Split(',');
|
||||
// if (item[0] == "ID") continue;
|
||||
// try
|
||||
// {
|
||||
// stuffDtos.Add(new stuff
|
||||
// {
|
||||
// CID = item[0],
|
||||
// sType = item[1],
|
||||
// sDate = item[2],
|
||||
// RunDate = item[3],
|
||||
// ExpirationDate = item[4],
|
||||
// SpecialOrGeneral = item[5],
|
||||
// TaxableOrFree = item[6],
|
||||
// Vat = item[7],
|
||||
// VatCustomPurposes = item[8],
|
||||
// DescriptionOfID = item[9]
|
||||
// });
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// countererror++;
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// return Ok(await _Servstuff.AddRange(stuffDtos));
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,7 @@ namespace TaxPayer.Infrastructure.Persistence
|
||||
public DbSet<TiceketUnknownPeople> TiceketUnknownPeoples { get; set; }
|
||||
public DbSet<SaleLead> SaleLeads { get; set; }
|
||||
public DbSet<UserNotfi> UserNotifis { get; set; }
|
||||
public DbSet<stuff> Stuffs { get; set; }
|
||||
#endregion
|
||||
//public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||
//{
|
||||
|
||||
25
Back/Data/Models/stuff.cs
Normal file
25
Back/Data/Models/stuff.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class stuff
|
||||
{
|
||||
public int ID { get; set; }
|
||||
//شناسه کالا/خدمت
|
||||
public string? CID { get; set; }
|
||||
// نوع شناسه کالا/خدمت
|
||||
public string? sType { get; set; }
|
||||
//تاریخ ثبت
|
||||
public string? sDate { get; set; }
|
||||
public string? RunDate { get; set; }
|
||||
public string? ExpirationDate { get; set; }
|
||||
//عمومی یا خاص بودن شناسه
|
||||
public string? SpecialOrGeneral { get; set; }
|
||||
//مشمول یا معاف بودن
|
||||
public string? TaxableOrFree { get; set; }
|
||||
//نرخ ارزش افزوده
|
||||
public string? Vat { get; set; }
|
||||
// نرخ ارزش افزوده مبادی گمرکی
|
||||
public string? VatCustomPurposes { get; set; }
|
||||
//شرح شناسه کالا/خدمت
|
||||
public string? DescriptionOfID { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,7 @@ builder.Services.AddScoped<AddOrUpdateInvoiceValidation>();
|
||||
builder.Services.AddScoped<AUInvoiceItemValidation>();
|
||||
builder.Services.AddScoped<servInvoiceItem>();
|
||||
builder.Services.AddScoped<ActionTaxPayer>();
|
||||
builder.Services.AddScoped<Servstuff>();
|
||||
builder.Services.AddScoped(c => new mpNuget.RestClient("09119660045", "C54S2"));
|
||||
|
||||
string origins = "OriginTaxPayer";
|
||||
|
||||
31
Back/Services/Servstuff.cs
Normal file
31
Back/Services/Servstuff.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.DTOs;
|
||||
|
||||
namespace Back.Services
|
||||
{
|
||||
public class Servstuff
|
||||
{
|
||||
private readonly IAsyncRepository<stuff> _repostuff;
|
||||
public Servstuff(IAsyncRepository<stuff> repostuff)
|
||||
{
|
||||
_repostuff=repostuff;
|
||||
}
|
||||
public async Task<List<stuffDto>> Getstuff(string value)
|
||||
{
|
||||
var request = _repostuff.Get(w => w.sType.Contains(value) || w.DescriptionOfID.Contains(value) || w.CID.Contains(value));
|
||||
|
||||
return await request.Select(s=>new stuffDto
|
||||
{
|
||||
DescriptionOfID=s.DescriptionOfID,
|
||||
ID=string.IsNullOrEmpty(s.CID) ? 0 :Convert.ToUInt64(s.CID),
|
||||
TaxableOrFree=s.TaxableOrFree,
|
||||
Type=s.sType,
|
||||
Vat= string.IsNullOrEmpty(s.Vat) ? 0 :Convert.ToInt32(s.Vat),
|
||||
// VatCustomPurposes = string.IsNullOrEmpty(s.VatCustomPurposes) ? 0 : Convert.ToInt32(s.VatCustomPurposes)
|
||||
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user