コード例 #1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            // Get data from database gateway
            ProjectSectionsNavigatorTDS projectSectionsNavigatorTDS = SubmitSearch();

            // Show results
            if (projectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATOR.DefaultView.Count > 0)
            {
                // ... Store data
                Session["lfsProjectSectionsNavigatorTDS"] = projectSectionsNavigatorTDS;

                // ... Go to the results page
                Response.Redirect("./project_sections_navigator2.aspx?source_page=project_sections_navigator.aspx&project_id=" + hdfProjectId.Value + GetNavigatorState() + "&origin=" + (string)ViewState["origin"] + "&update=" + (string)ViewState["update"] + "&data_changed=" + hdfDataChanged.Value + "&state=" + (string)ViewState["state"] + "&update_section=no&active_tab=" + (string)ViewState["active_tab"]);
            }
            else
            {
                ProjectGateway projectGateway = new ProjectGateway(projectTDS);
                lblTitleProjectName.Text = projectGateway.GetName(int.Parse(hdfProjectId.Value)) + " (" + projectGateway.GetProjectNumber(int.Parse(hdfProjectId.Value)) + ")";
                tNoResults.Visible = true;
            }
        }
コード例 #2
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_CWP_JUNCTIONLINING_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_JUNCTIONLINING_DELETE"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client_id"] == null) || ((string)Request.QueryString["project_id"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in jls_delete.aspx");
                }

                // Tag Page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfCurrentProjectId.Value = Request.QueryString["project_id"].ToString();
                hdfCurrentClientId.Value = Request.QueryString["client_id"].ToString();

                // Prepare initial data
                // ... for client
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());
                int companyId = Int32.Parse(hdfCompanyId.Value);

                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                // ... for project
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                if (name.Length > 23) name = name.Substring(0, 20) + "...";
                lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Selected Sections";

                // If coming from
                // ... jls_navigator2.aspx
                if (Request.QueryString["source_page"] == "jls_navigator2.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = "no";
                }

                // ... flat_section_jls_summary.aspx
                if (Request.QueryString["source_page"] == "flat_section_jls_summary.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];
                }

                // Restore datasets
                flatSectionJlsTDS = (FlatSectionJlsTDS)Session["flatSectionJlsTDS"];
            }
            else
            {
                // Restore datasets
                flatSectionJlsTDS = (FlatSectionJlsTDS)Session["flatSectionJlsTDS"];
            }
        }
コード例 #3
0
        protected void btnExportList_Click(object sender, EventArgs e)
        {
            mForm7 master = (mForm7)this.Master;
            ScriptManager scriptManager = (ScriptManager)master.FindControl("ScriptManagerMaster7");

            if (!scriptManager.IsInAsyncPostBack)
            {
                string url = "";
                string headerValues = "";
                int totalColumnsExport = 11;
                int totalColumnsPreview = 11;
                string client = "";
                string name = "";
                string project = "";
                string title = "Manhole Rehabilitation Search Results";
                string columnsForReport = "";
                int j;

                // ... for client
                int companyId = Int32.Parse(hdfCompanyId.Value);
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());
                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                client += "Client: " + companiesGateway.GetName(currentClientId);

                // ... for project
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                project = projectGateway.GetName(currentProjectId);
                name = client + " > Project: " + project + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")";

                // ... for title view
                if (hdfBtnOrigin.Value == "Go")
                {
                    int viewId = Int32.Parse(ddlView.SelectedValue.Trim());

                    // ... Load name view
                    WorkViewGateway workViewGateway = new WorkViewGateway();
                    workViewGateway.LoadByViewId(viewId, companyId);

                    title = workViewGateway.GetName(viewId);
                }

                // ... For comments option
                string comments = "None";

                headerValues = "";
                columnsForReport = "";

                // Establishing header values
                if (grdMRNavigator.Columns[1].Visible) headerValues += "Manhole No";
                if (grdMRNavigator.Columns[2].Visible) headerValues += " * Street";
                if (grdMRNavigator.Columns[3].Visible) headerValues += " * Latitude";
                if (grdMRNavigator.Columns[4].Visible) headerValues += " * Longitude";
                if (grdMRNavigator.Columns[5].Visible) headerValues += " * Shape";
                if (grdMRNavigator.Columns[6].Visible) headerValues += " * Location";
                if (grdMRNavigator.Columns[7].Visible) headerValues += " * Condition Rating";
                if (grdMRNavigator.Columns[8].Visible) headerValues += " * Prepped Date";
                if (grdMRNavigator.Columns[9].Visible) headerValues += " * Sprayed Date";
                if (grdMRNavigator.Columns[10].Visible) headerValues += " * Batch Date";
                if (grdMRNavigator.Columns[11].Visible) headerValues += " * Comments";

                // Establishing columns to display
                string[] columnsExcel = headerValues.Split('*');

                // ... for visible columns
                for (int i = 0; i < columnsExcel.Length; i++)
                {
                    j = i + 1;
                    columnsForReport += "&header" + j + "=" + columnsExcel[i].Trim();
                }

                // ... For not visible columns
                for (int i = columnsExcel.Length; i < totalColumnsExport; i++)
                {
                    j = i + 1;
                    columnsForReport += "&header" + j + "=None";
                }

                // Report call
                Page.Validate();
                if (Page.IsValid)
                {
                    PostPageChanges();
                    title = title.Replace("'", "%27");
                    Response.Write("<script language='javascript'> {window.open('./mr_print_search_results_report.aspx?" + columnsForReport + "&comments=" + comments + "&totalColumnsPreview=" + totalColumnsPreview + "&totalColumnsExport=" + totalColumnsExport + "&totalSelectedColumns=" + columnsExcel.Length + "&name=" + Server.UrlEncode(name) + "&title=" + Server.UrlEncode(title) + "&format=excel', '_blank', 'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=800, height=680');}</script>");
                }

                if (url != "") Response.Redirect(url);
            }
        }
コード例 #4
0
        private void Generate()
        {
            mReport1 master = (mReport1)this.Master;

            // Get Data
            JlLiningPlanTDS jlLiningPlanTDS = (JlLiningPlanTDS)Session["jlLiningPlanTDS"];
            JlLiningPlan jlLiningPlan = new JlLiningPlan();
            jlLiningPlan.ProcessForReport(jlLiningPlanTDS);

            // ... set properties to master page
            master.Data = jlLiningPlan.Data;
            master.Table = jlLiningPlan.TableName;

            // Get report
            if (jlLiningPlan.Table.Rows.Count > 0)
            {
                master.Report = new JlLiningPlanReport();

                // ... for client
                int companyId = Int32.Parse(Session["companyID"].ToString());
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value);
                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                master.SetParameter("Client", companiesGateway.GetName(currentClientId));

                // ... for project
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value);
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                master.SetParameter("Project", projectGateway.GetProjectNumber(currentProjectId));

                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());
            }
        }
コード例 #5
0
        /// <summary>
        /// ProcessDataForProject
        /// </summary>
        /// <param name="companyId">companyId</param>
        /// <para>Process de data from the original table for the Project Costing report </para>  
        private void ProcessDataForProject(int currentProjectId, string currentPhase, int companyId)
        {
            ArrayList alDays = new ArrayList();
            double rateAcum = 0;
            int numPeriods = 0;

            string projectName = "";
            ProjectGateway projectGateway = new ProjectGateway();
            projectGateway.LoadByProjectId(currentProjectId);
            projectName = projectGateway.GetName(currentProjectId);

            foreach (PrintManhoursPerPhaseTDS.PrintManHoursPerPhaseRARow rowOriginal in (PrintManhoursPerPhaseTDS.PrintManHoursPerPhaseRADataTable)Table)
            {
                if (rowOriginal.ProjectName.Contains(projectName) && rowOriginal.Phase.Contains(currentPhase))
                {
                    if (!rowOriginal.IsTotalFtNull())
                    {
                        Distance distOriginal = new Distance(rowOriginal.TotalFt);
                        rowOriginal.TotalFtDouble = distOriginal.ToDoubleInEng3();
                        rowOriginal.RealFt = distOriginal.ToDoubleInEng3();
                    }
                    else
                    {
                        rowOriginal.TotalFtDouble = 0;
                        rowOriginal.RealFt = 0;
                    }

                    rateAcum = rateAcum + rowOriginal.RealFt / rowOriginal.Hrs;

                    // For get number of periods
                    if (!alDays.Contains(rowOriginal.Date))
                    {
                        alDays.Add(rowOriginal.Date);
                        numPeriods = numPeriods + 1;
                    }
                }
            }

            foreach (PrintManhoursPerPhaseTDS.PrintManHoursPerPhaseRARow row2 in (PrintManhoursPerPhaseTDS.PrintManHoursPerPhaseRADataTable)Table)
            {
                if (row2.ProjectName.Contains(projectName) && row2.Phase.Contains(currentPhase))
                {
                    row2.AverageRate = rateAcum / numPeriods;
                    row2.NumPeriods = numPeriods;
                }
            }
        }
コード例 #6
0
        private void Generate3()
        {
            mReportForM12 master = (mReportForM12)this.Master;
            string unitType = ddlUnitType.SelectedValue;
            int companyId = Convert.ToInt32(hdfCompanyId.Value);

            FlM1ReportTDS flM1ReportTDS = new FlM1ReportTDS();

            // Get Data
            LiquiForce.LFSLive.BL.CWP.FullLengthLining.FlM1Report flM1Report = new LiquiForce.LFSLive.BL.CWP.FullLengthLining.FlM1Report(flM1ReportTDS);
            LiquiForce.LFSLive.BL.CWP.FullLengthLining.FlM12Report flM2Report = new LiquiForce.LFSLive.BL.CWP.FullLengthLining.FlM12Report(flM1ReportTDS);

            GetM1Data(flM1Report, unitType, companyId);
            GetM2Data(flM2Report, unitType);

            // ... set properties to master page
            //FlM1ReportTDS dataSet = new FlM1ReportTDS();
            //dataSet.M1ReportByClient.Merge(flM1Report, true);
            //dataSet.M2_SECTION.Merge(flM2Report, true);

            master.Data3 = flM1ReportTDS;
            master.Table1 = flM1Report.TableName;
            master.Table2 = flM2Report.TableName;

            // Get report
            if (flM2Report.Table.Rows.Count > 0 || flM1Report.Table.Rows.Count > 0)
            {
                if (master.Format3 == "pdf")
                {
                    master.Report3 = new FlM12Report();

                    if (ddlClient.SelectedValue != "-1")
                    {
                        // ... for client
                        int currentClientId = Int32.Parse(ddlClient.SelectedValue);

                        CompaniesGateway companiesGateway = new CompaniesGateway();
                        companiesGateway.LoadByCompaniesId(currentClientId, companyId);

                        master.SetParameter3("Client", companiesGateway.GetName(currentClientId));
                    }
                    else
                    {
                        master.SetParameter3("Client", "All");
                    }

                    if (ddlProject.SelectedValue != "-1")
                    {
                        // ... for project
                        int currentProjectId = Int32.Parse(ddlProject.SelectedValue);

                        ProjectGateway projectGateway = new ProjectGateway();
                        projectGateway.LoadByProjectId(currentProjectId);

                        string name = projectGateway.GetName(currentProjectId);
                        master.SetParameter3("Project", name);
                    }
                    else
                    {
                        master.SetParameter3("Project", "All");
                    }

                    master.SetParameter3("UnitType", unitType);

                    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.SetParameter3("User", user.Trim());
                }
                else
                {
                    //master.Report2 = new FlM12ReportExport();
                }
            }
        }
