コード例 #1
0
        public ActionResult Create(FormCollection collection)
        {
            var model = new InsLaborCost();
            this.TryUpdateModel<InsLaborCost>(model);
            if (model.Masons != null)
                model.LaborTotal += (int)model.Masons;
            if (model.Painter != null)
                model.LaborTotal += (int)model.Painter;
            if (model.Steel != null)
                model.LaborTotal += (int)model.Steel;
            if (model.Plumbers != null)
                model.LaborTotal += (int)model.Plumbers;
            if (model.TearDown != null)
                model.LaborTotal += (int)model.TearDown;
            if (model.Transportor != null)
                model.LaborTotal += (int)model.Transportor;
            if (model.Carpenter != null)
                model.LaborTotal += (int)model.Carpenter;
            if (model.Cleaner != null)
                model.LaborTotal += (int)model.Cleaner;
            if (model.ELectricWelder != null)
                model.LaborTotal += (int)model.ELectricWelder;
            if (model.OtherLabor != null)
                model.LaborTotal += (int)model.OtherLabor;

            this.ProjectService.SaveInsLaborCost(model);

            return this.RefreshParent();
        }
コード例 #2
0
        //
        // 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 InsLaborCost();
            return View("Edit", model);

        }
コード例 #3
0
ファイル: ProjectService.cs プロジェクト: addy002/HaoTang
 public void SaveInsLaborCost(InsLaborCost inslaborcost)
 {
     using (var dbContext = new ProjectDbContext())         
     {
         if (inslaborcost.ID > 0)
         {
             //var budgets = dbContext.Budgets.ToList();
             //if (inslaborcost.LaborTotal > 0)
             //{
             //    foreach (var budget in budgets)
             //    {
             //        if (budget.ProjectID == inslaborcost.ProjectID)
             //        {
             //            budget.LaborCostID = inslaborcost.ID;
             //            dbContext.Update<BudgetInfo>(budget);
             //        }
             //    }
             //}
             dbContext.Update<InsLaborCost>(inslaborcost);
         }
         else
         {
             dbContext.Insert<InsLaborCost>(inslaborcost);
         }
     }
 }