private void btnRemove_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.Remove(std); this.Close(); } catch (System.Data.SqlClient.SqlException ex) { MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void _Load(int ID) { try { StudenAccess acs = new StudenAccess(); student std = acs.getStudent(ID); txtID.Text = std.C01_id.ToString().Trim(); txtFirstName.Text = std.C02_firtsname.ToString().Trim(); txtLastName.Text = std.C03_lastname.ToString().Trim(); timeBirthday.Text = std.C04_birthday.ToString().Trim(); if (std.C05_gender == true) { radMale.Checked = true; } else { radFemale.Checked = true; } txtPhone.Text = std.C06_phonenumber.ToString().Trim(); txtAddress.Text = std.C07_address.ToString().Trim(); picAvatar.Image = AllUser.BinaryToImage(std.C08_avatar.ToArray()); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK); } }
private void _Load(int ID) { StudenAccess acs = new StudenAccess(); student std = acs.getStuden(ID); txtID.Text = std.C01_id.ToString().Trim(); txtFirstName.Text = std.C02_firtsname.ToString().Trim(); txtLastName.Text = std.C03_lastname.ToString().Trim(); timeBirthday.Text = std.C04_birthday.ToString().Trim(); if (std.C05_gender == true) { radMale.Checked = true; } else { radFemale.Checked = true; } txtPhone.Text = std.C06_phonenumber.ToString().Trim(); txtAddress.Text = std.C07_address.ToString().Trim(); //picAvatar.Image = AllUser.BinaryToImage(new byte[std.C08_avatar.Length]); }
private void _Load() { StudenAccess std = new StudenAccess(); dgvShoStudent.DataSource = std.getStudents(); }