Exemplo n.º 1
0
        private void btn_name_search_Click(object sender, EventArgs e)
        {
            if (cbo_guard_status.Text != String.Empty && cbo_branch_search.Text == String.Empty)
            {
                DataTable dt = Archieve_Lists.SEARCH_ARCHIEVED_GUARD_LIST_REPORT_BY_STATUS("FILTER_ARCHIEVE_BY_STATUS", cbo_guard_status.Text);

                if (dt != null)
                {
                    gdv_guards.DataSource         = dt;
                    gdv_guards.Columns[0].Visible = false;
                    gdv_guards.Columns[1].Visible = false;

                    gdv_guards.Columns[2].HeaderText = "NAME";
                    gdv_guards.Columns[3].HeaderText = "BRANCH";
                    gdv_guards.Columns[4].HeaderText = "STATUS";

                    gdv_guards.DefaultCellStyle.SelectionBackColor = Color.White;
                    gdv_guards.DefaultCellStyle.SelectionForeColor = Color.Black;

                    gdv_guards.RowsDefaultCellStyle.BackColor            = Color.LightGray;
                    gdv_guards.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;

                    // Set the row and column header styles.
                    gdv_guards.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
                    gdv_guards.ColumnHeadersDefaultCellStyle.BackColor = Color.Black;
                    gdv_guards.RowHeadersDefaultCellStyle.BackColor    = Color.Black;

                    // Set the selection background color for all the cells.
                    gdv_guards.DefaultCellStyle.SelectionBackColor = Color.White;
                    gdv_guards.DefaultCellStyle.SelectionForeColor = Color.Black;
                }
                else
                {
                    DataTable dt_null = null;
                    gdv_statisctics.DataSource = dt_null;
                }
            }
            else if (cbo_guard_status.Text == String.Empty && cbo_branch_search.Text != String.Empty)
            {
                DataTable dt = Archieve_Lists.SEARCH_ARCHIEVED_GUARD_LIST_REPORT_BY_BRANCH("FILTER_ARCHIEVE_BY_STATION", cbo_branch_search.Text);

                if (dt != null)
                {
                    gdv_guards.DataSource         = dt;
                    gdv_guards.Columns[0].Visible = false;
                    gdv_guards.Columns[1].Visible = false;

                    gdv_guards.Columns[2].HeaderText = "NAME";
                    gdv_guards.Columns[3].HeaderText = "BRANCH";
                    gdv_guards.Columns[4].HeaderText = "STATUS";

                    gdv_guards.DefaultCellStyle.SelectionBackColor = Color.White;
                    gdv_guards.DefaultCellStyle.SelectionForeColor = Color.Black;

                    gdv_guards.RowsDefaultCellStyle.BackColor            = Color.LightGray;
                    gdv_guards.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;

                    // Set the row and column header styles.
                    gdv_guards.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
                    gdv_guards.ColumnHeadersDefaultCellStyle.BackColor = Color.Black;
                    gdv_guards.RowHeadersDefaultCellStyle.BackColor    = Color.Black;

                    // Set the selection background color for all the cells.
                    gdv_guards.DefaultCellStyle.SelectionBackColor = Color.White;
                    gdv_guards.DefaultCellStyle.SelectionForeColor = Color.Black;
                }
                else
                {
                    DataTable dt_null = null;
                    gdv_statisctics.DataSource = dt_null;
                }
            }
            else if (cbo_guard_status.Text != String.Empty && cbo_branch_search.Text != String.Empty)
            {
                DataTable dt = Archieve_Lists.SEARCH_ARCHIEVED_GUARD_LIST_REPORT_BY_BRANCH_AND_STATUS("FILTER_ARCHIEVE_BY_STATION", cbo_branch_search.Text, cbo_guard_status.Text);

                if (dt != null)
                {
                    gdv_guards.DataSource         = dt;
                    gdv_guards.Columns[0].Visible = false;
                    gdv_guards.Columns[1].Visible = false;

                    gdv_guards.Columns[2].HeaderText = "NAME";
                    gdv_guards.Columns[3].HeaderText = "BRANCH";
                    gdv_guards.Columns[4].HeaderText = "STATUS";

                    gdv_guards.DefaultCellStyle.SelectionBackColor = Color.White;
                    gdv_guards.DefaultCellStyle.SelectionForeColor = Color.Black;

                    gdv_guards.RowsDefaultCellStyle.BackColor            = Color.LightGray;
                    gdv_guards.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;

                    // Set the row and column header styles.
                    gdv_guards.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
                    gdv_guards.ColumnHeadersDefaultCellStyle.BackColor = Color.Black;
                    gdv_guards.RowHeadersDefaultCellStyle.BackColor    = Color.Black;

                    // Set the selection background color for all the cells.
                    gdv_guards.DefaultCellStyle.SelectionBackColor = Color.White;
                    gdv_guards.DefaultCellStyle.SelectionForeColor = Color.Black;
                }
                else
                {
                    DataTable dt_null = null;
                    gdv_statisctics.DataSource = dt_null;
                }
            }
            else
            {
                GET_GUARD_LIST();
            }
        }
