public void SaveInsOverhead(InsOverhead insoverhead) { using (var dbContext = new ProjectDbContext()) { //var budgets = dbContext.Budgets.ToList(); if (insoverhead.ID > 0) { // if (overhead.OverheadTotal > 0) // { // foreach (var budget in budgets) // { // if (budget.ProjectID == overhead.ProjectID) // { // budget.OverheadID = overhead.ID; // dbContext.Update<BudgetInfo>(budget); // } // } // } dbContext.Update <InsOverhead>(insoverhead); } else { dbContext.Insert <InsOverhead>(insoverhead); } } }
// // GET: /Project/Labor/Create public ActionResult Create() { var ProjectList = this.ProjectService.GetProjectBasedataList(new ProjectRequest()); this.ViewBag.ProjectBasedataID = new SelectList(ProjectList, "ID", "PName"); var model = new InsOverhead(); return(View("Edit", model)); }
public ActionResult Create(FormCollection collection) { var model = new InsOverhead(); this.TryUpdateModel <InsOverhead>(model); if (model.OPay != null) { model.OverheadTotal += (int)model.OPay; } if (model.OBonus != null) { model.OverheadTotal += (int)model.OBonus; } if (model.OEntertainment != null) { model.OverheadTotal += (int)model.OEntertainment; } if (model.OTraffic != null) { model.OverheadTotal += (int)model.OTraffic; } if (model.OVehicle != null) { model.OverheadTotal += (int)model.OVehicle; } if (model.OOffice != null) { model.OverheadTotal += (int)model.OOffice; } if (model.OWelfare != null) { model.OverheadTotal += (int)model.OWelfare; } if (model.OSecurity != null) { model.OverheadTotal += (int)model.OSecurity; } if (model.OAccidentInsurance != null) { model.OverheadTotal += (int)model.OAccidentInsurance; } if (model.OHousingFund != null) { model.OverheadTotal += (int)model.OHousingFund; } if (model.OMeals != null) { model.OverheadTotal += (int)model.OMeals; } if (model.OAccommodation != null) { model.OverheadTotal += (int)model.OAccommodation; } if (model.OUnion != null) { model.OverheadTotal += (int)model.OUnion; } if (model.OEducation != null) { model.OverheadTotal += (int)model.OEducation; } if (model.OlaborInsurance != null) { model.OverheadTotal += (int)model.OlaborInsurance; } if (model.OFare != null) { model.OverheadTotal += (int)model.OFare; } if (model.OSewageCharges != null) { model.OverheadTotal += (int)model.OSewageCharges; } if (model.OMeasuring != null) { model.OverheadTotal += (int)model.OMeasuring; } if (model.OCost != null) { model.OverheadTotal += (int)model.OCost; } if (model.OFinance != null) { model.OverheadTotal += (int)model.OFinance; } if (model.OInvisible != null) { model.OverheadTotal += (int)model.OInvisible; } if (model.OOther != null) { model.OverheadTotal += (int)model.OOther; } this.ProjectService.SaveInsOverhead(model); return(this.RefreshParent()); }