コード例 #7
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) && ((string)Request.QueryString["others"] == null) && ((string)Request.QueryString["employee_id"] == null) && ((string)Request.QueryString["period_id"] == null) && ((string)Request.QueryString["projecttime_id"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in timesheet_summary.aspx");
                }

                // Security check
                if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_FULL_EDITING"]))
                {
                    if (Request.QueryString["others"] == "no")
                    {
                        if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_VIEW"]))
                        {
                            if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT"]))
                            {
                                if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT_WED"]))
                                {
                                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                                }
                            }
                        }
                    }
                    else
                    {
                        if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_VIEW"]))
                        {
                            if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT"]))
                            {
                                if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT_WED"]))
                                {
                                    if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_OTHERS_TIMESHEETS_VIEW"]))
                                    {
                                        if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_OTHERS_TIMESHEETS_MANAGEMENT"]))
                                        {
                                            if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_OTHERS_TIMESHEETS_MANAGEMENT_WED"]))
                                            {
                                                Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                // Initialize viewstate's variables
                ViewState["others"] = Request.QueryString["others"];
                ViewState["employee_id"] = int.Parse(Request.QueryString["employee_id"]);
                ViewState["period_id"] = int.Parse(Request.QueryString["period_id"]);
                ViewState["projecttime_id"] = int.Parse(Request.QueryString["projecttime_id"]);
                System.Configuration.AppSettingsReader appSettingReader = new System.Configuration.AppSettingsReader();
                ViewState["LHMode"] = appSettingReader.GetValue("LABOUR_HOURS_OPERATION_MODE", typeof(System.String)).ToString();

                // Get ProjectTime record
                projectTimeTDS =  new ProjectTimeTDS();

                ProjectTimeGateway projectTimeGateway = new ProjectTimeGateway(projectTimeTDS);
                projectTimeGateway.LoadByProjectTimeId((int)ViewState["projecttime_id"]);

                // Store datasets
                Session["projectTimeTDS"] = projectTimeTDS;

                // Databind
                tbxDate.DataBind();
                tbxWorkingDetails.DataBind();
                tbxStartTime.DataBind();
                tbxEndTime.DataBind();
                tbxLunch.DataBind();
                tbxComments.DataBind();
                tbxState.DataBind();

                // Prepare initial data for client
                StoreNavigatorState();

                EmployeeGateway employeeGateway = new EmployeeGateway(new DataSet());
                employeeGateway.LoadByEmployeeId((int)ViewState["employee_id"]);
                tbxEmployee.Text = employeeGateway.GetFullName((int)ViewState["employee_id"]);

                int companyId = Int32.Parse(Session["companyID"].ToString());

                CompaniesGateway companiesGateway = new CompaniesGateway(new DataSet());
                companiesGateway.LoadAllByCompaniesId(projectTimeGateway.GetCompaniesId((int)ViewState["projecttime_id"]), companyId);
                tbxClient.Text = companiesGateway.GetName(projectTimeGateway.GetCompaniesId((int)ViewState["projecttime_id"]));

                ProjectGateway projectGateway = new ProjectGateway(new DataSet());
                projectGateway.LoadByProjectId(projectTimeGateway.GetProjectId((int)ViewState["projecttime_id"]));
                tbxProject.Text = projectGateway.GetName(projectTimeGateway.GetProjectId((int)ViewState["projecttime_id"])) + "(" + projectGateway.GetProjectNumber(projectTimeGateway.GetProjectId((int)ViewState["projecttime_id"])) + ")";

                if (projectGateway.GetFairWageApplies(projectTimeGateway.GetProjectId((int)ViewState["projecttime_id"])))
                {
                    tbxJobClassType.Visible = true;
                    lblJobClassType.Visible = true;
                    tbxJobClassType.Text = projectTimeGateway.GetJobClassType((int)ViewState["projecttime_id"]);
                }
                else
                {
                    tbxJobClassType.Visible = false;
                    lblJobClassType.Visible = false;
                }

                if (projectTimeGateway.GetMealsCountry((int)ViewState["projecttime_id"]).HasValue)
                {
                    CountryGateway countryGateway = new CountryGateway(new DataSet());
                    countryGateway.LoadByCountryId((Int64)projectTimeGateway.GetMealsCountry((int)ViewState["projecttime_id"]));
                    tbxMealsCountry.Text = countryGateway.GetName((Int64)projectTimeGateway.GetMealsCountry((int)ViewState["projecttime_id"]));
                }

                //if (projectTimeGateway.GetMealsAllowance((int)ViewState["projecttime_id"]) > 0)
                //{
                //    cbxMealsAllowance.Checked = true;
                //}

                //if (projectTimeGateway.GetFairWage((int)ViewState["projecttime_id"]))
                //{
                //    cbxFairWage.Checked = true;
                //}

                if (projectTimeGateway.GetUnitId((int)ViewState["projecttime_id"]).HasValue)
                {
                    UnitsGateway unitGateway = new UnitsGateway(new DataSet());
                    unitGateway.LoadByUnitId((int)projectTimeGateway.GetUnitId((int)ViewState["projecttime_id"]), Convert.ToInt32(Session["companyID"]));
                    tbxUnit.Text = unitGateway.GetUnitCode((int)projectTimeGateway.GetUnitId((int)ViewState["projecttime_id"]));
                }

                if (projectTimeGateway.GetTowedUnitId((int)ViewState["projecttime_id"]).HasValue)
                {
                    UnitsGateway unitGateway = new UnitsGateway(new DataSet());
                    unitGateway.LoadByUnitId((int)projectTimeGateway.GetTowedUnitId((int)ViewState["projecttime_id"]), Convert.ToInt32(Session["companyID"]));
                    tbxTowed.Text = unitGateway.GetUnitCode((int)projectTimeGateway.GetTowedUnitId((int)ViewState["projecttime_id"]));
                }

                tbxTypeOfWork.Text = "";
                if (projectTimeGateway.GetWork((int)ViewState["projecttime_id"]) != "")
                {
                    tbxTypeOfWork.Text = projectTimeGateway.GetWork((int)ViewState["projecttime_id"]);
                }

                tbxFunction.Text = "";
                if (projectTimeGateway.GetFunction((int)ViewState["projecttime_id"]) != "")
                {
                    tbxFunction.Text = projectTimeGateway.GetFunction((int)ViewState["projecttime_id"]);
                }
            }
            else
            {
                // Restore datasets
                projectTimeTDS = (ProjectTimeTDS)Session["projectTimeTDS"];
            }
        }
コード例 #8
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!Convert.ToBoolean(Session["sgLFS_CWP_POINTREPAIRS_VIEW"]))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client_id"] == null) || ((string)Request.QueryString["project_id"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in pr_lining_plan.aspx");
                }

                // Tag Page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfCurrentProjectId.Value = Request.QueryString["project_id"].ToString();
                hdfCurrentClientId.Value = Request.QueryString["client_id"].ToString();
                hdfWorkType.Value = "Point Repairs";

                // Prepare initial data

                // ... for client
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());
                int companyId = Int32.Parse(hdfCompanyId.Value);

                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                // ... for project
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                if (name.Length > 23) name = name.Substring(0, 20) + "...";
                lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Lining Plan";

                // ... for the grid
                prLiningPlanTDS = new PlLiningPlanTDS();
                int projectId = Int32.Parse(hdfCurrentProjectId.Value);

                PrLiningPlanGateway prLiningPlanGateway = new PrLiningPlanGateway(prLiningPlanTDS);
                prLiningPlanGateway.ClearBeforeFill = false;
                prLiningPlanGateway.Load(projectId, companyId);

                grdLiningPlan.DataSource = prLiningPlanGateway.Table;
                grdLiningPlan.DataBind();

                // Check results
                if (prLiningPlanTDS.PlLiningPlan.Rows.Count > 0)
                {
                    tPreview.Visible = true;
                    tdNoResults.Visible = false;
                    tbFooterToolbar.Visible = true;
                }
                else
                {
                    tPreview.Visible = false;
                    tdNoResults.Visible = true;
                    tbFooterToolbar.Visible = false;
                }

                // Check results
                if (prLiningPlanTDS.PlLiningPlan.Rows.Count == 1)
                {
                    tbFooterToolbar.Visible = false;
                }

                // Store dataset
                Session["prLiningPlanTDS"] = prLiningPlanTDS;
            }
            else
            {
                // Restore dataset
                prLiningPlanTDS = (PlLiningPlanTDS)Session["prLiningPlanTDS"];

                // ... for the grid
                PrLiningPlanGateway prLiningPlanGateway = new PrLiningPlanGateway(prLiningPlanTDS);
                grdLiningPlan.DataSource = prLiningPlanGateway.Table;
                grdLiningPlan.DataBind();
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        /// <summary>
        /// Load
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="startDate">startDate</param>
        /// <param name="endDate">endDate</param>
        /// <param name="companyId">companyId</param>
        public void Load(ArrayList projects, DateTime startDate, DateTime endDate, int companyId, int clientId)
        {
            int refId = 0;

            foreach (int projectId in projects)
            {
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(projectId);

                string project = projectGateway.GetName(projectId);

                ProjectCostingSheetAddSubcontractorListGateway projectCostingSheetAddSubcontractorListGateway = new ProjectCostingSheetAddSubcontractorListGateway(Data);
                projectCostingSheetAddSubcontractorListGateway.LoadByProjectIdStartDateEndDate(projectId, startDate, endDate, companyId);

                foreach (ProjectCostingSheetAddTDS.SubcontractorListRow subcontractorListRow in (ProjectCostingSheetAddTDS.SubcontractorListDataTable)projectCostingSheetAddSubcontractorListGateway.Table)
                {
                    DateTime newStartDate = new DateTime();
                    newStartDate = startDate;
                    DateTime newEndDate = new DateTime();
                    newEndDate = endDate;

                    ProjectCostingSheetAddOriginalSubcontractorGateway projectCostingSheetAddOriginalSubcontractorGateway = new ProjectCostingSheetAddOriginalSubcontractorGateway(Data);
                    projectCostingSheetAddOriginalSubcontractorGateway.LoadByProjectIdStartDateEndDateSubcontractorId(projectId, newStartDate, newEndDate, subcontractorListRow.SubcontractorID);

                    if (projectCostingSheetAddOriginalSubcontractorGateway.Table.Rows.Count > 0)
                    {
                        foreach (ProjectCostingSheetAddTDS.OriginalSubcontractorRow originalSubcontractorRow in (ProjectCostingSheetAddTDS.OriginalSubcontractorDataTable)projectCostingSheetAddOriginalSubcontractorGateway.Table)
                        {
                            ProjectCostingSheetAddTDS.CombinedSubcontractorsInformationRow newRow = ((ProjectCostingSheetAddTDS.CombinedSubcontractorsInformationDataTable)Table).NewCombinedSubcontractorsInformationRow();
                            newRow.CostingSheetID = 0;
                            newRow.SubcontractorID = subcontractorListRow.SubcontractorID;
                            newRow.RefID = refId++;
                            newRow.Quantity = originalSubcontractorRow.Quantity;
                            newRow.CostCad = originalSubcontractorRow.RateCad;
                            newRow.TotalCostCad = (Convert.ToDecimal(originalSubcontractorRow.Quantity) * originalSubcontractorRow.RateCad);
                            newRow.CostUsd = originalSubcontractorRow.RateUsd;
                            newRow.TotalCostUsd = (Convert.ToDecimal(originalSubcontractorRow.Quantity) * originalSubcontractorRow.RateUsd);
                            newRow.Deleted = false;
                            newRow.InDatabase = false;
                            newRow.COMPANY_ID = companyId;
                            newRow.Comment = ""; if (!originalSubcontractorRow.IsCommentNull()) newRow.Comment = originalSubcontractorRow.Comment;
                            newRow.UnitOfMeasurement = subcontractorListRow.UnitOfMeasurement;
                            //newRow.StartDate = newStartDate;
                            newRow.StartDate = originalSubcontractorRow.Date_;
                            newRow.EndDate = newEndDate;
                            newRow.FromDatabase = true;
                            newRow.Subcontractor = originalSubcontractorRow.Subcontractor;
                            newRow.ClientID = clientId;
                            newRow.ProjectID = projectId;
                            newRow.Project = project;
                            ((ProjectCostingSheetAddTDS.CombinedSubcontractorsInformationDataTable)Table).AddCombinedSubcontractorsInformationRow(newRow);
                        }
                    }
                }
            }
        }
コード例 #10
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_VIEW"]))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (Request.QueryString["source_page"] == null)
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in project_sections_navigator2.aspx");
                }

                projectTDS = (ProjectTDS)Session["lfsProjectTDS"];
                assetsTDS = new AssetsTDS();
                lfsAssetsTDS = new LfsAssetsTDS();
                workTDS = new WorkTDS();

                // Tag page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfProjectId.Value = Request.QueryString["project_id"];
                hdfDataChanged.Value = Request.QueryString["data_changed"];
                hdfDataChangedMessage.Value = "Changes made to this project will not be saved.";
                ViewState["state"] = Request.QueryString["state"];
                ViewState["active_tab"] = Request.QueryString["active_tab"];
                ViewState["origin"] = Request.QueryString["origin"];
                ViewState["update"] = Request.QueryString["update"];

                Session.Remove("projectSectionsNavigatorNewDummy");
                Session.Remove("projectSectionsNavigator");

                // Prepare initial data
                lblError.Visible = false;

                // ... for project
                int currentProjectId = Int32.Parse(hdfProjectId.Value.ToString());
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                if (name.Length > 23) name = name.Substring(0, 20) + "...";
                lblTitleProjectName.Text = name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")";

                // ... for client
                int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                int currentClientId = projectGateway.GetClientID(Int32.Parse(hdfProjectId.Value.ToString()));
                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadAllByCompaniesId(currentClientId, companyId);
                lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                hdfClientId.Value = projectGateway.GetClientID(int.Parse(hdfProjectId.Value)).ToString();

                // Store navigator state at projects navigator
                StoreNavigatorState();

                // ... project_sections_navigator.aspx or project_sections_navigator2.aspx
                if ((Request.QueryString["source_page"] == "project_sections_navigator.aspx") || (Request.QueryString["source_page"] == "project_sections_navigator2.aspx"))
                {
                    // Restore navigator state
                    RestoreNavigatorState();

                    // Restore data
                    projectSectionsNavigatorTDS = (ProjectSectionsNavigatorTDS)Session["lfsProjectSectionsNavigatorTDS"];
                    projectSectionsNavigator = projectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATOR;

                    // Store data
                    Session["projectSectionsNavigator"] = projectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATOR;

                    if (Request.QueryString["update_section"] == "no")
                    {
                        // Restore data
                        projectSectionsNavigatorTDS = (ProjectSectionsNavigatorTDS)Session["lfsProjectSectionsNavigatorTDS"];
                        projectSectionsNavigator = projectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATOR;

                        // Store data
                        Session["projectSectionsNavigator"] = projectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATOR;
                    }
                    else
                    {
                        // ... Delete store data
                        Session.Contents.Remove("lfsProjectSectionsNavigatorTDS");

                        // ... Search data with updates
                        projectSectionsNavigatorTDS = SubmitSearch();

                        // ... store datasets
                        Session["lfsProjectSectionsNavigatorTDS"] = projectSectionsNavigatorTDS;
                        Session["projectSectionsNavigator"] = projectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATOR;
                    }

                    //... for the total rows
                    if (projectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATOR.Rows.Count > 0)
                    {
                        lblTotalRows.Text = "Total Rows: " + projectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATOR.Rows.Count;
                        lblTotalRows.Visible = true;
                    }
                    else
                    {
                        lblTotalRows.Visible = false;
                    }
                }
            }
            else
            {
                // Restore dataset
                projectTDS = (ProjectTDS)Session["lfsProjectTDS"];
                projectSectionsNavigatorTDS = (ProjectSectionsNavigatorTDS)Session["lfsProjectSectionsNavigatorTDS"];
                assetsTDS = (AssetsTDS)Session["assetsTDS"];
                lfsAssetsTDS = (LfsAssetsTDS)Session["lfsAssetsTDS"];
                workTDS = (WorkTDS)Session["workTDS"];

                // ... for project
                int currentProjectId = Int32.Parse(hdfProjectId.Value.ToString());
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                if (name.Length > 23) name = name.Substring(0, 20) + "...";
                lblTitleProjectName.Text = name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")";

                // ... for client
                int companyId = Int32.Parse(hdfCompanyId.Value);
                int currentClientId = projectGateway.GetClientID(Int32.Parse(hdfProjectId.Value.ToString()));
                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadAllByCompaniesId(currentClientId, companyId);
                lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                // Restore searched data (if any)
                projectSectionsNavigatorTDS = (ProjectSectionsNavigatorTDS)Session["lfsProjectSectionsNavigatorTDS"];
                projectSectionsNavigator = projectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATOR;

                //... for the total rows
                if (projectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATOR.Rows.Count > 0)
                {
                    lblTotalRows.Text = "Total Rows: " + projectSectionsNavigatorTDS.LFS_PROJECT_SECTIONS_NAVIGATOR.Rows.Count;
                }
                else
                {
                    lblTotalRows.Visible = false;
                }
            }
        }
コード例 #11
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_CWP_JUNCTIONLINING_VIEW"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client_id"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["work_type"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in jl_navigator.aspx");
                }

                // Tag Page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfCurrentProjectId.Value = Request.QueryString["project_id"].ToString();
                hdfCurrentClientId.Value = Request.QueryString["client_id"].ToString();
                hdfWorkType.Value = Request.QueryString["work_type"].ToString();

                // Prepare initial data
                // ... For sortByList
                odsSortByList.DataBind();
                ddlSortBy.DataSourceID = "odsSortByList";
                ddlSortBy.DataValueField = "SortID";
                ddlSortBy.DataTextField = "Name";
                ddlSortBy.DataBind();

                // ... For
                odsViewForDisplayList.DataBind();
                odsViewForDisplayList2.DataBind();

                // ... For view ddl
                int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                string workType = hdfWorkType.Value;
                int loginId = Convert.ToInt32(Session["loginID"]);
                string viewTypeGlobal = "";
                string viewTypePersonal = "Personal";

                // Global Views check
                if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
                {
                    viewTypeGlobal = "Global";
                }

                WorkViewList workViewList = new WorkViewList();
                workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId);
                ddlView.DataSource = workViewList.Table;
                ddlView.DataValueField = "ViewID";
                ddlView.DataTextField = "Name";
                ddlView.DataBind();
                ddlView.SelectedIndex = 1;

                WorkTypeViewSubAreaList workTypeViewSubAreaList = new WorkTypeViewSubAreaList();
                workTypeViewSubAreaList.LoadAndAddItem("Junction Lining", Int32.Parse(hdfCompanyId.Value), int.Parse(hdfCurrentProjectId.Value), "(All)");
                ddlSubArea.DataSource = workTypeViewSubAreaList.Table;
                ddlSubArea.DataValueField = "SubArea";
                ddlSubArea.DataTextField = "SubArea";
                ddlSubArea.DataBind();

                // ... for client
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());

                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                // ... for project
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                if (name.Length > 23) name = name.Substring(0, 20) + "...";
                lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")";

                // If coming from

                // ... Left Menu, select_project.aspx or Projects2.aspx
                if ((Request.QueryString["source_page"] == "lm") || (Request.QueryString["source_page"] == "select_project.aspx") || (Request.QueryString["source_page"] == "Projects2.aspx"))
                {
                    tdNoResults.Visible = false;
                }

                // ... jl_navigator2.aspx
                if (Request.QueryString["source_page"] == "jl_navigator2.aspx")
                {
                    RestoreNavigatorState();
                    if ((string)Request.QueryString["no_results"] == "yes")
                    {
                        tdNoResults.Visible = true;
                    }
                    else
                    {
                        tdNoResults.Visible = true;
                    }
                }
            }
        }
コード例 #12
0
        private void Generate()
        {
            mReport1 master = (mReport1)this.Master;
            LiquiForce.LFSLive.BL.CWP.ManholeRehabilitation.MrSummaryReport mrSummaryReport = new LiquiForce.LFSLive.BL.CWP.ManholeRehabilitation.MrSummaryReport();
            int companyId = Int32.Parse(hdfCompanyId.Value);

            Page.Validate();
            if (Page.IsValid)
            {
                // Get Data
                // For all clients
                if (ddlClient.SelectedValue == "-1")
                {
                    // validate checkboxes
                    if (cbxMhId.Checked)
                    {
                        ArrayList assetId = new ArrayList();
                        foreach (ListItem lst in cbxlMhId.Items)
                        {
                            if (lst.Selected)
                            {
                                assetId.Add(lst.Value);
                            }
                        }

                        mrSummaryReport.LoadByAssetId(companyId, assetId);
                    }
                }

                // For specific client
                else
                {
                    // For all projects
                    if (ddlProject.SelectedValue == "-1")
                    {
                        if (cbxMhId.Checked)
                        {
                            ArrayList assetId = new ArrayList();
                            foreach (ListItem lst in cbxlMhId.Items)
                            {
                                if (lst.Selected)
                                {
                                    assetId.Add(lst.Value);
                                }
                            }

                            mrSummaryReport.LoadByCompaniesIdAssetId(companyId, int.Parse(ddlClient.SelectedValue), assetId);
                        }
                    }
                    // For specific project
                    else
                    {
                        if (cbxMhId.Checked)
                        {
                            ArrayList assetId = new ArrayList();
                            foreach (ListItem lst in cbxlMhId.Items)
                            {
                                if (lst.Selected)
                                {
                                    assetId.Add(lst.Value);
                                }
                            }

                            mrSummaryReport.LoadByCompaniesIdProjectIdAssetId(companyId, int.Parse(ddlClient.SelectedValue), int.Parse(ddlProject.SelectedValue), assetId);
                        }
                    }
                }
            }

            // ... set properties to master page
            master.Data = mrSummaryReport.Data;
            master.Table = mrSummaryReport.TableName;

            // Get report
            if (mrSummaryReport.Table.Rows.Count > 0)
            {
                if (master.Format == "pdf")
                {
                    master.Report = new MrSummaryReport();
                }
                else
                {
                    master.Report = new MrSummaryReportExport();
                }

                // ... set parameters to report
                if (master.Format == "pdf")
                {
                    if (ddlClient.SelectedValue != "-1")
                    {
                        // ... for client
                        int currentClientId = Int32.Parse(ddlClient.SelectedValue);

                        CompaniesGateway companiesGateway = new CompaniesGateway();
                        companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                        master.SetParameter("Client", companiesGateway.GetName(currentClientId));
                    }
                    else
                    {
                        master.SetParameter("Client", "All");
                    }

                    if (ddlProject.SelectedValue != "-1")
                    {
                        // ... for project
                        int currentProjectId = Int32.Parse(ddlProject.SelectedValue);
                        ProjectGateway projectGateway = new ProjectGateway();
                        projectGateway.LoadByProjectId(currentProjectId);
                        string name = projectGateway.GetName(currentProjectId);
                        master.SetParameter("Project", name);
                    }
                    else
                    {
                        master.SetParameter("Project", "All");
                    }

                    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());
                }
            }
        }
