Beispiel #1
0
        public ActionResult ProjSummary(int id)
        {
            var projSummary = new ProjectSummary();

            if (id != 0)
            {
                var lead = db.leads.Where(l => l.lead_number == id).First();

                if (lead != null)
                {
                    // only recalculate if lead is not close
                    if (!lead.project_status.project_status_name.Equals(Constants.proj_Status_Closed, StringComparison.OrdinalIgnoreCase))
                    {
                        new GeneralHelper().SaveProjectTotal(lead.lead_number);
                    }

                    lead = db.leads.Where(l => l.lead_number == id).First();
                    ProjSummaryHelper projSummaryHelper = new ProjSummaryHelper();
                    if (db.total_cost.Where(c => c.lead_number == id).Any())
                    {
                        projSummary.TotalCost = db.total_cost.Where(c => c.lead_number == id).First();
                    }
                    projSummary      = projSummaryHelper.CalculateInstallCategoryCostMap(lead, projSummary);
                    projSummary      = projSummaryHelper.CalculateInstallationsData(lead, projSummary);
                    projSummary      = projSummaryHelper.GetProductCategoryList(lead, projSummary);
                    projSummary      = projSummaryHelper.GetProductTotalMap(lead, projSummary);
                    projSummary      = projSummaryHelper.SetCustomerData(lead, projSummary);
                    projSummary      = projSummaryHelper.SetAddresses(lead, projSummary);
                    projSummary.Lead = lead;
                }
            }

            return(View(projSummary));
        }