private void GenerateMH(mReport1 master, string projectTimeState, ref DateTime startDate, ref DateTime endDate, string work_, string function_, int companyId) { LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManHoursPerPhaseMH printManhoursPerPhase = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManHoursPerPhaseMH(); string shape = "%"; if (ddlShape.SelectedIndex > 0) shape = ddlShape.SelectedValue; string location = "%"; if (ddlLocation.SelectedIndex > 0) location = ddlLocation.SelectedValue; int conditionRating = 1; string material = "%"; if (ddlMaterial.SelectedIndex > 0) material = ddlMaterial.SelectedItem.Text; string crew = "%"; if (ddlCrew.SelectedIndex > 0) crew = ddlCrew.SelectedValue; int? countryId = null; if (ddlCountry.SelectedIndex > 0) { countryId = Convert.ToInt32(ddlCountry.SelectedValue); } if (ddlClient.SelectedValue == "-1") { // ... For specific type of work and specific function printManhoursPerPhase.LoadByStartDateEndDateProjectTimeStateWorkFunction(countryId, startDate, endDate, projectTimeState, work_, function_, companyId, shape, conditionRating, location, material, crew); } else { if (ddlProject.SelectedValue == "-1") { // ... For specific type of work and specific function printManhoursPerPhase.LoadByCompaniesIdStartDateEndDateProjectTimeStateWorkFunction(int.Parse(ddlClient.SelectedValue), startDate, endDate, projectTimeState, work_, function_, companyId, shape, conditionRating, location, material, crew); } else { // ... For specific type of work and specific function printManhoursPerPhase.LoadByCompaniesIdProjectIdStartDateEndDateProjectTimeStateWorkFunction(int.Parse(ddlClient.SelectedValue), int.Parse(ddlProject.SelectedValue), startDate, endDate, projectTimeState, work_, function_, companyId, shape, conditionRating, location, material, crew); } } // ... set properties to master page master.Data = printManhoursPerPhase.Data; master.Table = printManhoursPerPhase.TableName; // Get report if (printManhoursPerPhase.Table.Rows.Count > 0) { if (master.Format == "pdf") { switch (function_) { case "Prep": master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintManhoursPerPhaseReportMHGeneral(); break; case "Spray": master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintManhoursPerPhaseReportMHGeneral(); break; } } else { switch (function_) { case "Prep": master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintManhoursPerPhaseReportMHGeneralExport(); break; case "Spray": master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintManhoursPerPhaseReportMHGeneralExport(); break; } } // ... set parameters to report if (master.Format == "pdf") { // ... For report // ... ... project time state if (ddlProjectTimeState.SelectedValue == "(All)") { master.SetParameter("projectTimeState", "All"); } else { master.SetParameter("projectTimeState", ddlProjectTimeState.SelectedItem.Text); } // ... ... user int loginId = Convert.ToInt32(Session["loginID"]); LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(loginId, companyId); string user = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId); master.SetParameter("User", user.Trim()); // ... ... client if (ddlClient.SelectedValue == "-1") { master.SetParameter("client", "All"); } else { CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadByCompaniesId(Int32.Parse(ddlClient.SelectedValue), companyId); string clientName = companiesGateway.GetName(Int32.Parse(ddlClient.SelectedValue)); master.SetParameter("client", clientName); } // ... ... project if (ddlProject.SelectedValue == "-1") { master.SetParameter("project", "All"); } else { int projectId2 = Int32.Parse(ddlProject.SelectedValue); ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId2); string project = projectGateway.GetName(projectId2); master.SetParameter("project", project); } // ... ... phase / function if (ddlPhase.SelectedValue == "(All)") { master.SetParameter("phase", "All"); } else { master.SetParameter("phase", ddlPhase.SelectedItem.Text); } // ... ... MH Shape if (ddlShape.SelectedValue == "(All)") { master.SetParameter("Shape", "All"); } else { master.SetParameter("Shape", ddlShape.SelectedValue); } // ... ... Condition Rating if (ddlConditioningRating.SelectedValue == "-1") { master.SetParameter("ConditionRating", "All"); } else { master.SetParameter("ConditionRating", ddlConditioningRating.SelectedValue); } // ... ... Location if (ddlLocation.SelectedValue == "(All)") { master.SetParameter("Location", "All"); } else { master.SetParameter("Location", ddlLocation.SelectedValue); } // ... ... Material if (ddlMaterial.SelectedValue == "(All)") { master.SetParameter("Material", "All"); } else { master.SetParameter("Material", ddlMaterial.SelectedItem.Text); } // ... ... Crew if (ddlCrew.SelectedValue == "(All)") { master.SetParameter("Crew", "All"); } else { master.SetParameter("Crew", ddlCrew.SelectedValue); } master.SetParameter("dateFrom", tkrdpStartDate.SelectedDate.Value.ToShortDateString()); master.SetParameter("dateTo", tkrdpEndDate.SelectedDate.Value.ToShortDateString()); } } }
// //////////////////////////////////////////////////////////////////////// // PRIVATE METHODS // /// <summary> /// UpdateForReport /// </summary> private void UpdateForReport(DateTime startDate, DateTime endDate, string projectTimeState, int companyId, string confirmedSize1, string confirmedSize2, string accessType, string shape, int conditionRating, string location, string material, string crew) { LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManhoursPerPhase printManhoursPerPhaseJL = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManhoursPerPhase(Data); LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManHoursPerPhaseRA printManhoursPerPhaseRA = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManHoursPerPhaseRA(Data); LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManhoursPerPhaseFLL printManhoursPerPhaseFLL = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManhoursPerPhaseFLL(Data); LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManHoursPerPhaseMH printManhoursPerPhaseMH = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManHoursPerPhaseMH(Data); LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManHoursPerPhasePL printManhoursPerPhasePL = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManHoursPerPhasePL(Data); foreach (PrintManhoursPerPhaseTDS.PrintManHoursPerPhaseGeneralRow row in (PrintManhoursPerPhaseTDS.PrintManHoursPerPhaseGeneralDataTable)Table) { int clientId = row.ClientID; int projectId = row.ProjectID; int countryId = row.CountryID; printManhoursPerPhaseJL.LoadAllByCompaniesIdProjectIdStartDateEndDateProjectTimeStateWorkFunction(clientId, projectId, startDate, endDate, projectTimeState, "Junction Lining", ""); printManhoursPerPhaseRA.LoadAllByCompaniesIdProjectIdStartDateEndDateProjectTimeStateWorkFunction(clientId, projectId, startDate, endDate, projectTimeState, "Rehab Assessment", "", companyId, confirmedSize1, confirmedSize2, accessType); printManhoursPerPhaseFLL.LoadAllByCompaniesIdProjectIdStartDateEndDateProjectTimeStateWorkFunction(clientId, projectId, startDate, endDate, projectTimeState, "Full Length", "", companyId, confirmedSize1, confirmedSize2, accessType); printManhoursPerPhaseMH.LoadAllByCompaniesIdProjectIdStartDateEndDateProjectTimeStateWorkFunction(clientId, projectId, startDate, endDate, projectTimeState, "MH Rehab", "", companyId, shape, conditionRating, location, material, crew); printManhoursPerPhasePL.LoadAllByCompaniesIdProjectIdStartDateEndDateProjectTimeStateWorkFunction(clientId, projectId, startDate, endDate, projectTimeState, "Point Lining", "", companyId, confirmedSize1, confirmedSize2, accessType); } }