Ejemplo n.º 1
0
        public ActionResult Create(FormCollection collection)
        {
            var model = new MachineryCost();

            this.TryUpdateModel<MachineryCost>(model);
            this.ProjectService.SaveMachineryCost(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();
        }
Ejemplo n.º 3
0
        public void SaveMachineryCost(MachineryCost machinerycost)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (machinerycost.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<MachineryCost>(machinerycost);
                }
                else
                {
                    dbContext.Insert<MachineryCost>(machinerycost);
                }
            }
        }
Ejemplo n.º 4
0
        //
        // GET: /Project/Labor/Create

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

        }