コード例 #13
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            bool isFromTabClick = false;

            if (!IsPostBack)
            {
                if (!isFromTabClick)
                {
                    // Security check
                    if (!(Convert.ToBoolean(Session["sgLFS_CWP_MANHOLEREHABILITATION_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_MANHOLEREHABILITATION_EDIT"])))
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                    }

                    // Validate query string
                    if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client_id"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["asset_id"] == null) || ((string)Request.QueryString["active_tab"] == null) || ((string)Request.QueryString["in_project"] == null))
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in mr_edit.aspx");
                    }

                    // Tag Page
                    TagPage();

                    // If coming from
                    int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                    int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                    int assetId = Int32.Parse(hdfAssetId.Value.Trim());
                    int workId = Int32.Parse(hdfWorkId.Value.Trim());
                    string workType = hdfWorkType.Value;
                    lblNotLastBatch.Visible = false;

                    // ... mr_navigator2.aspx
                    if (Request.QueryString["source_page"] == "mr_navigator2.aspx")
                    {
                        StoreNavigatorState();
                        ViewState["update"] = "no";

                        // ... Set initial tab
                        if ((string)Session["dialogOpenedMr"] != "1")
                        {
                            hdfActiveTab.Value = Request.QueryString["active_tab"];

                            manholeRehabilitationTDS = new ManholeRehabilitationTDS();

                            ManholeRehabilitationManholeDetails manholeRehabilitationManholeDetails = new ManholeRehabilitationManholeDetails(manholeRehabilitationTDS);
                            manholeRehabilitationManholeDetails.LoadByAssetId(assetId, companyId);

                            ManholeRehabilitationWorkDetails fullLengthLiningWorkDetails = new ManholeRehabilitationWorkDetails(manholeRehabilitationTDS);
                            fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId);
                        }
                        else
                        {
                            hdfActiveTab.Value = (string)Session["activeTabMr"];

                            // Restore datasets
                            manholeRehabilitationTDS = (ManholeRehabilitationTDS)Session["manholeRehabilitationTDS"];
                        }

                        // ... Store dataset
                        Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS;
                    }

                    // ... mr_summary.aspx or mr_edit.aspx
                    if ((Request.QueryString["source_page"] == "mr_summary.aspx") || (Request.QueryString["source_page"] == "mr_edit.aspx"))
                    {
                        StoreNavigatorState();
                        ViewState["update"] = Request.QueryString["update"];

                        // ... Restore dataset
                        manholeRehabilitationTDS = (ManholeRehabilitationTDS)Session["manholeRehabilitationTDS"];

                        // ... Set initial tab
                        if ((string)Session["dialogOpenedMr"] != "1")
                        {
                            hdfActiveTab.Value = Request.QueryString["active_tab"];
                        }
                        else
                        {
                            hdfActiveTab.Value = (string)Session["activeTabMr"];
                        }

                        if (ViewState["update"].ToString().Trim() == "yes")
                        {
                            ManholeRehabilitationManholeDetails manholeRehabilitationManholeDetails = new ManholeRehabilitationManholeDetails(manholeRehabilitationTDS);
                            manholeRehabilitationManholeDetails.LoadByAssetId(assetId, companyId);

                            ManholeRehabilitationWorkDetails fullLengthLiningWorkDetails = new ManholeRehabilitationWorkDetails(manholeRehabilitationTDS);
                            fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId);

                            // ... Store dataset
                            Session["manholeRehabilitationTDS"] = manholeRehabilitationTDS;
                        }
                    }

                    // Set initial data
                    int activeTab = Int32.Parse(hdfActiveTab.Value);
                    tcMrDetails.ActiveTabIndex = activeTab;
                    lblBatchDateRequired.Visible = false;

                    if ((hdfCurrentClientId.Value != "0") && (hdfCurrentProjectId.Value != "0"))
                    {
                        // ... for client
                        int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());
                        CompaniesGateway companiesGateway = new CompaniesGateway();
                        companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                        lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                        // ... for project
                        ProjectGateway projectGateway = new ProjectGateway();
                        projectGateway.LoadByProjectId(currentProjectId);
                        string name = projectGateway.GetName(currentProjectId);
                        if (name.Length > 23) name = name.Substring(0, 20) + "...";
                        lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Selected Manhole";
                    }
                    else
                    {
                        lblTitleClientName.Text = "";
                        lblTitleProjectName.Text = "";
                    }

                    // ... For batch dates
                    WorkManholeRehabilitationBatchList workManholeRehabilitationBatchList = new WorkManholeRehabilitationBatchList();
                    workManholeRehabilitationBatchList.LoadAndAddItem(-1, "(Select a batch)", companyId);
                    ddlRehabilitationBatchDate.DataSource = workManholeRehabilitationBatchList.Table;
                    ddlRehabilitationBatchDate.DataValueField = "BatchID";
                    ddlRehabilitationBatchDate.DataTextField = "Description";
                    ddlRehabilitationBatchDate.DataBind();

                    // ... ... Data for current manhole rehabilitation work
                    LoadManholeRehabilitationData(currentProjectId, assetId, companyId);

                    // ... ... Make panels visible
                    ShapeStructure();

                    // Databind
                    Page.DataBind();

                    // For usmh, dsmh autocomplete
                    string provinceId_ = "0"; if (hdfProvinceId.Value != "") provinceId_ = hdfProvinceId.Value;
                    string countyId_ = "0"; if (hdfCountyId.Value != "") countyId_ = hdfCountyId.Value;
                    string cityId_ = "0"; if (hdfCityId.Value != "") cityId_ = hdfCityId.Value;
                }
            }
            else
            {
                // Restore datasets
                manholeRehabilitationTDS = (ManholeRehabilitationTDS)Session["manholeRehabilitationTDS"];

                // Set initial tab
                int activeTab = Int32.Parse(hdfActiveTab.Value);
                tcMrDetails.ActiveTabIndex = activeTab;
            }
        }
コード例 #14
0
        private void masterParameters(mReport1 master)
        {
            DateTime startDate = DateTime.Parse(tkrdpStartDate.SelectedDate.Value.ToShortDateString());
            DateTime endDate = DateTime.Parse(tkrdpEndDate.SelectedDate.Value.ToShortDateString());
            int companyId = Int32.Parse(hdfCompanyId.Value);

            // ... set parameters to report
            if (master.Format == "pdf")
            {
                // ... ... client
                if (ddlClient.SelectedValue != "-1")
                {
                    int currentClientId = Int32.Parse(ddlClient.SelectedValue);
                    CompaniesGateway companiesGateway = new CompaniesGateway();
                    companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                    master.SetParameter("Client", companiesGateway.GetName(currentClientId));
                }
                else
                {
                    master.SetParameter("Client", "All");
                }

                // ... ...  project
                if (ddlProject.SelectedValue != "-1")
                {
                    int currentProjectId = Int32.Parse(ddlProject.SelectedValue);
                    ProjectGateway projectGateway = new ProjectGateway();
                    projectGateway.LoadByProjectId(currentProjectId);
                    string name = projectGateway.GetName(currentProjectId);
                    master.SetParameter("Project", name);
                }
                else
                {
                    master.SetParameter("Project", "All");
                }

                // ... ... category
                if (ddlCategory.SelectedValue != "-1")
                {
                    string currentCategory = ddlCategory.SelectedValue;
                    master.SetParameter("Category", currentCategory);
                }
                else
                {
                    master.SetParameter("Category", "All");
                }

                // ... ... user
                LoginGateway loginGateway = new LoginGateway();
                loginGateway.LoadByLoginId(Convert.ToInt32(Session["loginID"]), companyId);
                string user = loginGateway.GetLastName(Convert.ToInt32(Session["loginID"]), companyId) + " " + loginGateway.GetFirstName(Convert.ToInt32(Session["loginID"]), companyId);
                master.SetParameter("User", user.Trim());

                // ... for start date
                string startDateParameter = startDate.Month.ToString() + "/" + startDate.Day.ToString() + "/" + startDate.Year.ToString();
                master.SetParameter("StartDate", startDateParameter);

                // ... for end date
                string endDateParameter = endDate.Month.ToString() + "/" + endDate.Day.ToString() + "/" + endDate.Year.ToString();
                master.SetParameter("EndDate", endDateParameter);
            }
        }
コード例 #15
0
        private void Generate()
        {
            mReport1 master = (mReport1)this.Master;

            // Get Data
            DateTime startDate = DateTime.Parse(tkrdpStartDate.SelectedDate.Value.ToShortDateString());
            DateTime endDate = DateTime.Parse(tkrdpEndDate.SelectedDate.Value.ToShortDateString());
            int companyId = Int32.Parse(hdfCompanyId.Value);
            LiquiForce.LFSLive.BL.Projects.Projects.ProductionReport productionReport = new LiquiForce.LFSLive.BL.Projects.Projects.ProductionReport();

            if (ddlCountry.SelectedValue == "(All)")
            {
                if (ddlClient.SelectedValue == "-1")
                {
                    productionReport.LoadByStartDateEndDate(startDate, endDate, companyId);
                }
                else
                {
                    int clientId = int.Parse(ddlClient.SelectedValue);

                    if (ddlProject.SelectedValue == "-1")
                    {
                        productionReport.LoadByClientIdStartDateEndDate(clientId, startDate, endDate, companyId);
                    }
                    else
                    {
                        int projectId = int.Parse(ddlProject.SelectedValue);
                        productionReport.LoadByClientIdProjectIdStartDateEndDate(clientId, projectId, startDate, endDate, companyId);
                    }
                }
            }
            else
            {
                int country = Int32.Parse(ddlCountry.SelectedValue);

                if (ddlClient.SelectedValue == "-1")
                {
                    productionReport.LoadByCountryIdStartDateEndDate(country, startDate, endDate, companyId);
                }
                else
                {
                    int clientId = int.Parse(ddlClient.SelectedValue);

                    if (ddlProject.SelectedValue == "-1")
                    {
                        productionReport.LoadByCountryIdClientIdStartDateEndDate(country, clientId, startDate, endDate, companyId);
                    }
                    else
                    {
                        int projectId = int.Parse(ddlProject.SelectedValue);
                        productionReport.LoadByCountryIdClientIdProjectIdStartDateEndDate(country, clientId, projectId, startDate, endDate, companyId);
                    }
                }
            }

            LiquiForce.LFSLive.DA.Projects.Projects.ProductionReportGateway productionReportGateway = new LiquiForce.LFSLive.DA.Projects.Projects.ProductionReportGateway(productionReport.Data);

            // ... set properties to master page
            master.Data = productionReportGateway.Data;
            master.Table = productionReportGateway.TableName;

            // Get report
            if (productionReportGateway.Table.Rows.Count > 0)
            {
                if (master.Format == "pdf")
                {
                    master.Report = new LiquiForce.LFSLive.WebUI.Projects.Projects.ProductionReport();
                }
                else
                {
                    master.Report = new LiquiForce.LFSLive.WebUI.Projects.Projects.ProductionReportExport();
                }

                // ... set parameters to report
                if (master.Format == "pdf")
                {
                    // ... ...  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());

                    // ... ... country
                    if (ddlCountry.SelectedValue == "2")
                    {
                        master.SetParameter("Country", "USA");
                    }
                    else
                    {
                        if (ddlCountry.SelectedValue == "1")
                        {
                            master.SetParameter("Country", "Canada");
                        }
                        else
                        {
                            master.SetParameter("Country", "All");
                        }
                    }

                    // ... ... 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);
                    }

                    // ... ... Date
                    string startDateParameter = tkrdpStartDate.SelectedDate.Value.ToShortDateString();
                    master.SetParameter("StartDate", startDateParameter);

                    string endDateParameter = tkrdpEndDate.SelectedDate.Value.ToShortDateString();
                    master.SetParameter("EndDate", endDateParameter);

                    // ... ... client
                    if (ddlClient.SelectedValue == "-1")
                    {
                        master.SetParameter("Client", "All");
                    }
                    else
                    {
                        int currentClientId = Int32.Parse(ddlClient.SelectedValue);

                        CompaniesGateway companiesGateway = new CompaniesGateway();
                        companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                        master.SetParameter("Client", companiesGateway.GetName(currentClientId));
                    }
                }
                else
                {
                    // ... ... Date
                    string startDateParameter = tkrdpStartDate.SelectedDate.Value.ToShortDateString();
                    master.SetParameter("StartDate", startDateParameter);

                    string endDateParameter = tkrdpEndDate.SelectedDate.Value.ToShortDateString();
                    master.SetParameter("EndDate", endDateParameter);
                }
            }
        }
