This commit is contained in:
mmrbnjd
2024-08-09 19:35:50 +03:30
parent 70df7d48b4
commit 3a4eb0a4de
5 changed files with 41 additions and 20 deletions

View File

@@ -50,6 +50,7 @@ namespace TaxPayer.Infrastructure.Persistence
public DbSet<Promotion> Promotions { get; set; }
public DbSet<PromotionDetails> PromotionDetails { get; set; }
public DbSet<CreditDocuments> CreditDocuments { get; set; }
public DbSet<Condition> Conditions { get; set; }
#endregion
//public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
//{

View File

@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Back.Data.Models
{
public class Condition
{
public int ID { get; set; }
public int fildID { get; set; }
public string condition { get; set; }
//----------nav
[ForeignKey("fildID")]
public Fild fild { get; set; }
}
}

View File

@@ -16,6 +16,7 @@ namespace Back.Data.Models
#region Navigation
public virtual ICollection<FildModeInPattern> FildModeInPatterns { get; set; }
public virtual ICollection<Coding> Codings { get; set; }
public virtual ICollection<Condition> Conditions { get; set; }
[NotMapped]
public ICollection<SpecialCondition> specialConditions { get; set; }
#endregion

View File

@@ -144,10 +144,19 @@ namespace Back.Services
var Bmodel = body.Clone();
foreach (_TaxPayer.Fild item in Bmodel)
{
var resval = invoicedetail.GetType().GetProperties().Where(w => w.Name == item.eName).Select(s => s.GetValue(invoicedetail)).FirstOrDefault();
item.Value = resval == null ? "" : resval.ToString().Split('.').Length == 2 ? ((decimal)resval).ToString("N0") : resval.ToString();
item.DefVals = item.InputBox == "fromdb" ? _codingRepo.Get(w => w.FildID == item.FildID).Select(ss => new _TaxPayer.Coding() { ID = ss.Code, Name = ss.Title }).ToList() : new List<_TaxPayer.Coding>();
item.Des = item.ModeID == 3 ? _specialConditionRepo.Get(w => w.FildID == item.FildID).Select(ss => ss.condition).ToArray() : null;
if (item.InputBox=="")
{
}
else
{
var resval = invoicedetail.GetType().GetProperties().Where(w => w.Name == item.eName).Select(s => s.GetValue(invoicedetail)).FirstOrDefault();
item.Value = resval == null ? "" : resval.ToString().Split('.').Length == 2 ? ((decimal)resval).ToString("N0") : resval.ToString();
item.DefVals = item.InputBox == "fromdb" ? _codingRepo.Get(w => w.FildID == item.FildID).Select(ss => new _TaxPayer.Coding() { ID = ss.Code, Name = ss.Title }).ToList() : new List<_TaxPayer.Coding>();
item.Des = item.ModeID == 3 ? _specialConditionRepo.Get(w => w.FildID == item.FildID).Select(ss => ss.condition).ToArray() : null;
}
}
ret.Bodys.Add(new _TaxPayer.Filds() { ID = invoicedetail.ID, filds = Bmodel });
}