protected void btnViewDelete_Click(object sender, EventArgs e)
        {
            int viewId = Int32.Parse(ddlView.SelectedValue.Trim());
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());

            if (!Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_DELETE"]))
            {
                WorkViewGateway workViewGateway = new WorkViewGateway();
                workViewGateway.LoadByViewId(viewId, companyId);
                string viewType = workViewGateway.GetType(viewId);

                if (viewType == "Global")
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }
            }

            UpdateDatabaseForViews();

            // ... For view ddl
            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;
        }
        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);
            }
        }
        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);
        }
        private MrNavigatorTDS SubmitSearchForViews()
        {
            string sqlCommand = "";
            int viewId = Int32.Parse(ddlView.SelectedValue.Trim());

            MrNavigator mrNavigator = new MrNavigator();
            string workType = hdfWorkType.Value.Trim();
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
            int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.Trim());
            bool inProject = bool.Parse(hdfInProject.Value);

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

            sqlCommand = workViewGateway.GetSqlCommand(viewId);

            // ... Load data
            mrNavigator.LoadForViewsProjectIdCompanyIdWorkType(sqlCommand, currentProjectId, companyId, workType, inProject);

            return (MrNavigatorTDS)mrNavigator.Data;
        }
        protected void btnExportList_Click(object sender, EventArgs e)
        {
            string url = "";

            string headerValues = "";
            int totalColumnsExport = 53;
            int totalColumnsPreview = 52;
            string client = "";
            string name = "";
            string project = "";
            string title = "Rehab Assessment 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 (grdRANavigator.Columns[2].Visible) headerValues += "ID (Section)";
            if (grdRANavigator.Columns[3].Visible) headerValues += " * Old CWP ID";
            if (grdRANavigator.Columns[4].Visible) headerValues += " * Sub Area";
            if (grdRANavigator.Columns[5].Visible) headerValues += " * Street";
            if (grdRANavigator.Columns[6].Visible) headerValues += " * USMH";
            if (grdRANavigator.Columns[7].Visible) headerValues += " * DSMH";
            if (grdRANavigator.Columns[8].Visible) headerValues += " * Pre-Flush Date";
            if (grdRANavigator.Columns[9].Visible) headerValues += " * Pre-Video Date";
            if (grdRANavigator.Columns[10].Visible) headerValues += " * Map Size";
            if (grdRANavigator.Columns[11].Visible) headerValues += " * Map Length";
            if (grdRANavigator.Columns[12].Visible) headerValues += " * Thickness";
            if (grdRANavigator.Columns[13].Visible) headerValues += " * Size_";
            if (grdRANavigator.Columns[14].Visible) headerValues += " * Length";
            if (grdRANavigator.Columns[15].Visible) headerValues += " * Comments";
            if (grdRANavigator.Columns[16].Visible) headerValues += " * VideoLength";
            if (grdRANavigator.Columns[17].Visible) headerValues += " * Laterals";
            if (grdRANavigator.Columns[18].Visible) headerValues += " * LiveLaterals";
            if (grdRANavigator.Columns[19].Visible) headerValues += " * ClientID";
            if (grdRANavigator.Columns[20].Visible) headerValues += " * P1Date";
            if (grdRANavigator.Columns[21].Visible) headerValues += " * CXIsRemoved";
            if (grdRANavigator.Columns[22].Visible) headerValues += " * M1Date";
            if (grdRANavigator.Columns[23].Visible) headerValues += " * MeasurementTakenBy";
            if (grdRANavigator.Columns[24].Visible) headerValues += " * MaterialType";
            if (grdRANavigator.Columns[25].Visible) headerValues += " * USMHAddress";
            if (grdRANavigator.Columns[26].Visible) headerValues += " * USMHDepth";
            if (grdRANavigator.Columns[27].Visible) headerValues += " * USMHMouth12";
            if (grdRANavigator.Columns[28].Visible) headerValues += " * USMHMouth1";
            if (grdRANavigator.Columns[29].Visible) headerValues += " * USMHMouth2";
            if (grdRANavigator.Columns[30].Visible) headerValues += " * USMHMouth3";
            if (grdRANavigator.Columns[31].Visible) headerValues += " * USMHMouth4";
            if (grdRANavigator.Columns[32].Visible) headerValues += " * USMHMouth5";
            if (grdRANavigator.Columns[33].Visible) headerValues += " * DSMHAddress";
            if (grdRANavigator.Columns[34].Visible) headerValues += " * DSMHDepth";
            if (grdRANavigator.Columns[35].Visible) headerValues += " * DSMHMouth12";
            if (grdRANavigator.Columns[36].Visible) headerValues += " * DSMHMouth1";
            if (grdRANavigator.Columns[37].Visible) headerValues += " * DSMHMouth2";
            if (grdRANavigator.Columns[38].Visible) headerValues += " * DSMHMouth3";
            if (grdRANavigator.Columns[39].Visible) headerValues += " * DSMHMouth4";
            if (grdRANavigator.Columns[40].Visible) headerValues += " * DSMHMouth5";
            if (grdRANavigator.Columns[41].Visible) headerValues += " * TrafficControl";
            if (grdRANavigator.Columns[42].Visible) headerValues += " * SiteDetails";
            if (grdRANavigator.Columns[43].Visible) headerValues += " * PipeSizeChange";
            if (grdRANavigator.Columns[44].Visible) headerValues += " * StandardBypass";
            if (grdRANavigator.Columns[45].Visible) headerValues += " * StandardBypassComments";
            if (grdRANavigator.Columns[46].Visible) headerValues += " * TrafficControlDetails";
            if (grdRANavigator.Columns[47].Visible) headerValues += " * MeasurementType";
            if (grdRANavigator.Columns[48].Visible) headerValues += " * MeasurementFromMH";
            if (grdRANavigator.Columns[49].Visible) headerValues += " * VideoDoneFromMH";
            if (grdRANavigator.Columns[50].Visible) headerValues += " * VideoDoneToMH";
            if (grdRANavigator.Columns[51].Visible) headerValues += " * RoboticPrepCompleted";
            if (grdRANavigator.Columns[52].Visible) headerValues += " * RoboticPrepCompleted Date";

            // 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('./ra_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);
        }
