protected void Save_or_Update_batch_deployment() { if (this.gdv_deployment_summary.Rows.Count > 0) { System.Windows.Forms.DialogResult dialogResult = MessageBox.Show("This might take a while.Save Batch Deploy?", " Batch Deploy", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { for (int i = 0; i < this.gdv_deployment_summary.Rows.Count; i++) { string guard_number = this.gdv_deployment_summary.Rows[i].Cells[1].Value.ToString(); string guard_name = this.gdv_deployment_summary.Rows[i].Cells[0].Value.ToString(); DateTime deployment_date = Convert.ToDateTime(this.gdv_deployment_summary.Rows[i].Cells[2].Value); string deploy_type = this.gdv_deployment_summary.Rows[i].Cells[8].Value.ToString(); string branch_name = this.gdv_deployment_summary.Rows[i].Cells[9].Value.ToString(); string client_code = this.gdv_deployment_summary.Rows[i].Cells[5].Value.ToString(); string client_location = this.gdv_deployment_summary.Rows[i].Cells[6].Value.ToString(); string fire_arm_serial = this.gdv_deployment_summary.Rows[i].Cells[11].Value.ToString(); int ammunition_count = Convert.ToInt32(this.gdv_deployment_summary.Rows[i].Cells[12].Value.ToString()); string shift_type = this.gdv_deployment_summary.Rows[i].Cells[7].Value.ToString(); bool is_leave_day_for_guard = Convert.ToBoolean(this.gdv_deployment_summary.Rows[i].Cells[13].Value); DateTime date = this.dt_start_date.Value.Date; DateTime value = this.dt_end_date.Value; Guard_deployment.Save_new_deployment_record("save_new_deployment_record", date, value.Date, SystemConst._username, guard_number, deployment_date, deploy_type, branch_name, client_code, client_location, guard_name, fire_arm_serial, ammunition_count, shift_type, is_leave_day_for_guard, frm_guard_deployment_summary_batch._is_public_holiday, frm_guard_deployment_summary_batch._is_weekend, SystemConst._user_id); Guard_deployment.Save_deployment_schedule(deployment_date, Convert.ToInt32(SystemConst._active_deployment_id), guard_number); } } else if (dialogResult == System.Windows.Forms.DialogResult.No) { base.Visible = true; } MessageBox.Show(string.Concat("Successfully deployed all guards in ", this.cbo_branch.Text, " for this date"), "Batch Guard Deployments", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.chk_save_status.Checked = true; } }
protected void Save_guard_deployment_record() { if (dt_start_date.Checked == false || dt_end_date.Checked == false || dt_deployment_date.Checked == false || cbo_deploy_type.Text == String.Empty || cbo_branch.Text == String.Empty || cbo_customer_name.Text == String.Empty || cbo_customer_location.Text == String.Empty || cbo_guard_name.Text == String.Empty || cbo_working_shift.Text == String.Empty) { MessageBox.Show("Fill in all required values", "Client Locations", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { Guard_deployment.Save_new_deployment_record("save_new_deployment_record", dt_start_date.Value.Date, dt_end_date.Value.Date, SystemConst._username, txt_guard_number.Text, dt_deployment_date.Value.Date, cbo_deploy_type.Text, cbo_branch.Text, txt_client_code.Text, cbo_customer_location.Text, cbo_guard_name.Text, txt_fire_arm_serial.Text, txt_ammunition_count.Text != String.Empty ? Convert.ToInt32(txt_ammunition_count.Text) : 0, cbo_working_shift.Text, chk_leave.Checked == true ? true : false, chk_public_holiday.Checked == true ? true : false, chk_weekend.Checked == true?true:false); MessageBox.Show("Successfully deployed guard for this date", "Guard Deployments", MessageBoxButtons.OK, MessageBoxIcon.Information); Return_list_of_deployments_by_deploy_id(); } }
protected void Save_or_Update_batch_deployment() { if (gdv_deployment_summary.Rows.Count > 0) { DialogResult dialogResult = MessageBox.Show("This might take a while.Save Batch Deploy?", " Batch Deploy", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { for (int i = 0; i < gdv_deployment_summary.Rows.Count; i++) { string guard_number = gdv_deployment_summary.Rows[i].Cells[1].Value.ToString(); string guard_name = gdv_deployment_summary.Rows[i].Cells[0].Value.ToString(); DateTime deployment_date = Convert.ToDateTime(gdv_deployment_summary.Rows[i].Cells[2].Value); string deploy_type = gdv_deployment_summary.Rows[i].Cells[8].Value.ToString(); string branch_name = gdv_deployment_summary.Rows[i].Cells[9].Value.ToString(); string client_code = gdv_deployment_summary.Rows[i].Cells[5].Value.ToString(); string client_location = gdv_deployment_summary.Rows[i].Cells[6].Value.ToString(); string fire_arm_serial = gdv_deployment_summary.Rows[i].Cells[11].Value.ToString(); int ammunition_count = Convert.ToInt32(gdv_deployment_summary.Rows[i].Cells[12].Value.ToString()); string shift_type = gdv_deployment_summary.Rows[i].Cells[7].Value.ToString(); bool is_leave_day_for_guard = Convert.ToBoolean(gdv_deployment_summary.Rows[i].Cells[13].Value); //call function to save this batch record Guard_deployment.Save_new_deployment_record("save_new_deployment_record", dt_start_date.Value.Date, dt_end_date.Value.Date, SystemConst._username, guard_number, deployment_date, deploy_type, branch_name, client_code, client_location, guard_name, fire_arm_serial, ammunition_count, shift_type, is_leave_day_for_guard, _is_public_holiday, _is_weekend); } } else if (dialogResult == DialogResult.No) { this.Visible = true; } MessageBox.Show("Successfully deployed all guards in " + cbo_branch.Text + " for this date", "Batch Guard Deployments", MessageBoxButtons.OK, MessageBoxIcon.Information); chk_save_status.Checked = true; //Return_list_of_deployments_by_deploy_id(); } }