private void InsertNewTaxEntry(Municipality municipality, TaxTypes taxType, DateTime startDate, float taxRate) { var newEntry = new TaxEntry { Municipality = municipality, TaxType = taxType, StartDate = startDate, TaxRate = taxRate }; _taxProvider.Insert(newEntry); }
private TaxEntry CreateTaxEntry(string tax_description, decimal tax_rate) { TaxEntry taxEntry = new TaxEntry { Description = tax_description, Rate = tax_rate }; return(taxEntry); }
internal void Insert(TaxEntry newEntry) { var oldEntry = _ctx.TaxEntries.Where(te => te.TaxType == newEntry.TaxType && te.StartDate == newEntry.StartDate).FirstOrDefault(); if (oldEntry != null) { _ctx.TaxEntries.Remove(oldEntry); _ctx.SaveChanges(); } _ctx.TaxEntries.Add(newEntry); _ctx.Entry(newEntry.Municipality).State = EntityState.Unchanged; //Municipality is guaranteed to already exist _ctx.SaveChanges(); }
public async Task <TaxEntry> InsertTaxEntryAsync(TaxEntry taxEntryToInsert) { try { await _context.TaxEntries.AddAsync(taxEntryToInsert); var saved = Save(); return(taxEntryToInsert); } catch (Exception e) { Console.WriteLine(e); throw; } }
private void ImportTaxFile(string fileName) { var contents = File.ReadAllText(fileName); var importData = new JavaScriptSerializer().Deserialize <Collection <TaxImportEntry> >(contents); foreach (var importEntry in importData) { var municipalityObj = _municipalityProvider.GetByTitle(importEntry.Municipality); var newTaxEntry = new TaxEntry { Municipality = municipalityObj, StartDate = importEntry.StartDate, TaxRate = importEntry.TaxRate, TaxType = importEntry.TaxType }; _taxProvider.Insert(newTaxEntry); } }
private void taxEntryToolStripMenuItem1_Click(object sender, EventArgs e) { TaxEntry obj = new TaxEntry(); obj.Show(); }
public async Task <TaxEntry> InsertTaxEntryAsync(TaxEntry taxEntryToInsert) { _taxEntries.Add(taxEntryToInsert); return(taxEntryToInsert); }