Exemplo n.º 2
0
        private void btn_name_search_Click(object sender, EventArgs e)
        {
            if (this.cbo_guard_status.Text != string.Empty && this.cbo_branch_search.Text == string.Empty)
            {
                DataTable _dt = Archieve_Lists.SEARCH_ARCHIEVED_GUARD_LIST_REPORT_BY_STATUS("FILTER_ARCHIEVE_BY_STATUS", this.cbo_guard_status.Text);
                if (_dt == null)
                {
                    this.gdv_statisctics.DataSource = null;
                    return;
                }
                this.gdv_guards.DataSource            = _dt;
                this.gdv_guards.Columns[0].Visible    = false;
                this.gdv_guards.Columns[1].Visible    = false;
                this.gdv_guards.Columns[2].HeaderText = "NAME";
                this.gdv_guards.Columns[3].HeaderText = "BRANCH";
                this.gdv_guards.Columns[4].HeaderText = "STATUS";
                this.gdv_guards.DefaultCellStyle.SelectionBackColor       = Color.White;
                this.gdv_guards.DefaultCellStyle.SelectionForeColor       = Color.Black;
                this.gdv_guards.RowsDefaultCellStyle.BackColor            = Color.LightGray;
                this.gdv_guards.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
                this.gdv_guards.ColumnHeadersDefaultCellStyle.ForeColor   = Color.White;
                this.gdv_guards.ColumnHeadersDefaultCellStyle.BackColor   = Color.Black;
                this.gdv_guards.RowHeadersDefaultCellStyle.BackColor      = Color.Black;
                this.gdv_guards.DefaultCellStyle.SelectionBackColor       = Color.White;
                this.gdv_guards.DefaultCellStyle.SelectionForeColor       = Color.Black;
                return;
            }
            if (this.cbo_guard_status.Text == string.Empty && this.cbo_branch_search.Text != string.Empty)
            {
                DataTable _dt = Archieve_Lists.SEARCH_ARCHIEVED_GUARD_LIST_REPORT_BY_BRANCH("FILTER_ARCHIEVE_BY_STATION", this.cbo_branch_search.Text);
                if (_dt == null)
                {
                    this.gdv_statisctics.DataSource = null;
                    return;
                }
                this.gdv_guards.DataSource            = _dt;
                this.gdv_guards.Columns[0].Visible    = false;
                this.gdv_guards.Columns[1].Visible    = false;
                this.gdv_guards.Columns[2].HeaderText = "NAME";
                this.gdv_guards.Columns[3].HeaderText = "BRANCH";
                this.gdv_guards.Columns[4].HeaderText = "STATUS";
                this.gdv_guards.DefaultCellStyle.SelectionBackColor       = Color.White;
                this.gdv_guards.DefaultCellStyle.SelectionForeColor       = Color.Black;
                this.gdv_guards.RowsDefaultCellStyle.BackColor            = Color.LightGray;
                this.gdv_guards.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
                this.gdv_guards.ColumnHeadersDefaultCellStyle.ForeColor   = Color.White;
                this.gdv_guards.ColumnHeadersDefaultCellStyle.BackColor   = Color.Black;
                this.gdv_guards.RowHeadersDefaultCellStyle.BackColor      = Color.Black;
                this.gdv_guards.DefaultCellStyle.SelectionBackColor       = Color.White;
                this.gdv_guards.DefaultCellStyle.SelectionForeColor       = Color.Black;
                return;
            }
            if (!(this.cbo_guard_status.Text != string.Empty) || !(this.cbo_branch_search.Text != string.Empty))
            {
                this.GET_GUARD_LIST();
                return;
            }
            DataTable dt = Archieve_Lists.SEARCH_ARCHIEVED_GUARD_LIST_REPORT_BY_BRANCH_AND_STATUS("FILTER_ARCHIEVE_BY_STATION", this.cbo_branch_search.Text, this.cbo_guard_status.Text);

            if (dt == null)
            {
                this.gdv_statisctics.DataSource = null;
                return;
            }
            this.gdv_guards.DataSource            = dt;
            this.gdv_guards.Columns[0].Visible    = false;
            this.gdv_guards.Columns[1].Visible    = false;
            this.gdv_guards.Columns[2].HeaderText = "NAME";
            this.gdv_guards.Columns[3].HeaderText = "BRANCH";
            this.gdv_guards.Columns[4].HeaderText = "STATUS";
            this.gdv_guards.DefaultCellStyle.SelectionBackColor       = Color.White;
            this.gdv_guards.DefaultCellStyle.SelectionForeColor       = Color.Black;
            this.gdv_guards.RowsDefaultCellStyle.BackColor            = Color.LightGray;
            this.gdv_guards.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
            this.gdv_guards.ColumnHeadersDefaultCellStyle.ForeColor   = Color.White;
            this.gdv_guards.ColumnHeadersDefaultCellStyle.BackColor   = Color.Black;
            this.gdv_guards.RowHeadersDefaultCellStyle.BackColor      = Color.Black;
            this.gdv_guards.DefaultCellStyle.SelectionBackColor       = Color.White;
            this.gdv_guards.DefaultCellStyle.SelectionForeColor       = Color.Black;
        }