コード例 #16
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            bool isFromTabClick = false;

            if (!IsPostBack)
            {
                if (!isFromTabClick)
                {
                    // Security check
                    if (!(Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_EDIT"])))
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                    }

                    // Validate query string
                    if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client_id"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["asset_id"] == null) || ((string)Request.QueryString["active_tab"] == null))
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in fl_edit.aspx");
                    }

                    // Tag Page
                    TagPage();

                    // Prepare initial data
                    Session.Remove("flAddLateralsNewDummy");
                    Session.Remove("wetOutCatalystsDetailsDummy");
                    Session.Remove("materialInformationTDS");

                    materialInformationTDS = new MaterialInformationTDS();

                    // ... for wet out section list
                    AssetSewerSectionList assetSewerSectionList = new AssetSewerSectionList();
                    assetSewerSectionList.LoadAndAddItem(Int32.Parse(hdfCurrentProjectId.Value), hdfWorkType.Value, "-1", "(All)", Int32.Parse(hdfCompanyId.Value));
                    cbxlSectionId.DataSource = assetSewerSectionList.Table;
                    cbxlSectionId.DataValueField = "SectionID";
                    cbxlSectionId.DataTextField = "FlowOrderID";
                    cbxlSectionId.DataBind();

                    cbxlInversionDataSectionId.DataSource = assetSewerSectionList.Table;
                    cbxlInversionDataSectionId.DataValueField = "SectionID";
                    cbxlInversionDataSectionId.DataTextField = "FlowOrderID";
                    cbxlInversionDataSectionId.DataBind();

                    // If coming from
                    int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                    int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                    int assetId = Int32.Parse(hdfAssetId.Value.Trim());
                    int workId = Int32.Parse(hdfWorkId.Value.Trim());
                    string workType = hdfWorkType.Value;

                    // ... fl_navigator2.aspx
                    if (Request.QueryString["source_page"] == "fl_navigator2.aspx")
                    {
                        StoreNavigatorState();
                        ViewState["update"] = "no";

                        // ... Set initial tab
                        if ((string)Session["dialogOpenedFll"] != "1")
                        {
                            hdfActiveTab.Value = Request.QueryString["active_tab"];

                            fullLengthLiningTDS = new FullLengthLiningTDS();

                            FullLengthLiningSectionDetails fullLengthLiningSectionDetails = new FullLengthLiningSectionDetails(fullLengthLiningTDS);
                            fullLengthLiningSectionDetails.LoadByWorkId(workId, companyId);

                            FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS);
                            fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId);

                            FullLengthLiningLateralDetails fullLengthLiningLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS);
                            fullLengthLiningLateralDetails.LoadForEdit(workId, assetId, companyId, currentProjectId);

                            FullLengthLiningWetOutCatalystsDetails fullLengthLiningWetOutCatalystsDetails = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS);
                            fullLengthLiningWetOutCatalystsDetails.LoadAll(workId, companyId);
                        }
                        else
                        {
                            hdfActiveTab.Value = (string)Session["activeTabFll"];

                            // Restore datasets
                            fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];
                        }

                        // ... Store dataset
                        Session["fullLengthLiningTDS"] = fullLengthLiningTDS;
                    }

                    // ... fl_summary.aspx or fl_edit.aspx
                    if ((Request.QueryString["source_page"] == "fl_summary.aspx") || (Request.QueryString["source_page"] == "fl_edit.aspx"))
                    {
                        StoreNavigatorState();
                        ViewState["update"] = Request.QueryString["update"];

                        // ... Restore dataset
                        fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];

                        // ... Set initial tab
                        if ((string)Session["dialogOpenedFll"] != "1")
                        {
                            hdfActiveTab.Value = Request.QueryString["active_tab"];
                        }
                        else
                        {
                            hdfActiveTab.Value = (string)Session["activeTabFll"];
                        }

                        if (ViewState["update"].ToString().Trim() == "yes")
                        {
                            FullLengthLiningSectionDetails fullLengthLiningSectionDetails = new FullLengthLiningSectionDetails(fullLengthLiningTDS);
                            fullLengthLiningSectionDetails.LoadByWorkId(workId, companyId);

                            FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS);
                            fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId);

                            FullLengthLiningLateralDetails fullLengthLiningLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS);
                            fullLengthLiningLateralDetails.LoadForEdit(workId, assetId, companyId, currentProjectId);

                            FullLengthLiningWetOutCatalystsDetails fullLengthLiningWetOutCatalystsDetails = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS);
                            fullLengthLiningWetOutCatalystsDetails.LoadAll(workId, companyId);

                            // ... Store dataset
                            Session["fullLengthLiningTDS"] = fullLengthLiningTDS;
                        }
                    }

                    // Prepare initial data
                    lblMissingData.Visible = false;

                    // Set initial tab
                    int activeTab = Int32.Parse(hdfActiveTab.Value);
                    tcFlDetails.ActiveTabIndex = activeTab;

                    // ... for client
                    int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());
                    CompaniesGateway companiesGateway = new CompaniesGateway();
                    companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                    lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                    // ... for project
                    ProjectGateway projectGateway = new ProjectGateway();
                    projectGateway.LoadByProjectId(currentProjectId);
                    string name = projectGateway.GetName(currentProjectId);
                    if (name.Length > 23) name = name.Substring(0, 20) + "...";
                    lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Selected Section";

                    // ... Data for current full length lining work
                    LoadFullLengthLiningData(currentProjectId, assetId, companyId);

                    // Databind
                    Page.DataBind();

                    // Especial load for Run details
                    string runDetails = hdfRunDetails.Value;
                    WorkFullLengthLiningWetOutGateway workFullLengthLiningWetOutGateway = new WorkFullLengthLiningWetOutGateway();
                    workFullLengthLiningWetOutGateway.LoadByWorkId(workId, companyId);

                    // ... Verify if work has cipp information to load run details
                    if (workFullLengthLiningWetOutGateway.Table.Rows.Count > 0)
                    {
                        string[] runDetailsList = runDetails.Split('>');
                        for (int i = 0; i < runDetailsList.Length; i++)
                        {
                            cbxlSectionId.Items.FindByValue(runDetailsList[i]).Selected = true;
                            cbxlInversionDataSectionId.Items.FindByValue(runDetailsList[i]).Selected = true;
                        }
                    }
                    else
                    {
                        if (cbxlSectionId.Items.Count > 1)
                        {
                            cbxlSectionId.Items.FindByValue(runDetails).Selected = true;
                        }
                    }

                    // SelectIndex for grids
                    ((DropDownList)grdLaterals.FooterRow.FindControl("ddlNewMaterial")).SelectedIndex = 0;
                    ((DropDownList)grdCatalysts.FooterRow.FindControl("ddlNameFooter")).SelectedIndex = 0;

                    // For usmh, dsmh autocomplete
                    string provinceId_ = "0"; if (hdfProvinceId.Value != "") provinceId_ = hdfProvinceId.Value;
                    string countyId_ = "0"; if (hdfCountyId.Value != "") countyId_ = hdfCountyId.Value;
                    string cityId_ = "0"; if (hdfCityId.Value != "") cityId_ = hdfCityId.Value;

                    aceUsmh.ContextKey = hdfCountryId.Value + "," + provinceId_ + "," + countyId_ + "," + cityId_ + "," + hdfCompanyId.Value;
                    aceDsmh.ContextKey = hdfCountryId.Value + "," + provinceId_ + "," + countyId_ + "," + cityId_ + "," + hdfCompanyId.Value;

                    // Make Wetout tab visible
                    if (ckbxWetOutDataIncludeWetOutInformation.Checked)
                    {
                        pnlVisibleInformation.Visible = true;
                        upnlVisibleInformation.Update();
                    }
                    else
                    {
                        pnlVisibleInformation.Visible = false;
                        upnlVisibleInformation.Update();
                    }

                    // Make inversion tab visible
                    lblInversionDataInversionMissingData.Visible = false;
                    uplInversionDataInversionMissingData.Update();
                    if (ckbxInversionDataIncludeInversionInformation.Checked)
                    {
                        // ... ... visible only if wet out information is provided.
                        if (!ckbxWetOutDataIncludeWetOutInformation.Checked)
                        {
                            pnlInversionVisibleInformation.Visible = false;
                            upnlInversionVisibleInformation.Update();
                        }
                        else
                        {

                            pnlInversionVisibleInformation.Visible = true;
                            upnlInversionVisibleInformation.Update();
                        }
                    }
                    else
                    {
                        pnlInversionVisibleInformation.Visible = false;
                        upnlInversionVisibleInformation.Update();
                    }

                    // Load Materials
                    MaterialInformationGateway materialInformationGateway = new MaterialInformationGateway(materialInformationTDS);
                    materialInformationGateway.LoadAllByAssetId(assetId, companyId);

                    materialInformation = materialInformationTDS.MaterialInformation;
                    Session["materialInformationTDS"] = materialInformationTDS;
                }
            }
            else
            {
                // Restore datasets
                fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];
                flatSectionJlTDSForFLL = (FlatSectionJlTDS)Session["flatSectionJlTDSForFLL"];
                materialInformationTDS = (MaterialInformationTDS)Session["materialInformationTDS"];
                materialInformation = materialInformationTDS.MaterialInformation;

                // Set initial tab
                int activeTab = Int32.Parse(hdfActiveTab.Value);
                tcFlDetails.ActiveTabIndex = activeTab;
            }
        }
