Пример #1
0
        private void btnPatientRegistrationUpdate_Click(object sender, EventArgs e)
        {
            string         doctorid3        = txtScheduleAppointmentDoctorID.Text;
            string         appointmentdate3 = txtScheduleAppointmentAppointmentDate.SelectionRange.Start.ToString("dd MMM yyyy");
            AppointmentDBO adbo3            = new AppointmentDBO();
            Appointment    appointment3     = adbo3.findCount(doctorid3, appointmentdate3);
            string         temp             = "";

            try
            {
                temp = appointment3.getCount().ToString();
            }
            catch (Exception ex2)
            {
            }

            if (temp == "8")
            {
                MessageBox.Show("Total Appointment Count Reached 8", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                AppointmentDBO adbo               = new AppointmentDBO();
                string         channelno          = txtScheduleAppointmentChannelNo.Text;
                string         patientid          = txtScheduleAppointmentPatientID.Text;
                string         treatmenttype      = txtScheduleAppointmentTreatmentType.Text;
                string         problemdescription = txtScheduleAppointmentProblemDescription.Text;
                string         doctorid           = txtScheduleAppointmentDoctorID.Text;
                string         appointmentdate    = txtScheduleAppointmentAppointmentDate.SelectionRange.Start.ToString("dd MMM yyyy");
                int            count              = 1; //int.Parse(txtScheduleAppointmentTreatmentType.Text.Trim());

                Appointment appointment = new Appointment(channelno, patientid, treatmenttype, problemdescription, doctorid, appointmentdate, count);
                adbo.updateAppointmentInfo(appointment);
                MessageBox.Show("Changes made to the scheduled appointment has been updated.", "Edit Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #2
0
        private void btnPatientRegistrationSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtScheduleAppointmentDoctorID.Text))
            {
                MessageBox.Show("A doctor ID should be entered.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (string.IsNullOrWhiteSpace(txtScheduleAppointmentPatientID.Text))
            {
                MessageBox.Show("A patient ID should be entered.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (string.IsNullOrWhiteSpace(txtScheduleAppointmentChannelNo.Text))
            {
                MessageBox.Show("A treatment No should be provided.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                string         doctorid3        = txtScheduleAppointmentDoctorID.Text;
                string         appointmentdate3 = txtScheduleAppointmentAppointmentDate.SelectionRange.Start.ToString("dd MMM yyyy");
                AppointmentDBO adbo3            = new AppointmentDBO();
                Appointment    appointment3     = adbo3.findCount(doctorid3, appointmentdate3);
                string         temp             = "";
                try
                {
                    temp = appointment3.getCount().ToString();
                }
                catch (Exception ex2)
                {
                }

                if (temp == "8")
                {
                    MessageBox.Show("Total Appointment Count Reached 8", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    try
                    {
                        AppointmentDBO adbo               = new AppointmentDBO();
                        string         channelno          = txtScheduleAppointmentChannelNo.Text;
                        string         patientid          = txtScheduleAppointmentPatientID.Text;
                        string         treatmenttype      = txtScheduleAppointmentTreatmentType.Text;
                        string         problemdescription = txtScheduleAppointmentProblemDescription.Text;
                        string         doctorid           = txtScheduleAppointmentDoctorID.Text;
                        string         appointmentdate    = txtScheduleAppointmentAppointmentDate.SelectionRange.Start.ToString("dd MMM yyyy");
                        int            count              = 1;

                        Appointment appointment1 = new Appointment(channelno, patientid, treatmenttype, problemdescription, doctorid, appointmentdate, count);
                        adbo.appointmentInfo(appointment1);
                        MessageBox.Show("New appointment has been scheduled successfully.", "Save Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);


                        AppointmentDBO bdbo         = new AppointmentDBO();
                        Appointment    appointment2 = bdbo.findAppointment(patientid, appointmentdate);
                        string         counter      = (appointment2.getCount() + 1).ToString();
                        int            result       = Int32.Parse(counter);

                        this.appointmentGridViewTableAdapter.Fill(this.dataSet2.AppointmentGridView);
                    }

                    catch (Exception ex2)
                    {
                        MessageBox.Show("This Treatment No has already been issued.", "Duplicate Entry", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }