Exemple #1
0
        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);
        }
Exemple #2
0
        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();
        }
Exemple #4
0
        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;
            }
        }
Exemple #5
0
        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);
            }
        }
Exemple #6
0
        private void taxEntryToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            TaxEntry obj = new TaxEntry();

            obj.Show();
        }
Exemple #7
0
 public async Task <TaxEntry> InsertTaxEntryAsync(TaxEntry taxEntryToInsert)
 {
     _taxEntries.Add(taxEntryToInsert);
     return(taxEntryToInsert);
 }