示例#1
0
        private void btnCheckAppID_Click(object sender, EventArgs e)
        {
            if (txtAppID.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Appointment ID !", "Confirmation",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtAppID.Focus();
                return;
            }

            if (Appointment.isExists(txtAppID.Text.Trim()) == "canceled")//Appointment already canceled
            {
                MessageBox.Show("Appointment already canceled !", "Confirmation",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtAppID.Focus();
                return;
            }
            if (Appointment.isExists(txtAppID.Text.Trim()) == "non")// Appointment not found
            {
                MessageBox.Show("Appointment not found !!!\nPlease re-check your Appointment ID", "Confirmation",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtAppID.Focus();
                return;
            }

            Appointment aAppointment = new Appointment();

            aAppointment.getAppointmentDetails(txtAppID.Text.Trim());

            Centre aCentre = new Centre();

            aCentre.getCentreDetails(aAppointment.getCentreID());
            txtCounty.Text     = aCentre.getCounty();
            txtCentreName.Text = aCentre.getCentreName();

            dtpAppDate.Text = aAppointment.getAppDate();
            txtTime.Text    = aAppointment.getAppTime();
            txtRegNo.Text   = aAppointment.getRegNo();

            grbAppDetails.Visible = true;
            btnCheckAppID.Visible = false;
            btnNext.Focus();
            btnClear.Visible = true;
        }
        private void grdCentre_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row = this.grdCentre.Rows[e.RowIndex];

            int    centre_id = Convert.ToInt32(row.Cells[0].Value);
            Centre aCentre   = new Centre();

            aCentre.getCentreDetails(Convert.ToInt32(grdCentre.Rows[grdCentre.CurrentCell.RowIndex].Cells[0].Value));

            txtCentreId.Text = aCentre.getCentreID().ToString();
            txtName.Text     = aCentre.getCentreName().ToString();
            txtAdd1.Text     = aCentre.getAdd1().ToString();
            txtAdd2.Text     = aCentre.getAdd2().ToString();
            txtTelNo.Text    = aCentre.getTelNo().ToString();
            txtEmail.Text    = aCentre.getEmail().ToString();
            txtCounty.Text   = aCentre.getCounty().ToString();

            grbCentreDetails.Visible = true;
            btnDeRegCentre.Visible   = true;
        }