protected void btn_search_Click( object sender, EventArgs e )
        {
            try
            {
                //defaultstatus();
                string input = this.txtbox_search.Text.ToString();
                BusinessTier.Admin admin = new BusinessTier.Admin();
                Data.DataBase.patientsDataTable table =  new Data.DataBase.patientsDataTable();

                if ( input.Length > 0 )
                {
                    table = admin.SearchPatientByID(input);
                    if ( table.Rows.Count > 0 )
                    {
                        this.gv_patientview.DataSource = table;
                        this.gv_patientview.DataBind();
                    }
                    else
                    {
                        this.lbl_searchwarning.Text = "Invalid ID, Please confirm the IDs before search...";
                        this.lbl_searchwarning.BackColor = System.Drawing.Color.Red;
                    }
                }
                else
                {
                    table = admin.SelectAllPatients();
                    this.gv_patientview.DataSource = table;
                    this.gv_patientview.DataBind();
                }
            }
            catch ( Exception ex )
            {
                this.lbl_searchwarning.Text = ex.Message;
            }
        }
 protected void btn_mypatients_Click( object sender, EventArgs e )
 {
     string pid = this.txtbox_seach.Text.Trim().ToString().ToUpper();
     Data.DataBase.patientsDataTable table = new Data.DataBase.patientsDataTable();
     BusinessTier.CareTakerOperation caretaker = new BusinessTier.CareTakerOperation();
     if ( pid != null )
     {
         if ( pid.Length > 0 )
         {
             table = caretaker.SearchPatientByID(pid);
             if ( table.Rows.Count > 0 )
             {
                 this.gv_mypatient.DataSource = table;
                 this.gv_mypatient.DataBind();
             }
             else
             {
                 this.lbl_search.Text = "No such patient, please check patient id";
                 this.lbl_search.BackColor = System.Drawing.Color.Red;
             }
         }
         else
         {
             table = caretaker.SelectMyPatientViaID("C0001");
             this.gv_mypatient.DataSource = table;
             this.gv_mypatient.DataBind();
         }
     }
 }
        protected void btn_addpatient_Click( object sender, EventArgs e )
        {
            //defaultstatus();
            string pid = this.txtbox_patientid.Text;
            string name = this.txtbox_name.Text;
            string gender = this.txtbox_gender.Text;
            string tempdate = this.txtbox_birthday.Text;
            string tempage = this.txtbox_age.Text;
            string medical = this.txtbox_medical.Text;

            if ( pid.Length > 0 && name.Length > 0 && gender.Length > 0 && tempdate.Length > 0 && tempage.Length > 0 && medical.Length > 0 )
            {
                BusinessTier.Admin admin = new BusinessTier.Admin();
                Data.DataBase.patientsDataTable table = new Data.DataBase.patientsDataTable();
                table = admin.SearchPatientByID(pid);
                if ( table.Rows.Count > 0 )
                {
                    this.lbl_idwarning.Text = "This ID is already exsit";
                    this.lbl_idwarning.BackColor = System.Drawing.Color.Red;
                }
                else
                {
                    try
                    {
                        int age = int.Parse(tempage);
                        DateTime date = DateTime.Parse(tempdate);
                        admin.AddPatient(pid, name, gender, date.Date, age, medical);
                    }
                    catch ( Exception ex )
                    {
                        this.lbl_agewarning.Text = ex.Message.ToString();
                        this.lbl_birthdaywarning.Text = ex.Message.ToString();
                    }
                }
            }
            else
            {
                errorWarning();
            }
        }