Esempio n. 1
0
        /// <summary>
        /// ProcessForReport
        /// </summary>
        /// <param name="linningPlanTDS">TDS for process</param>
        public void ProcessForReport(RaLiningPlanTDS raLiningPlanTDS)
        {
            foreach (RaLiningPlanTDS.RaLiningPlanRow raLiningPlanRow in raLiningPlanTDS.RaLiningPlan.Rows)
            {
                if (raLiningPlanRow.Selected != "9")
                {
                    // Create row for report
                    RaLiningPlanTDS.RaLiningPlanRow newRow = ((RaLiningPlanTDS.RaLiningPlanDataTable)Table).NewRaLiningPlanRow();

                    newRow.WorkID = raLiningPlanRow.WorkID;
                    newRow.AssetID = raLiningPlanRow.AssetID;
                    newRow.COMPANY_ID = raLiningPlanRow.COMPANY_ID;
                    newRow.SectionID = raLiningPlanRow.SectionID;
                    if (!raLiningPlanRow.IsStreetNull()) newRow.Street = raLiningPlanRow.Street;
                    if (!raLiningPlanRow.IsSubAreaNull()) newRow.SubArea = raLiningPlanRow.SubArea;
                    if (!raLiningPlanRow.IsUSMHNull()) newRow.USMH = raLiningPlanRow.USMH;
                    if (!raLiningPlanRow.IsDSMHNull()) newRow.DSMH = raLiningPlanRow.DSMH;
                    if (!raLiningPlanRow.IsDate_Null()) newRow.Date_ = raLiningPlanRow.Date_;
                    if (!raLiningPlanRow.IsFlusherNull()) newRow.Flusher = raLiningPlanRow.Flusher;
                    if (!raLiningPlanRow.IsFlusherMNNull()) newRow.FlusherMN = raLiningPlanRow.FlusherMN;
                    if (!raLiningPlanRow.IsVideoNull()) newRow.Video = raLiningPlanRow.Video;
                    if (!raLiningPlanRow.IsVideoMNNull()) newRow.VideoMN = raLiningPlanRow.VideoMN;
                    if (!raLiningPlanRow.IsUSMHDescriptionNull()) newRow.USMHDescription = raLiningPlanRow.USMHDescription;
                    if (!raLiningPlanRow.IsDSMHDescriptionNull()) newRow.DSMHDescription = raLiningPlanRow.DSMHDescription;
                    newRow.Selected = raLiningPlanRow.Selected;
                    newRow.FlowOrderID = raLiningPlanRow.FlowOrderID;

                    ((RaLiningPlanTDS.RaLiningPlanDataTable)Table).AddRaLiningPlanRow(newRow);
                }
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // 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"]))
                {
                    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_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 = "Rehab Assessment";

                // 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) + ") > Rehab Assessment Plan";

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

                RaLiningPlanGateway raLiningPlanGateway = new RaLiningPlanGateway(raLiningPlanTDS);
                raLiningPlanGateway.ClearBeforeFill = false;
                raLiningPlanGateway.LoadWithoutPreFlushDateWithouPreVideoDate(projectId, companyId);

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

                // Check results
                if (raLiningPlanTDS.RaLiningPlan.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 (raLiningPlanTDS.RaLiningPlan.Rows.Count == 1)
                {
                    tbFooterToolbar.Visible = false;
                }

                // Store dataset
                Session["raLiningPlanTDS"] = raLiningPlanTDS;
            }
            else
            {
                // Restore dataset
                raLiningPlanTDS = (RaLiningPlanTDS)Session["raLiningPlanTDS"];

                // ... for the grid
                RaLiningPlanGateway raLiningPlanGateway = new RaLiningPlanGateway(raLiningPlanTDS);
                int projectId = Int32.Parse(hdfCurrentProjectId.Value);
                int companyId = Int32.Parse(hdfCompanyId.Value);

                raLiningPlanGateway.ClearBeforeFill = false;
                raLiningPlanGateway.LoadWithoutPreFlushDateWithouPreVideoDate(projectId, companyId);

                grdLiningPlan.DataSource = raLiningPlanGateway.Table;
                grdLiningPlan.DataBind();
            }
        }
 /// <summary>
 /// InitData
 /// </summary>
 protected override void InitData()
 {
     _data = new RaLiningPlanTDS();
 }