Ejemplo n.º 6
0
        private JlNavigatorTDS SubmitSearchForViews()
        {
            string sqlCommand = "";
            int viewId = Int32.Parse(ddlView.SelectedValue.Trim());

            JlNavigator jlNavigator = new JlNavigator();
            string workType = "Junction Lining Lateral";
            int companyId = Int32.Parse(hdfCompanyId.Value.Trim());
            int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.Trim());

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

            sqlCommand = workViewGateway.GetSqlCommand(viewId);

            // ... Load data
            jlNavigator.LoadForViewsProjectIdCompanyIdWorkType(sqlCommand, currentProjectId, companyId, workType);

            return (JlNavigatorTDS)jlNavigator.Data;
        }
        protected void btnPrintLateralLocationSheet_Click(object sender, EventArgs e)
        {
            mForm7 master = (mForm7)this.Master;
            ScriptManager scriptManager = (ScriptManager)master.FindControl("ScriptManagerMaster7");

            if (!scriptManager.IsInAsyncPostBack)
            {
                string url = "";
                string client = "";
                string name = "";
                string project = "";
                string title = "Full Length Lining Search Results";

                // ... for client
                int currentClientId = Int32.Parse(hdfCurrentClientId.Value.ToString());
                int companyId = Int32.Parse(hdfCompanyId.Value);
                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);
                }

                // Report call
                Page.Validate();
                if (Page.IsValid)
                {
                    PostPageChanges();

                    int assetId = GetAssetId();
                    if (assetId > 0)
                    {
                        WorkGateway workGateway = new WorkGateway();
                        workGateway.LoadByProjectIdAssetIdWorkType(Int32.Parse(hdfCurrentProjectId.Value), assetId, "Full Length Lining", Int32.Parse(hdfCompanyId.Value));
                        int workId = workGateway.GetWorkId(assetId, "Full Length Lining", Int32.Parse(hdfCurrentProjectId.Value));

                        FullLengthLiningWorkDetailsGateway fullLengthLiningWorkDetailsGateway = new FullLengthLiningWorkDetailsGateway();
                        fullLengthLiningWorkDetailsGateway.LoadByWorkIdAssetId(workId, assetId, Int32.Parse(hdfCompanyId.Value));
                        string measuredFrom = fullLengthLiningWorkDetailsGateway.GetMeasurementFromMh(workId);

                        Response.Write("<script language='javascript'> {window.open('./../../CWP/Common/lateral_location_sheet_report.aspx?source_page=lm&project_id=" + hdfCurrentProjectId.Value + "&client_id=" + hdfCurrentClientId.Value + "&work_id=" + workId.ToString() + "&measured_from=" + measuredFrom + "&asset_id=" + assetId.ToString() + "', '_blank', 'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=800, height=680');}</script>");
                    }
                    else
                    {
                        cvSelection.IsValid = false;
                    }
                }

                if (url != "") Response.Redirect(url);
            }
        }
        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 = 85;
                int totalColumnsPreview = 84;
                string client = "";
                string name = "";
                string project = "";
                string title = "Full Length Lining 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 (grdFLNavigator.Columns[2].Visible) headerValues += "ID (Section)";
                if (grdFLNavigator.Columns[3].Visible) headerValues += " * Old CWP ID";
                if (grdFLNavigator.Columns[4].Visible) headerValues += " * Sub Area";
                if (grdFLNavigator.Columns[5].Visible) headerValues += " * Street";
                if (grdFLNavigator.Columns[6].Visible) headerValues += " * USMH";
                if (grdFLNavigator.Columns[7].Visible) headerValues += " * DSMH";
                if (grdFLNavigator.Columns[8].Visible) headerValues += " * Proposed Lining Date";
                if (grdFLNavigator.Columns[9].Visible) headerValues += " * Deadline Lining Date";
                if (grdFLNavigator.Columns[10].Visible) headerValues += " * P1 Date";
                if (grdFLNavigator.Columns[11].Visible) headerValues += " * M1 Date";
                if (grdFLNavigator.Columns[12].Visible) headerValues += " * M2 Date";
                if (grdFLNavigator.Columns[13].Visible) headerValues += " * Install Date";
                if (grdFLNavigator.Columns[14].Visible) headerValues += " * Final Video Date";
                if (grdFLNavigator.Columns[15].Visible) headerValues += " * Confirmed Size";
                if (grdFLNavigator.Columns[16].Visible) headerValues += " * Actual Length";
                if (grdFLNavigator.Columns[17].Visible) headerValues += " * Thickness";
                if (grdFLNavigator.Columns[18].Visible) headerValues += " * Comments";
                if (grdFLNavigator.Columns[19].Visible) headerValues += " * Map Size";
                if (grdFLNavigator.Columns[20].Visible) headerValues += " * Map Length";
                if (grdFLNavigator.Columns[21].Visible) headerValues += " * Video Length";
                if (grdFLNavigator.Columns[22].Visible) headerValues += " * Laterals";
                if (grdFLNavigator.Columns[23].Visible) headerValues += " * Live Laterals";
                if (grdFLNavigator.Columns[24].Visible) headerValues += " * Client ID";
                if (grdFLNavigator.Columns[25].Visible) headerValues += " * Pre-Flush Date";
                if (grdFLNavigator.Columns[26].Visible) headerValues += " * Pre-Video Date";
                if (grdFLNavigator.Columns[27].Visible) headerValues += " * Issue Identified";
                if (grdFLNavigator.Columns[28].Visible) headerValues += " * Issue LFS";
                if (grdFLNavigator.Columns[29].Visible) headerValues += " * Issue Client";
                if (grdFLNavigator.Columns[30].Visible) headerValues += " * Issue Sales";
                if (grdFLNavigator.Columns[31].Visible) headerValues += " * Issue Given To Client";
                if (grdFLNavigator.Columns[32].Visible) headerValues += " * Issue Investigation";
                if (grdFLNavigator.Columns[33].Visible) headerValues += " * Issue Resolved";
                if (grdFLNavigator.Columns[34].Visible) headerValues += " * CXIs Removed";
                if (grdFLNavigator.Columns[35].Visible) headerValues += " * Material Type";
                if (grdFLNavigator.Columns[36].Visible) headerValues += " * USMH Address";
                if (grdFLNavigator.Columns[37].Visible) headerValues += " * USMH Depth";
                if (grdFLNavigator.Columns[38].Visible) headerValues += " * USMH Mouth12";
                if (grdFLNavigator.Columns[39].Visible) headerValues += " * USMH Mouth1";
                if (grdFLNavigator.Columns[40].Visible) headerValues += " * USMH Mouth2";
                if (grdFLNavigator.Columns[41].Visible) headerValues += " * USMH Mouth3";
                if (grdFLNavigator.Columns[42].Visible) headerValues += " * USMH Mouth4";
                if (grdFLNavigator.Columns[43].Visible) headerValues += " * USMH Mouth5";
                if (grdFLNavigator.Columns[44].Visible) headerValues += " * DSMH Address";
                if (grdFLNavigator.Columns[45].Visible) headerValues += " * DSMH Depth";
                if (grdFLNavigator.Columns[46].Visible) headerValues += " * DSMH Mouth12";
                if (grdFLNavigator.Columns[47].Visible) headerValues += " * DSMH Mouth1";
                if (grdFLNavigator.Columns[48].Visible) headerValues += " * DSMH Mouth2";
                if (grdFLNavigator.Columns[49].Visible) headerValues += " * DSMH Mouth3";
                if (grdFLNavigator.Columns[50].Visible) headerValues += " * DSMH Mouth4";
                if (grdFLNavigator.Columns[51].Visible) headerValues += " * DSMH Mouth5";
                if (grdFLNavigator.Columns[52].Visible) headerValues += " * Traffic Control";
                if (grdFLNavigator.Columns[53].Visible) headerValues += " * Site Details";
                if (grdFLNavigator.Columns[54].Visible) headerValues += " * Pipe Size Change";
                if (grdFLNavigator.Columns[55].Visible) headerValues += " * Standard Bypass";
                if (grdFLNavigator.Columns[56].Visible) headerValues += " * Standard Bypass Comments";
                if (grdFLNavigator.Columns[57].Visible) headerValues += " * Traffic Control Details";
                if (grdFLNavigator.Columns[58].Visible) headerValues += " * Measurement Type";
                if (grdFLNavigator.Columns[59].Visible) headerValues += " * Measurement FromMH";
                if (grdFLNavigator.Columns[60].Visible) headerValues += " * Video Done From MH";
                if (grdFLNavigator.Columns[61].Visible) headerValues += " * Video Done To MH";
                if (grdFLNavigator.Columns[62].Visible) headerValues += " * M1 Measurement Taken By";
                if (grdFLNavigator.Columns[63].Visible) headerValues += " * M2 Measurement Taken By";
                if (grdFLNavigator.Columns[64].Visible) headerValues += " * Drop Pipe";
                if (grdFLNavigator.Columns[65].Visible) headerValues += " * Drop Pipe Invert Depth";
                if (grdFLNavigator.Columns[66].Visible) headerValues += " * Capped Laterals";
                if (grdFLNavigator.Columns[67].Visible) headerValues += " * Line With ID";
                if (grdFLNavigator.Columns[68].Visible) headerValues += " * Hydran tAddress";
                if (grdFLNavigator.Columns[69].Visible) headerValues += " * Distance To Inversion MH";
                if (grdFLNavigator.Columns[70].Visible) headerValues += " * Hydro Wire Within 10Ft Of Inversion MH";
                if (grdFLNavigator.Columns[71].Visible) headerValues += " * Surface Grade";
                if (grdFLNavigator.Columns[72].Visible) headerValues += " * Hydro Pulley";
                if (grdFLNavigator.Columns[73].Visible) headerValues += " * Fridge Cart";
                if (grdFLNavigator.Columns[74].Visible) headerValues += " * Two Pump";
                if (grdFLNavigator.Columns[75].Visible) headerValues += " * Six Bypass";
                if (grdFLNavigator.Columns[76].Visible) headerValues += " * Scaffolding";
                if (grdFLNavigator.Columns[77].Visible) headerValues += " * Winch Extention";
                if (grdFLNavigator.Columns[78].Visible) headerValues += " * Extra Generator";
                if (grdFLNavigator.Columns[79].Visible) headerValues += " * Grey Cable Extension";
                if (grdFLNavigator.Columns[80].Visible) headerValues += " * Easement Mats";
                if (grdFLNavigator.Columns[81].Visible) headerValues += " * Ramp Required";
                if (grdFLNavigator.Columns[82].Visible) headerValues += " * Camera Skid";
                if (grdFLNavigator.Columns[83].Visible) headerValues += " * RoboticPrepCompleted";
                if (grdFLNavigator.Columns[84].Visible) headerValues += " * RoboticPrepCompleted Date";

                // 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('./fl_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);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// SaveForEdit
        /// </summary>
        /// <param name="viewId">viewId</param>
        /// <param name="loginId">loginId</param>
        /// <param name="name">name</param>
        /// <param name="type">type</param>
        /// <param name="logic">logic</param>
        /// <param name="sqlCommand">sqlCommand</param>
        /// <param name="workType">workType</param>
        /// <param name="companyId">companyId</param>
        public void SaveForEdit(int viewId, int loginId, string name, string type, string logic, string sqlCommand, string workType, int companyId, string newName, string newType)
        {
            WorkViewGateway workViewGateway = new WorkViewGateway();
            workViewGateway.LoadByViewId(viewId, companyId);

            int originalViewId = viewId;
            int originalLoginId = workViewGateway.GetLoginId(viewId);
            string originalName = workViewGateway.GetName(viewId);
            string originalType = workViewGateway.GetType(viewId);
            string originalLogic = workViewGateway.GetLogic(viewId);
            string originalSqlCommand = workViewGateway.GetSqlCommand(viewId);
            string originalWorkType = workViewGateway.GetWorkType(viewId);
            bool originalDeleted = workViewGateway.GetDeleted(viewId);
            int originalCompanyId = workViewGateway.GetCompanyId(viewId);

            UpdateDirect(originalViewId, originalLoginId, originalName, originalType, originalLogic, originalSqlCommand, originalWorkType, originalDeleted, originalCompanyId, viewId, loginId, newName, newType, logic, sqlCommand, workType, false, companyId);
        }
