/// <summary> /// Adds fixed costs (tax, insurance) /// </summary> /// <param name="fixedCosts">All fixed costs, including dates</param> /// <param name="vehicleLicense">License of a vehicle</param> /// <returns>True if success</returns> public static bool AddFixedCosts(FixedCosts fixedCosts, string vehicleLicense) { { using var connect = DbUtils.GetDbConnection(); try { var insuranceResult = connect.Execute("INSERT INTO costs (TypeCost_ID, License, Cost, Date_Of_Cost) VALUES (@TypeCost_ID, @License, @Cost, @Date_Of_Cost)", new { TypeCost_ID = 4, License = vehicleLicense, Cost = fixedCosts.Insurance, Date_Of_Cost = fixedCosts.Insurance_Date }); var roadTaxResult = connect.Execute("INSERT INTO costs (TypeCost_ID, License, Cost, Date_Of_Cost) VALUES (@TypeCost_ID, @License, @Cost, @Date_Of_Cost)", new { TypeCost_ID = 3, License = vehicleLicense, Cost = fixedCosts.Road_Tax, Date_Of_Cost = fixedCosts.Road_Tax_Date }); return(insuranceResult == 1 && roadTaxResult == 1); } catch (MySqlException e) { return(false); } } }
public decimal CalcFixedCosts() { if (FixedCosts == null) { return(0); } return(FixedCosts.Where(f => f.RepassToClient).Sum(f => f.Cost)); }
public Shop() { goods = new Goods(); goods.AddGood(new Good("Сапоги женский", 150, 200, 10)); fixedCosts = new FixedCosts(); }