....
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
@@ -7,7 +7,29 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.9.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.15" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.15">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.15" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.15">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Features\" />
|
||||
<Folder Include="Validations\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@@ -1,6 +0,0 @@
|
||||
@Back_HostAddress = http://localhost:5271
|
||||
|
||||
GET {{Back_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
16
Back/Common/DTOs/PagingDto.cs
Normal file
16
Back/Common/DTOs/PagingDto.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Back.Common.ViewModels
|
||||
{
|
||||
public class PagingDto<T>
|
||||
{
|
||||
public PagingDto(int RowCount, int pageCount, List<T> list)
|
||||
{
|
||||
this.RowCount = RowCount;
|
||||
this.list = list;
|
||||
PageCount = pageCount;
|
||||
|
||||
}
|
||||
public int RowCount { get; set; }
|
||||
public int PageCount { get; set; }
|
||||
public List<T> list { get; set; }
|
||||
}
|
||||
}
|
17
Back/Common/Enums/CustomerType.cs
Normal file
17
Back/Common/Enums/CustomerType.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Back.Common.Enums
|
||||
{
|
||||
public enum CustomerType:int
|
||||
{
|
||||
[Display(Name = "حقیقی")]
|
||||
genuine = 1,
|
||||
[Display(Name = "حقوقی")]
|
||||
legal = 2,
|
||||
[Display(Name = "مشارکت مدنی")]
|
||||
CivilPartnership = 3,
|
||||
[Display(Name = "اتباع عیر ایرانی")]
|
||||
NonIranianNationals = 4
|
||||
|
||||
}
|
||||
}
|
25
Back/Common/Enums/InvoiceType.cs
Normal file
25
Back/Common/Enums/InvoiceType.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Back.Common.Enums
|
||||
{
|
||||
public enum InvoiceType:int
|
||||
{
|
||||
[Display(Name = "پیشنهاد قیمت")]
|
||||
Bidding=10,
|
||||
//[Display(Name = "فاکتور")]
|
||||
//Factor=11,
|
||||
//[Display(Name = "قطعی")]
|
||||
//Final=12,
|
||||
[Display(Name = "لغو")]
|
||||
CANCEL = 0,
|
||||
[Display(Name = "فروش")]
|
||||
Sale=1,
|
||||
[Display(Name = "ابطالی")]
|
||||
Cancellation=3,
|
||||
[Display(Name = "اصلاحی")]
|
||||
Repair=2,
|
||||
[Display(Name = "برگشت از فروش")]
|
||||
BackFrmSale = 4
|
||||
|
||||
}
|
||||
}
|
21
Back/Common/Enums/SentStatus.cs
Normal file
21
Back/Common/Enums/SentStatus.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
namespace Back.Common.Enums
|
||||
{
|
||||
public enum SentStatus
|
||||
{
|
||||
|
||||
[Display(Name = "ارسال شده")]
|
||||
Send,
|
||||
[Display(Name = "موفق")]
|
||||
Successful,
|
||||
[Display(Name = "ناموفق")]
|
||||
Unsuccessful,
|
||||
[Display(Name = "در حال پردازش")]
|
||||
pending,
|
||||
[Display(Name = "نامشخص")]
|
||||
Unknown,
|
||||
[Display(Name = "یافت نشده")]
|
||||
NOT_FOUND
|
||||
|
||||
}
|
||||
}
|
12
Back/Common/Enums/SideType.cs
Normal file
12
Back/Common/Enums/SideType.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Back.Common.Enums
|
||||
{
|
||||
public enum SideType
|
||||
{
|
||||
[Display(Name = "مشتری")]
|
||||
Customer,
|
||||
[Display(Name = "کارشناس")]
|
||||
Expert
|
||||
}
|
||||
}
|
14
Back/Common/Enums/StatusOrder.cs
Normal file
14
Back/Common/Enums/StatusOrder.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Back.Common.Enums
|
||||
{
|
||||
public enum StatusOrder
|
||||
{
|
||||
[Display(Name = "ساخته شده")]
|
||||
Create,
|
||||
[Display(Name = "پرداخت شده")]
|
||||
Paid,
|
||||
[Display(Name = "انصراف داده شده")]
|
||||
Cancel
|
||||
}
|
||||
}
|
28
Back/Common/Enums/StatusTicket.cs
Normal file
28
Back/Common/Enums/StatusTicket.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using static Back.Common.ExclusiveAttribute;
|
||||
|
||||
namespace Back.Common.Enums
|
||||
{
|
||||
public enum StatusTicket
|
||||
{
|
||||
|
||||
[Color("00FF23")]
|
||||
[Display(Name = "فرد ناشناس")]
|
||||
unknownPerson,
|
||||
[Color("8844A3")]
|
||||
[Display(Name = "در انتظار بررسی")]
|
||||
Awaitingreview,
|
||||
[Color("2CAFE8")]
|
||||
[Display(Name = "خوانده شده/ در حال بررسی")]
|
||||
Read_Checking,
|
||||
[Color("4AB621")]
|
||||
[Display(Name = "پاسخ داده شده")]
|
||||
hasbeenanswered,
|
||||
[Color("37363E")]
|
||||
[Display(Name = "پاِیان")]
|
||||
End,
|
||||
[Color("D24249")]
|
||||
[Display(Name = "انصراف")]
|
||||
optout,
|
||||
}
|
||||
}
|
13
Back/Common/ExclusiveAttribute.cs
Normal file
13
Back/Common/ExclusiveAttribute.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Back.Common
|
||||
{
|
||||
public class ExclusiveAttribute
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Class,
|
||||
AllowMultiple = false)]
|
||||
public class ColorAttribute : Attribute
|
||||
{
|
||||
public string _ColorHex;
|
||||
public ColorAttribute(string ColorHex) => _ColorHex = ColorHex;
|
||||
}
|
||||
}
|
||||
}
|
93
Back/Common/ExtentionMethods.cs
Normal file
93
Back/Common/ExtentionMethods.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using static Back.Common.ExclusiveAttribute;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using Back.Common.ViewModels;
|
||||
|
||||
namespace Back.Common
|
||||
{
|
||||
public static class ExtentionMethods
|
||||
{
|
||||
public static string GetEnumDisplayName(this Enum enumType)
|
||||
{
|
||||
return enumType.GetType().GetMember(enumType.ToString())
|
||||
.First()
|
||||
.GetCustomAttribute<DisplayAttribute>()
|
||||
.Name;
|
||||
}
|
||||
public static string GetEnumHexColor(this Enum enumType)
|
||||
{
|
||||
return enumType.GetType().GetMember(enumType.ToString())
|
||||
.First()
|
||||
.GetCustomAttribute<ColorAttribute>()
|
||||
._ColorHex;
|
||||
}
|
||||
public static string encrypted(this string txt)
|
||||
{
|
||||
HashAlgorithm hash = new MD5CryptoServiceProvider();
|
||||
var bytes = System.Text.Encoding.UTF8.GetBytes(txt);
|
||||
var hashedBytes = hash.ComputeHash(bytes);
|
||||
|
||||
string res = BitConverter.ToString(hashedBytes).Replace("-", string.Empty);
|
||||
return res;
|
||||
}
|
||||
public static string ConvertMiladiToShamsi(this DateTime date)
|
||||
{
|
||||
PersianCalendar PersianCal = new PersianCalendar();
|
||||
return PersianCal.GetYear(date).ToString("0000") +
|
||||
PersianCal.GetMonth(date).ToString("00") +
|
||||
PersianCal.GetDayOfMonth(date).ToString("00");
|
||||
}
|
||||
public static string ShamciToFormatShamci(this string str)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str)) return "";
|
||||
return str.Substring(0, 4) + "/" + str.Substring(4, 2) + "/" + str.Substring(6, 2);
|
||||
}
|
||||
public static DateTime ToMiladi(this string value)
|
||||
{
|
||||
PersianCalendar p = new PersianCalendar();
|
||||
return p.ToDateTime(Convert.ToInt32(value.Substring(0, 4)), Convert.ToInt32(value.Substring(4, 2)), Convert.ToInt32(value.Substring(6, 2)), 0, 0, 0, 0);
|
||||
}
|
||||
public static async Task<PagingDto<T>> Paging<T>(this IQueryable<T> values, int pageId, int take)
|
||||
{
|
||||
if (/*values.Count()<1000 && */pageId == 0 && take == 0)
|
||||
{
|
||||
return new PagingDto<T>(values.Count(), 1, await values.ToListAsync());
|
||||
}
|
||||
else
|
||||
{
|
||||
int skip = (pageId - 1) * take;
|
||||
int rowCount = values.Count();
|
||||
int PageCount = rowCount % take == 0 ? rowCount / take : rowCount / take + 1;
|
||||
return new PagingDto<T>(rowCount, PageCount, await values.Skip(skip).Take(take).ToListAsync());
|
||||
}
|
||||
|
||||
}
|
||||
public static System.Linq.Expressions.Expression<Func<TEntity, bool>> GetFunc<TEntity>(string Fild, string Value)
|
||||
{
|
||||
Type type = typeof(TEntity);
|
||||
// System.Linq.Expressions.Expression<Func<TEntity, bool>> convert = s => type.GetProperty(Fild) != null && s.GetType().GetProperty(Fild).GetValue(s) == Value;
|
||||
return Entity => type.GetProperty(Fild) != null && Entity.GetType().GetProperty(Fild).GetValue(Entity) == Value;
|
||||
}
|
||||
public static DataTable ConvertStringBase64toDataTable(this string value, string SheetName = null)
|
||||
{
|
||||
//try
|
||||
//{
|
||||
// MemoryStream stream1 = new MemoryStream(Convert.FromBase64String(value));
|
||||
// WorkBook workbook = WorkBook.Load(stream1);
|
||||
|
||||
// WorkSheet sheet = SheetName == null ? workbook.DefaultWorkSheet : workbook.GetWorkSheet(SheetName);
|
||||
|
||||
// return sheet.ToDataTable(true);
|
||||
//}
|
||||
//catch (Exception)
|
||||
//{
|
||||
return new DataTable();
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
22
Back/Controllers/BaseController.cs
Normal file
22
Back/Controllers/BaseController.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Back.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Shared.DTOs;
|
||||
|
||||
namespace Back.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class BaseController : ControllerBase
|
||||
{
|
||||
private readonly ServBase _sBase;
|
||||
public BaseController(ServBase sBase)
|
||||
{
|
||||
_sBase = sBase;
|
||||
}
|
||||
[HttpGet("BasePrice")]
|
||||
public async Task<ActionResult<List<BasePriceDto>>> GetBasePrice()
|
||||
=> Ok(await _sBase.GetBasePrice());
|
||||
|
||||
}
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Back.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
39
Back/Data/Contracts/IAsyncRepository.cs
Normal file
39
Back/Data/Contracts/IAsyncRepository.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Back.Data.Contracts
|
||||
{
|
||||
public interface IAsyncRepository<T>
|
||||
{
|
||||
IQueryable<T> GetAll();
|
||||
IQueryable<T> Get(Expression<Func<T, bool>> predicate);
|
||||
IQueryable<T> Get(Expression<Func<T, bool>> predicate = null,
|
||||
Func<IQueryable<T>, IOrderedQueryable<T>> orderBy = null,
|
||||
string[] includeSrings = null,
|
||||
bool disableTracking = true);
|
||||
|
||||
IQueryable<T> Get(Expression<Func<T, bool>> predicate = null,
|
||||
Func<IQueryable<T>, IOrderedQueryable<T>> orderBy = null,
|
||||
List<Expression<Func<T, object>>> includes = null,
|
||||
bool disableTracking = true);
|
||||
Task<bool> AddRangeAsync(ICollection<T> entites);
|
||||
Task<T> AddAsync(T entity);
|
||||
T? Add(T entity);
|
||||
Task<bool> AddBoolResultAsync(T entity);
|
||||
bool AddBoolResult(T entity);
|
||||
Task<bool> UpdateAsync(T entity);
|
||||
bool Update(T entity);
|
||||
Task<bool> UpdateRangeAsync(ICollection<T> entites);
|
||||
bool UpdateRange(ICollection<T> entites);
|
||||
bool Delete(T entity);
|
||||
Task<bool> DeleteRangeAsync(ICollection<T> entites);
|
||||
Task<bool> DeleteAsync(T entity);
|
||||
Task<List<SqlParameter>> RunSP(string query, List<SqlParameter> parameters);
|
||||
Task ExecuteSql(string query);
|
||||
}
|
||||
}
|
67
Back/Data/Infrastructure/Persistence/SqlDbContext.cs
Normal file
67
Back/Data/Infrastructure/Persistence/SqlDbContext.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Back.Data.Models;
|
||||
|
||||
namespace TaxPayer.Infrastructure.Persistence
|
||||
{
|
||||
public class SqlDbContext : DbContext
|
||||
{
|
||||
public SqlDbContext(DbContextOptions<SqlDbContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
#region Table
|
||||
public DbSet<BillType> BillTypes { get; set; }
|
||||
public DbSet<Fild> Filds { get; set; }
|
||||
public DbSet<FildMode> FildModes { get; set; }
|
||||
public DbSet<FildModeInPattern> FildModeInPattern { get; set; }
|
||||
public DbSet<Pattern> Patterns { get; set; }
|
||||
public DbSet<Coding> Codings { get; set; }
|
||||
public DbSet<SpecialCondition> SpecialConditions { get; set; }
|
||||
public DbSet<Company> Companies { get; set; }
|
||||
public DbSet<User> Users { get; set; }
|
||||
public DbSet<CalculationType> CalculationTypes { get; set; }
|
||||
public DbSet<Permission> Permissions { get; set; }
|
||||
public DbSet<PermissionPeriod> PermissionPeriods { get; set; }
|
||||
public DbSet<RolUser> RolUsers { get; set; }
|
||||
public DbSet<Customer> Customers { get; set; }
|
||||
public DbSet<CODUnit> CODUnits { get; set; }
|
||||
public DbSet<CODItem> CODItems { get; set; }
|
||||
public DbSet<Invoice> Invoices { get; set; }
|
||||
public DbSet<InvoiceItem> InvoiceItems { get; set; }
|
||||
public DbSet<InvoicePayment> InvoicePayments { get; set; }
|
||||
public DbSet<PermissionUser> PermissionUsers { get; set; }
|
||||
public DbSet<InvoiceStatusChang> InvoiceStatusChangs { get; set; }
|
||||
public DbSet<VerificationCode> VerificationCodes { get; set; }
|
||||
public DbSet<Pricing> Pricing { get; set; }
|
||||
public DbSet<Order> Orders { get; set; }
|
||||
public DbSet<OrderItem> OrderItems { get; set; }
|
||||
public DbSet<Notification> Notifications { get; set; }
|
||||
public DbSet<Question> Questions { get; set; }
|
||||
public DbSet<QuestionCategory> QuestionCategories { get; set; }
|
||||
public DbSet<Blog> Blogs { get; set; }
|
||||
public DbSet<Ticket> Tickets { get; set; }
|
||||
public DbSet<SubTicket> SubTickets { get; set; }
|
||||
public DbSet<OrderDiscountCode> OrderDiscountCodes { get; set; }
|
||||
public DbSet<TiceketUnknownPeople> TiceketUnknownPeoples { get; set; }
|
||||
public DbSet<SaleLead> SaleLeads { get; set; }
|
||||
#endregion
|
||||
//public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||
//{
|
||||
// foreach (var entry in ChangeTracker.Entries<EntityBase>())
|
||||
// {
|
||||
// switch (entry.State)
|
||||
// {
|
||||
// case EntityState.Added:
|
||||
// entry.Entity.CreateDate = "";
|
||||
// entry.Entity.CreatedBy = "mohammad";
|
||||
// break;
|
||||
// case EntityState.Modified:
|
||||
// entry.Entity.ModifiedDate = "";
|
||||
// entry.Entity.LastModifiedBy = "mohammad";
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// return base.SaveChangesAsync(cancellationToken);
|
||||
//}
|
||||
}
|
||||
}
|
235
Back/Data/Infrastructure/Repository/RepositoryBase.cs
Normal file
235
Back/Data/Infrastructure/Repository/RepositoryBase.cs
Normal file
@@ -0,0 +1,235 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Contracts;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TaxPayer.Infrastructure.Persistence;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
|
||||
namespace Back.Data.Infrastructure.Repository
|
||||
{
|
||||
public class RepositoryBase<T> : IAsyncRepository<T> where T : class
|
||||
{
|
||||
protected readonly SqlDbContext _dbContext;
|
||||
private DbSet<T> _query;
|
||||
public RepositoryBase(SqlDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_query = _dbContext.Set<T>();
|
||||
}
|
||||
public IQueryable<T> GetAll()
|
||||
{
|
||||
return _query.AsQueryable();
|
||||
}
|
||||
public IQueryable<T> Get(Expression<Func<T, bool>> predicate)
|
||||
{
|
||||
var query = _query.AsQueryable();
|
||||
query = query.AsNoTracking();
|
||||
return query.Where(predicate).AsQueryable();
|
||||
}
|
||||
|
||||
public IQueryable<T> Get(
|
||||
Expression<Func<T, bool>> predicate = null,
|
||||
Func<IQueryable<T>, IOrderedQueryable<T>> orderBy = null,
|
||||
string[] includeStrings = null,
|
||||
bool disableTracking = true)
|
||||
{
|
||||
var query = _query.AsQueryable();
|
||||
|
||||
if (disableTracking) query = query.AsNoTracking();
|
||||
if (includeStrings != null)
|
||||
{
|
||||
foreach (var includeString in includeStrings)
|
||||
if (!string.IsNullOrWhiteSpace(includeString)) query = query.Include(includeString);
|
||||
}
|
||||
|
||||
|
||||
if (predicate != null) query = query.Where(predicate);
|
||||
|
||||
if (orderBy != null)
|
||||
return orderBy(query).AsQueryable();
|
||||
|
||||
return query.AsQueryable();
|
||||
}
|
||||
|
||||
public IQueryable<T> Get(
|
||||
Expression<Func<T, bool>> predicate = null,
|
||||
Func<IQueryable<T>, IOrderedQueryable<T>> orderBy = null,
|
||||
List<Expression<Func<T, object>>> includes = null,
|
||||
bool disableTracking = true)
|
||||
{
|
||||
var query = _query.AsQueryable();
|
||||
|
||||
if (disableTracking) query = query.AsNoTracking();
|
||||
|
||||
if (includes != null) query = includes.Aggregate(query, (current, include) => current.Include(include));
|
||||
|
||||
if (predicate != null) query = query.Where(predicate);
|
||||
|
||||
if (orderBy != null)
|
||||
return orderBy(query).AsQueryable();
|
||||
|
||||
return query.AsQueryable();
|
||||
}
|
||||
|
||||
public async Task<T> AddAsync(T entity)
|
||||
{
|
||||
await _query.AddAsync(entity);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
return entity;
|
||||
}
|
||||
public T? Add(T entity)
|
||||
{
|
||||
_query.Add(entity);
|
||||
var res = _dbContext.SaveChanges();
|
||||
return res > 0 ? entity : null;
|
||||
//await _dbContext.SaveChangesAsync();
|
||||
//return entity;
|
||||
}
|
||||
public async Task<bool> AddRangeAsync(ICollection<T> entites)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _query.AddRangeAsync(entites);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public async Task<bool> UpdateAsync(T entity)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
_dbContext.Entry(entity).State = EntityState.Modified;
|
||||
var result = await _dbContext.SaveChangesAsync();
|
||||
return result > 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
public bool Update(T entity)
|
||||
{
|
||||
try
|
||||
{
|
||||
_dbContext.Update(entity);
|
||||
var result = _dbContext.SaveChanges();
|
||||
return result > 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<bool> DeleteAsync(T entity)
|
||||
{
|
||||
try
|
||||
{
|
||||
_query.Remove(entity);
|
||||
var res = await _dbContext.SaveChangesAsync();
|
||||
return res > 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<bool> DeleteRangeAsync(ICollection<T> entites)
|
||||
{
|
||||
try
|
||||
{
|
||||
_query.RemoveRange(entites);
|
||||
var res = await _dbContext.SaveChangesAsync();
|
||||
return res > 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<List<SqlParameter>> RunSP(string query, List<SqlParameter> parameters)
|
||||
{
|
||||
await _dbContext.Database.ExecuteSqlRawAsync(query, parameters);
|
||||
return parameters;
|
||||
}
|
||||
public async Task ExecuteSql(string query)
|
||||
{
|
||||
await _dbContext.Database.ExecuteSqlRawAsync(query);
|
||||
}
|
||||
public bool Delete(T entity)
|
||||
{
|
||||
_query.Remove(entity);
|
||||
var res = _dbContext.SaveChanges();
|
||||
return res > 0;
|
||||
}
|
||||
public async Task<bool> AddBoolResultAsync(T entity)
|
||||
{
|
||||
int a = 0;
|
||||
await _query.AddAsync(entity);
|
||||
try
|
||||
{
|
||||
a = await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
return a > 0;
|
||||
}
|
||||
public bool AddBoolResult(T entity)
|
||||
{
|
||||
_query.Add(entity);
|
||||
var res = _dbContext.SaveChanges();
|
||||
return res > 0;
|
||||
}
|
||||
public async Task<bool> UpdateRangeAsync(ICollection<T> entites)
|
||||
{
|
||||
try
|
||||
{
|
||||
//_dbContext.Entry(entites).State = EntityState.Modified;
|
||||
_dbContext.UpdateRange(entites);
|
||||
var result = await _dbContext.SaveChangesAsync();
|
||||
return result > 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public bool UpdateRange(ICollection<T> entites)
|
||||
{
|
||||
try
|
||||
{
|
||||
_dbContext.UpdateRange(entites);
|
||||
var result = _dbContext.SaveChanges();
|
||||
return result > 0;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Sample Inclucde List
|
||||
//new List<Expression<Func<AdmUsersPermission, object>>>
|
||||
// { x => x.System }
|
20
Back/Data/Models/BillType.cs
Normal file
20
Back/Data/Models/BillType.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class BillType
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public int ID { get; set; }
|
||||
public int inty { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Dec { get; set; }
|
||||
|
||||
|
||||
#region Navigation
|
||||
public virtual ICollection<Pattern> Patterns { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
13
Back/Data/Models/Blog.cs
Normal file
13
Back/Data/Models/Blog.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class Blog
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Text { get; set; }
|
||||
public byte[]? Photo { get; set; }
|
||||
public string Date { get; set; }
|
||||
public string Time { get; set; }
|
||||
public bool Status { get; set; }
|
||||
}
|
||||
}
|
26
Back/Data/Models/CODItem.cs
Normal file
26
Back/Data/Models/CODItem.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class CODItem
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int UnitID { get; set; }
|
||||
[MaxLength(13)]
|
||||
public string? ItemTaxID { get; set; }
|
||||
public int CompanyID { get; set; }
|
||||
public string Title { get; set; }
|
||||
public int TaxRate { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("UnitID")]
|
||||
public virtual CODUnit CODUnit { get; set; }
|
||||
[ForeignKey("CompanyID")]
|
||||
public virtual Company Company { get; set; }
|
||||
public virtual ICollection<InvoiceItem> invoiceDetails { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
17
Back/Data/Models/CODUnit.cs
Normal file
17
Back/Data/Models/CODUnit.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class CODUnit
|
||||
{
|
||||
|
||||
public int ID { get; set; }
|
||||
[MaxLength(8)]
|
||||
public string? UnitTaxID { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
#region Navigation
|
||||
public virtual ICollection<CODItem> CODItemS { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
15
Back/Data/Models/CalculationType.cs
Normal file
15
Back/Data/Models/CalculationType.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class CalculationType
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Title { get; set; }
|
||||
#region Navigation
|
||||
public virtual ICollection<PermissionPeriod> permissionPeriods { get; set; }
|
||||
#endregion
|
||||
|
||||
}
|
||||
//a number
|
||||
//unlimited
|
||||
}
|
19
Back/Data/Models/Coding.cs
Normal file
19
Back/Data/Models/Coding.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
[PrimaryKey("FildID", "Code")]
|
||||
public class Coding
|
||||
{
|
||||
public int FildID { get; set; }
|
||||
[Column(TypeName = "varchar(10)")]
|
||||
public string Code { get; set; }
|
||||
public string Title { get; set; }
|
||||
#region Navigation
|
||||
|
||||
[ForeignKey("FildID")]
|
||||
public virtual Fild Fild { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
26
Back/Data/Models/Company.cs
Normal file
26
Back/Data/Models/Company.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class Company
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
public string Mobile { get; set; }
|
||||
public string? BranchID { get; set; }
|
||||
public string? EconomicCode { get; set; }
|
||||
public string? UniqeMemory { get; set; }
|
||||
public string? PrivateKey { get; set; }
|
||||
public byte[]? Logo { get; set; }
|
||||
public string RegisterDate { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
#region Navigation
|
||||
public virtual ICollection<CODItem> CODItemS { get; set; }
|
||||
public virtual ICollection<RolUser> RolUsers { get; set; }
|
||||
public virtual ICollection<PermissionPeriod> PermissionPeriods { get; set; }
|
||||
public virtual ICollection<Customer> Customers { get; set; }
|
||||
public virtual ICollection<Invoice> invoices { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
35
Back/Data/Models/Customer.cs
Normal file
35
Back/Data/Models/Customer.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Back.Common.Enums;
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
|
||||
public class Customer
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public CustomerType CustomerType { get; set; }
|
||||
public string FullName { get; set; }
|
||||
public string? EconomicCode { get; set; }
|
||||
public string? Phone { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public string? Info { get; set; }
|
||||
public int CompanyID { get; set; }
|
||||
[MaxLength(10)]
|
||||
public string? ZipCode { get; set; }
|
||||
[MaxLength(10)]
|
||||
public string? BranchID { get; set; }
|
||||
[MaxLength(14)]
|
||||
public string? MeliCode { get; set; }
|
||||
[MaxLength(9)]
|
||||
public string? PassportNumber { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
#region Navigation
|
||||
|
||||
[ForeignKey("CompanyID")]
|
||||
public virtual Company Company { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
24
Back/Data/Models/Fild.cs
Normal file
24
Back/Data/Models/Fild.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class Fild
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public int ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string InputBox { get; set; }
|
||||
|
||||
#region Navigation
|
||||
public virtual ICollection<FildModeInPattern> FildModeInPatterns { get; set; }
|
||||
public virtual ICollection<Coding> Codings { get; set; }
|
||||
[NotMapped]
|
||||
public ICollection<SpecialCondition> specialConditions { get; set; }
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
18
Back/Data/Models/FildMode.cs
Normal file
18
Back/Data/Models/FildMode.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class FildMode
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public int ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
#region Navigation
|
||||
public virtual ICollection<FildModeInPattern> FildModeInPatterns { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
27
Back/Data/Models/FildModeInPattern.cs
Normal file
27
Back/Data/Models/FildModeInPattern.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
[PrimaryKey("FildID", "PatternID", "FildModeID")]
|
||||
public class FildModeInPattern
|
||||
{
|
||||
|
||||
public int FildID { get; set; }
|
||||
public int PatternID { get; set; }
|
||||
public int FildModeID { get; set; }
|
||||
|
||||
#region Navigation
|
||||
|
||||
[ForeignKey("FildID")]
|
||||
public virtual Fild Fild { get; set; }
|
||||
|
||||
[ForeignKey("PatternID")]
|
||||
public virtual Pattern pattern { get; set; }
|
||||
|
||||
[ForeignKey("FildModeID")]
|
||||
public virtual FildMode FildMode { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
176
Back/Data/Models/Invoice.cs
Normal file
176
Back/Data/Models/Invoice.cs
Normal file
@@ -0,0 +1,176 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Back.Common;
|
||||
using Back.Common.Enums;
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class Invoice
|
||||
{
|
||||
#region Key
|
||||
public int ID { get; set; }
|
||||
public int? PatternID { get; set; }
|
||||
public int? CompanyID { get; set; }
|
||||
public int CustomerID { get; set; }
|
||||
public int? BillReference { get; set; }
|
||||
#endregion
|
||||
|
||||
#region autofild
|
||||
//سریال صورتحساب داخلی حافظه مالیاتی
|
||||
[MaxLength(10)]
|
||||
public string? inno { get { return ID.ToString("0000000000"); } }
|
||||
//تاریخ و زمان صدور صورتحساب )میالدی(
|
||||
[MaxLength(13)]
|
||||
public long? indatim { get { return new DateTimeOffset(InvoicIssueDate.Trim().ToMiladi()).ToUnixTimeMilliseconds(); } }
|
||||
//تاریخ و زمان ایجاد صورتحساب )میالدی(
|
||||
[MaxLength(15)]
|
||||
public long? Indati2m { get { return new DateTimeOffset(InvoiceDate.Trim().ToMiladi()).ToUnixTimeMilliseconds(); } }
|
||||
//نوع صورتحساب
|
||||
[MaxLength(1)]
|
||||
public int? inty { get { return pattern.BillType.inty; } }
|
||||
//الگوی صورتحساب
|
||||
[MaxLength(2)]
|
||||
public int? inp { get { return pattern.inp; } }
|
||||
//شماره اقتصادی فروشنده
|
||||
[MaxLength(14)]
|
||||
public string? tins { get { return company.EconomicCode; } }
|
||||
//شماره اقتصادی خریدار
|
||||
[MaxLength(14)]
|
||||
public string? tinb { get { return Customer.EconomicCode; } }
|
||||
//مجموع مبلغ قبل از کسر تخفیف
|
||||
[MaxLength(18)]
|
||||
public decimal? tprdis { get { return invoiceDetails.Sum(i => i.prdis); } }
|
||||
//مجموع تخفیفات
|
||||
[MaxLength(18)]
|
||||
public decimal? tdis { get { return invoiceDetails.Sum(i => i.dis); } }
|
||||
//مجموع مبلغ پس از کسر تخفیف
|
||||
[MaxLength(18)]
|
||||
public decimal? tadis { get { return invoiceDetails.Sum(i => i.adis); } }
|
||||
//مجموع مالیات بر ارزش افزوده
|
||||
[MaxLength(18)]
|
||||
public decimal? tvam { get { return invoiceDetails.Sum(i => i.vam); } }
|
||||
//مجموع سایر مالیات، عوارض و وجوه قانونی
|
||||
[MaxLength(18)]
|
||||
public decimal? todam { get { return invoiceDetails.Sum(i => i.odam) + invoiceDetails.Sum(i => i.olam); } }
|
||||
//مجموع صورتحساب
|
||||
[MaxLength(18)]
|
||||
public decimal? tbill { get {return pattern.inp==10? torv+ tvam+ todam : invoiceDetails.Sum(i => i.tsstam);}}
|
||||
//مجموع وزن خالص
|
||||
[MaxLength(18)]
|
||||
public decimal? tonw { get { return invoiceDetails.Sum(i => i.nw); } }
|
||||
//مجموع ارزش ریالی
|
||||
[MaxLength(18)]
|
||||
public decimal? torv { get { return invoiceDetails.Sum(i => i.ssrv); } }
|
||||
//مجموع ارزش ارزی
|
||||
[MaxLength(18)]
|
||||
public decimal? tocv { get { return invoiceDetails.Sum(i => i.sscv); } }
|
||||
//مجموع سهم مالیات بر ارزش افزوده از پرداخت
|
||||
[MaxLength(18)]
|
||||
public decimal? tvop { get { return invoiceDetails.Sum(i => i.vop); } }
|
||||
//نوع شخص خریدار
|
||||
[MaxLength(1)]
|
||||
public int tob { get { return (int)Customer.CustomerType; } }
|
||||
//اریخ کوتاژ اظهارنامه گمرکی
|
||||
// Unix Time => from fild CottageDateOfCustomsDeclaration
|
||||
[MaxLength(5)]
|
||||
public long? cdcd { get { return new DateTimeOffset(CottageDateOfCustomsDeclaration.Trim().ToMiladi()).ToUnixTimeMilliseconds(); } }
|
||||
//کد پستی خریدار
|
||||
[MaxLength(10)]
|
||||
public string? bpc { get { return Customer.ZipCode; } }
|
||||
//کد شعبه خریدار
|
||||
[MaxLength(10)]
|
||||
public string? bbc { get { return Customer.BranchID; } }
|
||||
//شناسه ملی/ شماره ملی/ شناسه مشارکت مدنی/ کد فراگیر اتباع غیرایرانی خریدار
|
||||
[MaxLength(14)]
|
||||
public string? bid { get { return Customer.MeliCode; } }
|
||||
//شماره گذرنامه خریدار
|
||||
[MaxLength(9)]
|
||||
public string? bpn { get { return Customer.PassportNumber; } }
|
||||
//کد شعبه فروشنده
|
||||
[MaxLength(9)]
|
||||
public string? sbc { get { return company.BranchID; } }
|
||||
//مبلغ پرداختی نقدی
|
||||
[MaxLength(18)]
|
||||
public decimal? cap { get { return insp - tvam - todam - tbill; } }
|
||||
//موضوع صورتحساب
|
||||
[MaxLength(1)]
|
||||
public int? ins { get { return (int)invoiceType; } }
|
||||
#endregion
|
||||
|
||||
#region fild
|
||||
public string Title { get; set; }
|
||||
public string Des { get; set; }
|
||||
public InvoiceType invoiceType { get; set; }
|
||||
//شماره منحصر به فرد مالیاتی
|
||||
[MaxLength(22)]
|
||||
public string? taxid { get; set; }
|
||||
//شماره منحصر به فرد مالیاتی صورتحساب مرجع
|
||||
[MaxLength(22)]
|
||||
public string? irtaxid { get; set; }
|
||||
//نوع پرواز
|
||||
[MaxLength(9)]
|
||||
public int? ft { get; set; }
|
||||
//شماره پروانه گمرکی
|
||||
[MaxLength(14)]
|
||||
public string? scln { get; set; }
|
||||
//کد گمرک محل اظهار فروشنده
|
||||
[MaxLength(5)]
|
||||
public string? scc { get; set; }
|
||||
//شناسه یکتای ثبت قرارداد فروشنده
|
||||
[MaxLength(12)]
|
||||
public string? crn { get; set; }
|
||||
//شماره کوتاژ اظهارنامه گمرکی
|
||||
[MaxLength(14)]
|
||||
public string? cdcn { get; set; }
|
||||
//اریخ کوتاژ اظهارنامه گمرکی
|
||||
// Unix Time
|
||||
[MaxLength(5)]
|
||||
public string? CottageDateOfCustomsDeclaration { get; set; }
|
||||
//شماره اشتراک/ شناسه قبض بهرهبردار
|
||||
[MaxLength(19)]
|
||||
public string? billid { get; set; }
|
||||
//روش تسویه
|
||||
private int? _setm;
|
||||
[MaxLength(1)]
|
||||
public int? setm { get { return pattern.BillTypeID == 3 || pattern.BillTypeID == 4 || pattern.inp==8
|
||||
? 1
|
||||
:_setm; }
|
||||
set { _setm = value; }
|
||||
}
|
||||
//مبلغ نسیه
|
||||
[MaxLength(18)]
|
||||
public decimal? insp { get; set; }
|
||||
//مالیات موضوع ماده 17
|
||||
[MaxLength(18)]
|
||||
public string? seventeentax { get; set; }
|
||||
//نکته باید به شمسی تبدیل شود
|
||||
public string? Cdate { get; set; }
|
||||
//تفاوت نرخ خرید و فروش ارز/ کارمزد فروش ارز
|
||||
[MaxLength(26)]
|
||||
public decimal? pspd { get; set; }
|
||||
public string? Udate { get; set; }
|
||||
public string InvoicIssueDate { get; set; }
|
||||
public string InvoiceDate { get; set; }
|
||||
public bool PreparedtoSendtoTax { get; set; } = false;
|
||||
public int LastChangeUserID { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("CustomerID")]
|
||||
public virtual Customer Customer { get; set; }
|
||||
[ForeignKey("LastChangeUserID")]
|
||||
public virtual User user { get; set; }
|
||||
public virtual ICollection<InvoiceItem> invoiceDetails { get; set; }
|
||||
[ForeignKey("BillReference")]
|
||||
public virtual Invoice? invoice { get; set; }
|
||||
public virtual ICollection<InvoicePayment> payments { get; set; }
|
||||
public virtual ICollection<InvoiceStatusChang> invoiceStatusChangs { get; set; }
|
||||
public virtual ICollection<SentTax> sentTax { get; set; }
|
||||
[ForeignKey("PatternsID")]
|
||||
public virtual Pattern? pattern { get; set; }
|
||||
[ForeignKey("CompanyID")]
|
||||
public virtual Company? company { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
135
Back/Data/Models/InvoiceItem.cs
Normal file
135
Back/Data/Models/InvoiceItem.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class InvoiceItem
|
||||
{
|
||||
#region Key
|
||||
public int ID { get; set; }
|
||||
public int CODID { get; set; }
|
||||
public int? InvoiceID { get; set; }
|
||||
#endregion
|
||||
|
||||
#region autofild
|
||||
//شناسه کاال/خدمت
|
||||
[MaxLength(13)]
|
||||
// [DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public string? sstid { get { return cODItem.ItemTaxID; } }
|
||||
// شرح کاال/خدمت
|
||||
[MaxLength(13)]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public string? sstt { get { return cODItem.Title; } }
|
||||
//واحد اندازهگیری
|
||||
[MaxLength(8)]
|
||||
public string? mu { get { return cODItem.CODUnit.UnitTaxID; } }
|
||||
//میزان ارز
|
||||
[MaxLength(18)]
|
||||
public decimal? cfee { get { return fee / exr; } }
|
||||
//مبلغ مالیات بر ارزش افزوده
|
||||
[MaxLength(18)]
|
||||
public decimal? vam { get
|
||||
{
|
||||
return invoice.pattern.inp == 9 ? fee*vra/100 :
|
||||
invoice.pattern.inp == 13 ? ((tcpbs+9)/100)+((prdis*vra)/100)
|
||||
: vra * adis / 100;
|
||||
} }
|
||||
//جمع کل اجرت ،حق العمل و سود
|
||||
[MaxLength(18)]
|
||||
public decimal? tcpbs { get { return consfee + spro + bros; } }
|
||||
//سهم نقدی از پرداخت
|
||||
[MaxLength(18)]
|
||||
public decimal? cop { get { return (tsstam * invoice.cap) / invoice.tadis; } }
|
||||
//سهم مالیات بر ارزش افزوده از پرداخت
|
||||
[MaxLength(18)]
|
||||
public decimal? vop { get { return vra == 0 ? 0 : (vam * invoice.cap) / invoice.tadis; } }
|
||||
//مبلغ کل کالا/خدمت
|
||||
[MaxLength(18)]
|
||||
public decimal? tsstam { get
|
||||
{
|
||||
return invoice.pattern.inp == 9 ? fee+vam :
|
||||
invoice.pattern.inp == 10 ? sscv + vam + odam + olam :
|
||||
invoice.pattern.inp == 4 ? prdis + vam + odam + olam :
|
||||
vam + adis + odam + olam;
|
||||
} }
|
||||
//مبلغ بعد از تخفیف
|
||||
[MaxLength(18)]
|
||||
public decimal? adis { get
|
||||
{
|
||||
return invoice.pattern.inp == 13 ? prdis+ tcpbs - dis: prdis - dis;
|
||||
} }
|
||||
//مبلغ قبل از تخفیف
|
||||
[MaxLength(18)]
|
||||
public decimal? prdis { get { return am * fee; } }
|
||||
//نرخ مالیات بر ازش افزوده
|
||||
[MaxLength(5)]
|
||||
public decimal? vra { get { return cODItem.TaxRate; } }
|
||||
#endregion
|
||||
|
||||
#region fild
|
||||
//تعداد/مقدار
|
||||
[MaxLength(36)]
|
||||
public decimal? am { get; set; }
|
||||
//وزن خالص
|
||||
[MaxLength(23)]
|
||||
public decimal? nw { get; set; }
|
||||
//مبلغ واحد
|
||||
[MaxLength(36)]
|
||||
public decimal? fee { get; set; }
|
||||
//نوع ارز
|
||||
[MaxLength(4)]
|
||||
public string? cut { get; set; }
|
||||
//نرخ برابری ارز با ریال
|
||||
[MaxLength(18)]
|
||||
public decimal? exr { get; set; }
|
||||
//ارزش ریالی کالا
|
||||
[MaxLength(18)]
|
||||
public decimal? ssrv { get; set; }
|
||||
//ارزش ارزی کالا
|
||||
[MaxLength(18)]
|
||||
public decimal? sscv { get; set; }
|
||||
//مبلغ تخفیف
|
||||
[MaxLength(18)]
|
||||
public decimal? dis { get; set; }
|
||||
//موضوع سایر مالیات و عوارض
|
||||
[MaxLength(255)]
|
||||
public string? odt { get; set; }
|
||||
//نرخ سایرمالیات و عوارض
|
||||
[MaxLength(5)]
|
||||
public decimal? odr { get; set; }
|
||||
//مبلغ سایر مالیات و عواض
|
||||
[MaxLength(18)]
|
||||
public decimal? odam { get; set; }
|
||||
//موضوع سایر وجوه قانونی
|
||||
[MaxLength(255)]
|
||||
public string? olt { get; set; }
|
||||
//نرخ سایروجوه قانونی
|
||||
[MaxLength(5)]
|
||||
public decimal? olr { get; set; }
|
||||
//مبلغ سایر وجوه قانونی
|
||||
[MaxLength(18)]
|
||||
public decimal? olam { get; set; }
|
||||
//اجرت دساخت
|
||||
[MaxLength(18)]
|
||||
public decimal? consfee { get; set; }
|
||||
//سود فروشنده
|
||||
[MaxLength(18)]
|
||||
public decimal? spro { get; set; }
|
||||
//حق العمل
|
||||
[MaxLength(18)]
|
||||
public decimal? bros { get; set; }
|
||||
//شناسه یکتای ثبت قرارداد حق العمل کاری
|
||||
[MaxLength(12)]
|
||||
public string? bsrn { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("InvoiceID")]
|
||||
public virtual Invoice? invoice { get; set; }
|
||||
|
||||
[ForeignKey("CODID")]
|
||||
public virtual CODItem cODItem { get; set; }
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
53
Back/Data/Models/InvoicePayment.cs
Normal file
53
Back/Data/Models/InvoicePayment.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using Back.Common;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class InvoicePayment
|
||||
{
|
||||
#region Key
|
||||
public int ID { get; set; }
|
||||
public int InvoiceID { get; set; }
|
||||
#endregion
|
||||
|
||||
#region autofild
|
||||
//تاریخ و زمان پرداخت
|
||||
[MaxLength(13)]
|
||||
public long? pdt { get { return new DateTimeOffset(PaymentDateTime.Trim().ToMiladi()).ToUnixTimeMilliseconds(); } }
|
||||
#endregion
|
||||
|
||||
#region fild
|
||||
//شماره سوییچ پرداخت
|
||||
[MaxLength(9)]
|
||||
public string? iinn { get; set; }
|
||||
//شماره پذیرنده فروشگاهی
|
||||
[MaxLength(14)]
|
||||
public string? acn { get; set; }
|
||||
//شماره پایانه
|
||||
[MaxLength(8)]
|
||||
public string? trmn { get; set; }
|
||||
//روش پرداخت
|
||||
[MaxLength(2)]
|
||||
public int? pmt { get; set; }
|
||||
//شماره پیگیری/شماره مرجع
|
||||
[MaxLength(14)]
|
||||
public string? trn { get; set; }
|
||||
//شماره کارت پرداخت کننده صورتحساب
|
||||
[MaxLength(16)]
|
||||
public string? pcn { get; set; }
|
||||
//شماره/شناسه ملی/کد فراگیر اتباع غیر ایرانی پرداخت کننده صورتحساب
|
||||
[MaxLength(12)]
|
||||
public string? pid { get; set; }
|
||||
public string PaymentDateTime { get; set; }
|
||||
//مبلغ پرداختی
|
||||
[MaxLength(18)]
|
||||
public long? pv { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("InvoiceID")]
|
||||
public virtual Invoice invoice { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
21
Back/Data/Models/InvoiceStatusChang.cs
Normal file
21
Back/Data/Models/InvoiceStatusChang.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class InvoiceStatusChang
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int? InvoiceID { get; set; }
|
||||
public string FromStatus { get; set; }
|
||||
public string ToStatus { get; set; }
|
||||
public string Date { get; set; }
|
||||
public int? UserID { get; set; }
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("UserID")]
|
||||
public virtual User? user { get; set; }
|
||||
[ForeignKey("InvoiceID")]
|
||||
public virtual Invoice? invoice { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
12
Back/Data/Models/Mongodb/SystemLog.cs
Normal file
12
Back/Data/Models/Mongodb/SystemLog.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace TaxPayer.Models.Mongodb
|
||||
{
|
||||
public class SystemLog
|
||||
{
|
||||
public string TraceIdentifierID { get; set; }
|
||||
public string Datetime { get; set; }
|
||||
public string Route { get; set; }
|
||||
public string Method { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
13
Back/Data/Models/Notification.cs
Normal file
13
Back/Data/Models/Notification.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class Notification
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int Type { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string? Path { get; set; }
|
||||
public string? ViewSize { get; set; }
|
||||
public string Date { get; set; }
|
||||
public bool Status { get; set; }
|
||||
}
|
||||
}
|
26
Back/Data/Models/Order.cs
Normal file
26
Back/Data/Models/Order.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Back.Common.Enums;
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
|
||||
public class Order
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int CompanyID { get; set; }
|
||||
public int UserID { get; set; }
|
||||
public StatusOrder Status { get; set; }
|
||||
public string DateCreate { get; set; }
|
||||
public string ApprovalDate { get; set; }
|
||||
public decimal PreDiscount { get { return OrderItems.Sum(s => s.Total); } }
|
||||
public decimal TDiscount { get; set; } = 0;
|
||||
public decimal TPrice { get { return OrderItems.Sum(s => s.Total) - TDiscount; } }
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("CompanyID")]
|
||||
public virtual Company Company { get; set; }
|
||||
[ForeignKey("UserID")]
|
||||
public virtual User User { get; set; }
|
||||
public virtual ICollection<OrderItem> OrderItems { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
10
Back/Data/Models/OrderDiscountCode.cs
Normal file
10
Back/Data/Models/OrderDiscountCode.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class OrderDiscountCode
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int Code { get; set; }
|
||||
public int Val { get; set; }
|
||||
public bool Status { get; set; }
|
||||
}
|
||||
}
|
26
Back/Data/Models/OrderItem.cs
Normal file
26
Back/Data/Models/OrderItem.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class OrderItem
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int OrderID { get; set; }
|
||||
public int PermissionID { get; set; }
|
||||
public int CalculationTypeID { get; set; }
|
||||
public int CreditAmount { get; set; }
|
||||
public decimal APrice { get; set; }
|
||||
public decimal Discount { get; set; }
|
||||
public decimal Tax { get; set; }
|
||||
public decimal Total { get { return (CreditAmount * APrice) - Discount + Tax; } }
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("OrderID")]
|
||||
public virtual Order Order { get; set; }
|
||||
[ForeignKey("PermissionID")]
|
||||
public virtual Permission Permission { get; set; }
|
||||
[ForeignKey("CalculationTypeID")]
|
||||
public virtual CalculationType CalculationType { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
21
Back/Data/Models/Pattern.cs
Normal file
21
Back/Data/Models/Pattern.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class Pattern
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public int ID { get; set; }
|
||||
public int inp { get; set; }
|
||||
public int BillTypeID { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Dec { get; set; }
|
||||
public bool Status { get; set; }
|
||||
#region Navigation
|
||||
public virtual BillType BillType { get; set; }
|
||||
public virtual ICollection<FildModeInPattern> FildModeInPatterns { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
19
Back/Data/Models/Permission.cs
Normal file
19
Back/Data/Models/Permission.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class Permission
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int ParentID { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
#region Navigation
|
||||
public virtual ICollection<PermissionUser> RolUsers { get; set; }
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
25
Back/Data/Models/PermissionPeriod.cs
Normal file
25
Back/Data/Models/PermissionPeriod.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
[PrimaryKey("CompanyID", "PermissionID", "CalculationTypeID")]
|
||||
public class PermissionPeriod
|
||||
{
|
||||
public int CompanyID { get; set; }
|
||||
public int PermissionID { get; set; }
|
||||
public int TotalAmount { get; set; }
|
||||
public int RemainingAmount { get; set; }
|
||||
public int CalculationTypeID { get; set; }
|
||||
public bool? IsLocked { get; set; }
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("CompanyID")]
|
||||
public virtual Company Company { get; set; }
|
||||
[ForeignKey("PermissionID")]
|
||||
public virtual Permission Permission { get; set; }
|
||||
[ForeignKey("CalculationTypeID")]
|
||||
public virtual CalculationType CalculationType { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
19
Back/Data/Models/PermissionUser.cs
Normal file
19
Back/Data/Models/PermissionUser.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
[PrimaryKey("PermissionID", "RolUserID")]
|
||||
public class PermissionUser
|
||||
{
|
||||
public int PermissionID { get; set; }
|
||||
public int RolUserID { get; set; }
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("RolUserID")]
|
||||
public virtual RolUser RolUser { get; set; }
|
||||
[ForeignKey("PermissionID")]
|
||||
public virtual Permission Permission { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
21
Back/Data/Models/Pricing.cs
Normal file
21
Back/Data/Models/Pricing.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
// قیمت گداری
|
||||
public class Pricing
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int PermissionID { get; set; }
|
||||
public int CalculationTypeID { get; set; }
|
||||
public decimal Price { get; set; }
|
||||
|
||||
#region Navigation
|
||||
|
||||
[ForeignKey("PermissionID")]
|
||||
public virtual Permission Permission { get; set; }
|
||||
[ForeignKey("CalculationTypeID")]
|
||||
public virtual CalculationType CalculationType { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
28
Back/Data/Models/Question.cs
Normal file
28
Back/Data/Models/Question.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class QuestionCategory
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Title { get; set; }
|
||||
|
||||
#region Navigation
|
||||
public virtual ICollection<Question> questions { get; set; }
|
||||
#endregion
|
||||
}
|
||||
public class Question
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int QuestionCategoryID { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Answer { get; set; }
|
||||
public bool Status { get; set; }
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("QuestionCategoryID")]
|
||||
public virtual QuestionCategory questionCategory { get; set; }
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
21
Back/Data/Models/RolUser.cs
Normal file
21
Back/Data/Models/RolUser.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
|
||||
public class RolUser
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int UserID { get; set; }
|
||||
public int CompanyID { get; set; }
|
||||
public bool IsAdmin { get; set; }
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("UserID")]
|
||||
public virtual User User { get; set; }
|
||||
[ForeignKey("CompanyID")]
|
||||
public virtual Company Company { get; set; }
|
||||
public virtual ICollection<PermissionUser> rolePermissions { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
16
Back/Data/Models/SaleLead.cs
Normal file
16
Back/Data/Models/SaleLead.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class SaleLead
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string cn { get; set; }
|
||||
public string sn { get; set; }
|
||||
public string company { get; set; }
|
||||
public string Mobile { get; set; }
|
||||
public string Key { get; set; }
|
||||
public string csr { get; set; }
|
||||
}
|
||||
}
|
26
Back/Data/Models/SentTax.cs
Normal file
26
Back/Data/Models/SentTax.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Back.Common.Enums;
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class SentTax
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int InvoiceID { get; set; }
|
||||
public string Date { get; set; }
|
||||
public string Time { get; set; }
|
||||
public string uId { get; set; }
|
||||
public string ReferenceNumber { get; set; }
|
||||
public InvoiceType InvoiceType { get; set; }
|
||||
[Column(TypeName = "nvarchar(MAX)")]
|
||||
public string InvoiceModel { get; set; }
|
||||
[Column(TypeName = "nvarchar(MAX)")]
|
||||
public string? ResponseModel { get; set; }
|
||||
public SentStatus SentStatus { get; set; }
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("InvoiceID")]
|
||||
public virtual Invoice invoice { get; set; }
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
17
Back/Data/Models/SpecialCondition.cs
Normal file
17
Back/Data/Models/SpecialCondition.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
[Keyless]
|
||||
public class SpecialCondition
|
||||
{
|
||||
public int FildID { get; set; }
|
||||
public string condition { get; set; }
|
||||
#region Navigation
|
||||
|
||||
[ForeignKey("FildID")]
|
||||
public virtual Fild Fild { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
23
Back/Data/Models/SubTicket.cs
Normal file
23
Back/Data/Models/SubTicket.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Back.Common.Enums;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
|
||||
public class SubTicket
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public int TicketID { get; set; }
|
||||
public string Text { get; set; }
|
||||
public string Date { get; set; }
|
||||
public string Time { get; set; }
|
||||
public SideType Type { get; set; }
|
||||
|
||||
#region Navigation
|
||||
[ForeignKey("TicketID")]
|
||||
public virtual Ticket Ticket { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
9
Back/Data/Models/TiceketUnknownPeople.cs
Normal file
9
Back/Data/Models/TiceketUnknownPeople.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class TiceketUnknownPeople
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Mobile { get; set; }
|
||||
public string FullName { get; set; }
|
||||
}
|
||||
}
|
23
Back/Data/Models/Ticket.cs
Normal file
23
Back/Data/Models/Ticket.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Back.Common.Enums;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
//حتما مدیر میخواد
|
||||
|
||||
public class Ticket
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string CompanyIDOrMobile { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string CreateDate { get; set; }
|
||||
public string CreateTime { get; set; }
|
||||
public string? EndDate { get; set; }
|
||||
public string? EndTime { get; set; }
|
||||
public StatusTicket Status { get; set; }
|
||||
|
||||
#region Navigation
|
||||
public virtual ICollection<SubTicket> SubTickets { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
23
Back/Data/Models/User.cs
Normal file
23
Back/Data/Models/User.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Fullname { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string Mobile { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public byte[]? Photo { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
[Column(TypeName = "varchar(max)")]
|
||||
public string? Token { get; set; }
|
||||
public string? DateLastLogin { get; set; }
|
||||
#region Navigation
|
||||
public virtual ICollection<RolUser> RolUsers { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
15
Back/Data/Models/ValidationCode.cs
Normal file
15
Back/Data/Models/ValidationCode.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
||||
namespace Back.Data.Models
|
||||
{
|
||||
public class VerificationCode
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public int ID { get; set; }
|
||||
public string prm { get; set; }
|
||||
public string val { get; set; }
|
||||
public string Type { get; set; }
|
||||
}
|
||||
}
|
@@ -1,3 +1,9 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Infrastructure.Repository;
|
||||
using Back.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TaxPayer.Infrastructure.Persistence;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
@@ -6,6 +12,23 @@ builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.AddDbContext<SqlDbContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("Base"));
|
||||
});
|
||||
builder.Services.AddScoped(typeof(IAsyncRepository<>), typeof(RepositoryBase<>));
|
||||
builder.Services.AddScoped<Back.Services.ServBase>();
|
||||
string origins = "OriginTaxPayer";
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy(origins,
|
||||
policy =>
|
||||
{
|
||||
policy.WithOrigins("http://localhost:5107")
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod();
|
||||
});
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
@@ -17,7 +40,7 @@ if (app.Environment.IsDevelopment())
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseCors(origins);
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
27
Back/Services/ServBase.cs
Normal file
27
Back/Services/ServBase.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.DTOs;
|
||||
|
||||
namespace Back.Services
|
||||
{
|
||||
public class ServBase
|
||||
{
|
||||
private readonly IAsyncRepository<Pricing> _repoPricing;
|
||||
public ServBase(IAsyncRepository<Pricing> repoPricing)
|
||||
{
|
||||
_repoPricing = repoPricing;
|
||||
}
|
||||
public async Task<List<BasePriceDto>> GetBasePrice()
|
||||
{
|
||||
return await _repoPricing.GetAll().Select(x => new BasePriceDto
|
||||
{
|
||||
Price = x.Price,
|
||||
CalculationType = x.CalculationTypeID==1 ? "واحدی"
|
||||
: x.CalculationTypeID == 1 && x.PermissionID==16 ? "هر ارسال"
|
||||
: x.CalculationTypeID == 2 ? "نامحدود" : "روزانه",
|
||||
PermissionID=x.PermissionID,
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
namespace Back
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
@@ -4,5 +4,12 @@
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"Base": "Data Source=195.88.208.142;Initial Catalog=TaxPayer020713;User ID=sa;Password=M439610m@;TrustServerCertificate=True"
|
||||
|
||||
},
|
||||
"Fixedvalues": {
|
||||
"Jwt_Lifetime_Minutes": "60"
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +0,0 @@
|
||||
namespace Shared
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
9
Shared/DTOs/BasePriceDto.cs
Normal file
9
Shared/DTOs/BasePriceDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Shared.DTOs
|
||||
{
|
||||
public class BasePriceDto
|
||||
{
|
||||
public int PermissionID { get; set; }
|
||||
public string CalculationType { get; set; }
|
||||
public decimal Price { get; set; }
|
||||
}
|
||||
}
|
@@ -1,9 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -11,4 +13,11 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Shared\Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<div class="tp-rank__area pb-200">
|
||||
@using Shared.DTOs
|
||||
@inject HttpClient _hc
|
||||
<div class="tp-rank__area pb-200">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xl-5 col-lg-5 order-1 order-lg-1">
|
||||
@@ -45,7 +47,7 @@
|
||||
</div>
|
||||
<div class="tp-rank__company-info">
|
||||
<a>صدور انواع فاکتور</a><br />
|
||||
<span>روزانه</span> <span>10000 تومان</span>
|
||||
<span>@GetTypeService(3)</span> <span>@GetPriceService(3).ToString("N0") تومان</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tp-rank__item p-relative">
|
||||
@@ -54,8 +56,9 @@
|
||||
</div>
|
||||
<div class="tp-rank__company-info">
|
||||
<a>مشتری جدید</a><br />
|
||||
<span>واحدی</span> <span>8500 تومان</span>
|
||||
<span>@GetTypeService(5)</span> <span>@GetPriceService(5).ToString("N0") تومان</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="tp-rank__item p-relative z-index">
|
||||
<div class="tp-rank__company">
|
||||
@@ -63,7 +66,7 @@
|
||||
</div>
|
||||
<div class="tp-rank__company-info">
|
||||
<a>کالای جدید</a><br />
|
||||
<span>واحدی</span> <span>10000 تومان</span>
|
||||
<span>@GetTypeService(4)</span> <span>@GetPriceService(4).ToString("N0") تومان</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tp-rank__item p-relative">
|
||||
@@ -72,7 +75,7 @@
|
||||
</div>
|
||||
<div class="tp-rank__company-info">
|
||||
<a>سامانه مودیان</a><br />
|
||||
<span>هر ارسال</span> <span>8500 تومان</span>
|
||||
<span>@GetTypeService(16)</span> <span>@GetPriceService(16).ToString("N0") تومان</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -81,7 +84,25 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@functions{
|
||||
private string GetTypeService(int permissionID){
|
||||
var type = Models.Where(w => w.PermissionID == permissionID).Select(s => s.CalculationType).FirstOrDefault() ;
|
||||
if (type==null)
|
||||
type = "";
|
||||
|
||||
@code {
|
||||
|
||||
return type;
|
||||
}
|
||||
private decimal GetPriceService(int permissionID)
|
||||
=> Models.Where(w => w.PermissionID == permissionID).Select(s => s.Price).FirstOrDefault();
|
||||
}
|
||||
@code {
|
||||
List<BasePriceDto> Models = new List<BasePriceDto>();
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
Models = await _hc.GetFromJsonAsync<List<BasePriceDto>>("Base/BasePrice");
|
||||
await base.OnParametersSetAsync();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,14 @@
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using Front;
|
||||
using System.Globalization;
|
||||
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
|
||||
|
||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
|
Reference in New Issue
Block a user