コード例 #17
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_PROJECTS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_PROJECTS_EDIT"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["project_id"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in project_edit.aspx");
                }

                // Tag page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfProjectId.Value = Request.QueryString["project_id"];
                hdfLoginId.Value = Convert.ToInt32(Session["loginID"]).ToString();
                hdfDataChanged.Value = Request.QueryString["data_changed"];
                hdfDataChangedMessage.Value = "Changes made to this project will not be saved.";

                // Prepare initial data
                Session.Remove("projectNotesDummy");
                Session.Remove("projectServicesDummy");
                Session.Remove("projectTypeOfWorkFunctionClassificationDummy");
                Session.Remove("projectJobClassClassificationDummy");
                Session.Remove("projectBudgetDummy");
                Session.Remove("subcontractorsBudgetDummy");
                Session.Remove("hotelsBudgetDummy");
                Session.Remove("bondingsBudgetDummy");
                Session.Remove("insurancesBudgetDummy");
                Session.Remove("otherCostsBudgetDummy");

                Session["fairWage"] = "None";

                // ... Set initial tab
                if ((string)Session["dialogOpenedProjects"] != "1")
                {
                    hdfActiveTab.Value = Request.QueryString["active_tab"];
                }
                else
                {
                    hdfActiveTab.Value = (string)Session["activeTabProjects"];
                }

                // ... For Library
                if (Session["lfsLibraryTDS"] != null)
                {
                    libraryTDS = (LibraryTDS)Session["lfsLibraryTDS"];
                }
                else
                {
                    libraryTDS = new LibraryTDS();
                }

                // If coming from
                // ... projects2.aspx or project_add.aspx
                if (Request.QueryString["source_page"] == "projects2.aspx" || Request.QueryString["source_page"] == "project_add.aspx")
                {
                    // Store Navigator State, Update control and Origin
                    StoreNavigatorState();
                    ViewState["update"] = "no";
                    ViewState["origin"] = "navigator";

                    // Get Project Id
                    int projectId = int.Parse(hdfProjectId.Value);

                    // ... Attachment control
                    if (Session["fromAttachment"] != null)
                    {
                        if (Session["fromAttachment"].ToString() == "yes")
                        {
                            // Restore dataset
                            projectTDS = (ProjectTDS)Session["lfsProjectTDS"];
                            projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"];
                            projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"];
                            projectServices = (ProjectNavigatorTDS.ProjectServiceDataTable)Session["projectServices"];
                            projectJobClassClassification = (ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable)Session["projectJobClassClassification"];
                            projectTypeOfWorkFunctionClassification = (ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable)Session["projectTypeOfWorkFunctionClassification"];
                            projectBudget = (ProjectNavigatorTDS.ProjectWorkFunctionBudgetDataTable)Session["projectBudget"];
                            unitsBudget = (ProjectNavigatorTDS.ProjectUnitsBudgetDataTable)Session["unitsBudget"];
                            materialsBudget = (ProjectNavigatorTDS.ProjectMaterialsBudgetDataTable)Session["materialsBudget"];
                            subcontractorsBudget = (ProjectNavigatorTDS.ProjectSubcontractorsBudgetDataTable)Session["subcontractorsBudget"];
                            hotelsBudget = (ProjectNavigatorTDS.ProjectHotelsBudgetDataTable)Session["hotelsBudget"];
                            bondingsBudget = (ProjectNavigatorTDS.ProjectBondingsBudgetDataTable)Session["bondingsBudget"];
                            insurancesBudget = (ProjectNavigatorTDS.ProjectInsurancesBudgetDataTable)Session["insurancesBudget"];
                            otherCostsBudget = (ProjectNavigatorTDS.ProjectOtherCostsBudgetDataTable)Session["otherCostsBudget"];
                        }

                        Session.Remove("fromAttachment");
                    }
                    else
                    {
                        // Get dataset
                        projectTDS = new ProjectTDS();
                        projectNavigatorTDS = new ProjectNavigatorTDS();
                        projectNotes = new ProjectNavigatorTDS.ProjectNotesDataTable();
                        projectServices = new ProjectNavigatorTDS.ProjectServiceDataTable();
                        projectTypeOfWorkFunctionClassification = new ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable();
                        projectJobClassClassification = new ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable();
                        projectBudget = new ProjectNavigatorTDS.ProjectWorkFunctionBudgetDataTable();
                        unitsBudget = new ProjectNavigatorTDS.ProjectUnitsBudgetDataTable();
                        materialsBudget = new ProjectNavigatorTDS.ProjectMaterialsBudgetDataTable();
                        subcontractorsBudget = new ProjectNavigatorTDS.ProjectSubcontractorsBudgetDataTable();
                        hotelsBudget = new ProjectNavigatorTDS.ProjectHotelsBudgetDataTable();
                        bondingsBudget = new ProjectNavigatorTDS.ProjectBondingsBudgetDataTable();
                        insurancesBudget = new ProjectNavigatorTDS.ProjectInsurancesBudgetDataTable();
                        otherCostsBudget = new ProjectNavigatorTDS.ProjectOtherCostsBudgetDataTable();

                        // Get General Data
                        ProjectGateway projectGatewayForLoad = new ProjectGateway(projectTDS);
                        projectGatewayForLoad.LoadByProjectId(projectId);

                        // Get job info
                        ProjectJobInfoGateway projectJobInfoGateway = new ProjectJobInfoGateway(projectNavigatorTDS);
                        projectJobInfoGateway.LoadAllByProjectId(projectId);

                        // Get Sale/Billing/Pricing
                        ProjectSaleBillingPricingGateway projectSaleBillingPricingGatewayForLoad = new ProjectSaleBillingPricingGateway(projectTDS);
                        projectSaleBillingPricingGatewayForLoad.LoadAllByProjectId(projectId);

                        // ... Get Sale/Billing/Pricing - Services
                        ProjectNavigatorProjectService projectNavigatorProjectService = new ProjectNavigatorProjectService(projectNavigatorTDS);
                        projectNavigatorProjectService.LoadAllByProjectId(projectId);
                        projectNavigatorProjectService.UpdateForLoad();

                        // Get Costing Updates
                        ProjectCostingUpdatesGateway projectCostingUpdatesGatewayForLoad = new ProjectCostingUpdatesGateway(projectTDS);
                        projectCostingUpdatesGatewayForLoad.LoadByProjectId(projectId);

                        // Get Project Terms
                        ProjectTermsPOGateway projectTermsPOGatewayForLoad = new ProjectTermsPOGateway(projectTDS);
                        projectTermsPOGatewayForLoad.LoadByProjectId(projectId);

                        // Get Technical
                        ProjectTechnicalGateway projectTechnicalGatewayForLoad = new ProjectTechnicalGateway(projectTDS);
                        projectTechnicalGatewayForLoad.LoadByProjectId(projectId);

                        // Get Engineer Subcontractors
                        ProjectEngineerSubcontractorsGateway projectEngineerSubcontractorsGatewayForLoad = new ProjectEngineerSubcontractorsGateway(projectTDS);
                        projectEngineerSubcontractorsGatewayForLoad.LoadAllByProjectId(projectId);

                        // ... Get Subcontractors
                        ProjectSubcontractorGateway projectSubcontractorGatewayForLoad = new ProjectSubcontractorGateway(projectTDS);
                        projectSubcontractorGatewayForLoad.LoadAllByProjectId(projectId);

                        // Cost Exceptions
                        // ... Get Type Of Work & Function Classification
                        ProjectNavigatorProjectWorkFunctionFairWage projectNavigatorProjectWorkFunctionFairWage = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS);
                        projectNavigatorProjectWorkFunctionFairWage.LoadAllByProjectId(projectId);

                        // ... Get Job Class Classification
                        ProjectNavigatorProjectJobClassTypeRate projectNavigatorProjectJobClassTypeRate = new ProjectNavigatorProjectJobClassTypeRate(projectNavigatorTDS);
                        projectNavigatorProjectJobClassTypeRate.LoadAllByProjectId(projectId);

                        // Get Budget
                        ProjectNavigatorProjectWorkFunctionBudget projectNavigatorProjectWorkFunctionBudget = new ProjectNavigatorProjectWorkFunctionBudget(projectNavigatorTDS);
                        projectNavigatorProjectWorkFunctionBudget.LoadAllByProjectId(projectId);

                        // Get Units Budget
                        ProjectNavigatorProjectUnitsBudget projectNavigatorProjectUnitsBudget = new ProjectNavigatorProjectUnitsBudget(projectNavigatorTDS);
                        projectNavigatorProjectUnitsBudget.LoadAllByProjectId(projectId);

                        // Get Materials Budget
                        ProjectNavigatorProjectMaterialsBudget projectNavigatorProjectMaterialsBudget = new ProjectNavigatorProjectMaterialsBudget(projectNavigatorTDS);
                        projectNavigatorProjectMaterialsBudget.LoadAllByProjectId(projectId);

                        // Get Subcontractors Budget
                        ProjectNavigatorProjectSubcontractorsBudget projectNavigatorProjectSubcontractorsBudget = new ProjectNavigatorProjectSubcontractorsBudget(projectNavigatorTDS);
                        projectNavigatorProjectSubcontractorsBudget.LoadAllByProjectId(projectId);

                        // Get Hotels Budget
                        ProjectNavigatorProjectHotelsBudget projectNavigatorProjectHotelsBudget = new ProjectNavigatorProjectHotelsBudget(projectNavigatorTDS);
                        projectNavigatorProjectHotelsBudget.LoadAllByProjectId(projectId);

                        // Get Bondings Budget
                        ProjectNavigatorProjectBondingsBudget projectNavigatorProjectBondingsBudget = new ProjectNavigatorProjectBondingsBudget(projectNavigatorTDS);
                        projectNavigatorProjectBondingsBudget.LoadAllByProjectId(projectId);

                        // Get Insurances Budget
                        ProjectNavigatorProjectInsurancesBudget projectNavigatorProjectInsurancesBudget = new ProjectNavigatorProjectInsurancesBudget(projectNavigatorTDS);
                        projectNavigatorProjectInsurancesBudget.LoadAllByProjectId(projectId);

                        // Get Other Costs Budget
                        ProjectNavigatorProjectOtherCostsBudget projectNavigatorProjectOtherCostsBudget = new ProjectNavigatorProjectOtherCostsBudget(projectNavigatorTDS);
                        projectNavigatorProjectOtherCostsBudget.LoadAllByProjectId(projectId);

                        // Get Notes
                        ProjectNavigatorProjectNotes projectNavigatorProjectNotes = new ProjectNavigatorProjectNotes(projectNavigatorTDS);
                        projectNavigatorProjectNotes.LoadAllByProjectId(projectId);

                        // Store dataset
                        Session["lfsProjectTDS"] = projectTDS;
                        Session["projectNavigatorTDS"] = projectNavigatorTDS;
                        Session["projectNotes"] = projectNavigatorTDS.ProjectNotes;
                        Session["projectServices"] = projectNavigatorTDS.ProjectService;
                        Session["projectTypeOfWorkFunctionClassification"] = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE;
                        Session["projectJobClassClassification"] = projectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATE;
                        Session["projectBudget"] = projectNavigatorTDS.ProjectWorkFunctionBudget;
                        Session["unitsBudget"] = projectNavigatorTDS.ProjectUnitsBudget;
                        Session["materialsBudget"] = projectNavigatorTDS.ProjectMaterialsBudget;
                        Session["subcontractorsBudget"] = projectNavigatorTDS.ProjectSubcontractorsBudget;
                        Session["hotelsBudget"] = projectNavigatorTDS.ProjectHotelsBudget;
                        Session["bondingsBudget"] = projectNavigatorTDS.ProjectBondingsBudget;
                        Session["insurancesBudget"] = projectNavigatorTDS.ProjectInsurancesBudget;
                        Session["otherCostsBudget"] = projectNavigatorTDS.ProjectOtherCostsBudget;
                    }

                    //grdNotes.DataBind();
                    //grdServices.DataBind();
                    grdTypeOfWorkFunctionClassification.DataBind();
                    grdJobClassClassification.DataBind();
                    grdBudget.DataBind();
                    /*grdSubcontractorsBudget.DataBind();
                    grdHotelsBudget.DataBind();
                    grdBondingsBudget.DataBind();
                    grdInsurancesBudget.DataBind();*/
                    grdOtherCostsBudget.DataBind();
                }

                // ... project_summary.aspx or project_edit.aspx
                if ((Request.QueryString["source_page"] == "project_summary.aspx") || (Request.QueryString["source_page"] == "project_edit.aspx") || (Request.QueryString["source_page"] == "lm"))
                {
                    // Store Navigator State, update control and origin
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];
                    ViewState["origin"] = Request.QueryString["origin"]; //summary

                    // Restore dataset
                    projectTDS = (ProjectTDS)Session["lfsProjectTDS"];
                    projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"];
                    projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"];
                    projectServices = (ProjectNavigatorTDS.ProjectServiceDataTable)Session["projectServices"];
                    projectJobClassClassification = (ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable)Session["projectJobClassClassification"];
                    projectTypeOfWorkFunctionClassification = (ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable)Session["projectTypeOfWorkFunctionClassification"];
                    projectBudget = (ProjectNavigatorTDS.ProjectWorkFunctionBudgetDataTable)Session["projectBudget"];
                    unitsBudget = (ProjectNavigatorTDS.ProjectUnitsBudgetDataTable)Session["unitsBudget"];
                    materialsBudget = (ProjectNavigatorTDS.ProjectMaterialsBudgetDataTable)Session["materialsBudget"];
                    subcontractorsBudget = (ProjectNavigatorTDS.ProjectSubcontractorsBudgetDataTable)Session["subcontractorsBudget"];
                    hotelsBudget = (ProjectNavigatorTDS.ProjectHotelsBudgetDataTable)Session["hotelsBudget"];
                    bondingsBudget = (ProjectNavigatorTDS.ProjectBondingsBudgetDataTable)Session["bondingsBudget"];
                    insurancesBudget = (ProjectNavigatorTDS.ProjectInsurancesBudgetDataTable)Session["insurancesBudget"];
                    otherCostsBudget = (ProjectNavigatorTDS.ProjectOtherCostsBudgetDataTable)Session["otherCostsBudget"];

                    // Get Project Id
                    int projectId = int.Parse(hdfProjectId.Value);

                    if (ViewState["update"].ToString().Trim() == "yes")
                    {
                        // Get General Data
                        ProjectGateway projectGatewayForLoad = new ProjectGateway(projectTDS);
                        projectGatewayForLoad.LoadByProjectId(projectId);

                        // Get job info
                        ProjectJobInfoGateway projectJobInfoGateway = new ProjectJobInfoGateway(projectNavigatorTDS);
                        projectJobInfoGateway.LoadAllByProjectId(projectId);

                        // Get Sale/Billing/Pricing
                        ProjectSaleBillingPricingGateway projectSaleBillingPricingGatewayForLoad = new ProjectSaleBillingPricingGateway(projectTDS);
                        projectSaleBillingPricingGatewayForLoad.LoadAllByProjectId(projectId);

                        // ... Get Sale/Billing/Pricing - Services
                        ProjectNavigatorProjectService projectNavigatorProjectService = new ProjectNavigatorProjectService(projectNavigatorTDS);
                        projectNavigatorProjectService.LoadAllByProjectId(projectId);
                        projectNavigatorProjectService.UpdateForLoad();

                        // Get Costing Updates
                        ProjectCostingUpdatesGateway projectCostingUpdatesGatewayForLoad = new ProjectCostingUpdatesGateway(projectTDS);
                        projectCostingUpdatesGatewayForLoad.LoadByProjectId(projectId);

                        // Get Project Terms
                        ProjectTermsPOGateway projectTermsPOGatewayForLoad = new ProjectTermsPOGateway(projectTDS);
                        projectTermsPOGatewayForLoad.LoadByProjectId(projectId);

                        // Get Technical
                        ProjectTechnicalGateway projectTechnicalGatewayForLoad = new ProjectTechnicalGateway(projectTDS);
                        projectTechnicalGatewayForLoad.LoadByProjectId(projectId);

                        // Get Engineer Subcontractors
                        ProjectEngineerSubcontractorsGateway projectEngineerSubcontractorsGatewayForLoad = new ProjectEngineerSubcontractorsGateway(projectTDS);
                        projectEngineerSubcontractorsGatewayForLoad.LoadAllByProjectId(projectId);

                        // ... Get Subcontractors
                        ProjectSubcontractorGateway projectSubcontractorGatewayForLoad = new ProjectSubcontractorGateway(projectTDS);
                        projectSubcontractorGatewayForLoad.LoadAllByProjectId(projectId);

                        // Cost Exceptions
                        // ... Get Type Of Work & Function Classification
                        ProjectNavigatorProjectWorkFunctionFairWage projectNavigatorProjectWorkFunctionFairWage = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS);
                        projectNavigatorProjectWorkFunctionFairWage.LoadAllByProjectId(projectId);

                        // ... Get Job Class Classification
                        ProjectNavigatorProjectJobClassTypeRate projectNavigatorProjectJobClassTypeRate = new ProjectNavigatorProjectJobClassTypeRate(projectNavigatorTDS);
                        projectNavigatorProjectJobClassTypeRate.LoadAllByProjectId(projectId);

                        // Get Budget
                        ProjectNavigatorProjectWorkFunctionBudget projectNavigatorProjectWorkFunctionBudget = new ProjectNavigatorProjectWorkFunctionBudget(projectNavigatorTDS);
                        projectNavigatorProjectWorkFunctionBudget.LoadAllByProjectId(projectId);

                        // Get Units Budget
                        ProjectNavigatorProjectUnitsBudget projectNavigatorProjectUnitsBudget = new ProjectNavigatorProjectUnitsBudget(projectNavigatorTDS);
                        projectNavigatorProjectUnitsBudget.LoadAllByProjectId(projectId);

                        // Get Materials Budget
                        ProjectNavigatorProjectMaterialsBudget projectNavigatorProjectMaterialsBudget = new ProjectNavigatorProjectMaterialsBudget(projectNavigatorTDS);
                        projectNavigatorProjectMaterialsBudget.LoadAllByProjectId(projectId);

                        // Get Subcontractors Budget
                        ProjectNavigatorProjectSubcontractorsBudget projectNavigatorProjectSubcontractorsBudget = new ProjectNavigatorProjectSubcontractorsBudget(projectNavigatorTDS);
                        projectNavigatorProjectSubcontractorsBudget.LoadAllByProjectId(projectId);

                        // Get Hotels Budget
                        ProjectNavigatorProjectHotelsBudget projectNavigatorProjectHotelsBudget = new ProjectNavigatorProjectHotelsBudget(projectNavigatorTDS);
                        projectNavigatorProjectHotelsBudget.LoadAllByProjectId(projectId);

                        // Get Bondings Budget
                        ProjectNavigatorProjectBondingsBudget projectNavigatorProjectBondingsBudget = new ProjectNavigatorProjectBondingsBudget(projectNavigatorTDS);
                        projectNavigatorProjectBondingsBudget.LoadAllByProjectId(projectId);

                        // Get Insurances Budget
                        ProjectNavigatorProjectInsurancesBudget projectNavigatorProjectInsurancesBudget = new ProjectNavigatorProjectInsurancesBudget(projectNavigatorTDS);
                        projectNavigatorProjectInsurancesBudget.LoadAllByProjectId(projectId);

                        // Get Other Costs Budget
                        ProjectNavigatorProjectOtherCostsBudget projectNavigatorProjectOtherCostsBudget = new ProjectNavigatorProjectOtherCostsBudget(projectNavigatorTDS);
                        projectNavigatorProjectOtherCostsBudget.LoadAllByProjectId(projectId);

                        // Get Notes
                        ProjectNavigatorProjectNotes projectNavigatorProjectNotes = new ProjectNavigatorProjectNotes(projectNavigatorTDS);
                        projectNavigatorProjectNotes.LoadAllByProjectId(projectId);

                        //grdNotes.DataBind();
                        //grdServices.DataBind();
                        grdTypeOfWorkFunctionClassification.DataBind();
                        grdJobClassClassification.DataBind();
                        grdBudget.DataBind();
                        /*grdSubcontractorsBudget.DataBind();
                        grdHotelsBudget.DataBind();
                        grdBondingsBudget.DataBind();
                        grdInsurancesBudget.DataBind();*/
                        grdOtherCostsBudget.DataBind();

                        // Store dataset
                        Session["lfsProjectTDS"] = projectTDS;
                        Session["projectNavigatorTDS"] = projectNavigatorTDS;
                        Session["projectNotes"] = projectNavigatorTDS.ProjectNotes;
                        Session["projectServices"] = projectNavigatorTDS.ProjectService;
                        Session["projectTypeOfWorkFunctionClassification"] = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE;
                        Session["projectJobClassClassification"] = projectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATE;
                        Session["projectBudget"] = projectNavigatorTDS.ProjectWorkFunctionBudget;
                        Session["unitsBudget"] = projectNavigatorTDS.ProjectUnitsBudget;
                        Session["materialsBudget"] = projectNavigatorTDS.ProjectMaterialsBudget;
                        Session["subcontractorsBudget"] = projectNavigatorTDS.ProjectSubcontractorsBudget;
                        Session["hotelsBudget"] = projectNavigatorTDS.ProjectHotelsBudget;
                        Session["bondingsBudget"] = projectNavigatorTDS.ProjectBondingsBudget;
                        Session["insurancesBudget"] = projectNavigatorTDS.ProjectInsurancesBudget;
                        Session["otherCostsBudget"] = projectNavigatorTDS.ProjectOtherCostsBudget;
                    }
                }

                // Data for current project
                ProjectGateway projectGateway = new ProjectGateway(projectTDS);

                // ... for project
                int currentProjectId = Int32.Parse(hdfProjectId.Value.ToString());
                string name = projectGateway.GetName(currentProjectId);
                if (name.Length > 23) name = name.Substring(0, 20) + "...";
                lblTitleProjectName.Text = name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")";

                // ... for client
                int companyId = Int32.Parse(hdfCompanyId.Value);
                int currentClientId = projectGateway.GetClientID(Int32.Parse(hdfProjectId.Value.ToString()));
                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadAllByCompaniesId(currentClientId, companyId);
                lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                // Load Data
                LoadData();

                // Store Dataset
                Session["lfsProjectTDS"] = projectTDS;

                //// ... For total cost at services
                //ProjectNavigatorProjectService projectNavigatorProjectServiceForCost = new ProjectNavigatorProjectService(projectNavigatorTDS);
                //tbxTotalCost.Text = Decimal.Round(projectNavigatorProjectServiceForCost.GetTotalCost(), 2).ToString();
            }
            else
            {
                // Restore dataset
                projectTDS = (ProjectTDS)Session["lfsProjectTDS"];
                projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"];
                projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"];
                projectServices = (ProjectNavigatorTDS.ProjectServiceDataTable)Session["projectServices"];
                projectJobClassClassification = (ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable)Session["projectJobClassClassification"];
                projectTypeOfWorkFunctionClassification = (ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable)Session["projectTypeOfWorkFunctionClassification"];
                projectBudget = (ProjectNavigatorTDS.ProjectWorkFunctionBudgetDataTable)Session["projectBudget"];
                unitsBudget = (ProjectNavigatorTDS.ProjectUnitsBudgetDataTable)Session["unitsBudget"];
                materialsBudget = (ProjectNavigatorTDS.ProjectMaterialsBudgetDataTable)Session["materialsBudget"];
                subcontractorsBudget = (ProjectNavigatorTDS.ProjectSubcontractorsBudgetDataTable)Session["subcontractorsBudget"];
                hotelsBudget = (ProjectNavigatorTDS.ProjectHotelsBudgetDataTable)Session["hotelsBudget"];
                bondingsBudget = (ProjectNavigatorTDS.ProjectBondingsBudgetDataTable)Session["bondingsBudget"];
                insurancesBudget = (ProjectNavigatorTDS.ProjectInsurancesBudgetDataTable)Session["insurancesBudget"];
                otherCostsBudget = (ProjectNavigatorTDS.ProjectOtherCostsBudgetDataTable)Session["otherCostsBudget"];

                tbxProjectNumber.DataBind();

                if (Session["lfsLibraryTDS"] != null)
                {
                    libraryTDS = (LibraryTDS)Session["lfsLibraryTDS"];
                }
                else
                {
                    libraryTDS = new LibraryTDS();
                }
            }
        }
