예제 #1
0
        private void dgvInv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                switch (dgvInv.Columns[e.ColumnIndex].Name)
                {
                case "btnInvEdit":
                    if (objCD.getRecordFromID(Convert.ToInt32(txtAppID.Text)).Rows[0]["status"].ToString() == "2")
                    {
                        ShowStatus(0, "Not allowed! Appointment Completed.");
                    }
                    else
                    {
                        txtAppInvId.Text = dgvInv.Rows[e.RowIndex].Cells["inv_id"].Value.ToString();
                        DataTable dt = objCD.getInvestigationsFromInvID(Convert.ToInt32(txtAppInvId.Text));
                        txtInvFee.Text = dt.Rows[0]["fee"].ToString();
                        cmbInvestigation.SelectedValue = dt.Rows[0]["investigation_id"].ToString();
                        cmbInvStatus.SelectedValue     = dt.Rows[0]["status"].ToString();
                        txtInvNotes.Text = dt.Rows[0]["notes"].ToString();
                    }
                    break;

                case "btnInvDelete":
                    if (objCD.getRecordFromID(Convert.ToInt32(txtAppID.Text)).Rows[0]["status"].ToString() == "2")
                    {
                        ShowStatus(0, "Not allowed! Appointment Completed.");
                    }
                    else
                    {
                        DeletePatientInvestigation(Int32.Parse(dgvInv.Rows[e.RowIndex].Cells["inv_id"].Value.ToString()));
                        getInvestigationList();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                CommonLogger.Info("frmConsultationDetails\r\n" + ex.ToString());
            }
        }