protected void Get_list_of_guards_for_selected_deploy_date() { if (!this.dt_deployment_date.Checked) { MessageBox.Show("Select a deployment date", "Batch Guard Deployments", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } string text = this.cbo_branch.Text; DateTime value = this.dt_deployment_date.Value; DataTable dt = Guard_deployment.select_list_of_guards_by_branch_and_date_for_selected_date("select_list_of_guards_by_branch_and_date_for_selected_date", text, value.Date); if (dt.Rows.Count <= 0) { this.gdv_deployment_summary.DataSource = dt; return; } DataRow item = dt.Rows[0]; 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["record_guid"].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 = true; lblCount.Text = dt.Rows.Count.ToString() + " Guards Loaded"; }
//return guards for particular deploy date which was already saved protected void Get_list_of_guards_for_selected_deploy_date() { if (dt_deployment_date.Checked == false) { MessageBox.Show("Select a deployment date", "Batch Guard Deployments", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DataTable dt = Guard_deployment.select_list_of_guards_by_branch_and_date_for_selected_date("select_list_of_guards_by_branch_and_date_for_selected_date", cbo_branch.Text, dt_deployment_date.Value.Date); if (dt.Rows.Count > 0) { //set value of deployment date DataRow dtRow = dt.Rows[0]; 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["record_guid"].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 this batch as saved already chk_save_status.Checked = true; } else { gdv_deployment_summary.DataSource = dt; } } }