Ejemplo n.º 1
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 InsMachineryCost();
            return View("Edit", model);

        }
Ejemplo n.º 2
0
 public ActionResult Create(FormCollection collection)
 {
     var model = new InsMachineryCost();
     this.TryUpdateModel<InsMachineryCost>(model);
     if (model.Transport != null)
         model.MachineryTotal += (int)model.Transport;
     if (model.Operating != null)
         model.MachineryTotal += (int)model.Operating;
     if (model.Repair != null)
         model.MachineryTotal += (int)model.Repair;
     if (model.Fuel != null)
         model.MachineryTotal += (int)model.Fuel;
     if (model.Depreciation != null)
         model.MachineryTotal += (int)model.Depreciation;
     if (model.TravelTax != null)
         model.MachineryTotal += (int)model.TravelTax;
     if (model.OtherFee != null)
         model.MachineryTotal += (int)model.OtherFee;
    
     this.ProjectService.SaveInsMachineryCost(model);
     return this.RefreshParent();
 }
Ejemplo n.º 3
0
        public void SaveInsMachineryCost(InsMachineryCost insmachinerycost)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (insmachinerycost.ID > 0)
                {
                    //var budgets = dbContext.Budgets.ToList();
                    //if (machinerycost.MachineryTotal > 0)
                    //{
                    //    foreach (var budget in budgets)
                    //    {
                    //        if (budget.ProjectID == machinerycost.ProjectID)
                    //        {
                    //            budget.MachineryCostID = machinerycost.ID;
                    //            dbContext.Update<BudgetInfo>(budget);
                    //        }
                    //    }
                    //}
                    dbContext.Update<InsMachineryCost>(insmachinerycost);
                }
                else
                {
                    dbContext.Insert<InsMachineryCost>(insmachinerycost);
                }
            }
        }