コード例 #1
0
        private void GenerateJL(mReport1 master, string projectTimeState, ref DateTime startDate, ref DateTime endDate, string work_, string function_)
        {
            LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManhoursPerPhase printManhoursPerPhase = new LiquiForce.LFSLive.BL.LabourHours.ProjectTime.PrintManhoursPerPhase();

            int? countryId = null;

            if (ddlCountry.SelectedIndex > 0)
            {
                countryId = Convert.ToInt32(ddlCountry.SelectedValue);
            }

            if (ddlClient.SelectedValue == "-1")
            {
                printManhoursPerPhase.LoadByStartDateEndDateProjectTimeStateWorkFunction(countryId, startDate, endDate, projectTimeState, work_, function_);
            }
            else
            {
                if (ddlProject.SelectedValue == "-1")
                {
                    printManhoursPerPhase.LoadByCompaniesIdStartDateEndDateProjectTimeStateWorkFunction(int.Parse(ddlClient.SelectedValue), startDate, endDate, projectTimeState, work_, function_);
                }
                else
                {
                    printManhoursPerPhase.LoadByCompaniesIdProjectIdStartDateEndDateProjectTimeStateWorkFunction(int.Parse(ddlClient.SelectedValue), int.Parse(ddlProject.SelectedValue), startDate, endDate, projectTimeState, work_, function_);
                }
            }

            // ... 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 "Install":
                            master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintManhoursPerPhaseReport();
                            break;

                        case "Prep from Main":
                            master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintManhoursPerPhaseReportJLPrepFromMain();
                            break;

                        case "Scoping":
                            master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintManhoursPerPhaseReportJLScoping();
                            break;
                    }
                }
                else
                {
                    switch (function_)
                    {
                        case "Install":
                            master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintManhoursPerPhaseReportExport();
                            break;

                        case "Prep from Main":
                            master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintManhoursPerPhaseReportJLPrepFromMainExport();
                            break;

                        case "Scoping":
                            master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintManhoursPerPhaseReportJLScopingExport();
                            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"]);
                    int companyId = Convert.ToInt32(Session["companyID"]);

                    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
                    {
                        string clientName = ddlClient.SelectedItem.Text;
                        master.SetParameter("client", clientName);
                    }

                    // ... ... project
                    if (ddlProject.SelectedValue == "-1")
                    {
                        master.SetParameter("project", "All");
                    }
                    else
                    {
                        string project = ddlProject.SelectedItem.Text;
                        master.SetParameter("project", project);
                    }

                    // ... ... phase / function
                    if (ddlPhase.SelectedValue == "Scoping")
                    {
                        master.SetParameter("phase", "PreVideo & Locate (V1)");
                    }
                    else
                    {
                        master.SetParameter("phase", ddlPhase.SelectedValue);
                    }

                    // ... ... Dates Range
                    master.SetParameter("dateFrom", tkrdpStartDate.SelectedDate.Value.ToShortDateString());
                    master.SetParameter("dateTo", tkrdpEndDate.SelectedDate.Value.ToShortDateString());
                }
            }
        }