コード例 #18
0
        private void Generate()
        {
            mReport1 master = (mReport1)this.Master;
            int companyId = Convert.ToInt32(Session["companyID"]);
            string type = Request.QueryString["type"].ToString();
            int costingSheetId = 0;
            int projectId = 0;

            ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation();

            if (ddlCostingSheets.SelectedValue != "-1")
            {
                // Get Data
                costingSheetId = Convert.ToInt32(ddlCostingSheets.SelectedValue);
                projectCostingSheetInformationBasicInformation.LoadByCostingSheetIdForPreviewReport(costingSheetId, companyId);
                ProjectCostingSheetInformationBasicInformationGateway projectCostingSheetInformationBasicInformationGateway = new ProjectCostingSheetInformationBasicInformationGateway(projectCostingSheetInformationBasicInformation.Data);
                projectId = projectCostingSheetInformationBasicInformationGateway.GetProjectID(costingSheetId);

                // ... set properties to master page
                master.Data = projectCostingSheetInformationBasicInformation.Data;
                master.Table = projectCostingSheetInformationBasicInformation.TableName;
                master.Report = new ProjectCostingSheetsPreview();

                // Get report
                if (projectCostingSheetInformationBasicInformation.Table.Rows.Count > 0)
                {
                    ProjectGateway projectGateway = new ProjectGateway();
                    projectGateway.LoadByProjectId(projectId);
                    int clientId = projectGateway.GetClientID(projectId);

                    CompaniesGateway companiesGateway = new CompaniesGateway();
                    companiesGateway.LoadByCompaniesId(clientId, companyId);
                    master.SetParameter("Client", companiesGateway.GetName(clientId));

                    string name = projectGateway.GetName(projectId);
                    master.SetParameter("Project", name);

                    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());

                    master.SetParameter("CostingSheet", projectCostingSheetInformationBasicInformationGateway.GetName(costingSheetId));

                    if (type == "resume")
                    {
                        ((Section)master.Report.ReportDefinition.Sections["detailsLabourHours"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["detailsLabourHours2"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["detailsUnits"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["detailsUnits2"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["detailsMaterials"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["detailsMaterials2"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["detailsOtherCosts"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["detailsOtherCosts2"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["detailsSubcontractors"]).SectionFormat.EnableSuppress = true;
                        //((Section)master.Report.ReportDefinition.Sections["detailsSubcontractors2"]).SectionFormat.EnableSuppress = true;
                    }
                    else
                    {
                        ((Section)master.Report.ReportDefinition.Sections["detailsLabourHours"]).SectionFormat.EnableSuppress = false;
                        ((Section)master.Report.ReportDefinition.Sections["detailsLabourHours2"]).SectionFormat.EnableSuppress = false;
                        ((Section)master.Report.ReportDefinition.Sections["detailsUnits"]).SectionFormat.EnableSuppress = false;
                        ((Section)master.Report.ReportDefinition.Sections["detailsUnits2"]).SectionFormat.EnableSuppress = false;
                        ((Section)master.Report.ReportDefinition.Sections["detailsMaterials"]).SectionFormat.EnableSuppress = false;
                        ((Section)master.Report.ReportDefinition.Sections["detailsMaterials2"]).SectionFormat.EnableSuppress = false;
                        ((Section)master.Report.ReportDefinition.Sections["detailsOtherCosts"]).SectionFormat.EnableSuppress = false;
                        ((Section)master.Report.ReportDefinition.Sections["detailsOtherCosts2"]).SectionFormat.EnableSuppress = false;
                        ((Section)master.Report.ReportDefinition.Sections["detailsSubcontractors"]).SectionFormat.EnableSuppress = false;
                        //((Section)master.Report.ReportDefinition.Sections["detailsSubcontractors2"]).SectionFormat.EnableSuppress = false;
                    }

                    if (projectGateway.GetCountryID(projectId) == 1)//Canada
                    {
                        // General
                        ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text32"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text34"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text36"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text38"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["headerTotalSubcontractorsUsd"].ObjectFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalLabourHoursUsd1"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalUnitsUsd1"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalMaterialsUsd1"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalOtherCostsUsd1"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["GrandTotalUsd1"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalSubcontractorsUsd1"].ObjectFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["GrandTotalUsd2"].ObjectFormat.EnableSuppress = true;

                        // Labour Hours
                        ReportDocument rpLabourHoursDetails = master.Report.OpenSubreport("LabourHoursDetails");
                        ReportDocument rpLabourHoursResume = master.Report.OpenSubreport("LabourHoursResume");

                        ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpLabourHoursDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["LHCostUsd1"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpLabourHoursDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true;
                        //
                        ((Section)rpLabourHoursResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpLabourHoursResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpLabourHoursResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true;

                        // Units
                        ReportDocument rpUnitsDetails = master.Report.OpenSubreport("UnitsDetails");
                        ReportDocument rpUnitsResume = master.Report.OpenSubreport("UnitsResume");

                        ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text3"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpUnitsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostUsd1"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpUnitsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true;
                        //
                        ((Section)rpUnitsResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpUnitsResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpUnitsResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true;

                        // Materials
                        ReportDocument rpMaterialsDetails = master.Report.OpenSubreport("MaterialsDetails");
                        ReportDocument rpMaterialsResune = master.Report.OpenSubreport("MaterialsResume");

                        ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text3"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpMaterialsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostUsd1"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpMaterialsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true;

                        ///
                        ((Section)rpMaterialsResune.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpMaterialsResune.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpMaterialsResune.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true;

                        // Subcontractors
                        ReportDocument rpSubcontractorsDetails = master.Report.OpenSubreport("SubcontractorsDetails");
                        //ReportDocument rpSubcontractorsResune = master.Report.OpenSubreport("SubcontractorsResume");

                        ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text3"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostUsd1"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true;

                        ///
                        //((Section)rpSubcontractorsResune.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true;

                        //((Section)rpSubcontractorsResune.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true;

                        //((Section)rpSubcontractorsResune.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true;

                        // Other Costs
                        ReportDocument rpOtherCostsDetails = master.Report.OpenSubreport("OtherCostsDetails");
                        ReportDocument rpOtherCostsResume = master.Report.OpenSubreport("OtherCostsResume");

                        ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text3"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpOtherCostsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostUsd1"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpOtherCostsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true;

                        ///
                        ((Section)rpOtherCostsResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpOtherCostsResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpOtherCostsResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true;
                    }
                    else//USA
                    {
                        // General
                        ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text31"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text33"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text35"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text37"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text1"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["headerTotalSubcontractorsCad"].ObjectFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalLabourHoursCad1"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalUnitsCad1"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalMaterialsCad1"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalOtherCostsCad1"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["GrandTotalCad1"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalSubcontractorsCad1"].ObjectFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["GrandTotalCad2"].ObjectFormat.EnableSuppress = true;

                        // Labour Hours
                        ReportDocument rpLabourHoursDetails = master.Report.OpenSubreport("LabourHoursDetails");
                        ReportDocument rpLabourHoursResume = master.Report.OpenSubreport("LabourHoursResume");

                        ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text9"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpLabourHoursDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["LHCostCad1"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpLabourHoursDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true;

                        //
                        ((Section)rpLabourHoursResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpLabourHoursResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpLabourHoursResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true;

                        // Units
                        ReportDocument rpUnitsDetails = master.Report.OpenSubreport("UnitsDetails");
                        ReportDocument rpUnitsResume = master.Report.OpenSubreport("UnitsResume");

                        ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpUnitsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostCad1"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpUnitsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true;

                        //
                        ((Section)rpUnitsResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpUnitsResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpUnitsResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true;

                        // Materials
                        ReportDocument rpMaterialsDetails = master.Report.OpenSubreport("MaterialsDetails");
                        ReportDocument rpMaterialsResune = master.Report.OpenSubreport("MaterialsResume");

                        ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpMaterialsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostCad1"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpMaterialsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true;

                        ///
                        ((Section)rpMaterialsResune.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpMaterialsResune.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpMaterialsResune.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true;

                        // Subcontractors
                        ReportDocument rpSubcontractorsDetails = master.Report.OpenSubreport("SubcontractorsDetails");

                        ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostCad1"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true;

                        // Other Costs
                        ReportDocument rpOtherCostsDetails = master.Report.OpenSubreport("OtherCostsDetails");
                        ReportDocument rpOtherCostsResume = master.Report.OpenSubreport("OtherCostsResume");

                        ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpOtherCostsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostCad1"].ObjectFormat.EnableSuppress = true;
                        ((Section)rpOtherCostsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true;

                        ///
                        ((Section)rpOtherCostsResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpOtherCostsResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true;

                        ((Section)rpOtherCostsResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true;
                    }
                }
            }
        }
コード例 #19
0
        protected void tkrmTop_ItemClick(object sender, RadMenuEventArgs e)
        {
            if (e.Item.Value == "mPreview")
            {
                if (prLiningPlanTDS.PlLiningPlan.Rows.Count > 0)
                {
                    Page.Validate();
                    if (Page.IsValid)
                    {
                        PostPageChanges();

                        string name = "";
                        string client = "";
                        string project = "";

                        // ... for client
                        int companyId = Int32.Parse(hdfCompanyId.Value);
                        int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());
                        CompaniesGateway companiesGateway = new CompaniesGateway();
                        companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                        client += "Client: " + companiesGateway.GetName(currentClientId);

                        // ... for project
                        int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                        ProjectGateway projectGateway = new ProjectGateway();
                        projectGateway.LoadByProjectId(currentProjectId);
                        project = projectGateway.GetName(currentProjectId);
                        name = client + " > Project: " + project + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")";

                        Response.Write("<script language='javascript'> {window.open('./pr_lining_plan_report.aspx?name=" + name + "', '_blank', 'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=800, height=680');}</script>");
                    }
                }
            }
        }
コード例 #20
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_CWP_REHABASSESSMENT_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_REHABASSESSMENT_DELETE"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client_id"] == null) || ((string)Request.QueryString["project_id"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in ra_delete.aspx");
                }

                // Tag Page
                TagPage();

                // Prepare initial data
                // ... for client
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());
                int companyId = Int32.Parse(hdfCompanyId.Value);
                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                // ... for project
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                if (name.Length > 23) name = name.Substring(0, 20) + "...";
                lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Selected Sections";

                // If coming from
                // ... ra_navigator2.aspx
                if (Request.QueryString["source_page"] == "ra_navigator2.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = "no";

                    rehabAssessmentTDS = new RehabAssessmentTDS();

                    int workId = Int32.Parse(hdfWorkId.Value);

                    RehabAssessmentSectionDetails rehabAssessmentSectionDetails = new RehabAssessmentSectionDetails(rehabAssessmentTDS);
                    rehabAssessmentSectionDetails.LoadByWorkId(workId, companyId);

                    RehabAssessmentWorkDetails rehabAssessmentWorkDetails = new RehabAssessmentWorkDetails(rehabAssessmentTDS);
                    rehabAssessmentWorkDetails.LoadByWorkId(workId, companyId);

                    RehabAssessmentLateralDetails rehabAssessmentLateralDetails = new RehabAssessmentLateralDetails(rehabAssessmentTDS);
                    rehabAssessmentLateralDetails.LoadAllByWorkId(workId, companyId);

                    // Store dataset
                    Session["rehabAssessmentTDS"] = rehabAssessmentTDS;
                }

                // ... ra_summary.aspx
                if (Request.QueryString["source_page"] == "ra_summary.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];

                    // Restore dataset
                    rehabAssessmentTDS = (RehabAssessmentTDS)Session["rehabAssessmentTDS"];
                }
            }
            else
            {
                // Restore datasets
                rehabAssessmentTDS = (RehabAssessmentTDS)Session["rehabAssessmentTDS"];
            }
        }
コード例 #21
0
        private void Generate2()
        {
            mReportForM12 master = (mReportForM12)this.Master;
            string unitType = ddlUnitType.SelectedValue;

            // Get Data
            LiquiForce.LFSLive.BL.CWP.FullLengthLining.FlM2Report flM2Report = new LiquiForce.LFSLive.BL.CWP.FullLengthLining.FlM2Report();

            if (ddlClient.SelectedValue == "-1")
            {
                if (cbxSectionId.Checked)
                {
                    ArrayList sectionsId = new ArrayList();
                    foreach (ListItem lst in cbxlSectionId.Items)
                    {
                        if (lst.Selected)
                        {
                            sectionsId.Add(lst.Value);
                        }
                    }

                    flM2Report.LoadBySectionId(int.Parse(hdfCompanyId.Value), sectionsId, unitType);
                }
                else
                {
                    if (cbxDate.Checked)
                    {
                        DateTime m1Date = DateTime.Parse(tkrdpDate.SelectedDate.Value.ToShortDateString());
                        flM2Report.LoadByDate(int.Parse(hdfCompanyId.Value), m1Date.ToShortDateString(), unitType);
                    }
                    else
                    {
                        if (cbxStreet.Checked)
                        {
                            flM2Report.LoadByStreet(int.Parse(hdfCompanyId.Value), tbxStreet.Text.Trim(), unitType);
                        }
                        else
                        {
                            if (cbxSubArea.Checked)
                            {
                                flM2Report.LoadBySubArea(int.Parse(hdfCompanyId.Value), tbxSubArea.Text.Trim(), unitType);
                            }
                            else
                            {
                                flM2Report.Load(int.Parse(hdfCompanyId.Value), unitType);
                            }
                        }
                    }
                }
            }
            else
            {
                if (ddlProject.SelectedValue == "-1")
                {
                    if (cbxSectionId.Checked)
                    {
                        ArrayList sectionsId = new ArrayList();
                        foreach (ListItem lst in cbxlSectionId.Items)
                        {
                            if (lst.Selected)
                            {
                                sectionsId.Add(lst.Value);
                            }
                        }

                        flM2Report.LoadByCompaniesIdSectionId(int.Parse(hdfCompanyId.Value), int.Parse(ddlClient.SelectedValue), unitType, sectionsId);
                    }
                    else
                    {
                        if (cbxDate.Checked)
                        {
                            DateTime m1Date = DateTime.Parse(tkrdpDate.SelectedDate.Value.ToShortDateString());
                            flM2Report.LoadByCompaniesIdDate(int.Parse(hdfCompanyId.Value), int.Parse(ddlClient.SelectedValue), unitType, m1Date.ToShortDateString());
                        }
                        else
                        {
                            if (cbxStreet.Checked)
                            {
                                flM2Report.LoadByCompaniesIdStreet(int.Parse(hdfCompanyId.Value), int.Parse(ddlClient.SelectedValue), unitType, tbxStreet.Text.Trim());
                            }
                            else
                            {
                                if (cbxSubArea.Checked)
                                {
                                    flM2Report.LoadByCompaniesIdSubArea(int.Parse(hdfCompanyId.Value), int.Parse(ddlClient.SelectedValue), unitType, tbxSubArea.Text.Trim());
                                }
                                else
                                {
                                    flM2Report.LoadByCompaniesId(int.Parse(hdfCompanyId.Value), int.Parse(ddlClient.SelectedValue), unitType);
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (cbxSectionId.Checked)
                    {
                        ArrayList sectionsId = new ArrayList();
                        foreach (ListItem lst in cbxlSectionId.Items)
                        {
                            if (lst.Selected)
                            {
                                sectionsId.Add(lst.Value);
                            }
                        }

                        flM2Report.LoadByCompaniesIdProjectIdSectionId(int.Parse(hdfCompanyId.Value), int.Parse(ddlClient.SelectedValue), int.Parse(ddlProject.SelectedValue), unitType, sectionsId);
                    }
                    else
                    {
                        if (cbxDate.Checked)
                        {
                            DateTime m1Date = DateTime.Parse(tkrdpDate.SelectedDate.Value.ToShortDateString());
                            flM2Report.LoadByCompaniesIdProjectIdDate(int.Parse(hdfCompanyId.Value), int.Parse(ddlClient.SelectedValue), int.Parse(ddlProject.SelectedValue), unitType, m1Date.ToShortDateString());
                        }
                        else
                        {
                            if (cbxStreet.Checked)
                            {
                                flM2Report.LoadByCompaniesIdProjectIdStreet(int.Parse(hdfCompanyId.Value), int.Parse(ddlClient.SelectedValue), int.Parse(ddlProject.SelectedValue), unitType, tbxStreet.Text.Trim());
                            }
                            else
                            {
                                if (cbxSubArea.Checked)
                                {
                                    flM2Report.LoadByCompaniesIdProjectIdSubArea(int.Parse(hdfCompanyId.Value), int.Parse(ddlClient.SelectedValue), int.Parse(ddlProject.SelectedValue), unitType, tbxSubArea.Text.Trim());
                                }
                                else
                                {
                                    flM2Report.LoadByCompaniesIdProjectId(int.Parse(hdfCompanyId.Value), int.Parse(ddlClient.SelectedValue), int.Parse(ddlProject.SelectedValue), unitType);
                                }
                            }
                        }
                    }
                }
            }

            // ... set properties to master page
            master.Data2 = flM2Report.Data;
            master.Table2 = flM2Report.TableName;

            // Get report
            if (flM2Report.Table.Rows.Count > 0)
            {
                if (master.Format2 == "pdf")
                {
                    master.Report2 = new FlM2Report();
                }
                else
                {
                    master.Report2 = new FlM2ReportExport();
                }

                // ... set parameters to report
                int companyId = Convert.ToInt32(Session["companyID"]);
                if (master.Format2 == "pdf")
                {
                    if (ddlClient.SelectedValue != "-1")
                    {
                        // ... for client
                        int currentCompanyId = Int32.Parse(ddlClient.SelectedValue);
                        CompaniesGateway companiesGateway = new CompaniesGateway();
                        companiesGateway.LoadByCompaniesId(currentCompanyId, companyId);
                        master.SetParameter2("Client", companiesGateway.GetName(currentCompanyId));
                    }
                    else
                    {
                        master.SetParameter2("Client", "All");
                    }

                    if (ddlProject.SelectedValue != "-1")
                    {
                        // ... for project
                        int currentProjectId = Int32.Parse(ddlProject.SelectedValue);
                        ProjectGateway projectGateway = new ProjectGateway();
                        projectGateway.LoadByProjectId(currentProjectId);
                        string name = projectGateway.GetName(currentProjectId);
                        master.SetParameter2("Project", name);
                    }
                    else
                    {
                        master.SetParameter2("Project", "All");
                    }

                    master.SetParameter2("UnitType", unitType);

                    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.SetParameter2("User", user.Trim());
                }
            }
        }
コード例 #22
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_EDIT"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client_id"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["asset_id"] == null) || ((string)Request.QueryString["active_tab"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in fl_summary.aspx");
                }

                // Tag Page
                TagPage();

                Session.Remove("flAddLateralsNewDummy");
                Session.Remove("wetOutCatalystsDetailsDummy");

                // If comming from
                int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                int assetId = Int32.Parse(hdfAssetId.Value.Trim());
                string workType = hdfWorkType.Value;
                int workId = Int32.Parse(hdfWorkId.Value);

                // ... fl_navigator2.aspx
                if (Request.QueryString["source_page"] == "fl_navigator2.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = "no";

                    // Set initial tab
                    if ((string)Session["dialogOpenedFll"] != "1")
                    {
                        hdfActiveTab.Value = Request.QueryString["active_tab"];

                        fullLengthLiningTDS = new FullLengthLiningTDS();

                        FullLengthLiningSectionDetails fullLengthLiningSectionDetails = new FullLengthLiningSectionDetails(fullLengthLiningTDS);
                        fullLengthLiningSectionDetails.LoadByWorkId(workId, companyId);

                        FullLengthLiningWorkDetails fullLengthLiningWorkDetails = new FullLengthLiningWorkDetails(fullLengthLiningTDS);
                        fullLengthLiningWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId);

                        FullLengthLiningLateralDetails fullLengthLiningLateralDetails = new FullLengthLiningLateralDetails(fullLengthLiningTDS);
                        fullLengthLiningLateralDetails.LoadForEdit(workId, assetId, companyId, currentProjectId);

                        FullLengthLiningWetOutCatalystsDetails fullLengthLiningWetOutCatalystsDetails = new FullLengthLiningWetOutCatalystsDetails(fullLengthLiningTDS);
                        fullLengthLiningWetOutCatalystsDetails.LoadAll(workId, companyId);
                    }
                    else
                    {
                        hdfActiveTab.Value = (string)Session["activeTabFll"];

                        // Restore datasets
                        fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];
                    }

                    tcFlDetails.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);

                    // Store dataset
                    Session["fullLengthLiningTDS"] = fullLengthLiningTDS;
                }

                // ... fl_delete.aspx or fl_edit.aspx
                if ((Request.QueryString["source_page"] == "fl_delete.aspx") || (Request.QueryString["source_page"] == "fl_edit.aspx"))
                {
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];

                    // Restore dataset
                    fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];

                    // ... Set initial tab
                    if ((string)Session["dialogOpenedFll"] != "1")
                    {
                        hdfActiveTab.Value = Request.QueryString["active_tab"];
                    }
                    else
                    {
                        hdfActiveTab.Value = (string)Session["activeTabFll"];
                    }

                    tcFlDetails.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);
                }

                // Prepare initial data
                // ... for client
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());

                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                // ... for project
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                if (name.Length > 23) name = name.Substring(0, 20) + "...";
                lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Selected Section";

                // ... for wet out section list
                AssetSewerSectionList assetSewerSectionList = new AssetSewerSectionList();
                assetSewerSectionList.LoadAndAddItem(Int32.Parse(hdfCurrentProjectId.Value), hdfWorkType.Value, "-1", "(All)", Int32.Parse(hdfCompanyId.Value));
                cbxlWetOutDataSectionId.DataSource = assetSewerSectionList.Table;
                cbxlWetOutDataSectionId.DataValueField = "SectionID";
                cbxlWetOutDataSectionId.DataTextField = "FlowOrderID";
                cbxlWetOutDataSectionId.DataBind();

                cbxlInversionDataSectionId.DataSource = assetSewerSectionList.Table;
                cbxlInversionDataSectionId.DataValueField = "SectionID";
                cbxlInversionDataSectionId.DataTextField = "FlowOrderID";
                cbxlInversionDataSectionId.DataBind();

                // ... Data for current full length lining work
                LoadFullLengthLiningData(currentProjectId, assetId, companyId);

                // Databind
                Page.DataBind();

                // Especial load for Run details
                string runDetails = hdfRunDetails.Value;
                WorkFullLengthLiningWetOutGateway workFullLengthLiningWetOutGateway = new WorkFullLengthLiningWetOutGateway();
                workFullLengthLiningWetOutGateway.LoadByWorkId(workId, companyId);

                // ... Verify if work has cipp information to load run details
                if (workFullLengthLiningWetOutGateway.Table.Rows.Count > 0)
                {
                    string[] runDetailsList = runDetails.Split('>');
                    for (int i = 0; i < runDetailsList.Length; i++)
                    {
                        cbxlWetOutDataSectionId.Items.FindByValue(runDetailsList[i]).Selected = true;
                        cbxlInversionDataSectionId.Items.FindByValue(runDetailsList[i]).Selected = true;
                    }
                }
                else
                {
                    if (cbxlWetOutDataSectionId.Items.Count > 1)
                    {
                        cbxlWetOutDataSectionId.Items.FindByValue(hdfSectionId.Value).Selected = true;
                    }
                }
            }
            else
            {
                // Restore datasets
                fullLengthLiningTDS = (FullLengthLiningTDS)Session["fullLengthLiningTDS"];

                // Set initial tab
                int activeTab = Int32.Parse(hdfActiveTab.Value);
                tcFlDetails.ActiveTabIndex = activeTab;

                // Load summary for inversionfield cure record
                int companyId =Int32.Parse(hdfCompanyId.Value);
                int workId = Int32.Parse(hdfWorkId.Value);

                FlInversionFieldCureRecord FlInversionFieldCureRecordForSummary = new FlInversionFieldCureRecord();
                FlInversionFieldCureRecordForSummary.Load(workId, companyId);
                if (FlInversionFieldCureRecordForSummary.Table.Rows.Count > 0)
                {
                    lblInversionDataFieldCureRecordSummary.Text = FlInversionFieldCureRecordForSummary.GetSummary();
                }

            }
        }
        private void Generate()
        {
            mReport1 master = (mReport1)this.Master;
            int companyId = Convert.ToInt32(Session["companyID"]);

            ProjectCostingSheetInformationReportInformation projectCostingSheetInformationReportInformation = new ProjectCostingSheetInformationReportInformation();

            if (ddlClient.SelectedValue == "-1")
            {
                projectCostingSheetInformationReportInformation.Load(companyId);
            }
            else
            {
                if (ddlProject.SelectedValue == "-1")
                {
                    projectCostingSheetInformationReportInformation.LoadByCompaniesId(Int32.Parse(ddlClient.SelectedValue), companyId);
                }
                else
                {
                    projectCostingSheetInformationReportInformation.LoadByCompaniesIdProjectId(Int32.Parse(ddlClient.SelectedValue), Int32.Parse(ddlProject.SelectedValue), companyId);
                }
            }

            // ... set properties to master page
            master.Data = projectCostingSheetInformationReportInformation.Data;
            master.Table = projectCostingSheetInformationReportInformation.TableName;

            // Get report
            if (projectCostingSheetInformationReportInformation.Table.Rows.Count > 0)
            {
                if (master.Format == "pdf")
                {
                    master.Report = new ConsolidatedCostingSheetReport();
                    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());

                    // For process code
                    ProjectCostingSheetInformationReportInformationGateway projectCostingSheetInformationReportInformationGateway = new ProjectCostingSheetInformationReportInformationGateway(projectCostingSheetInformationReportInformation.Data);

                    // ... ... client
                    if (ddlClient.SelectedValue == "-1")
                    {
                        master.SetParameter("client", "All");
                    }
                    else
                    {
                        CompaniesGateway companiesGateway = new CompaniesGateway();
                        companiesGateway.LoadByCompaniesId(Int32.Parse(ddlClient.SelectedValue), Int32.Parse(hdfCompanyId.Value));
                        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);
                    }
                }
                else
                {
                    master.Report = new ConsolidatedCostingSheetPreviewReport();
                }
            }
        }
コード例 #24
0
        protected void btnExportList_Click(object sender, EventArgs e)
        {
            string url = "";
            string headerValues = "";
            int totalColumnsExport = 40;
            int totalColumnsPreview = 39;
            string client = "";
            string name = "";
            string project = "";
            string title = "Point Repairs Search Results";
            string columnsForReport = "";
            int j;

            // ... for client
            int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());

            CompaniesGateway companiesGateway = new CompaniesGateway();
            companiesGateway.LoadByCompaniesId(currentClientId, companyId);
            client += "Client: " + companiesGateway.GetName(currentClientId);

            // ... for project
            int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
            ProjectGateway projectGateway = new ProjectGateway();
            projectGateway.LoadByProjectId(currentProjectId);
            project = projectGateway.GetName(currentProjectId);
            name = client + " > Project: " + project + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")";

            // ... for title view
            if (hdfBtnOrigin.Value == "Go")
            {
                int viewId = Int32.Parse(ddlView.SelectedValue.Trim());

                // ... Load name view
                WorkViewGateway workViewGateway = new WorkViewGateway();
                workViewGateway.LoadByViewId(viewId, companyId);

                title = workViewGateway.GetName(viewId);
            }

            // ... For comments option
            string comments = "None";

            headerValues = "";
            columnsForReport = "";

            // Establishing header values
            if (grdPrNavigator.Columns[2].Visible) headerValues += "ID (Section)";
            if (grdPrNavigator.Columns[3].Visible) headerValues += " * Sub Area";
            if (grdPrNavigator.Columns[4].Visible) headerValues += " * Street";
            if (grdPrNavigator.Columns[5].Visible) headerValues += " * USMH";
            if (grdPrNavigator.Columns[6].Visible) headerValues += " * USMH Address";
            if (grdPrNavigator.Columns[7].Visible) headerValues += " * DSMH";
            if (grdPrNavigator.Columns[8].Visible) headerValues += " * DSMH Address";
            if (grdPrNavigator.Columns[9].Visible) headerValues += " * Map Size";
            if (grdPrNavigator.Columns[10].Visible) headerValues += " * Confirmed Size";
            if (grdPrNavigator.Columns[11].Visible) headerValues += " * Map Length";
            if (grdPrNavigator.Columns[12].Visible) headerValues += " * Steel Tape Length";
            if (grdPrNavigator.Columns[13].Visible) headerValues += " * Video Length";
            if (grdPrNavigator.Columns[14].Visible) headerValues += " * Laterals";
            if (grdPrNavigator.Columns[15].Visible) headerValues += " * Live Laterals";
            if (grdPrNavigator.Columns[16].Visible) headerValues += " * Client ID";
            if (grdPrNavigator.Columns[17].Visible) headerValues += " * Measurements Taken By";
            if (grdPrNavigator.Columns[18].Visible) headerValues += " * Pre-Flush Date";
            if (grdPrNavigator.Columns[19].Visible) headerValues += " * Pre-Video Date";
            if (grdPrNavigator.Columns[20].Visible) headerValues += " * P1 Date";
            if (grdPrNavigator.Columns[21].Visible) headerValues += " * Repair Confirmation Date";
            if (grdPrNavigator.Columns[22].Visible) headerValues += " * Traffic Control";
            if (grdPrNavigator.Columns[23].Visible) headerValues += " * Material";
            if (grdPrNavigator.Columns[24].Visible) headerValues += " * Bypass Required?";
            if (grdPrNavigator.Columns[25].Visible) headerValues += " * Robotic Prep Required?";
            if (grdPrNavigator.Columns[26].Visible) headerValues += " * CXI&rsquo;s Removed";
            if (grdPrNavigator.Columns[27].Visible) headerValues += " * Robotic Distances";
            if (grdPrNavigator.Columns[28].Visible) headerValues += " * Proposed Lining Date";
            if (grdPrNavigator.Columns[29].Visible) headerValues += " * Deadline Lining Date";
            if (grdPrNavigator.Columns[30].Visible) headerValues += " * Final Video";
            if (grdPrNavigator.Columns[31].Visible) headerValues += " * Estimated Joints";
            if (grdPrNavigator.Columns[32].Visible) headerValues += " * Joints Test Sealed";
            if (grdPrNavigator.Columns[33].Visible) headerValues += " * Issue Identified?";
            if (grdPrNavigator.Columns[34].Visible) headerValues += " * LFS Issue?";
            if (grdPrNavigator.Columns[35].Visible) headerValues += " * Client Issue?";
            if (grdPrNavigator.Columns[36].Visible) headerValues += " * Sales Issue?";
            if (grdPrNavigator.Columns[37].Visible) headerValues += " * Issue Given To Client?";
            if (grdPrNavigator.Columns[38].Visible) headerValues += " * Issue Investigation?";
            if (grdPrNavigator.Columns[39].Visible) headerValues += " * Issue Resolved?";
            if (grdPrNavigator.Columns[40].Visible) headerValues += " * Comments";
            if (grdPrNavigator.Columns[41].Visible) headerValues += " * Repair";

            // Establishing columns to display
            string[] columnsExcel = headerValues.Split('*');

            // ... for visible columns
            for (int i = 0; i < columnsExcel.Length; i++)
            {
                j = i + 1;
                columnsForReport += "&header" + j + "=" + columnsExcel[i].Trim();
            }

            // ... For not visible columns
            for (int i = columnsExcel.Length; i < totalColumnsExport; i++)
            {
                j = i + 1;
                columnsForReport += "&header" + j + "=None";
            }

            // Report call
            Page.Validate();
            if (Page.IsValid)
            {
                PostPageChanges();
                title = title.Replace("'", "%27");
                Response.Write("<script language='javascript'> {window.open('./pr_print_search_results_report.aspx?" + columnsForReport + "&comments=" + comments + "&totalColumnsPreview=" + totalColumnsPreview + "&totalColumnsExport=" + totalColumnsExport + "&totalSelectedColumns=" + columnsExcel.Length + "&name=" + Server.UrlEncode(name) + "&title=" + Server.UrlEncode(title) + "&format=excel', '_blank', 'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=800, height=680');}</script>");
            }

            if (url != "") Response.Redirect(url);
        }
        // ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        /// <summary>
        /// Load
        /// </summary>
        /// <param name="projectId">projectId</param>
        /// <param name="startDate">startDate</param>
        /// <param name="endDate">endDate</param>
        /// <param name="companyId">companyId</param>
        public void Load(ArrayList projects, DateTime startDate, DateTime endDate, int companyId)
        {
            foreach (int projectId in projects)
            {
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(projectId);

                string project = projectGateway.GetName(projectId);

                DateTime newStartDate = new DateTime();
                newStartDate = startDate;
                DateTime newEndDate = new DateTime();
                newEndDate = endDate;

                ProjectCostingSheetAddOriginalRevenueGateway projectCostingSheetAddOriginalRevenueGateway = new ProjectCostingSheetAddOriginalRevenueGateway(Data);
                projectCostingSheetAddOriginalRevenueGateway.LoadByProjectIdStartDateEndDate(projectId, newStartDate, newEndDate);

                if (projectCostingSheetAddOriginalRevenueGateway.Table.Rows.Count > 0)
                {
                    foreach (ProjectCostingSheetAddTDS.OriginalRevenueRow originalRow in (ProjectCostingSheetAddTDS.OriginalRevenueDataTable)projectCostingSheetAddOriginalRevenueGateway.Table)
                    {
                        ProjectCostingSheetAddTDS.CombinedRevenueInformationRow newRow = ((ProjectCostingSheetAddTDS.CombinedRevenueInformationDataTable)Table).NewCombinedRevenueInformationRow();
                        newRow.CostingSheetID = 0;
                        newRow.RefIDRevenue = originalRow.RefIDRevenue;
                        newRow.Revenue = originalRow.Revenue;
                        newRow.Deleted = false;
                        newRow.InDatabase = false;
                        newRow.COMPANY_ID = companyId;
                        newRow.Comment = ""; if (!originalRow.IsCommentNull()) newRow.Comment = originalRow.Comment;
                        newRow.StartDate = originalRow.Date_;
                        newRow.EndDate = originalRow.Date_;
                        newRow.FromDatabase = true;
                        newRow.ProjectID = projectId;
                        newRow.Project = project;
                        ((ProjectCostingSheetAddTDS.CombinedRevenueInformationDataTable)Table).AddCombinedRevenueInformationRow(newRow);
                    }
                }
            }
        }
コード例 #26
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_CWP_POINTREPAIRS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_CWP_POINTREPAIRS_EDIT"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client_id"] == null) || ((string)Request.QueryString["project_id"] == null) ||  ((string)Request.QueryString["asset_id"] == null) || ((string)Request.QueryString["active_tab"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in pr_summary.aspx");
                }

                // Tag Page
                TagPage();

                // If coming from
                int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                int assetId = Int32.Parse(hdfAssetId.Value.Trim());
                int workId = Int32.Parse(hdfWorkId.Value);

                Session.Remove("pointRepairsRepairsTempDummy");
                Session.Remove("pointRepairsCommentsTempDummy");

                // ... pr_navigator2.aspx
                if (Request.QueryString["source_page"] == "pr_navigator2.aspx")
                {
                    StoreNavigatorState();
                    ViewState["update"] = "no";

                    // ... Set initial tab
                    if ((string)Session["dialogOpenedPr"] != "1")
                    {
                        hdfActiveTab.Value = Request.QueryString["active_tab"];

                        pointRepairsTDS = new PointRepairsTDS();
                        pointRepairsRepairsTemp = new PointRepairsTDS.RepairDetailsDataTable();
                        pointRepairsCommentsTemp = new PointRepairsTDS.CommentDetailsDataTable();

                        PointRepairsSectionDetails pointRepairsSectionDetails = new PointRepairsSectionDetails(pointRepairsTDS);
                        pointRepairsSectionDetails.LoadByWorkId(workId, companyId);

                        PointRepairsWorkDetails pointRepairsWorkDetails = new PointRepairsWorkDetails(pointRepairsTDS);
                        pointRepairsWorkDetails.LoadByWorkIdAssetId(workId, assetId, companyId);

                        PointRepairsRepairDetails pointRepairsRepairDetails = new PointRepairsRepairDetails(pointRepairsTDS);
                        pointRepairsRepairDetails.LoadAllByWorkId(workId, companyId);

                        PointRepairsCommentDetails pointRepairsCommentDetails = new PointRepairsCommentDetails(pointRepairsTDS);
                        pointRepairsCommentDetails.LoadAllByWorkIdWorkType(workId, companyId, "Point Repairs");
                    }
                    else
                    {
                        hdfActiveTab.Value = (string)Session["activeTabPr"];

                        // Restore datasets
                        pointRepairsTDS = (PointRepairsTDS)Session["pointRepairsTDS"];
                        pointRepairsRepairsTemp = (PointRepairsTDS.RepairDetailsDataTable)Session["pointRepairsRepairsTemp"];
                        pointRepairsCommentsTemp = (PointRepairsTDS.CommentDetailsDataTable)Session["pointRepairsCommentsTemp"];
                    }

                    tcPrDetails.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);

                    Session["filterExpression"] = "Deleted = 0";

                    // Store dataset
                    Session["pointRepairsTDS"] = pointRepairsTDS;
                    Session["pointRepairsRepairsTemp"] = pointRepairsRepairsTemp;
                    Session["pointRepairsCommentsTemp"] = pointRepairsCommentsTemp;
                }

                // ... pr_delete.aspx or pr_edit.aspx
                if ((Request.QueryString["source_page"] == "pr_delete.aspx") || (Request.QueryString["source_page"] == "pr_edit.aspx"))
                {
                    StoreNavigatorState();
                    ViewState["update"] = Request.QueryString["update"];

                    // Restore dataset
                    pointRepairsTDS = (PointRepairsTDS)Session["pointRepairsTDS"];
                    pointRepairsRepairsTemp = (PointRepairsTDS.RepairDetailsDataTable)Session["pointRepairsRepairsTemp"];
                    pointRepairsCommentsTemp = (PointRepairsTDS.CommentDetailsDataTable)Session["pointRepairsCommentsTemp"];

                    // ... Set initial tab
                    if ((string)Session["dialogOpenedPr"] != "1")
                    {
                        hdfActiveTab.Value = Request.QueryString["active_tab"];
                    }
                    else
                    {
                        hdfActiveTab.Value = (string)Session["activeTabPr"];
                    }

                    tcPrDetails.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);

                    ApplyFilter();

                    switch ((string)Session["filterExpression"])
                    {
                        case "Deleted = 0":
                            ddlFilter.SelectedIndex = 0;
                            break;

                        case "Type='Robotic Reaming' AND Deleted = 0":
                            ddlFilter.SelectedIndex = 1;
                            break;

                        case "Type='Point Lining' AND Deleted = 0":
                            ddlFilter.SelectedIndex = 2;
                            break;

                        case "Type='Grouting' AND Deleted = 0":
                            ddlFilter.SelectedIndex = 3;
                            break;

                        default:
                            ddlFilter.SelectedIndex = 0;
                            break;
                    }
                }

                // Prepare initial data
                // ... for client
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());

                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                // ... for project
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(currentProjectId);
                string name = projectGateway.GetName(currentProjectId);
                if (name.Length > 23) name = name.Substring(0, 20) + "...";
                lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ") > Selected Section";

                // ... Data for current point repairs work
                LoadPointRepairsData(currentProjectId, assetId, companyId);
            }
            else
            {
                // Restore datasets
                pointRepairsTDS = (PointRepairsTDS)Session["pointRepairsTDS"];
                pointRepairsRepairsTemp = (PointRepairsTDS.RepairDetailsDataTable)Session["pointRepairsRepairsTemp"];
                pointRepairsCommentsTemp = (PointRepairsTDS.CommentDetailsDataTable)Session["pointRepairsCommentsTemp"];

                // Set initial tab
                int activeTab = Int32.Parse(hdfActiveTab.Value);
                tcPrDetails.ActiveTabIndex = activeTab;

                ApplyFilter();
            }
        }
