コード例 #1
0
        private void LoadFilterGridData()
        {
            //set gridview panel height
            PnlGrid.Style.Add("height", hdnGridPnlHeight.Value);

            if (ddlCompany.SelectedValue != "-" || ddlReportingSch.SelectedValue != "-" || ddlTeamResponsibility.SelectedValue != "-" || ddlMngrResponsibility.SelectedValue != "-" || txtEarnings.Text != "")
            {
                if (ddlReportingSch.SelectedValue != "-")
                {
                    tdGvRemainingDays.Visible    = true;
                    tdGvRemainingDaysHdr.Visible = true;
                }
                else
                {
                    tdGvRemainingDays.Visible    = false;
                    tdGvRemainingDaysHdr.Visible = false;
                }

                stmtProgressDashboarBL = new StmtProgressDashboardBL();
                DataSet stmtData = stmtProgressDashboarBL.GetFilterData(ddlCompany.SelectedValue, ddlReportingSch.SelectedValue, ddlTeamResponsibility.SelectedValue, ddlMngrResponsibility.SelectedValue, ddlEarningsCompare.SelectedValue, txtEarnings.Text, out errorId);
                stmtProgressDashboarBL = null;

                if (stmtData.Tables.Count != 0 && errorId != 2)
                {
                    if (stmtData.Tables[0].Rows.Count == 0)
                    {
                        gvStatements.DataSource    = stmtData.Tables[0];
                        gvStatements.EmptyDataText = "No Data Found";
                        gvStatements.DataBind();
                    }
                    else
                    {
                        gvStatements.DataSource = stmtData.Tables[0];
                        gvStatements.DataBind();
                    }

                    if (stmtData.Tables[1].Rows.Count == 0)
                    {
                        gvRemainingDays.DataSource    = stmtData.Tables[1];
                        gvRemainingDays.EmptyDataText = "No Data Found";
                        gvRemainingDays.DataBind();
                    }
                    else
                    {
                        gvRemainingDays.DataSource = stmtData.Tables[1];
                        gvRemainingDays.DataBind();
                    }
                }
                else if (stmtData.Tables.Count == 0 && errorId != 2)
                {
                    dtEmpty = new DataTable();
                    gvStatements.DataSource    = dtEmpty;
                    gvStatements.EmptyDataText = "No Data Found";
                    gvStatements.DataBind();
                }
                else
                {
                    ExceptionHandler("Error in loading search data.", string.Empty);
                }
            }
            else
            {
                DataTable intialData = (DataTable)Session["StmtDashboardInitialData"];
                if (intialData.Rows.Count == 0)
                {
                    gvStatements.DataSource    = intialData;
                    gvStatements.EmptyDataText = "No Data Found";
                    gvStatements.DataBind();
                }
                else
                {
                    gvStatements.DataSource = intialData;
                    gvStatements.DataBind();
                }
            }
        }
コード例 #2
0
        private void LoadInitialGridData()
        {
            //set gridview panel height
            PnlGrid.Style.Add("height", hdnGridPnlHeight.Value);

            stmtProgressDashboarBL = new StmtProgressDashboardBL();
            DataSet intialData = stmtProgressDashboarBL.GetInitialData(out errorId);

            stmtProgressDashboarBL = null;

            if (intialData.Tables.Count != 0 && errorId != 2)
            {
                ddlCompany.DataTextField  = "com_name";
                ddlCompany.DataValueField = "com_number";
                ddlCompany.DataSource     = intialData.Tables[0];
                ddlCompany.DataBind();
                ddlCompany.Items.Insert(0, new System.Web.UI.WebControls.ListItem("-"));

                ddlReportingSch.DataTextField  = "stmt_period";
                ddlReportingSch.DataValueField = "statement_period_id";
                ddlReportingSch.DataSource     = intialData.Tables[1];
                ddlReportingSch.DataBind();
                ddlReportingSch.Items.Insert(0, new System.Web.UI.WebControls.ListItem("-"));

                ddlTeamResponsibility.DataTextField  = "responsibility";
                ddlTeamResponsibility.DataValueField = "responsibility_code";
                ddlTeamResponsibility.DataSource     = intialData.Tables[2];
                ddlTeamResponsibility.DataBind();
                ddlTeamResponsibility.Items.Insert(0, new ListItem("-"));

                ddlMngrResponsibility.DataTextField  = "responsibility";
                ddlMngrResponsibility.DataValueField = "responsibility_code";
                ddlMngrResponsibility.DataSource     = intialData.Tables[3];
                ddlMngrResponsibility.DataBind();
                ddlMngrResponsibility.Items.Insert(0, new System.Web.UI.WebControls.ListItem("-"));

                Session["StmtDashboardInitialData"] = intialData.Tables[4];
                if (intialData.Tables[4].Rows.Count == 0)
                {
                    gvStatements.DataSource    = intialData.Tables[4];
                    gvStatements.EmptyDataText = "No Data Found";
                    gvStatements.DataBind();
                }
                else
                {
                    gvStatements.DataSource = intialData.Tables[4];
                    gvStatements.DataBind();
                }
            }
            else if (intialData.Tables.Count == 0 && errorId != 2)
            {
                dtEmpty = new DataTable();
                gvStatements.DataSource    = dtEmpty;
                gvStatements.EmptyDataText = "No Data Found";
                gvStatements.DataBind();
            }
            else
            {
                ExceptionHandler("Error in loading search data.", string.Empty);
            }
        }