Exemplo n.º 1
0
        public ActionResult Index(BudgetRequest request)
        {
            var result = this.ProjectService.GetBudgetList(request);
            foreach (var rt in result)
            {
                if (rt.LaborCost != null)
                {
                    rt.BudgetTotal += rt.LaborCost.LaborTotal; 
                }
                if (rt.MaterialCost != null)
                {
                    rt.BudgetTotal += rt.MaterialCost.MaterialTotal;
                }
                if (rt.MachineryCost != null)
                {
                    rt.BudgetTotal += rt.MachineryCost.MachineryTotal;
                }
                if (rt.Measure != null)
                {
                    rt.BudgetTotal += rt.Measure.MeasureTotal;
                }
                if (rt.Overhead != null)
                {
                    rt.BudgetTotal += rt.Overhead.OverheadTotal;
                }


                //rt.BudgetTotal +=rt.Warranty + rt.Subcontracting + rt.OtherBudget;
            }
            return View(result);
        }
Exemplo n.º 2
0
 public IEnumerable<BudgetInfo> GetBudgetList(BudgetRequest request = null)
 {
     request = request ?? new BudgetRequest();
     using (var dbContext = new ProjectDbContext())
     {
         IQueryable<BudgetInfo> Budgets = dbContext.Budgets.Include("LaborCost").Include("Overhead").Include("MachineryCost").Include("MaterialCost").Include("Measure");              
         if (!string.IsNullOrEmpty(request.ProjectName))
             Budgets = Budgets.Where(u => u.ProjectName.Contains(request.ProjectName));                  
         return Budgets.OrderByDescending(u => u.ID).ToPagedList(request.PageIndex, request.PageSize);
     }
 }