Ejemplo n.º 10
0
        protected void btnPrintLateralLocationSheet_Click(object sender, EventArgs e)
        {
            string url = "";
            string name = "";
            string client = "";
            string project = "";
            string title = "Junction Lining Search Results";
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int projectId = Int32.Parse(hdfCurrentProjectId.Value);

            // ... for client
            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 and history options
            JlNavigator jlNavigator = new JlNavigator(jlNavigatorTDS);

            // Report call
            Page.Validate();
            if (Page.IsValid)
            {
                PostPageChanges();

                int assetId = GetFirstSectionAssetId();
                if (assetId > 0)
                {
                    Response.Write("<script language='javascript'> {window.open('./../../CWP/Common/jl_lateral_location_sheet_report.aspx?source_page=lm&project_id=" + hdfCurrentProjectId.Value + "&client_id=" + hdfCurrentClientId.Value + "', '_blank', 'toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=800, height=680');}</script>");
                }
                else
                {
                    cvSelection.IsValid = false;
                }
            }

            if (url != "") Response.Redirect(url);
        }
Ejemplo n.º 11
0
        protected void btnPreviewList_Click(object sender, EventArgs e)
        {
            string url = "";
            string headerValues = "";
            int totalColumnsPreview = 57;
            int totalColumnsExport = 59;
            string name = "";
            string client = "";
            string project = "";
            string title = "Junction Lining Search Results";
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int projectId = Int32.Parse(hdfCurrentProjectId.Value);

            // ... for client
            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 and history options
            string comments = "None";
            string history = "None";
            JlNavigator jlNavigator = new JlNavigator(jlNavigatorTDS);

            // Update for comments
            jlNavigator.UpdateEnterForReport(projectId, companyId);

            // Establishing header values
            if (grdJLNavigator.Columns[2].Visible) headerValues += "LateralID";
            if (grdJLNavigator.Columns[3].Visible) headerValues += " * Old CWP ID";
            if (grdJLNavigator.Columns[4].Visible) headerValues += " * Client Lateral ID";
            if (grdJLNavigator.Columns[5].Visible) headerValues += " * Hamilton Inspection Number";
            if (grdJLNavigator.Columns[6].Visible) headerValues += " * Street";
            if (grdJLNavigator.Columns[7].Visible) headerValues += " * MN";
            if (grdJLNavigator.Columns[8].Visible) headerValues += " * USMH";
            if (grdJLNavigator.Columns[9].Visible) headerValues += " * DSMH";
            if (grdJLNavigator.Columns[10].Visible) headerValues += " * V1 Inspection";
            if (grdJLNavigator.Columns[11].Visible) headerValues += " * Video Length To PL";
            if (grdJLNavigator.Columns[12].Visible) headerValues += " * Depth Of Pipe";
            if (grdJLNavigator.Columns[13].Visible) headerValues += " * Pipe Located";
            if (grdJLNavigator.Columns[14].Visible) headerValues += " * Services Located";
            if (grdJLNavigator.Columns[15].Visible) headerValues += " * Prep Type";
            if (grdJLNavigator.Columns[16].Visible) headerValues += " * C/O Req.";
            if (grdJLNavigator.Columns[17].Visible) headerValues += " * Pit Req.";
            if (grdJLNavigator.Columns[18].Visible) headerValues += " * CO/Pit Location";
            if (grdJLNavigator.Columns[19].Visible) headerValues += " * C/O Installed";
            if (grdJLNavigator.Columns[20].Visible) headerValues += " * Backfilled Con.";
            if (grdJLNavigator.Columns[21].Visible) headerValues += " * Backfilled Soil";
            if (grdJLNavigator.Columns[22].Visible) headerValues += " * Grouted";
            if (grdJLNavigator.Columns[23].Visible) headerValues += " * Cored";
            if (grdJLNavigator.Columns[24].Visible) headerValues += " * Prepped";
            if (grdJLNavigator.Columns[25].Visible) headerValues += " * Pre-Video";
            if (grdJLNavigator.Columns[26].Visible) headerValues += " * Measured";
            if (grdJLNavigator.Columns[27].Visible) headerValues += " * Connection Type";
            if (grdJLNavigator.Columns[28].Visible) headerValues += " * Liner Type";
            if (grdJLNavigator.Columns[29].Visible) headerValues += " * Flange";
            if (grdJLNavigator.Columns[30].Visible) headerValues += " * Gasket";
            if (grdJLNavigator.Columns[31].Visible) headerValues += " * Main Size";
            if (grdJLNavigator.Columns[32].Visible) headerValues += " * Liner Size";
            if (grdJLNavigator.Columns[33].Visible) headerValues += " * Lining Thru C/O";
            if (grdJLNavigator.Columns[34].Visible) headerValues += " * Notice Delivered";
            if (grdJLNavigator.Columns[35].Visible) headerValues += " * In Process";
            if (grdJLNavigator.Columns[36].Visible) headerValues += " * In Stock";
            if (grdJLNavigator.Columns[37].Visible) headerValues += " * Delivered";
            if (grdJLNavigator.Columns[38].Visible) headerValues += " * Liner Installed";
            if (grdJLNavigator.Columns[39].Visible) headerValues += " * Final Video";
            if (grdJLNavigator.Columns[40].Visible) headerValues += " * Dist. From USMH";
            if (grdJLNavigator.Columns[41].Visible) headerValues += " * Dist. From DSMH";
            if (grdJLNavigator.Columns[42].Visible) headerValues += " * Post Contract Dig?";
            if (grdJLNavigator.Columns[43].Visible) headerValues += " * C/O Cut Down?";
            if (grdJLNavigator.Columns[44].Visible) headerValues += " * Final Restoration";
            if (grdJLNavigator.Columns[45].Visible) headerValues += " * Cost";
            if (grdJLNavigator.Columns[46].Visible) headerValues += " * Build / Rebuild";
            if (grdJLNavigator.Columns[49].Visible) headerValues += " * Dig Required Prior To Lining";
            if (grdJLNavigator.Columns[50].Visible) headerValues += " * Dig Required Prior To Lining Completed";
            if (grdJLNavigator.Columns[51].Visible) headerValues += " * Dig Required After Lining";
            if (grdJLNavigator.Columns[52].Visible) headerValues += " * Dig Required After Lining Completed";
            if (grdJLNavigator.Columns[53].Visible) headerValues += " * Out Of Scope";
            if (grdJLNavigator.Columns[54].Visible) headerValues += " * Hold - Client Issue";
            if (grdJLNavigator.Columns[55].Visible) headerValues += " * Hold - Client Issue Resolved";
            if (grdJLNavigator.Columns[56].Visible) headerValues += " * Hold - LFS Issue";
            if (grdJLNavigator.Columns[57].Visible) headerValues += " * Hold - LFS Issue Resolved";
            if (grdJLNavigator.Columns[58].Visible) headerValues += " * Requires Robotic Prep";
            if (grdJLNavigator.Columns[59].Visible) headerValues += " * Requires Robotic Prep Completed";

            // Establishing columns to display
            string[] columns = headerValues.Split('*');
            string columnsForReport = "";
            int j;

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

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

            if (grdJLNavigator.Columns[47].Visible) { comments = "Comments"; }
            if (grdJLNavigator.Columns[48].Visible) { history = "History"; }

            // Report call
            Page.Validate();
            if (Page.IsValid)
            {
                PostPageChanges();
                title = title.Replace("'", "%27");
                Response.Write("<script language='javascript'> {window.open('./jl_print_search_results_report.aspx?" + columnsForReport + "&comments=" + comments + "&history=" + history + "&totalColumnsPreview=" + totalColumnsPreview + "&totalColumnsExport=" + totalColumnsExport + "&totalSelectedColumns=" + columns.Length + "&name=" + Server.UrlEncode(name) + "&title=" + Server.UrlEncode(title) + "&format=pdf', '_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);
        }
Ejemplo n.º 12
0
        private bool StepConditionsNext()
        {
            // Validate data
            bool validData = true;

            // Edit if there is data to save
            Page.Validate("ConditionsUpdate");
            if (!Page.IsValid) validData = false;

            if (validData)
            {
                // Conditions Gridview, if the gridview is edition mode
                if (grdConditions.EditIndex >= 0)
                {
                    grdConditions.UpdateRow(grdConditions.EditIndex, true);
                    grdConditions.DataBind();
                }
            }

            Page.Validate("ConditionsNext");
            if (!Page.IsValid) validData = false;

            if (validData)
            {
                // Add conditions if exists at footer
                if (ValidateFooterNext())
                {
                    GrdConditionsAdd();
                }

                WorkViewGateway workViewGateway = new WorkViewGateway();
                workViewGateway.LoadByViewId(int.Parse(hdfViewId.Value), int.Parse(hdfCompanyId.Value));

                workViewConditionTemp.Rows.Clear();

                // create dataset
                WorkViewTDS dataSet = new WorkViewTDS();
                dataSet.WorkViewConditionNew.Merge(workViewConditionNew, true);
                dataSet.WorkViewConditionTemp.Merge(workViewConditionTemp, true);

                // process conditions
                WorkViewConditionTemp model = new WorkViewConditionTemp(dataSet);
                WorkViewConditionNew modelLogic = new WorkViewConditionNew(dataSet);

                string originalLogic = workViewGateway.GetLogic(int.Parse(hdfViewId.Value));
                string newLogic = modelLogic.GetConditionsByDefault();

                ArrayList aConditions = new ArrayList();
                aConditions = modelLogic.GetConditions();

                bool isConditionsUpdate = false;

                if (originalLogic.Trim() != newLogic.Trim())
                {
                    foreach (string conditionNumber in aConditions)
                    {
                        if (!originalLogic.Contains(conditionNumber))
                        {
                            isConditionsUpdate = true;
                        }
                    }

                    if (!isConditionsUpdate)
                    {

                        if (Session["conditionsUpdate"] != null)
                        {
                            if (Session["conditionsUpdate"].ToString() == "true")
                            {
                                isConditionsUpdate = true;
                            }
                        }
                    }
                }
                else
                {
                    tbxLogic.Text = originalLogic.Trim();
                }

                if (isConditionsUpdate)
                {
                    tbxLogic.Text = newLogic.Trim();
                }
                else
                {
                    tbxLogic.Text = originalLogic.Trim();
                }

                // get changes
                workViewConditionNew.Rows.Clear();
                workViewConditionNew.Merge(modelLogic.Table);
                workViewConditionTemp.Rows.Clear();
                workViewConditionTemp.Merge(model.Table);

                //// store tables
                Session.Remove("workViewConditionNewDummy");
                Session.Remove("workViewConditionTempDummy");
                Session["workViewConditionNew"] = workViewConditionNew;
                Session["workViewConditionTemp"] = workViewConditionTemp;

                Session["conditionsUpdate"] = null;

                return true;
            }
            else
            {
                return false;
            }
        }
Ejemplo n.º 13
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["work_type"] == null) || ((string)Request.QueryString["view_id"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in view_edit.aspx");
                }

                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_VIEWS_EDIT"])))
                {
                    if ((string)Request.QueryString["work_type"] == "Rehab Assessment")
                    {
                        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.");
                        }
                    }

                    if ((string)Request.QueryString["work_type"] == "Full Length Lining")
                    {
                        if (!(Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_VIEW"])))
                        {
                            Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                        }
                    }

                    if ((string)Request.QueryString["work_type"] == "Junction Lining")
                    {
                        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.");
                        }
                    }

                    if ((string)Request.QueryString["work_type"] == "Point Repairs")
                    {
                        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.");
                        }
                    }

                    if ((string)Request.QueryString["work_type"] == "Manhole Rehabilitation")
                    {
                        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.");
                        }
                    }
                }

                // Tag page
                hdfWorkType.Value = (string)Request.QueryString["work_type"];
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfViewId.Value = (string)Request.QueryString["view_id"];
                hdfProjectId.Value = (string)Request.QueryString["project_id"];
                int viewId = int.Parse(hdfViewId.Value);
                int companyId = int.Parse(hdfCompanyId.Value);
                hdfUpdate.Value = "no";

                // Security check for global views
                if (!(Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_EDIT"])))
                {
                    if ((string)Request.QueryString["work_type"] == "Rehab Assessment")
                    {
                        if (Convert.ToBoolean(Session["sgLFS_CWP_REHABASSESSMENT_VIEW"]))
                        {
                            WorkViewGateway workViewGateway = new WorkViewGateway();
                            workViewGateway.LoadByViewId(Int32.Parse(hdfViewId.Value), Int32.Parse(hdfCompanyId.Value));
                            string viewType = workViewGateway.GetType(Int32.Parse(hdfViewId.Value));

                            if (viewType == "Global")
                            {
                                Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                            }
                        }
                    }

                    if ((string)Request.QueryString["work_type"] == "Full Length Lining")
                    {
                        if (Convert.ToBoolean(Session["sgLFS_CWP_FULLLENGTHLINING_VIEW"]))
                        {
                            WorkViewGateway workViewGateway = new WorkViewGateway();
                            workViewGateway.LoadByViewId(Int32.Parse(hdfViewId.Value), Int32.Parse(hdfCompanyId.Value));
                            string viewType = workViewGateway.GetType(Int32.Parse(hdfViewId.Value));

                            if (viewType == "Global")
                            {
                                Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                            }
                        }
                    }

                    if ((string)Request.QueryString["work_type"] == "Junction Lining")
                    {
                        if (Convert.ToBoolean(Session["sgLFS_CWP_JUNCTIONLINING_VIEW"]))
                        {
                            WorkViewGateway workViewGateway = new WorkViewGateway();
                            workViewGateway.LoadByViewId(Int32.Parse(hdfViewId.Value), Int32.Parse(hdfCompanyId.Value));
                            string viewType = workViewGateway.GetType(Int32.Parse(hdfViewId.Value));

                            if (viewType == "Global")
                            {
                                Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                            }
                        }
                    }

                    if ((string)Request.QueryString["work_type"] == "Point Repairs")
                    {
                        if (Convert.ToBoolean(Session["sgLFS_CWP_POINTREPAIRS_VIEW"]))
                        {
                            WorkViewGateway workViewGateway = new WorkViewGateway();
                            workViewGateway.LoadByViewId(Int32.Parse(hdfViewId.Value), Int32.Parse(hdfCompanyId.Value));
                            string viewType = workViewGateway.GetType(Int32.Parse(hdfViewId.Value));

                            if (viewType == "Global")
                            {
                                Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                            }
                        }
                    }

                    if ((string)Request.QueryString["work_type"] == "Manhole Rehabilitation")
                    {
                        if (Convert.ToBoolean(Session["sgLFS_CWP_MANHOLEREHABILITATION_VIEW"]))
                        {
                            WorkViewGateway workViewGateway = new WorkViewGateway();
                            workViewGateway.LoadByViewId(Int32.Parse(hdfViewId.Value), Int32.Parse(hdfCompanyId.Value));
                            string viewType = workViewGateway.GetType(Int32.Parse(hdfViewId.Value));

                            if (viewType == "Global")
                            {
                                Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                            }
                        }
                    }
                }

                ViewState["columnsToDisplayPageIndex"] = 0;
                ViewState["sortPageIndex"] = 0;

                Session.Remove("workTypeViewDisplay");
                Session.Remove("workTypeViewDisplayDummy");
                Session.Remove("workViewDisplayTemp");
                Session.Remove("workViewDisplay");
                Session.Remove("workViewConditionNew");
                Session.Remove("workViewConditionTemp");
                Session.Remove("workViewConditionNewDummy");
                Session.Remove("workViewConditionTempDummy");

                // Prepare initial data
                // ... For view type
                WorkViewTypeList workViewTypeList = new WorkViewTypeList(new DataSet());
                workViewTypeList.LoadAndAddItem("(Select a type)", int.Parse(hdfCompanyId.Value));
                ddlType.DataSource = workViewTypeList.Table;
                ddlType.DataValueField = "Type";
                ddlType.DataTextField = "Type";
                ddlType.DataBind();
                ddlType.SelectedIndex = 0;

                // ... Global Views check
                if (!Convert.ToBoolean(Session["sgLFS_GLOBALVIEWS_VIEW"]))
                {
                    ddlType.Items.Remove("Global");
                }

                // If coming from
                // ... ra_navigator.aspx, ra_navigator2.aspx, fl_navigator.aspx, fl_navigator2.aspx, jl_navigator.aspx, jl_navigator2.aspx, pr_navigator.aspx or pr_navigator2.aspx, , mr_navigator.aspx, mr_navigator2.aspx
                if ((Request.QueryString["source_page"] == "ra_navigator.aspx") || (Request.QueryString["source_page"] == "ra_navigator2.aspx") || (Request.QueryString["source_page"] == "fl_navigator.aspx") || (Request.QueryString["source_page"] == "fl_navigator2.aspx") || (Request.QueryString["source_page"] == "jl_navigator.aspx") || (Request.QueryString["source_page"] == "jl_navigator2.aspx") || (Request.QueryString["source_page"] == "pr_navigator.aspx") || (Request.QueryString["source_page"] == "pr_navigator2.aspx") || (Request.QueryString["source_page"] == "mr_navigator.aspx") || (Request.QueryString["source_page"] == "mr_navigator2.aspx"))
                {
                    // ... For Grids
                    workViewTDS = new WorkViewTDS();

                    workTypeViewDisplay = new WorkViewTDS.LFS_WORK_TYPE_VIEW_DISPLAYDataTable();
                    workTypeViewSort = new WorkViewTDS.LFS_WORK_TYPE_VIEW_SORTDataTable();
                    workViewDisplayTemp = new WorkViewTDS.WorkViewDisplayTempDataTable();
                    workViewSortTemp = new WorkViewTDS.WorkViewSortTempDataTable();
                    workViewConditionNew = new WorkViewTDS.WorkViewConditionNewDataTable();
                    workViewConditionTemp = new WorkViewTDS.WorkViewConditionTempDataTable();

                    // Initiaize view data
                    // ... Loading views and data
                    WorkViewGateway workViewGateway = new WorkViewGateway(workViewTDS);
                    workViewGateway.LoadByViewId(viewId, companyId);
                    tbxName.Text = workViewGateway.GetName(viewId);
                    ddlType.SelectedValue = workViewGateway.GetType(viewId);

                    // ... Store datasets
                    Session["workTypeViewDisplay"] = workTypeViewDisplay;
                    Session["workTypeViewSort"] = workTypeViewSort;
                    Session["workViewDisplayTemp"] = workViewDisplayTemp;
                    Session["workViewSortTemp"] = workViewSortTemp;
                    Session["workViewConditionNew"] = workViewConditionNew;
                    Session["workViewConditionTemp"] = workViewConditionTemp;
                }

                // StepSection1In
                wzViews.ActiveStepIndex = 0;
                StepBeginIn();
            }
            else
            {
                // Restore datasets
                workViewTDS = (WorkViewTDS)Session["workViewTDS"];

                workTypeViewDisplay = (WorkViewTDS.LFS_WORK_TYPE_VIEW_DISPLAYDataTable)Session["workTypeViewDisplay"];
                workTypeViewSort = (WorkViewTDS.LFS_WORK_TYPE_VIEW_SORTDataTable)Session["workTypeViewSort"];
                workViewDisplayTemp = (WorkViewTDS.WorkViewDisplayTempDataTable)Session["workViewDisplayTemp"];
                workViewSortTemp = (WorkViewTDS.WorkViewSortTempDataTable)Session["workViewSortTemp"];
                workViewConditionNew = (WorkViewTDS.WorkViewConditionNewDataTable)Session["workViewConditionNew"];
                workViewConditionTemp = (WorkViewTDS.WorkViewConditionTempDataTable)Session["workViewConditionTemp"];
            }

            // control for postback
            hdfTag.Value = DateTime.Now.ToLongTimeString();
        }