private void btn_save_Click(object sender, EventArgs e) { if (txt_client_code.Text == String.Empty || cbo_customer_location.Text == String.Empty || cbo_working_shift.Text == String.Empty) { MessageBox.Show("All values shaded red are required", "Guard Deployments", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { if (chk_absent.Checked == true) { DialogResult dialogResult = MessageBox.Show("Marking" + lbl_name.Text + " as absent will delete this record from the deployment list for this date.sure to proceed?", "Deploy guards", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { Guard_deployment.delete_guard_marked_as_absent_from_deployment_list_per_date("delete_guard_marked_as_absent_from_deployment_list_per_date", lbl_record_guid.Text); } else if (dialogResult == DialogResult.No) { this.Visible = true; } } else { Guard_deployment.Update_guard_deployment_record("update_guard_deployment_record", lbl_record_guid.Text, txt_client_code.Text, cbo_customer_location.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); MessageBox.Show("Updated deployment record for " + lbl_name.Text + " successfully", "Guard Deployments", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private void btn_save_Click(object sender, EventArgs e) { if (this.txt_client_code.Text == string.Empty || this.cbo_customer_location.Text == string.Empty || this.cbo_working_shift.Text == string.Empty) { MessageBox.Show("All values shaded red are required", "Guard Deployments", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (!this.chk_absent.Checked) { Guard_deployment.Update_guard_deployment_record("update_guard_deployment_record", this.lbl_record_guid.Text, this.txt_client_code.Text, this.cbo_customer_location.Text, this.txt_fire_arm_serial.Text, (this.txt_ammunition_count.Text != string.Empty ? Convert.ToInt32(this.txt_ammunition_count.Text) : 0), this.cbo_working_shift.Text, (this.chk_leave.Checked ? true : false)); MessageBox.Show(string.Concat("Updated deployment record for ", this.lbl_name.Text, " successfully"), "Guard Deployments", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { System.Windows.Forms.DialogResult dialogResult = MessageBox.Show(string.Concat("Marking", this.lbl_name.Text, " as absent will delete this record from the deployment list for this date.sure to proceed?"), "Deploy guards", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { Guard_deployment.delete_guard_marked_as_absent_from_deployment_list_per_date("delete_guard_marked_as_absent_from_deployment_list_per_date", this.lbl_record_guid.Text); return; } if (dialogResult == System.Windows.Forms.DialogResult.No) { base.Visible = true; return; } } }