....
This commit is contained in:
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; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user