private bool setHoSoTheoThongTinXML(XmlNodeList list_HoSo, XmlNodeList list_HuanLuyen) { try { if (File.Exists("HoSo.hrd")) { cbNhomTrachVu_LLCN.Text = NhomTrachVu_BUS.TraCuuNhomTrachVuTheoMa(list_HoSo[0]["MaNhomTrachVu"].InnerText).Ten; cbTrachVu_LLCN.Text = TrachVu_BUS.TraCuuTrachVuTheoMa(list_HoSo[0]["MaTrachVu"].InnerText).Ten; //sAvatarPath = Path.Combine(File_Function.getFinalFolder(list_FolderAvatar), setAvatarPath(iMa.ToString(), dto_HoSo.NgayCapNhat)); //if (File.Exists(sAvatarPath)) //{ // pbAvatar.Image = Image.FromFile(sAvatarPath); // bNewAvatar = true; //} if (list_HoSo[0]["Avatar"].InnerText != "") { pbAvatar.Image = Convert_Function.ConvertByteArrayToImage(Convert_Function.ConvertStringToByteArray(list_HoSo[0]["Avatar"].InnerText)); } else { pbAvatar.Image = Image.FromFile(@"Resources\NhanSu\avatar.png"); } tbHoTen_LLCN.Text = list_HoSo[0]["HoTen"].InnerText; dtpNgaySinh_LLCN.Value = DateTime.Parse(list_HoSo[0]["NgaySinh"].InnerText); if (list_HoSo[0]["GioiTinh"].InnerText == "Nam") { rbNam.Checked = true; } if (list_HoSo[0]["GioiTinh"].InnerText == "Nữ") { rbNu.Checked = true; } tbQueQuan_LLCN.Text = list_HoSo[0]["QueQuan"].InnerText; tbTrinhDoHocVan_LLCN.Text = list_HoSo[0]["TrinhDoHocVan"].InnerText; tbTonGiao_LLCN.Text = list_HoSo[0]["TonGiao"].InnerText; tbDiaChi_LLCN.Text = list_HoSo[0]["DiaChi"].InnerText; tbDienThoaiLienLac_LLCN.Text = list_HoSo[0]["DienThoaiLienLac"].InnerText; tbEmail_LLCN.Text = list_HoSo[0]["Email"].InnerText; if (list_HoSo[0]["Nganh"].InnerText == "Ấu") { rbAu.Checked = true; } if (list_HoSo[0]["Nganh"].InnerText == "Thiếu") { rbThieu.Checked = true; } if (list_HoSo[0]["Nganh"].InnerText == "Kha") { rbKha.Checked = true; } if (list_HoSo[0]["Nganh"].InnerText == "Tráng") { rbTrang.Checked = true; } if (list_HoSo[0]["Nganh"].InnerText == "Khác") { rbKhac.Checked = true; } tbDonVi_LLHD.Text = list_HoSo[0]["DonVi"].InnerText; tbLienDoan_LLHD.Text = list_HoSo[0]["LienDoan"].InnerText; tbDao_LLHD.Text = list_HoSo[0]["Dao"].InnerText; tbChau_LLHD.Text = list_HoSo[0]["Chau"].InnerText; dtpNgayTuyenHua_LLHD.Value = DateTime.Parse(list_HoSo[0]["NgayTuyenHua"].InnerText); tbTruongNhanLoiHua_LLHD.Text = list_HoSo[0]["TruongNhanLoiHua"].InnerText; tbTrachVuTaiDonVi_LLHD.Text = list_HoSo[0]["TrachVuTaiDonVi"].InnerText; tbTrachVuNgoaiDonVi_LLHD.Text = list_HoSo[0]["TrachVuNgoaiDonVi"].InnerText; tbTenRung_LLHD.Text = list_HoSo[0]["TenRung"].InnerText; tbGhiChu_LLHD.Text = list_HoSo[0]["GhiChu"].InnerText; tbNgheNghiep_NNKN.Text = list_HoSo[0]["NgheNghiep"].InnerText; if ("1" == list_HoSo[0]["NutDay"].InnerText) //1 { chbNutDay_NNKN.Checked = true; } if ("1" == list_HoSo[0]["PhuongHuong"].InnerText) //2 { chbPhuongHuong_NNKN.Checked = true; } if ("1" == list_HoSo[0]["CuuThuong"].InnerText) //3 { chbCuuThuong_NNKN.Checked = true; } if ("1" == list_HoSo[0]["TruyenTin"].InnerText) //4 { chbTruyenTin_NNKN.Checked = true; } if ("1" == list_HoSo[0]["TroChoi"].InnerText) //5 { chbTroChoi_NNKN.Checked = true; } if ("1" == list_HoSo[0]["LuaTrai"].InnerText) //6 { chbLuaTrai_NNKN.Checked = true; } tbSoTruong_NNKN.Text = list_HoSo[0]["SoTruong"].InnerText; for (int i = 0; i < list_HuanLuyen.Count; i++) //foreach (XmlNodeList dto_Temp in list_HuanLuyen) { UC_HuanLuyen uc_HuanLuyen = new UC_HuanLuyen(int.Parse(list_HuanLuyen[i].Attributes["Ma"].InnerText), list_HuanLuyen[i]["Nganh"].InnerText, list_HuanLuyen[i]["Khoa"].InnerText, list_HuanLuyen[i]["TenKhoa"].InnerText, list_HuanLuyen[i]["KhoaTruong"].InnerText, DateTime.Parse(list_HuanLuyen[i]["Nam"].InnerText), list_HuanLuyen[i]["MHL"].InnerText, list_HuanLuyen[i]["TinhTrang"].InnerText, true); int iNewLocation = list_UC_HuanLuyen.Count * 180 + pn_gbHuanLuyen.AutoScrollPosition.Y; uc_HuanLuyen.Location = new Point(8, iNewLocation); list_UC_HuanLuyen.Add(uc_HuanLuyen); pn_gbHuanLuyen.Controls.Add(list_UC_HuanLuyen[list_UC_HuanLuyen.Count - 1]); list_UC_HuanLuyen[list_UC_HuanLuyen.Count - 1].VisibleChanged += new EventHandler(AfterDeleteHL); list_UC_HuanLuyen_Update.Add(uc_HuanLuyen); } } } catch { return false; } return true; }
private void pbAdd_Click(object sender, EventArgs e) { //pnThem_HL.Top = pnThem_HL.Location.Y + 180; int iNewLocation = list_UC_HuanLuyen.Count * 180 + pn_gbHuanLuyen.AutoScrollPosition.Y; UC_HuanLuyen uc_HuanLuyen = new UC_HuanLuyen(); uc_HuanLuyen.Location = new Point(8, iNewLocation); uc_HuanLuyen.VisibleChanged += new EventHandler(AfterDeleteHL); list_UC_HuanLuyen.Add(uc_HuanLuyen); //dung de hien thi pn_gbHuanLuyen.Controls.Add(list_UC_HuanLuyen[list_UC_HuanLuyen.Count - 1]); list_UC_HuanLuyen_Insert.Add(uc_HuanLuyen); //dung de insert }
private void setHoSoTheoMaHoSo(int iMa) { if (File.Exists("HoSo.hrd")) { dto_HoSo = HoSo_BUS.TraCuuHoSoTheoMa(iMa); cbNhomTrachVu_LLCN.Text = NhomTrachVu_BUS.TraCuuNhomTrachVuTheoMa(dto_HoSo.MaNhomTrachVu).Ten; cbTrachVu_LLCN.Text = TrachVu_BUS.TraCuuTrachVuTheoMa(dto_HoSo.MaTrachVu).Ten; //sAvatarPath = Path.Combine(File_Function.getFinalFolder(list_FolderAvatar), setAvatarPath(iMa.ToString(), dto_HoSo.NgayCapNhat)); //if (File.Exists(sAvatarPath)) //{ // pbAvatar.Image = Image.FromFile(sAvatarPath); // bNewAvatar = true; //} if (dto_HoSo.Avatar != "") { pbAvatar.Image = Convert_Function.ConvertByteArrayToImage(Convert_Function.ConvertStringToByteArray(dto_HoSo.Avatar)); } tbHoTen_LLCN.Text = dto_HoSo.HoTen; dtpNgaySinh_LLCN.Value = (DateTime)dto_HoSo.NgaySinh; if (dto_HoSo.GioiTinh == "Nam") { rbNam.Checked = true; } if (dto_HoSo.GioiTinh == "Nữ") { rbNu.Checked = true; } tbQueQuan_LLCN.Text = dto_HoSo.QueQuan; tbTrinhDoHocVan_LLCN.Text = dto_HoSo.TrinhDoHocVan; tbTonGiao_LLCN.Text = dto_HoSo.TonGiao; tbDiaChi_LLCN.Text = dto_HoSo.DiaChi; tbDienThoaiLienLac_LLCN.Text = dto_HoSo.DienThoaiLienLac; tbEmail_LLCN.Text = dto_HoSo.Email; if (dto_HoSo.Nganh == "Ấu") { rbAu.Checked = true; } if (dto_HoSo.Nganh == "Thiếu") { rbThieu.Checked = true; } if (dto_HoSo.Nganh == "Kha") { rbKha.Checked = true; } if (dto_HoSo.Nganh == "Tráng") { rbTrang.Checked = true; } if (dto_HoSo.Nganh == "Khác") { rbKhac.Checked = true; } tbDonVi_LLHD.Text = dto_HoSo.DonVi; tbLienDoan_LLHD.Text = dto_HoSo.LienDoan; tbDao_LLHD.Text = dto_HoSo.Dao; tbChau_LLHD.Text = dto_HoSo.Chau; dtpNgayTuyenHua_LLHD.Value = (DateTime)dto_HoSo.NgayTuyenHua; tbTruongNhanLoiHua_LLHD.Text = dto_HoSo.TruongNhanLoiHua; tbTrachVuTaiDonVi_LLHD.Text = dto_HoSo.TrachVuTaiDonVi; tbTrachVuNgoaiDonVi_LLHD.Text = dto_HoSo.TrachVuNgoaiDonVi; tbTenRung_LLHD.Text = dto_HoSo.TenRung; tbGhiChu_LLHD.Text = dto_HoSo.GhiChu; tbNgheNghiep_NNKN.Text = dto_HoSo.NgheNghiep; if (dto_HoSo.NutDay == 1) //1 { chbNutDay_NNKN.Checked = true; } if (dto_HoSo.PhuongHuong == 1) //2 { chbPhuongHuong_NNKN.Checked = true; } if (dto_HoSo.CuuThuong == 1) //3 { chbCuuThuong_NNKN.Checked = true; } if (dto_HoSo.TruyenTin == 1) //4 { chbTruyenTin_NNKN.Checked = true; } if (dto_HoSo.TroChoi == 1) //5 { chbTroChoi_NNKN.Checked = true; } if (dto_HoSo.LuaTrai == 1) //6 { chbLuaTrai_NNKN.Checked = true; } tbSoTruong_NNKN.Text = dto_HoSo.SoTruong; List<HoSo_HuanLuyen_DTO> list_HoSo_HuanLuyen = HoSo_HuanLuyen_BUS.TraCuuDSHuanLuyenTheoMaHoSo(iMa); foreach (HoSo_HuanLuyen_DTO dto_Temp in list_HoSo_HuanLuyen) { HuanLuyen_DTO dto_HuanLuyen_Temp = HuanLuyen_BUS.TraCuuHuanLuyenTheoMa(dto_Temp.MaHuanLuyen); UC_HuanLuyen uc_HuanLuyen = new UC_HuanLuyen(dto_HuanLuyen_Temp.Ma, dto_HuanLuyen_Temp.Nganh, dto_HuanLuyen_Temp.Khoa, dto_HuanLuyen_Temp.TenKhoa, dto_HuanLuyen_Temp.KhoaTruong, (DateTime)dto_HuanLuyen_Temp.Nam, dto_HuanLuyen_Temp.MHL, dto_HuanLuyen_Temp.TinhTrang, true); int iNewLocation = list_UC_HuanLuyen.Count * 180 + pn_gbHuanLuyen.AutoScrollPosition.Y; uc_HuanLuyen.Location = new Point(8, iNewLocation); list_UC_HuanLuyen.Add(uc_HuanLuyen); pn_gbHuanLuyen.Controls.Add(list_UC_HuanLuyen[list_UC_HuanLuyen.Count - 1]); list_UC_HuanLuyen[list_UC_HuanLuyen.Count - 1].VisibleChanged += new EventHandler(AfterDeleteHL); list_UC_HuanLuyen_Update.Add(uc_HuanLuyen); } } }