public ActionResult VerifyAppointment(VerifyAppointmentModel VAM) { DAL obj = new DAL(); VerifyAppointment va = new VerifyAppointment(); va.CaseId = (int)Session["cid"]; va.Status = VAM.status; bool res = obj.UpdateAppiontmentStatus(va); if (res == true) { ViewBag.msg = "Succeed....."; } else { ViewBag.msg = "Failed......"; } return(View(VAM)); }
private void sbtnAppointmentVerifiedBy_Click(object sender, System.EventArgs e) { VerifyAppointment verifyForm = new VerifyAppointment(); DialogResult result = verifyForm.ShowDialog(this); bool allValid = true; bool allNoTick = true; if (result == DialogResult.OK) { try { for (int i = 0; i < this.gvAppointment.RowCount; i++) { int rowHandle = gvAppointment.GetVisibleRowHandle(i); DataRow row = gvAppointment.GetDataRow(rowHandle); if (gvAppointment.IsDataRow(rowHandle)) { if (gvAppointment.GetRowCellValue(rowHandle, "UtlCheck").ToString().ToUpper() == "TRUE") { allNoTick = false; if (!VerifyAppointment(Convert.ToInt32(gvAppointment.GetRowCellValue(rowHandle, "nAppointmentId").ToString()),gvAppointment.GetRowCellValue(rowHandle, "strContactName").ToString(),gvAppointment.GetRowCellValue(rowHandle, "strServedBy").ToString(),gvAppointment.GetRowCellValue(rowHandle, "strVerifiedBy").ToString(),Convert.ToInt32(gvAppointment.GetRowCellValue(rowHandle, "nContactId").ToString()),Convert.ToInt32(gvAppointment.GetRowCellValue(rowHandle, "nStaffAssign").ToString()))) { allValid = false; break; } } } } if (allNoTick) { MessageBox.Show(this, "Please tick at least one appointment to verify"); return; } if (allValid) { DialogResult yes = MessageBox.Show(this, "Confirm to verify?", "Warning", MessageBoxButtons.YesNo); if (yes == DialogResult.Yes) { DialogResult closeYes = MessageBox.Show(this, "Do you want to update these appointments status to Close?\n Lead will be removed from the Contact List as well.", "", MessageBoxButtons.YesNo); for (int i = 0; i < this.gvAppointment.RowCount; i++) { int rowHandle = gvAppointment.GetVisibleRowHandle(i); DataRow row = gvAppointment.GetDataRow(rowHandle); if (gvAppointment.IsDataRow(rowHandle)) { if (gvAppointment.GetRowCellValue(rowHandle, "UtlCheck").ToString().ToUpper() == "TRUE") { myAppointment.VerifyAppointment(verifyForm.VerifierID, verifyForm.Password, Convert.ToInt32(gvAppointment.GetRowCellValue(rowHandle, "nAppointmentId").ToString())); if (closeYes == DialogResult.Yes) myAppointment.CloseAppointment(Convert.ToInt32(gvAppointment.GetRowCellValue(rowHandle, "nAppointmentId").ToString())); } } } ListAppointment(); MessageBox.Show(this, "Appointment has been verified."); } } } catch (Exception ex) { MessageBox.Show(this, ex.Message); } } }