Esempio n. 1
0
 private void btnSaveProcedure_Click(object sender, EventArgs e)
 {
     try
     {
         // For completed appointments, save functionality is disabled
         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 (txtApptProcID.Text.Trim() == "") //add data
                 {
                     rtn = objCD.addProcedures(Convert.ToInt32(txtPatientID.Text), Convert.ToInt32(txtDoctorID.Text), Convert.ToInt32(txtAppID.Text), Convert.ToInt32(cmbProcedure.SelectedValue.ToString()), txtProcNotes.Text.Trim(), Convert.ToDecimal(txtFee.Text), Convert.ToInt32(cmbStatus.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!");
                         clearFormFields();
                         getProcedureList();
                     }
                 }
                 else //edit record
                 {
                     rtn = objCD.editProcedures(Convert.ToInt32(txtApptProcID.Text.Trim()), Convert.ToInt32(txtPatientID.Text), Convert.ToInt32(txtDoctorID.Text), Convert.ToInt32(txtAppID.Text), Convert.ToInt32(cmbProcedure.SelectedValue.ToString()), txtProcNotes.Text.Trim(), Convert.ToDecimal(txtFee.Text), Convert.ToInt32(cmbStatus.SelectedValue.ToString()));
                     if (rtn == 0)
                     {
                         ShowStatus(0, "This name already exists. Please provide unique name!");
                     }
                     else if (rtn == 1)
                     {
                         ShowStatus(1, "Record succesfully updated!");
                         clearFormFields();
                         getProcedureList();
                     }
                     else if (rtn == -1)
                     {
                         ShowStatus(0, "Some error occurred... Record cannot be added!");
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         CommonLogger.Info(ex.ToString());
     }
 }