Exemplo n.º 1
0
        public ActionResult Create(FormCollection collection)
        {


            var model = new InsMeasure();
            this.TryUpdateModel<InsMeasure>(model);

            if (model.Water != null)
                model.MeasureTotal += (int)model.Water;
            if (model.Electric != null)
                model.MeasureTotal += (int)model.Electric;
            if (model.TempTool != null)
                model.MeasureTotal += (int)model.TempTool;

            if (model.Test != null)
                model.MeasureTotal += (int)model.Test;
            if (model.Electric != null)
                model.MeasureTotal += (int)model.QualityCosts;
            if (model.Civilization != null)
                model.MeasureTotal += (int)model.Civilization;

            if (model.Secure != null)
                model.MeasureTotal += (int)model.Secure;
            if (model.SecondHand != null)
                model.MeasureTotal += (int)model.SecondHand;
            if (model.TempFacility != null)
                model.MeasureTotal += (int)model.TempFacility;
            if (model.OtherFee != null)
                model.MeasureTotal += (int)model.OtherFee; 

            this.ProjectService.SaveInsMeasure(model);

            return this.RefreshParent();
        }
Exemplo n.º 2
0
 public void SaveInsMeasure(InsMeasure insmeasure)
 {
     using (var dbContext = new ProjectDbContext())
     {
         if (insmeasure.ID > 0)
         {
             //var budgets = dbContext.Budgets.ToList();
             //if (measure.MeasureTotal > 0)
             //{
             //    foreach (var budget in budgets)
             //    {
             //        if (budget.ProjectID == measure.ProjectID)
             //        {
             //            budget.MeasureID = measure.ID;
             //            dbContext.Update<BudgetInfo>(budget);
             //        }
             //    }
             //}
             dbContext.Update <InsMeasure>(insmeasure);
         }
         else
         {
             dbContext.Insert <InsMeasure>(insmeasure);
         }
     }
 }
Exemplo n.º 3
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 InsMeasure();
            return View("Edit", model);

        }
Exemplo n.º 4
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 InsMeasure();

            return(View("Edit", model));
        }
Exemplo n.º 5
0
        public ActionResult Create(FormCollection collection)
        {
            var model = new InsMeasure();

            this.TryUpdateModel <InsMeasure>(model);

            if (model.Water != null)
            {
                model.MeasureTotal += (int)model.Water;
            }
            if (model.Electric != null)
            {
                model.MeasureTotal += (int)model.Electric;
            }
            if (model.TempTool != null)
            {
                model.MeasureTotal += (int)model.TempTool;
            }

            if (model.Test != null)
            {
                model.MeasureTotal += (int)model.Test;
            }
            if (model.Electric != null)
            {
                model.MeasureTotal += (int)model.QualityCosts;
            }
            if (model.Civilization != null)
            {
                model.MeasureTotal += (int)model.Civilization;
            }

            if (model.Secure != null)
            {
                model.MeasureTotal += (int)model.Secure;
            }
            if (model.SecondHand != null)
            {
                model.MeasureTotal += (int)model.SecondHand;
            }
            if (model.TempFacility != null)
            {
                model.MeasureTotal += (int)model.TempFacility;
            }
            if (model.OtherFee != null)
            {
                model.MeasureTotal += (int)model.OtherFee;
            }

            this.ProjectService.SaveInsMeasure(model);

            return(this.RefreshParent());
        }
Exemplo n.º 6
0
        public void SaveInsMeasure(InsMeasure insmeasure)
        {
            using (var dbContext = new ProjectDbContext())
            {

                if (insmeasure.ID > 0)
                {
                    //var budgets = dbContext.Budgets.ToList();
                    //if (measure.MeasureTotal > 0)
                    //{
                    //    foreach (var budget in budgets)
                    //    {
                    //        if (budget.ProjectID == measure.ProjectID)
                    //        {
                    //            budget.MeasureID = measure.ID;
                    //            dbContext.Update<BudgetInfo>(budget);
                    //        }
                    //    }
                    //}
                    dbContext.Update<InsMeasure>(insmeasure);
                }
                else
                {
                    dbContext.Insert<InsMeasure>(insmeasure);
                }
            }
        }