public static void bill_Water_Add(Guid id) { var Water_use = Context.Water_usage.Where(x => x.invoiceperiods_id == id).ToList(); foreach (var i in Water_use) { var data = new bill_Water_usage { Uid = Guid.NewGuid(), Water_usage_id = i.Uid, water_usagefirst = water_usagefirst(i.customer_services_id), water_usageafter = i.water_Unit, unit = i.water_Unit - water_usagefirst(i.customer_services_id), service_charge = 5, Minimum_rate = Minimum_rate(i.water_Unit - water_usagefirst(i.customer_services_id)), price = ((i.water_Unit - water_usagefirst(i.customer_services_id)) * 7) + 5 + Minimum_rate(i.water_Unit - water_usagefirst(i.customer_services_id)), status = bill_Water_usage.Statusbill.Wait }; Context.bill_Water_usage.Add(data); Context.SaveChanges(); } }
public static void bill_Water_Add(Guid id) { AssetDbContext Context = new AssetDbContext(); var Water_use = Context.Water_usage.Where(x => x.invoiceperiods_id == id).ToList(); foreach (var i in Water_use) { var data = new bill_Water_usage { Uid = Guid.NewGuid(), Water_usage_id = i.Uid, water_usagefirst = 0, water_usageafter = i.water_Unit, unit = 0 - i.water_Unit, service_charge = 15, Minimum_rate = 35, price = (0 - i.water_Unit) * 5, status = bill_Water_usage.Statusbill.Wait }; Context.bill_Water_usage.Add(data); Context.SaveChanges(); } }