Example #1
0
        public ActionResult Create(FormCollection collection)
        {
            var model = new MaterialCost();

            this.TryUpdateModel<MaterialCost>(model);
            this.ProjectService.SaveMaterialCost(model);

            return this.RefreshParent();
        }
        public ActionResult Create(FormCollection collection)
        {
            var model = new ProjectBasedata();
            model.PSDate = DateTime.Now.ToString("yyyy/MM/dd");
            model.PEdate = DateTime.Now.ToString("yyyy/MM/dd");
            this.TryUpdateModel<ProjectBasedata>(model);

            this.ProjectService.SaveProjectBasedata(model);

            var labor = new LaborCost();
            labor.ProjectID = model.ID;
            labor.ProjectName = model.PName;
            this.TryUpdateModel<LaborCost>(labor);
            this.ProjectService.SaveLaborCost(labor);

            var material = new MaterialCost();
            material.ProjectID = model.ID;
            material.ProjectName = model.PName;
            this.TryUpdateModel<MaterialCost>(material);
            this.ProjectService.SaveMaterialCost(material);

            var machine = new MachineryCost();
            machine.ProjectID = model.ID;
            machine.ProjectName = model.PName;
            this.TryUpdateModel<MachineryCost>(machine);
            this.ProjectService.SaveMachineryCost(machine);

            var measure = new Measure();
            measure.ProjectID = model.ID;
            measure.ProjectName = model.PName;
            this.TryUpdateModel<Measure>(measure);
            this.ProjectService.SaveMeasure(measure);

            var overhead = new Overhead();
            overhead.ProjectID = model.ID;
            overhead.ProjectName = model.PName;
            this.TryUpdateModel<Overhead>(overhead);
            this.ProjectService.SaveOverhead(overhead);

            var budgetinfo = new BudgetInfo();
            budgetinfo.ProjectID = model.ID;
            budgetinfo.ProjectName = model.PName;
            this.TryUpdateModel<BudgetInfo>(budgetinfo);
            this.ProjectService.SaveBudget(budgetinfo); 
            return this.RefreshParent();
        }
Example #3
0
        //
        // GET: /Project/Labor/Create

        public ActionResult Create()
        {
            var model = new MaterialCost();
            return View("Edit", model);

        }
Example #4
0
        public void SaveMaterialCost(MaterialCost materialcost)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (materialcost.ID >0)
                {
                    var budgets = dbContext.Budgets.ToList();
                    if (materialcost.MaterialTotal > 0)
                    {
                        foreach (var budget in budgets)
                        {
                            if (budget.ProjectID == materialcost.ProjectID)
                            {
                                budget.MaterialCostID = materialcost.ID;
                                dbContext.Update<BudgetInfo>(budget);
                            }
                        }
                    }

                    dbContext.Update<MaterialCost>(materialcost);
                }
                else
                {
                    dbContext.Insert<MaterialCost>(materialcost);
                }
            }
        }