コード例 #27
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_CWP_MANHOLEREHABILITATION_VIEW"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["client_id"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["in_project"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in mr_navigator2.aspx");
                }

                // Tag Page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfCurrentProjectId.Value = Request.QueryString["project_id"].ToString();
                hdfCurrentClientId.Value = Request.QueryString["client_id"].ToString();
                hdfInProject.Value = Request.QueryString["in_project"].ToString();
                hdfWorkType.Value = "Manhole Rehabilitation";

                // Prepare initial data
                // ... For sortByList
                odsSortByList.DataBind();
                ddlSortBy.DataSourceID = "odsSortByList";
                ddlSortBy.DataValueField = "SortID";
                ddlSortBy.DataTextField = "Name";
                ddlSortBy.DataBind();

                // ... For
                odsViewForDisplayList.DataBind();
                ddlCondition1.DataSourceID = "odsViewForDisplayList";
                ddlCondition1.DataValueField = "ConditionID";
                ddlCondition1.DataTextField = "Name";
                ddlCondition1.DataBind();

                // ... For view ddl
                int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
                string workType = hdfWorkType.Value;
                int loginId = Convert.ToInt32(Session["loginID"]);
                string viewTypeGlobal = "";
                string viewTypePersonal = "Personal";

                // Global Views check
                if (Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
                {
                    viewTypeGlobal = "Global";
                }

                WorkViewList workViewList = new WorkViewList();
                workViewList.LoadAndAddItem(workType, viewTypeGlobal, viewTypePersonal, loginId, companyId);
                ddlView.DataSource = workViewList.Table;
                ddlView.DataValueField = "ViewID";
                ddlView.DataTextField = "Name";
                ddlView.DataBind();
                ddlView.SelectedIndex = 1;

                // Validate top information
                if ((hdfCurrentClientId.Value != "0") && (hdfCurrentProjectId.Value != "0"))
                {
                    // ... for client
                    int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());

                    CompaniesGateway companiesGateway = new CompaniesGateway();
                    companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                    lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId);

                    // ... for project
                    int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.ToString());
                    ProjectGateway projectGateway = new ProjectGateway();
                    projectGateway.LoadByProjectId(currentProjectId);
                    string name = projectGateway.GetName(currentProjectId);
                    if (name.Length > 23) name = name.Substring(0, 20) + "...";
                    lblTitleProjectName.Text = " > Project: " + name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")";
                }
                else
                {
                    lblTitleClientName.Text = "";
                    lblTitleProjectName.Text = "";
                }

                // If coming from
                // ... mr_navigator.aspx or mr_navigator2.aspx
                if ((Request.QueryString["source_page"] == "mr_navigator.aspx") || (Request.QueryString["source_page"] == "mr_navigator2.aspx"))
                {
                    RestoreNavigatorState();

                    mrNavigatorTDS = (MrNavigatorTDS)Session["mrNavigatorTDS"];
                }

                // ... mr_edit.aspx, mr_summary.aspx or mr_delete.aspx
                if ((Request.QueryString["source_page"] == "mr_edit.aspx") || (Request.QueryString["source_page"] == "mr_summary.aspx") || (Request.QueryString["source_page"] == "mr_delete.aspx"))
                {
                    RestoreNavigatorState();

                    if (Request.QueryString["update"] == "no")
                    {
                        mrNavigatorTDS = (MrNavigatorTDS)Session["mrNavigatorTDS"];
                    }
                    else
                    {
                        // ... Delete store data
                        Session.Contents.Remove("mrNavigatorTDS");

                        // ... Search data with updates
                        if (hdfBtnOrigin.Value == "Search")
                        {
                            mrNavigatorTDS = SubmitSearch();
                        }
                        else
                        {
                            if (hdfBtnOrigin.Value == "Go")
                            {
                                mrNavigatorTDS = SubmitSearchForViews();
                            }
                        }

                        // ... store datasets
                        Session["mrNavigatorTDS"] = mrNavigatorTDS;
                    }
                }

                // ... mr_delete.aspx, mr_summary.aspx or mr_edit.aspx
                if ((Request.QueryString["source_page"] == "mr_delete.aspx") || (Request.QueryString["source_page"] == "mr_summary.aspx") || (Request.QueryString["source_page"] == "mr_edit.aspx"))
                {
                    if (mrNavigatorTDS.MrNavigator.Rows.Count == 0)
                    {
                        string url = "./mr_navigator.aspx?source_page=mr_navigator2.aspx&client_id=" + hdfCurrentClientId.Value + "&project_id=" + hdfCurrentProjectId.Value + "&work_type=" + hdfWorkType.Value + "&in_project=" + hdfInProject.Value + GetNavigatorState() + "&no_results=yes";
                        Response.Redirect(url);
                    }
                }

                // For the grid
                grdMRNavigator.DataSource = mrNavigatorTDS.MrNavigator;
                grdMRNavigator.DataBind();

                //... for the total rows
                if (mrNavigatorTDS.MrNavigator.Rows.Count > 0)
                {
                    lblTotalRows.Text = "Total Rows: " + mrNavigatorTDS.MrNavigator.Rows.Count;
                    lblTotalRows.Visible = true;
                }
                else
                {
                    lblTotalRows.Visible = false;
                }
            }
            else
            {
                // Restore TDS
                mrNavigatorTDS = (MrNavigatorTDS)Session["mrNavigatorTDS"];

                // ... for the total rows
                if (mrNavigatorTDS.MrNavigator.Rows.Count > 0)
                {
                    lblTotalRows.Text = "Total Rows: " + mrNavigatorTDS.MrNavigator.Rows.Count;
                    lblTotalRows.Visible = true;
                }
                else
                {
                    lblTotalRows.Visible = false;
                }
            }
        }
