예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            StudenAccess stdac = new StudenAccess();

            try
            {
                student std = new student
                {
                    C01_id          = int.Parse(txtID.Text),
                    C02_firtsname   = txtFirstName.Text,
                    C03_lastname    = txtLastName.Text,
                    C04_birthday    = timeBirthday.Value,
                    C05_gender      = radMale.Checked,
                    C06_phonenumber = txtPhone.Text,
                    C07_address     = txtAddress.Text,
                    C08_avatar      = new Binary(AllUser.ImageToBinary(picAvatar.Image))
                };
                stdac.Add(std);
                MessageBox.Show("Done");
                this.txtID.Text         = "";
                this.txtFirstName.Text  = "";
                this.txtLastName.Text   = "";
                this.timeBirthday.Value = DateTime.Today;
                this.radMale.Checked    = true;
                this.txtPhone.Text      = "";
                this.txtAddress.Text    = "";
                this.picAvatar.Image    = null;
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #2
0
 private void _LoadBack_()
 {
     std.C01_ID        = int.Parse(txt_id.Text);
     std.C02_FirstName = txt_firstname.Text;
     std.C03_LastName  = txt_lastname.Text;
     std.C04_Birthday  = date_birthday.Value;
     std.C05_Male      = rad_male.Checked;
     std.C06_Phone     = txt_phone.Text;
     std.C07_Address   = txt_address.Text;
     std.C08_Avatar    = AllUser.ImageToBinary(btn_avatar.BackgroundImage);
 }
예제 #3
0
 private void btn_add_Click(object sender, EventArgs e)
 {
     try
     {
         Students std = new Students
         {
             C01_ID        = int.Parse(txt_id.Text),
             C02_FirstName = txt_firstname.Text,
             C03_LastName  = txt_lastname.Text,
             C04_Birthday  = date_birthday.Value,
             C05_Male      = rad_male.Checked,
             C06_Phone     = txt_phone.Text,
             C07_Address   = txt_address.Text,
             C08_Avatar    = AllUser.ImageToBinary(btn_avatar.BackgroundImage)
         };
         mySTD.Add(std);
         MessageBox.Show("Done");
         _Close();
     }
     catch (System.Data.SqlClient.SqlException ex)
     {
         MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }