protected void txtQueQuanHuyen_SelectedIndexChanged(object sender, EventArgs e) { ServiceCanBo es = new ServiceCanBo(); int t = Convert.ToInt32(txtQueQuanHuyen.SelectedItem.Value); txtQueQuanXa.DataSource = es.LoadXa("TheBinh", "12345678", t); txtQueQuanXa.DataBind(); txtQueQuanXa.DataTextField = "NAME"; txtQueQuanXa.DataValueField = "ID"; txtQueQuanXa.DataBind(); }
private void PopulateRequiredData() { ServiceCanBo es = new ServiceCanBo(); try { var id = Common.TryParseObjectToInt(Request.QueryString["ID"] + ""); var item = es.GetThongTin1CanBo("TheBinh", "12345678", id); BindCombobox(es, item); if (id != 0) { Button1.Text = "Lưu Thông Tin Cán Bộ"; Button2.Visible = false; txtNgayVaoDang.Text = item.NgayVaoDang; txtChiBoKetNap.Text = item.ChiBoKetNap; txtNguoiGioiThieu1.Text = item.NguoiGioiThieu1; txtChucVuNguoiGioiThieu1.Text = item.ChucVuNguoiGioiThieu1; txtNgheNghiepKhiVaoDang.Text = item.NgheNghiepKhiVaoDang; txtNguoiGioiThieu2.Text = item.NguoiGioiThieu2; txtGhiChuVeNguoiGioiThieu2.Text = item.GhiChuVeNguoiGioiThieu2; txtNgayChinhThucVaoDang.Text = item.NgayChinhThucVaoDang; txtSoLyLichDangVien.Text = item.SoLyLichDangVien; txtSoTheDangVien.Text = item.SoTheDangVien; txtMaCoSoDangQLDangVien.Text = item.MaCoSoDangQLDangVien; txtChucVuTrongDang.Text = item.ChucVuTrongDang; imgAnhDaiDien.ImageUrl = item.Image; txtHoTenKhaiSinh.Text = item.HoTenKhaiSinh; txtTenGoiKhac.Text = item.TenGoiKhac; txtNgaySinh.Text = item.NgaySinh; txtHoKhauThuongTru.Text = item.HoKhauThuongTru; txtNoiSinh.Text = item.NoiSinh; txtQueQuanTinh.Text = item.QueQuanTinh; txtQueQuanHuyen.Text = item.QueQuanHuyen; txtQueQuanXa.Text = item.QueQuanXa; txtNoiOHienNay.Text = item.NoiOHienNay; txtTinhTrangHonNhan.Text = item.TinhTrangHonNhan; txtSoCMND.Text = item.SoCMND; txtNgayCapCMND.Text = item.NgayCapCMND; txtNoiCapCMND.Text = item.NoiCapCMND; txtEmail.Text = item.Email; txtSDT.Text = item.SDT; txtNgayTuyenDung.Text = item.NgayTuyenDung; txtTenCoQuanTuyenDung.Text = item.TenCoQuanTuyenDung; txtNgayVaoCoQuanHienTai.Text = item.NgayVaoCoQuanHienTai; txtNgayNhapNgu.Text = item.NgayNhapNgu; txtNgayXuatNgu.Text = item.NgayXuatNgu; txtTrinhDoChuyenMonCaoNhat.Text = item.TrinhDoChuyenMonCaoNhat; txtChuyenNganh.Text = item.ChuyenNganh; txtTrinhDoTinHoc.Text = item.TrinhDoTinHoc; txtTrinhDoNgoaiNguThuNhat.Text = item.TrinhDoNgoaiNguThuNhat; txtNgoaiNguThuNhat.Text = item.NgoaiNguThuNhat; txtTrinhDoNgoaiNguThuHai.Text = item.TrinhDoNgoaiNguThuHai; txtNgoaiNguThuHai.Text = item.NgoaiNguThuHai; txtKhenThuong.Text = item.KhenThuong; txtKyLuat.Text = item.KyLuat; txtSoHieuCB.Text = item.SoHieuCB; txtDoiTuong.Text = item.DoiTuong; txtHuongLuong.Text = item.HuongLuong; txtDonViQuanLy.Text = item.DonViQuanLy; txtDonViCongTac.Text = item.DonViCongTac; txtMaNgachCongChuc.Text = item.MaNgachCongChuc; txtNgayHuong.Text = item.NgayHuong; txtBacLuong.Text = item.BacLuong + ""; txtHeSoLuong.Text = item.HeSoLuong + ""; txtChucVuHienTai.Text = item.ChucVuHienTai; txtChucVuKiemNhiem.Text = item.ChucVuKiemNhiem; txtPhuCapChucVu.Text = item.PhuCapChucVu + ""; } else { Button1.Text = "Thêm mới Cán Bộ"; Button2.Visible = true; } } catch (Exception ee) { lblMessage.Text = ee.Message; } finally { es.Dispose(); } }
protected void EditRecord(object sender, EventArgs e) { ViewModel item = new ViewModel(); item.Image = imgAnhDaiDien.ImageUrl; item.HoTenKhaiSinh = txtHoTenKhaiSinh.Text; item.TenGoiKhac = txtTenGoiKhac.Text; item.NgaySinh = txtNgaySinh.Text; item.GioiTinh = txtGioiTinh.Text; item.HoKhauThuongTru = txtHoKhauThuongTru.Text; item.NoiSinh = txtNoiSinh.Text; item.QueQuanTinh = txtQueQuanTinh.Text; item.QueQuanHuyen = txtQueQuanHuyen.Text; item.QueQuanXa = txtQueQuanXa.Text; item.NoiOHienNay = txtNoiOHienNay.Text; item.DanToc = txtDanToc.Text; item.TonGiao = txtTonGiao.Text; item.ThanhPhanGiaDinh = txtThanhPhanGiaDinh.Text; item.TinhTrangHonNhan = txtTinhTrangHonNhan.Text; item.SoCMND = txtSoCMND.Text; item.NgayCapCMND = txtNgayCapCMND.Text; item.NoiCapCMND = txtNoiCapCMND.Text; item.Email = txtEmail.Text; item.SDT = txtSDT.Text; item.NgheNghiepKhiTuyenDung = txtNgheNghiepKhiTuyenDung.Text; item.NgayTuyenDung = txtNgayTuyenDung.Text; item.TenCoQuanTuyenDung = txtTenCoQuanTuyenDung.Text; item.NgayVaoCoQuanHienTai = txtNgayVaoCoQuanHienTai.Text; item.NgayNhapNgu = txtNgayNhapNgu.Text; item.NgayXuatNgu = txtNgayXuatNgu.Text; item.QuanHamCaoNhat = txtQuanHamCaoNhat.Text; item.TrinhDoHocVan = txtTrinhDoHocVan.Text; item.HocHam = txtHocHam.Text; item.HocVi = txtHocVi.Text; item.TrinhDoQuanLyNhaNuoc = txtTrinhDoQuanLyNhaNuoc.Text; item.TrinhDoLyLuanChinhTri = txtTrinhDoLyLuanChinhTri.Text; item.TrinhDoChuyenMonCaoNhat = txtTrinhDoChuyenMonCaoNhat.Text; item.ChuyenNganh = txtChuyenNganh.Text; item.TrinhDoTinHoc = txtTrinhDoTinHoc.Text; item.TrinhDoNgoaiNguThuNhat = txtTrinhDoNgoaiNguThuNhat.Text; item.NgoaiNguThuNhat = txtNgoaiNguThuNhat.Text; item.TrinhDoNgoaiNguThuHai = txtTrinhDoNgoaiNguThuHai.Text; item.NgoaiNguThuHai = txtNgoaiNguThuHai.Text; item.KhenThuong = txtKhenThuong.Text; item.KyLuat = txtKyLuat.Text; item.TinhTrangSucKhoe = txtTinhTrangSucKhoe.Text; item.LaThuongBinh = txtLaThuongBinh.Text; item.SoHieuCB = txtSoHieuCB.Text; item.DoiTuong = txtDoiTuong.Text; item.HuongLuong = txtHuongLuong.Text; item.DonViQuanLy = txtDonViQuanLy.Text; item.DonViCongTac = txtDonViCongTac.Text; item.MaNgachCongChuc = txtMaNgachCongChuc.Text; item.NgayHuong = txtNgayHuong.Text; item.BacLuong = Common.TryParseObjectToInt(txtBacLuong.Text); item.HeSoLuong = Common.TryParseObjectToDecemal(txtHeSoLuong.Text); item.ChucVuHienTai = txtChucVuHienTai.Text; item.ChucVuKiemNhiem = txtChucVuKiemNhiem.Text; item.PhuCapChucVu = Common.TryParseObjectToDecemal(txtPhuCapChucVu.Text); item.CongViecChinhDangLam = txtCongViecChinhDangLam.Text; ServiceCanBo es = new ServiceCanBo(); try { var id = Common.TryParseObjectToInt(Request.QueryString["ID"] + ""); item.ID = id; if (id == 0) { bool result = es.ThemCanBo("TheBinh", "12345678", item); if (result) { lblMessage.Text = "Đã thêm mới thông tin cán bộ thành công!"; } else { lblMessage.Text = "Có lỗi xảy ra, chưa lưu được thông tin. Hãy kiểm tra và thử lại"; } } else { bool result = es.SuaCanBo("TheBinh", "12345678", item); if (result) { lblMessage.Text = "Đã lưu thông tin cán bộ thành công!"; } else { lblMessage.Text = "Có lỗi xảy ra, chưa lưu được thông tin. Hãy kiểm tra và thử lại"; } } } catch (Exception ee) { lblMessage.Text = ee.Message; } finally { es.Dispose(); item = null; } }
public void BindCombobox(ServiceCanBo es, ViewALLCB item) { if (item == null) { item = new ViewALLCB(); } txtTinhTrangSucKhoe.DataSource = es.TinhTrangSucKhoe("TheBinh", "12345678"); txtTinhTrangSucKhoe.DataBind(); txtTinhTrangSucKhoe.DataTextField = "TenTinhTrangSucKhoe"; txtTinhTrangSucKhoe.DataValueField = "TenTinhTrangSucKhoe"; txtTinhTrangSucKhoe.DataBind(); txtTinhTrangSucKhoe.Text = item.TinhTrangSucKhoe; txtLaThuongBinh.DataSource = es.ThuongBinh("TheBinh", "12345678"); txtLaThuongBinh.DataBind(); txtLaThuongBinh.DataTextField = "TenLoaiThuongBinh"; txtLaThuongBinh.DataValueField = "TenLoaiThuongBinh"; txtLaThuongBinh.DataBind(); txtLaThuongBinh.Text = item.LaThuongBinh; txtQuanHamCaoNhat.DataSource = es.QuanHamCaoNhat("TheBinh", "12345678"); txtQuanHamCaoNhat.DataBind(); txtQuanHamCaoNhat.DataTextField = "TenQuanHamCaoNhat"; txtQuanHamCaoNhat.DataValueField = "TenQuanHamCaoNhat"; txtQuanHamCaoNhat.DataBind(); txtQuanHamCaoNhat.Text = item.QuanHamCaoNhat; txtTrinhDoHocVan.DataSource = es.TrinhDoHocVan("TheBinh", "12345678"); txtTrinhDoHocVan.DataBind(); txtTrinhDoHocVan.DataTextField = "TenTrinhDoHocVan"; txtTrinhDoHocVan.DataValueField = "TenTrinhDoHocVan"; txtTrinhDoHocVan.DataBind(); txtTrinhDoHocVan.Text = item.TrinhDoHocVan; txtHocHam.DataSource = es.HocHam("TheBinh", "12345678"); txtHocHam.DataBind(); txtHocHam.DataTextField = "TenHocHam"; txtHocHam.DataValueField = "TenHocHam"; txtHocHam.DataBind(); txtHocHam.Text = item.HocHam; txtHocVi.DataSource = es.HocVi("TheBinh", "12345678"); txtHocVi.DataBind(); txtHocVi.DataTextField = "TenHocVi"; txtHocVi.DataValueField = "TenHocVi"; txtHocVi.DataBind(); txtHocVi.Text = item.HocVi; txtTrinhDoQuanLyNhaNuoc.DataSource = es.TrinhDoQuanLyNhaNuoc("TheBinh", "12345678"); txtTrinhDoQuanLyNhaNuoc.DataBind(); txtTrinhDoQuanLyNhaNuoc.DataTextField = "TenTrinhDoQuanLyNhaNuoc"; txtTrinhDoQuanLyNhaNuoc.DataValueField = "TenTrinhDoQuanLyNhaNuoc"; txtTrinhDoQuanLyNhaNuoc.DataBind(); txtTrinhDoQuanLyNhaNuoc.Text = item.TrinhDoQuanLyNhaNuoc; txtTrinhDoLyLuanChinhTri.DataSource = es.TrinhDoLyLuanChinhTri("TheBinh", "12345678"); txtTrinhDoLyLuanChinhTri.DataBind(); txtTrinhDoLyLuanChinhTri.DataTextField = "TenTrinhDoLyLuanChinhTri"; txtTrinhDoLyLuanChinhTri.DataValueField = "TenTrinhDoLyLuanChinhTri"; txtTrinhDoLyLuanChinhTri.DataBind(); txtTrinhDoLyLuanChinhTri.Text = item.TrinhDoLyLuanChinhTri; txtDanToc.DataSource = es.DanToc("TheBinh", "12345678"); txtDanToc.DataBind(); txtDanToc.DataTextField = "TenDanToc"; txtDanToc.DataValueField = "TenDanToc"; txtDanToc.DataBind(); txtDanToc.Text = item.DanToc; txtTonGiao.DataSource = es.TonGiao("TheBinh", "12345678"); txtTonGiao.DataBind(); txtTonGiao.DataTextField = "TenTonGiao"; txtTonGiao.DataValueField = "TenTonGiao"; txtTonGiao.DataBind(); txtTonGiao.Text = item.TonGiao; txtGioiTinh.DataSource = es.GioiTinh("TheBinh", "12345678"); txtGioiTinh.DataBind(); txtGioiTinh.DataTextField = "TenGioiTinh"; txtGioiTinh.DataValueField = "TenGioiTinh"; txtGioiTinh.DataBind(); txtGioiTinh.Text = item.GioiTinh; txtThanhPhanGiaDinh.DataSource = es.ThanhPhanGiaDinh("TheBinh", "12345678"); txtThanhPhanGiaDinh.DataBind(); txtThanhPhanGiaDinh.DataTextField = "TenTPGiaDinh"; txtThanhPhanGiaDinh.DataValueField = "TenTPGiaDinh"; txtThanhPhanGiaDinh.DataBind(); txtThanhPhanGiaDinh.Text = item.ThanhPhanGiaDinh; txtNgheNghiepKhiTuyenDung.DataSource = es.NgheNghiepKhiTuyenDung("TheBinh", "12345678"); txtNgheNghiepKhiTuyenDung.DataBind(); txtNgheNghiepKhiTuyenDung.DataTextField = "TenNgheNghiepKhiTuyenDung"; txtNgheNghiepKhiTuyenDung.DataValueField = "TenNgheNghiepKhiTuyenDung"; txtNgheNghiepKhiTuyenDung.DataBind(); txtNgheNghiepKhiTuyenDung.Text = item.NgheNghiepKhiTuyenDung; txtCongViecChinhDangLam.DataSource = es.CongViecChinhDangLam("TheBinh", "12345678"); txtCongViecChinhDangLam.DataBind(); txtCongViecChinhDangLam.DataTextField = "TenCongViecChinhDangLam"; txtCongViecChinhDangLam.DataValueField = "TenCongViecChinhDangLam"; txtCongViecChinhDangLam.DataBind(); txtCongViecChinhDangLam.Text = item.CongViecChinhDangLam; txtQueQuanTinh.DataSource = es.LoadTinh("TheBinh", "12345678"); txtQueQuanTinh.DataBind(); txtQueQuanTinh.DataTextField = "NAME"; txtQueQuanTinh.DataValueField = "ID"; txtQueQuanTinh.DataBind(); txtQueQuanTinh.Text = item.QueQuanTinh; int t = Convert.ToInt32(txtQueQuanTinh.SelectedItem.Value); txtQueQuanHuyen.DataSource = es.LoadHuyen("TheBinh", "12345678", t); txtQueQuanHuyen.DataBind(); txtQueQuanHuyen.DataTextField = "NAME"; txtQueQuanHuyen.DataValueField = "ID"; txtQueQuanHuyen.DataBind(); txtQueQuanHuyen.Text = item.QueQuanHuyen; txtQueQuanXa.DataSource = es.LoadXa("TheBinh", "12345678", Common.TryParseObjectToInt(item.QueQuanHuyen)); txtQueQuanXa.DataBind(); txtQueQuanXa.DataTextField = "NAME"; txtQueQuanXa.DataValueField = "ID"; txtQueQuanXa.DataBind(); txtQueQuanXa.Text = item.QueQuanXa; }