コード例 #28
0
        private void GrdProjectAdd()
        {
            if (Page.IsValid)
            {
                int projectId = Int32.Parse(ddlProject.SelectedValue);
                int clientId = Int32.Parse(ddlClient.SelectedValue);
                int companyId = Int32.Parse(hdfCompanyId.Value);
                int loginId = Convert.ToInt32(Session["loginID"]);
                DateTime lastLoggedInDate = DateTime.Now;
                bool deleted = false;
                string workType = hdfWorkType.Value;

                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(projectId);
                string projectName = projectGateway.GetName(projectId) + " (" + projectGateway.GetProjectNumber(projectId) + ")";

                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadByCompaniesId(clientId, companyId);
                string clientName = companiesGateway.GetName(clientId);

                SelectProjectLastUsedProjects model = new SelectProjectLastUsedProjects(selectProjectTDS);
                model.Insert(clientId, projectId, loginId, lastLoggedInDate, companyId, deleted, workType, projectName, clientName, false);

                Session.Remove("lastUsedProjectsDummy");
                Session["selectProjectTDS"] = selectProjectTDS;
                Session["lastUsedProjects"] = selectProjectTDS.LastUsedProjects;

                grdProjects.DataBind();
                grdProjects.PageIndex = grdProjects.PageCount - 1;
            }
        }
        private void Generate()
        {
            mReport1 master = (mReport1)this.Master;

            // Get Data
            LiquiForce.LFSLive.BL.CWP.FullLengthLining.FlOutstandingInvestigationIssuesReport flOutstandingInvestigationIssuesReport = new LiquiForce.LFSLive.BL.CWP.FullLengthLining.FlOutstandingInvestigationIssuesReport();

            if (ddlClient.SelectedValue == "-1")
            {
                flOutstandingInvestigationIssuesReport.Load(int.Parse(hdfCompanyId.Value));
            }
            else
            {
                if (ddlProject.SelectedValue == "-1")
                {
                    flOutstandingInvestigationIssuesReport.LoadByCompaniesId(int.Parse(hdfCompanyId.Value), int.Parse(ddlClient.SelectedValue));
                }
                else
                {
                    flOutstandingInvestigationIssuesReport.LoadByCompaniesIdProjectId(int.Parse(hdfCompanyId.Value), int.Parse(ddlClient.SelectedValue), int.Parse(ddlProject.SelectedValue));
                }
            }

            // ... set properties to master page
            master.Data = flOutstandingInvestigationIssuesReport.Data;
            master.Table = flOutstandingInvestigationIssuesReport.TableName;

            // Get report
            if (flOutstandingInvestigationIssuesReport.Table.Rows.Count > 0)
            {
                if (master.Format == "pdf")
                {
                    master.Report = new FlOutstandingInvestigationIssuesReport();
                }
                else
                {
                    master.Report = new FlOutstandingInvestigationIssuesReportExport();
                }

                // ... set parameters to report
                int companyId = Convert.ToInt32(Session["companyID"]);
                if (master.Format == "pdf")
                {
                    if (ddlClient.SelectedValue != "-1")
                    {
                        // ... for client
                        int currentClientId = Int32.Parse(ddlClient.SelectedValue);
                        CompaniesGateway companiesGateway = new CompaniesGateway();
                        companiesGateway.LoadByCompaniesId(currentClientId, companyId);
                        master.SetParameter("Client", companiesGateway.GetName(currentClientId));
                    }
                    else
                    {
                        master.SetParameter("Client", "All");
                    }

                    if (ddlProject.SelectedValue != "-1")
                    {
                        // ... for project
                        int currentProjectId = Int32.Parse(ddlProject.SelectedValue);
                        ProjectGateway projectGateway = new ProjectGateway();
                        projectGateway.LoadByProjectId(currentProjectId);
                        string name = projectGateway.GetName(currentProjectId);
                        master.SetParameter("Project", name);
                    }
                    else
                    {
                        master.SetParameter("Project", "All");
                    }

                    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());
                }
            }
        }
コード例 #30
0
        // ////////////////////////////////////////////////////////////////////////
        // METHODS
        //
        private void Save()
        {
            bool existsAtGrid = false;

            // Validate page
            if (Page.IsValid)
            {
                SelectProjectLastUsedProjectsGateway selectProjectLastUsedProjectsVerifyGateway = new SelectProjectLastUsedProjectsGateway(selectProjectTDS);
                if (selectProjectLastUsedProjectsVerifyGateway.Table.Rows.Count > 0)
                {
                    // If exists the project in the grid
                    foreach (GridViewRow row in grdProjects.Rows)
                    {
                        // Grid Data
                        int gridClientId = Int32.Parse(((Label)row.FindControl("lblClientId")).Text.Trim());
                        int gridProjectId = Int32.Parse(((Label)row.FindControl("lblProjectId")).Text.Trim());
                        int gridUserId = Int32.Parse(((Label)row.FindControl("lblUserId")).Text.Trim());
                        int gridCompanyId = Int32.Parse(((Label)row.FindControl("lblCompanyId")).Text.Trim());
                        DateTime gridLastLoggedInDate = DateTime.Parse(((Label)row.FindControl("lblLastLoggedInDate")).Text.Trim());
                        string workType = hdfWorkType.Value;

                        // New Data
                        DateTime newLastLoggedInDate = DateTime.Now;

                        if ((gridClientId.ToString() == ddlClient.SelectedValue) && (gridProjectId.ToString() == ddlProject.SelectedValue) && (gridUserId == Int32.Parse(hdfLoginId.Value)) && (gridCompanyId == Int32.Parse(hdfCompanyId.Value)))
                        {
                            // Update if exists
                            SelectProjectLastUsedProjects model = new SelectProjectLastUsedProjects(selectProjectTDS);
                            model.UpdateLogginDate(gridClientId, gridProjectId, gridUserId, gridLastLoggedInDate, gridCompanyId, false, workType, newLastLoggedInDate);
                            existsAtGrid = true;
                        }

                        Session["selectProjectTDS"] = selectProjectTDS;
                        Session["lastUsedProjects"] = selectProjectTDS.LastUsedProjects;

                        grdProjects.DataBind();
                        grdProjects.PageIndex = grdProjects.PageCount - 1;
                    }
                }

                // If doesn't exists at grid
                if (!existsAtGrid)
                {
                    if (grdProjects.Rows.Count < 5)
                    {
                        // Add data if exist at grid's foot
                        GrdProjectAdd();
                    }
                    else
                    {
                        int index = 1;
                        foreach (GridViewRow row in grdProjects.Rows)
                        {
                            if (index == 5)
                            {
                                // Grid Data
                                int gridClientId = Int32.Parse(((Label)row.FindControl("lblClientId")).Text.Trim());
                                int gridProjectId = Int32.Parse(((Label)row.FindControl("lblProjectId")).Text.Trim());
                                int gridUserId = Int32.Parse(((Label)row.FindControl("lblUserId")).Text.Trim());
                                int gridCompanyId = Int32.Parse(((Label)row.FindControl("lblCompanyId")).Text.Trim());
                                DateTime gridLastLoggedInDate = DateTime.Parse(((Label)row.FindControl("lblLastLoggedInDate")).Text.Trim());
                                string workType = hdfWorkType.Value;

                                // New Data
                                int newProjectId = Int32.Parse(ddlProject.SelectedValue);
                                int newClientId = Int32.Parse(ddlClient.SelectedValue);
                                int newCompanyId = Int32.Parse(hdfCompanyId.Value);
                                int newUserId = Convert.ToInt32(Session["loginID"]);
                                DateTime newLastLoggedInDate = DateTime.Now;
                                string newWorkType = hdfWorkType.Value;

                                ProjectGateway projectGateway = new ProjectGateway();
                                projectGateway.LoadByProjectId(newProjectId);
                                string newProjectName = projectGateway.GetName(newProjectId) + " (" + projectGateway.GetProjectNumber(newProjectId) + ")";

                                int companyId = Int32.Parse(hdfCompanyId.Value);
                                CompaniesGateway companiesGateway = new CompaniesGateway();
                                companiesGateway.LoadByCompaniesId(newClientId, companyId);
                                string newClientName = companiesGateway.GetName(newClientId);

                                // Update if exists
                                SelectProjectLastUsedProjects model = new SelectProjectLastUsedProjects(selectProjectTDS);
                                model.Update(gridClientId, gridProjectId, gridUserId, gridCompanyId, workType, newClientId, newProjectId, newUserId, newLastLoggedInDate, newCompanyId, false, newWorkType, newProjectName, newClientName);
                            }

                            index = index + 1;
                        }

                        Session["selectProjectTDS"] = selectProjectTDS;
                        Session["lastUsedProjects"] = selectProjectTDS.LastUsedProjects;

                        grdProjects.DataBind();
                        grdProjects.PageIndex = grdProjects.PageCount - 1;
                    }
                }

                // Update data at bd
                UpdateDatabase();
            }
        }