private void btnXoa_Click(object sender, EventArgs e) { DialogResult dlrTraloi; dlrTraloi = MessageBox.Show("Bạn chắc chắn muốn xóa ?" + lbTenTG.Text, "Trả Lời", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dlrTraloi == DialogResult.OK) { if (ws.Xoa(id) > 0) { MessageBox.Show("Xóa thành công!"); DataTable s = ws.LayDanhSach(); dgvDSTG.DataSource = s; labelTen.Visible = false; txtTenTG.Visible = false; btnLuu.Enabled = false; lbTenTG.Visible = true; txtTenTG.Text = lbTenTG.Text = dgvDSTG.CurrentRow.Cells["clmTenTG"].Value.ToString(); txtSLTindo.Text = dgvDSTG.CurrentRow.Cells["clmSLTinDo"].Value.ToString(); rtbGioiThieu.Text = dgvDSTG.CurrentRow.Cells["clmGioiThieu"].Value.ToString(); hinhanh = dgvDSTG.CurrentRow.Cells["clmHinhAnh"].Value.ToString(); id = dgvDSTG.CurrentRow.Cells["clmID"].Value.ToString(); if (hinhanh != "") { FilesTransfer.FilesTransferSoapClient WSFile = new FilesTransfer.FilesTransferSoapClient(); System.IO.FileStream fs1 = null; byte[] b1 = null; b1 = WSFile.DownloadFile(hinhanh); fs1 = new FileStream(@"..\\..\\hinh_anh\\tongiao\\" + id + ".xml", FileMode.Create); fs1.Write(b1, 0, b1.Length); fs1.Close(); fs1 = null; pictureBox1.Image = Image.FromFile(@"..\\..\\hinh_anh\\tongiao\\" + id.ToString() + ".xml"); } } } else { MessageBox.Show("xóa không thành công!"); } }
public FormUser(string id, bool ad) { InitializeComponent(); _id = id; _ad = ad; DataTable dt = ws.GetInfo(id); txtHoTen.Text = dt.Rows[0]["HoTen"].ToString(); txtEmail.Text = dt.Rows[0]["Email"].ToString(); txtTenDangNhap.Text = dt.Rows[0]["UserName"].ToString(); dateEdit1.Text = dt.Rows[0]["Ngaysinh"].ToString(); _mk = dt.Rows[0]["PassWord"].ToString(); _quyen = dt.Rows[0]["PhanQuyen"].ToString(); btnXong.Visible = false; if (ad) { comboBox1.Enabled = true; } comboBox1.Text = comboBox1.Items[int.Parse(dt.Rows[0]["PhanQuyen"].ToString()) - 1].ToString(); lbTittle.Text = "Thông tin tài khoản"; string hinhanh = dt.Rows[0]["HinhAnh"].ToString(); if (hinhanh != "") { System.IO.FileStream fs1 = null; byte[] b1 = null; string name = hinhanh.Substring(hinhanh.LastIndexOf("/") + 1); if (File.Exists(@"..\..\hinh_anh\user\" + name + ".xml")) { } else { b1 = WSFile.DownloadFile(hinhanh); fs1 = new FileStream(@"..\..\hinh_anh\user\" + name + ".xml", FileMode.Create); fs1.Write(b1, 0, b1.Length); fs1.Close(); fs1 = null; } pictureBox1.Image = Image.FromFile(@"..\..\hinh_anh\user\" + name + ".xml"); } }
private void dgvDSTG_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex >= 0) { pictureBox1.Image = null; txtTenTG.Text = lbTenTG.Text = dgvDSTG.CurrentRow.Cells["clmTenTG"].Value.ToString(); XacDinhTinDoTheoTungTonGiao(txtTenTG.Text); txtSLTindo.Text = dgvDSTG.CurrentRow.Cells["clmSLTinDo"].Value.ToString(); rtbGioiThieu.Text = dgvDSTG.CurrentRow.Cells["clmGioiThieu"].Value.ToString(); hinhanh = dgvDSTG.CurrentRow.Cells["clmHinhAnh"].Value.ToString(); id = dgvDSTG.CurrentRow.Cells["clmID"].Value.ToString(); if (hinhanh != "") { FilesTransfer.FilesTransferSoapClient WSFile = new FilesTransfer.FilesTransferSoapClient(); System.IO.FileStream fs1 = null; byte[] b1 = null; string name = hinhanh.Substring(hinhanh.LastIndexOf("/") + 1); if (File.Exists(@"..\..\hinh_anh\tongiao\" + name + ".xml")) { } else { b1 = WSFile.DownloadFile(hinhanh); fs1 = new FileStream(@"..\..\hinh_anh\tongiao\" + name + ".xml", FileMode.Create); fs1.Write(b1, 0, b1.Length); fs1.Close(); fs1 = null; } pictureBox1.Image = Image.FromFile(@"..\..\hinh_anh\tongiao\" + name + ".xml"); } btnSua.Enabled = true; btnXoa.Enabled = true; btnLuu.Enabled = false; btnThemChucSac.Visible = true; btnThemToChuc.Visible = true; dgvChucSac.DataSource = ws.GetTable("select tenchucsac,gioithieu from tblChucSac where daxoa=0 and idtongiao=" + id, "tblChucSac"); dgvToChuc.DataSource = ws.GetTable("select tentochuc,gioithieu from tblTochucquantri where daxoa=0 and idtongiao=" + id, "tblToChucQuanTri"); // panelHinhAnh.BackgroundImage = global::service_quan_ly_ton_giao.Properties.Resources.user_login_icon; } }