diff --git a/Back/Data/Infrastructure/Persistence/SqlDbContext.cs b/Back/Data/Infrastructure/Persistence/SqlDbContext.cs index 6776274..a0c8b93 100644 --- a/Back/Data/Infrastructure/Persistence/SqlDbContext.cs +++ b/Back/Data/Infrastructure/Persistence/SqlDbContext.cs @@ -50,6 +50,7 @@ namespace TaxPayer.Infrastructure.Persistence public DbSet Promotions { get; set; } public DbSet PromotionDetails { get; set; } public DbSet CreditDocuments { get; set; } + public DbSet Conditions { get; set; } #endregion //public override Task SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken()) //{ diff --git a/Back/Data/Models/Condition.cs b/Back/Data/Models/Condition.cs new file mode 100644 index 0000000..e02f182 --- /dev/null +++ b/Back/Data/Models/Condition.cs @@ -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; } + } +} diff --git a/Back/Data/Models/Fild.cs b/Back/Data/Models/Fild.cs index 139d6c4..14bfa34 100644 --- a/Back/Data/Models/Fild.cs +++ b/Back/Data/Models/Fild.cs @@ -16,6 +16,7 @@ namespace Back.Data.Models #region Navigation public virtual ICollection FildModeInPatterns { get; set; } public virtual ICollection Codings { get; set; } + public virtual ICollection Conditions { get; set; } [NotMapped] public ICollection specialConditions { get; set; } #endregion diff --git a/Back/Services/servTaxPayer.cs b/Back/Services/servTaxPayer.cs index 63da6d0..d60e41d 100644 --- a/Back/Services/servTaxPayer.cs +++ b/Back/Services/servTaxPayer.cs @@ -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 }); } diff --git a/TaxPayerFull/Pages/UserPanel/TaxPayerInvoiceItem.razor b/TaxPayerFull/Pages/UserPanel/TaxPayerInvoiceItem.razor index abb6a1c..6c6093c 100644 --- a/TaxPayerFull/Pages/UserPanel/TaxPayerInvoiceItem.razor +++ b/TaxPayerFull/Pages/UserPanel/TaxPayerInvoiceItem.razor @@ -1,6 +1,7 @@ @page "/TaxPayerInvoiceItem/{InvoiceID:int}" @page "/FullInvoiceItem/{InvoiceID:int}" @using Front.Services +@using Shared @using Shared.DTOs @layout PanelLayout @inject HttpClientController hc; @@ -130,8 +131,6 @@ else { item.Value = bill; } - - } else if (item.eName.ToLower() == "inp") { @@ -140,28 +139,23 @@ else { item.Value = patt; } - - } else if (item.eName.ToLower() == "ins") { - var patt = Patterns.Where(w => w.ID == Convert.ToInt32(item.Value)).Select(s => s.Title).FirstOrDefault(); - if (patt != null) - { - item.Value = patt; - } - - + InvoiceType foo = (InvoiceType)Enum.Parse(typeof(InvoiceType), item.Value); + item.Value = foo.GetEnumDisplayName(); } - - - - else + else if (item.eName.ToLower() == "tob") { + CustomerType foo = (CustomerType)Enum.Parse(typeof(CustomerType), item.Value); + item.Value = foo.GetEnumDisplayName(); + + } + - } +