コード例 #1
0
        /// ////////////////////////////////////////////////////////////////////////
        /// PUBLIC METHODS
        ///
        public TDSLFSRecordForNavigator.NAVIGATORDataTable GetNavigator()
        {
            navigator = (TDSLFSRecordForNavigator.NAVIGATORDataTable)Session["navigatorDummy"];
            if (navigator == null)
            {
                navigator = ((TDSLFSRecordForNavigator.NAVIGATORDataTable)Session["navigator"]);
            }

            return navigator;
        }
コード例 #2
0
        protected void AddNavigatorNewEmptyFix(GridView grdCWPNavigator)
        {
            if (grdCWPNavigator.Rows.Count == 0)
            {
                TDSLFSRecordForNavigator.NAVIGATORDataTable dt = new TDSLFSRecordForNavigator.NAVIGATORDataTable();
                dt.AddNAVIGATORRow(Guid.NewGuid(), -1, "", -1, "", "", "", "", new DateTime(), new DateTime(), new DateTime(), new DateTime(), false, false, false);
                Session["navigatorDummy"] = dt;

                grdCWPNavigator.DataBind();
            }

            // normally executes at all postbacks
            if (grdCWPNavigator.Rows.Count == 1)
            {
                TDSLFSRecordForNavigator.NAVIGATORDataTable dt = (TDSLFSRecordForNavigator.NAVIGATORDataTable)Session["navigatorDummy"];
                if (dt != null)
                {
                    grdCWPNavigator.Rows[0].Visible = false;
                    grdCWPNavigator.Rows[0].Controls.Clear();
                }
            }
        }
コード例 #3
0
        protected void btnSubmit_Click(object sender, System.EventArgs e)
        {
            Page.Validate("submitText");
            if (Page.IsValid && (tbxSearch.Text.Trim() != ""))
            {
                // Get data from database gateway
                tdsLfsRecordForNavigator = this.SubmitSearch();
                Session["tdsLfsRecordForNavigator"] = tdsLfsRecordForNavigator;
                navigator = tdsLfsRecordForNavigator.NAVIGATOR;
                Session["navigator"] = navigator;

                grdCWPNavigator.DataBind();

                // Show results
                if (tdsLfsRecordForNavigator.NAVIGATOR.DefaultView.Count <= 0)
                {
                    // ... No results
                    // ... Store navigator state
                    Session["ddlSearchSelectedIndex"] = ddlSearch.SelectedIndex;
                    Session["tbxSearchText"] = tbxSearch.Text;
                    Session["lblHintVisible"] = lblHint.Visible;
                    Session["lblHintText"] = lblHint.Text;

                    // ... Go to search page
                    Response.Redirect("navigator.aspx?search_results=true");
                }
            }
        }
コード例 #4
0
        /// ////////////////////////////////////////////////////////////////////////
        /// EVENTS
        ///
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!Convert.ToBoolean(Session["sgLFS_APP_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["search_results"] == null) && (Request.QueryString["record_modified"] == null) && (Request.QueryString["record_deleted"] == null))
                {
                    Response.Redirect("./../error_page.aspx?error=" + "Invalid query string in navigator2.aspx");
                }

                // Tag Page
                Session.Remove("navigatorDummy");

                // If coming from navigator.aspx
                if (Request.QueryString["search_results"] != null)
                {
                    // ... Restore navigator state
                    ddlSearch.SelectedIndex = (int)Session["ddlSearchSelectedIndex"];
                    tbxSearch.Text = (string)Session["tbxSearchText"];
                    lblHint.Visible = (bool)Session["lblHintVisible"];
                    lblHint.Text = (string)Session["lblHintText"];

                    // ... Restore searched data
                    tdsLfsRecordForNavigator = (TDSLFSRecordForNavigator)Session["tdsLfsRecordForNavigator"];
                    navigator = tdsLfsRecordForNavigator.NAVIGATOR;
                    Session["navigator"] = navigator;
                }

                // If coming from target page
                if (Request.QueryString["record_modified"] != null)
                {
                    // ...Restore navigator state
                    ddlSearch.SelectedIndex = (int)Session["ddlSearchSelectedIndex"];
                    tbxSearch.Text = (string)Session["tbxSearchText"];
                    lblHint.Visible = (bool)Session["lblHintVisible"];
                    lblHint.Text = (string)Session["lblHintText"];

                    // ...Reload data
                    if (Request.QueryString["record_modified"] == "true")
                    {
                        tdsLfsRecordForNavigator = this.SubmitSearch();
                        Session["tdsLfsRecordForNavigator"] = tdsLfsRecordForNavigator;
                        navigator = tdsLfsRecordForNavigator.NAVIGATOR;
                        Session["navigator"] = navigator;
                    }
                    else
                    {
                        tdsLfsRecordForNavigator = (TDSLFSRecordForNavigator)Session["tdsLfsRecordForNavigator"];
                        navigator = tdsLfsRecordForNavigator.NAVIGATOR;
                        Session["navigator"] = navigator;
                    }
                }

                // If coming from delete record
                if (Request.QueryString["record_deleted"] != null)
                {
                    // ... Restore navigator state
                    ddlSearch.SelectedIndex = (int)Session["ddlSearchSelectedIndex"];
                    tbxSearch.Text = (string)Session["tbxSearchText"];
                    lblHint.Visible = (bool)Session["lblHintVisible"];
                    lblHint.Text = (string)Session["lblHintText"];

                    // ... Reload data
                    if (Request.QueryString["record_deleted"] == "true")
                    {
                        tdsLfsRecordForNavigator = this.SubmitSearch();
                        Session["tdsLfsRecordForNavigator"] = tdsLfsRecordForNavigator;
                        navigator = tdsLfsRecordForNavigator.NAVIGATOR;
                        Session["navigator"] = navigator;
                    }
                    else
                    {
                        tdsLfsRecordForNavigator = (TDSLFSRecordForNavigator)Session["tdsLfsRecordForNavigator"];
                        navigator = tdsLfsRecordForNavigator.NAVIGATOR;
                        Session["navigator"] = navigator;
                    }
                }

                // For the total rows
                if (tdsLfsRecordForNavigator.NAVIGATOR.Rows.Count > 0)
                {
                    lblTotalRows.Text = "Total Rows: " + tdsLfsRecordForNavigator.NAVIGATOR.Rows.Count;
                    lblTotalRows.Visible = true;
                }
                else
                {
                    lblTotalRows.Visible = false;
                }
            }
            else
            {
                // Restore searched data (if any)
                tdsLfsRecordForNavigator = (TDSLFSRecordForNavigator)Session["tdsLfsRecordForNavigator"];

                // For the total rows
                if (tdsLfsRecordForNavigator.NAVIGATOR.Rows.Count > 0)
                {
                    lblTotalRows.Text = "Total Rows: " + tdsLfsRecordForNavigator.NAVIGATOR.Rows.Count;
                    lblTotalRows.Visible = true;
                }
                else
                {
                    lblTotalRows.Visible = false;
                }
            }
        }