Esempio n. 1
0
        //return guards for batch deploy....
        protected void get_list_of_guards_for_batch_deploy()
        {
            DataTable dt = Guard_deployment.select_list_of_guards_by_branch_and_date_for_batch_deployment("select_list_of_guards_by_branch_and_date_for_batch_deployment", cbo_branch.Text);

            if (dt.Rows.Count > 0)
            {
                //set value of deployment date
                DataRow dtRow = dt.Rows[0];
                dt_deployment_date.Value          = Convert.ToDateTime(dtRow["next_deploy_date"]);
                gdv_deployment_summary.DataSource = dt;

                gdv_deployment_summary.Columns["deploy_type"].Visible            = false;
                gdv_deployment_summary.Columns["branch_name"].Visible            = false;
                gdv_deployment_summary.Columns["guard_auto_id"].Visible          = false;
                gdv_deployment_summary.Columns["firearm_serial"].Visible         = false;
                gdv_deployment_summary.Columns["number_of_ammunitions"].Visible  = false;
                gdv_deployment_summary.Columns["is_leave_day_for_guard"].Visible = false;
                gdv_deployment_summary.Columns["is_public_holiday"].Visible      = false;
                gdv_deployment_summary.Columns["deploy_date"].Visible            = false;
                gdv_deployment_summary.Columns["is_weekend"].Visible             = false;

                gdv_deployment_summary.Columns["guard_name"].HeaderText       = "Guard";
                gdv_deployment_summary.Columns["guard_number"].HeaderText     = "Guard";
                gdv_deployment_summary.Columns["next_deploy_date"].HeaderText = "Day";
                gdv_deployment_summary.Columns["client_name"].HeaderText      = "Client";
                gdv_deployment_summary.Columns["client_code"].HeaderText      = "Client Code";
                gdv_deployment_summary.Columns["client_location"].HeaderText  = "Location";
                gdv_deployment_summary.Columns["shift_type"].HeaderText       = "Shift";

                gdv_deployment_summary.Columns["guard_name"].Width = 250;

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

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

                // Set the selection background color for all the cells.
                gdv_deployment_summary.DefaultCellStyle.SelectionBackColor = Color.DeepSkyBlue;
                gdv_deployment_summary.DefaultCellStyle.SelectionForeColor = Color.Black;

                foreach (DataGridViewColumn c in gdv_deployment_summary.Columns)
                {
                    c.DefaultCellStyle.Font = new Font("Arial", 11F, GraphicsUnit.Pixel);
                }

                //set the background color of the header row
                gdv_deployment_summary.ColumnHeadersDefaultCellStyle.BackColor = Color.CadetBlue;
                gdv_deployment_summary.EnableHeadersVisualStyles = false;

                //set batch save status as not saved
                chk_save_status.Checked = false;
            }
            else
            {
                gdv_deployment_summary.DataSource = dt;
            }
        }
        protected void get_list_of_guards_for_batch_deploy()
        {
            DataTable dt = Guard_deployment.select_list_of_guards_by_branch_and_date_for_batch_deployment("select_list_of_guards_by_branch_and_date_for_batch_deployment", this.cbo_branch.Text, SystemConst._user_id);

            if (dt.Rows.Count <= 0)
            {
                this.gdv_deployment_summary.DataSource = dt;
                return;
            }
            DataRow dtRow = dt.Rows[0];

            this.dt_deployment_date.Value          = Convert.ToDateTime(dtRow["next_deploy_date"]);
            this.gdv_deployment_summary.DataSource = dt;
            this.gdv_deployment_summary.Columns["deploy_type"].Visible            = false;
            this.gdv_deployment_summary.Columns["branch_name"].Visible            = false;
            this.gdv_deployment_summary.Columns["guard_auto_id"].Visible          = false;
            this.gdv_deployment_summary.Columns["firearm_serial"].Visible         = false;
            this.gdv_deployment_summary.Columns["number_of_ammunitions"].Visible  = false;
            this.gdv_deployment_summary.Columns["is_leave_day_for_guard"].Visible = false;
            this.gdv_deployment_summary.Columns["is_public_holiday"].Visible      = false;
            this.gdv_deployment_summary.Columns["deploy_date"].Visible            = false;
            this.gdv_deployment_summary.Columns["is_weekend"].Visible             = false;
            this.gdv_deployment_summary.Columns["guard_name"].HeaderText          = "Guard";
            this.gdv_deployment_summary.Columns["guard_number"].HeaderText        = "Guard Number";
            this.gdv_deployment_summary.Columns["next_deploy_date"].HeaderText    = "Day";
            this.gdv_deployment_summary.Columns["client_name"].HeaderText         = "Client";
            this.gdv_deployment_summary.Columns["client_code"].HeaderText         = "Client Code";
            this.gdv_deployment_summary.Columns["client_location"].HeaderText     = "Location";
            this.gdv_deployment_summary.Columns["shift_type"].HeaderText          = "Shift";
            this.gdv_deployment_summary.Columns["guard_name"].Width               = 250;
            this.gdv_deployment_summary.RowsDefaultCellStyle.BackColor            = Color.LightGray;
            this.gdv_deployment_summary.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
            this.gdv_deployment_summary.ColumnHeadersDefaultCellStyle.ForeColor   = Color.White;
            this.gdv_deployment_summary.ColumnHeadersDefaultCellStyle.BackColor   = Color.Black;
            this.gdv_deployment_summary.RowHeadersDefaultCellStyle.BackColor      = Color.Black;
            this.gdv_deployment_summary.DefaultCellStyle.SelectionBackColor       = Color.DeepSkyBlue;
            this.gdv_deployment_summary.DefaultCellStyle.SelectionForeColor       = Color.Black;
            foreach (DataGridViewColumn c in this.gdv_deployment_summary.Columns)
            {
                c.DefaultCellStyle.Font = new System.Drawing.Font("Arial", 11f, GraphicsUnit.Pixel);
            }
            this.gdv_deployment_summary.ColumnHeadersDefaultCellStyle.BackColor = Color.CadetBlue;
            this.gdv_deployment_summary.EnableHeadersVisualStyles = false;
            this.chk_save_status.Checked = false;

            lblCount.Text = dt.Rows.Count.ToString() + " Guards Loaded";
        }