private void cmdNew_Click(object sender, EventArgs e) { curIndex = grdViewDoctor.RowCount; if (SqlDb.IsAllow(AppVariable.CURRENT_SUB_MENU, AppVariable.CURRENT_USER_LEVEL_ID.ToString(), "IsInsert") == true) { frmDoctorDetail DoctorDetailForm = new frmDoctorDetail(); DoctorDetailForm.txtName.Text = string.Empty; DoctorDetailForm.txtName.Tag = string.Empty; DoctorDetailForm.cmdSave.Tag = "Add"; DoctorDetailForm.ShowDialog(); BindingDoctor(); getCurDataRow(); } else { MessageBox.Show("Sorry, Administrator is not allow this action?", "MediPro :: Clinic System", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Edit() { if (SqlDb.IsAllow(AppVariable.CURRENT_SUB_MENU, AppVariable.CURRENT_USER_LEVEL_ID.ToString(), "IsEdit") == true) { curIndex = grdViewDoctor.GetDataSourceRowIndex(grdViewDoctor.FocusedRowHandle); frmDoctorDetail DoctorDetailForm = new frmDoctorDetail(); DoctorDetailForm.cmdSave.Tag = "Edit"; DoctorDetailForm.txtName.Tag = drDoctor.ItemArray[0].ToString(); DoctorDetailForm.txtName.Text = drDoctor.ItemArray[11].ToString(); DoctorDetailForm.cboTitle.Tag = drDoctor.ItemArray[12].ToString(); DoctorDetailForm.cboGender.Text = drDoctor.ItemArray[4].ToString(); DoctorDetailForm.cboSpecialize.Tag = drDoctor.ItemArray[13].ToString(); DoctorDetailForm.cboPosition.Tag = drDoctor.ItemArray[14].ToString(); DoctorDetailForm.txtSAMA.Text = drDoctor.ItemArray[5].ToString(); DoctorDetailForm.txtHomePhone.Text = drDoctor.ItemArray[7].ToString(); DoctorDetailForm.txtMobilePhone.Text = drDoctor.ItemArray[8].ToString(); DoctorDetailForm.chkIsActive.EditValue = bool.Parse(drDoctor.ItemArray[10].ToString()); DoctorDetailForm.txtEmail.Text = drDoctor.ItemArray[9].ToString(); DoctorDetailForm.txtAddress.Text = drDoctor.ItemArray[6].ToString(); DoctorDetailForm.ShowDialog(); sysLogs.logsDetail(int.Parse(AppVariable.CURRENT_SUB_MENU.ToString()), "Edit Doctor Info."); BindingDoctor(); getCurDataRow(); } else { MessageBox.Show("Sorry, Administrator is not allow this action?", "MediPro :: Clinic System", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }