Example #1
0
 private void btnInvClick_Click(object sender, EventArgs e)
 {
     try
     {
         if (objCD.getRecordFromID(Convert.ToInt32(txtAppID.Text)).Rows[0]["status"].ToString() == "2")
         {
             ShowStatus(0, "Not allowed! Appointment Completed.");
         }
         else
         {
             if (ValidateChildren(ValidationConstraints.Enabled))
             {
                 int rtn = -1;
                 if (txtAppInvId.Text.Trim() == "") //add data
                 {
                     rtn = objCD.addInvestigations(Convert.ToInt32(txtPatientID.Text), Convert.ToInt32(txtDoctorID.Text), Convert.ToInt32(txtAppID.Text), Convert.ToInt32(cmbInvestigation.SelectedValue.ToString()), txtInvNotes.Text.Trim(), Convert.ToDecimal(txtInvFee.Text), Convert.ToInt32(cmbInvStatus.SelectedValue.ToString()));
                     if (rtn == -1)
                     {
                         ShowStatus(0, "Some error occurred... Record cannot be added!");
                     }
                     else if (rtn == 0)
                     {
                         ShowStatus(0, "Record already exists!");
                     }
                     else if (rtn == 1)
                     {
                         ShowStatus(1, "Record succesfully added!");
                         clearFormInvFields();
                         getInvestigationList();
                     }
                 }
                 else //edit record
                 {
                     rtn = objCD.editInvestigations(Convert.ToInt32(txtAppInvId.Text.Trim()), Convert.ToInt32(txtPatientID.Text), Convert.ToInt32(txtDoctorID.Text), Convert.ToInt32(txtAppID.Text), Convert.ToInt32(cmbInvestigation.SelectedValue.ToString()), txtInvNotes.Text.Trim(), Convert.ToDecimal(txtInvFee.Text), Convert.ToInt32(cmbInvStatus.SelectedValue.ToString()));
                     if (rtn == 0)
                     {
                         ShowStatus(0, "This name already exists. Please provide unique name!");
                     }
                     else if (rtn == 1)
                     {
                         ShowStatus(1, "Record succesfully updated!");
                         clearFormInvFields();
                         getInvestigationList();
                     }
                     else if (rtn == -1)
                     {
                         ShowStatus(0, "Some error occurred... Record cannot be added!");
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         CommonLogger.Info(ex.ToString());
     }
 }