Exemple #1
0
        private void BtnSave_Click_1(object sender, EventArgs e)
        {
            MemoryStream stream = new MemoryStream();

            pbxAvatar.Image.Save(stream, ImageFormat.Jpeg);
            DialogResult a = MessageBox.Show("Sửa thông tin?", "Thông báo!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (a == DialogResult.OK)
            {
                if (txtHoTen.Text == "" || txtSdt.Text == "" || txtDiaChi.Text == "" || txtSex.Text == "")
                {
                    errorProvider1.SetError(txtHoTen, "Bạn chưa điền đủ thông tin!");
                }
                else
                {
                    db.Editprofile(email, txtHoTen.Text, txtDiaChi.Text, txtSdt.Text, txtSex.Text, stream.ToArray(), dptNgaysinh.Value);
                    dgvThongtin.Refresh();
                    LoadAnh();
                    txtHoTen.Enabled    = false;
                    txtDiaChi.Enabled   = false;
                    txtSdt.Enabled      = false;
                    txtSex.Enabled      = false;
                    dptNgaysinh.Enabled = false;
                    btnEdit.Visible     = true;
                    btnSave.Visible     = false;
                    btnOpenFile.Visible = false;
                }
            }
        }