コード例 #1
0
 protected void btn_search_Click( object sender, EventArgs e )
 {
     //defaultstatus();
     string input = this.txtbox_search.Text.ToString();
     BusinessTier.Admin admin = new BusinessTier.Admin();
     Data.DataBase.doctorsDataTable table = new Data.DataBase.doctorsDataTable();
     if ( input.Length > 0 )
     {
         table = admin.SearchDoctorByID(input);
         if ( table.Rows.Count > 0 )
         {
             this.gv_doctorview.DataSource = table;
             this.gv_doctorview.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.SelectAllDoctors();
         this.gv_doctorview.DataSource = table;
         this.gv_doctorview.DataBind();
     }
 }
コード例 #2
0
        protected void btn_update_Click( object sender, EventArgs e )
        {
            //defaultstatus();
            string did = this.txtbox_did.Text;
            string name = this.txtbox_name.Text;
            string gender = this.txtbox_gender.Text;
            string tempage = this.txtbox_age.Text;

            if ( did.Length > 0 && name.Length > 0 && gender.Length > 0 && tempage.ToString().Length > 0 )
            {
                Data.DataBase.doctorsDataTable table = new Data.DataBase.doctorsDataTable();
                BusinessTier.Admin admin = new BusinessTier.Admin();
                table = admin.SearchDoctorByID(did);
                if ( table.Rows.Count > 0 )
                {
                    int age = int.Parse(tempage);
                    admin.UpdateDoctorByID(name, gender, age, did);
                }
                else
                {
                    this.lbl_idwarning.Text = "This ID is not exsit";
                    this.lbl_idwarning.BackColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                errorWarning();
            }
        }
コード例 #3
0
        protected void btn_adddoctor_Click( object sender, EventArgs e )
        {
            //defaultstatus();
            string did = this.txtbox_did.Text;
            string name = this.txtbox_name.Text;
            string gender = this.txtbox_gender.Text;
            string tempage = this.txtbox_age.Text;
            //int age = int.Parse(this.txtbox_age.Text);

            if ( did.Length > 0 && name.Length > 0 && gender.Length > 0 && tempage.Length > 0 )
            {
                BusinessTier.Admin admin = new BusinessTier.Admin();
                Data.DataBase.doctorsDataTable table = new Data.DataBase.doctorsDataTable();
                table = admin.SearchDoctorByID(did);
                if ( table.Rows.Count > 0 )
                {
                    this.lbl_idwarning.Text = "This ID is already exsit";
                    this.lbl_idwarning.BackColor = System.Drawing.Color.Red;
                }
                else
                {
                    int age = int.Parse(tempage);
                    admin.AddDoctor(did, name, gender, age);
                    this.gv_doctorview.DataSource = admin.SelectAllDoctors();
                    this.gv_doctorview.DataBind();
                }
            }
            else
            {
                errorWarning();
            }
        }