private void cmdNew_Click(object sender, EventArgs e) { curIndex = grdViewPatient.RowCount; if (SqlDb.IsAllow(AppVariable.CURRENT_SUB_MENU, AppVariable.CURRENT_USER_LEVEL_ID.ToString(), "IsInsert") == true) { curIndex = grdViewPatient.RowCount; frmPatientDetail PatientDetailForm = new frmPatientDetail(); PatientDetailForm.cmdSave.Tag = "Add"; PatientDetailForm.ShowDialog(); BindingPatient(); if (grdViewPatient.RowCount > 0) { drPatient = grdViewPatient.GetDataRow(grdViewPatient.FocusedRowHandle); } } else { MessageBox.Show("Sorry, Administrator is not allow this action?", "MediPro :: Clinic System", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void grdViewPatient_DoubleClick(object sender, EventArgs e) { if (SqlDb.IsAllow(AppVariable.CURRENT_SUB_MENU, AppVariable.CURRENT_USER_LEVEL_ID.ToString(), "IsEdit") == true) { curIndex = grdViewPatient.GetDataSourceRowIndex(grdViewPatient.FocusedRowHandle); frmPatientDetail PatientDetailForm = new frmPatientDetail(); PatientDetailForm.cmdSave.Tag = "Edit"; PatientDetailForm.dteRegDate.Properties.ReadOnly = true; DateTime regDate = DateTime.Parse(drPatient.ItemArray[9].ToString()); PatientDetailForm.dteRegDate.EditValue = regDate.ToShortDateString(); PatientDetailForm.txtRegNo.Text = drPatient.ItemArray[0].ToString(); PatientDetailForm.txtName.Text = drPatient.ItemArray[10].ToString(); PatientDetailForm.cboTitle.Tag = drPatient.ItemArray[11].ToString(); PatientDetailForm.txtFatherName.Text = drPatient.ItemArray[4].ToString(); PatientDetailForm.txtNRC.Text = drPatient.ItemArray[2].ToString(); PatientDetailForm.txtContactNo.Text = drPatient.ItemArray[7].ToString(); //PatientDetailForm.txtAge.Text = Helper.CalAge(DateTime.Parse(drPatient.ItemArray[5].ToString())); DateTime dobDate = DateTime.Parse(drPatient.ItemArray[5].ToString()); PatientDetailForm.dteDOB.EditValue = dobDate.ToShortDateString(); PatientDetailForm.cboGender.Text = drPatient.ItemArray[3].ToString(); PatientDetailForm.txtEmail.Text = drPatient.ItemArray[8].ToString(); PatientDetailForm.txtAddress.Text = drPatient.ItemArray[7].ToString(); PatientDetailForm.ShowDialog(); sysLogs.logsDetail(int.Parse(AppVariable.CURRENT_SUB_MENU.ToString()), "Edit Patient Info."); BindingPatient(); if (grdViewPatient.RowCount > 0) { drPatient = grdViewPatient.GetDataRow(grdViewPatient.FocusedRowHandle); } } else { MessageBox.Show("Sorry, Administrator is not allow this action?", "MediPro :: Clinic System", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }