static void Main() { if (Process.GetProcessesByName(@"HR-STG for Client").Length > 1) { Form_Notice frm = new Form_Notice("Chương trình HR-STG đang chạy!", false); } else { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form_Main()); } }
private void LoadPic() { try { this.BackgroundImage = Image.FromFile(@"Resources\General\form_confirm.jpg"); pbHuy.Image = Image.FromFile(@"Resources\ChucNang\icon_cancel.png"); pbHoanTat.Image = Image.FromFile(@"Resources\ChucNang\icon_ok.png"); } catch { this.Dispose(); Form_Notice frm_Notice = new Form_Notice("Kiểm tra thư mục Resource!", false); } }
private bool KiemTraHoSoCaNhanBiTrungHoSoThamDu(int iMa) { for (int i = 0; i < lvThongTin_HSTD.Items.Count; i++) { if (int.Parse(lvThongTin_HSTD.Items[i].SubItems[0].Text) == iMa) { string[] sTen = lvThongTin_HSTD.Items[i].SubItems[2].Text.Split(); Form_Notice frm = new Form_Notice("Kiểm tra Hồ sơ " + sTen[sTen.Length - 1] + " bị trùng!", false); return true; } } return false; }
private void pbHuy_HSTD_Click(object sender, EventArgs e) { Form_Notice frm_Notice = new Form_Notice("Dữ liệu mới sẽ không được lưu lại!", "Bạn có muốn thoát?", true); if (frm_Notice.Yes) { this.Dispose(); } }
private void pbHoanTat_Click(object sender, EventArgs e) { XmlDocument XmlDoc = XMLConnection.SelectXmlDocConfig(); string sContent = XmlDoc.FirstChild.OuterXml.Split(new char[] {'>'})[0] + ">"; sContent += "<HS>"; //bat dau ghi thong tin Ho so foreach (int iMa in list_dto_HSTD) { sContent += HoSo_BUS.Insert2String(HoSo_BUS.TraCuuHoSoTheoMa(iMa), sIDV); } sContent += "</HS>"; sContent += "<HL>"; //bat dau ghi thong tin Huan luyen foreach (int iMa in list_dto_HSTD) { List<HoSo_HuanLuyen_DTO> list_HoSo_HuanLuyen = HoSo_HuanLuyen_BUS.TraCuuDSHuanLuyenTheoMaHoSo(iMa); foreach (HoSo_HuanLuyen_DTO dto_Temp in list_HoSo_HuanLuyen) { sContent += HuanLuyen_BUS.Insert2String(HuanLuyen_BUS.TraCuuHuanLuyenTheoMa(dto_Temp.MaHuanLuyen)); } } sContent += "</HL>"; sContent += "<HS_HL>"; //bat dau ghi thong tin Huan luyen foreach (int iMa in list_dto_HSTD) { List<HoSo_HuanLuyen_DTO> list_HoSo_HuanLuyen = HoSo_HuanLuyen_BUS.TraCuuDSHuanLuyenTheoMaHoSo(iMa); foreach (HoSo_HuanLuyen_DTO dto_Temp in list_HoSo_HuanLuyen) { sContent += HoSo_HuanLuyen_BUS.Insert2String(dto_Temp); } } sContent += "</HS_HL>"; sContent += "</HR-STG>"; if (Crypto.EncryptData(sContent, tbSave.Text)) { //Form_Notice frm = new Form_Notice("Tạo file thành công.", false); this.Dispose(); } else { Form_Notice frm = new Form_Notice("Tạo file thất bại!", "Vui lòng thử lại.", false); } }
private void pbImport_Click(object sender, EventArgs e) { string[] sPaths = File_Function.OpenDialogMultiSelect("HR data", "hrd"); if (null != sPaths) { for (int i = 0; i < sPaths.Length; i++) { if (lvThongTin.Items.Count >= 50) { frm_Notice = new Form_Notice("Đã sử dụng hết 50 Hồ sơ.", false); return; } else { XmlDocument XmlDoc = new XmlDocument(); string sContent = Crypto.DecryptData(sPaths[i]); if (sContent == null) { frm_Notice = new Form_Notice("Không thể mở file!", "Vui lòng kiểm tra lại.", false); return; } else { XmlDoc.LoadXml(sContent); } XmlNodeList list_HoSo = XmlDoc.GetElementsByTagName("HoSo"); XmlNodeList list_HuanLuyen = XmlDoc.GetElementsByTagName("HuanLuyen"); XmlNodeList list_HoSo_HuanLuyen = XmlDoc.GetElementsByTagName("HoSo_HuanLuyen"); XmlDocument XmlDocHoSo = XMLConnection.SelectXmlDocHoSo(); if (setHoSoTheoThongTinXML(list_HoSo, list_HuanLuyen)) { lbSelect.Text = "THÊM"; pbHoanTat_HL_Click(sender, e); lbSelect.Text = ""; } } } } }
private void pbHuy_NNKN_Click(object sender, EventArgs e) { frm_Notice = new Form_Notice("Dữ liệu mới sẽ không được lưu lại!", "Bạn có muốn thoát?", true); if (frm_Notice.Yes) { Cancel(); } }
private void pbHoanTat_HL_Click(object sender, EventArgs e) { //Nhap vao CSDL if (lbSelect.Text == "THÊM") { NewHoSo(); if (InsertHoSo(dto_HoSo)) { if (InsertHuanLuyen(list_UC_HuanLuyen)) { Cancel(); refreshListView(); } else { Form_Notice frm = new Form_Notice("Không thể tạo Khóa Huấn Luyện!", false); } } else { Form_Notice frm = new Form_Notice("Không thể tạo Hồ Sơ!", false); } } if (lbSelect.Text == "SỬA") { sNgayCapNhatTruoc = dto_HoSo.NgayCapNhat; NewHoSo(); if (UpdateHoSo(dto_HoSo)) { if (UpdateHuanLuyen()) { Cancel(); refreshListView(); } else { Form_Notice frm = new Form_Notice("Không thể cập nhật Hồ Sơ!", false); } } else { Form_Notice frm = new Form_Notice("Không thể cập nhật Hồ Sơ!", false); } } }
private void pbBrowse_Click(object sender, EventArgs e) { string sPath = File_Function.OpenDialog("JPG file", "jpg"); if (sPath != null) { try { imgAvatar = Image.FromFile(sPath); } catch { frm_Notice = new Form_Notice("Không thể mở hình!", "Vui lòng kiểm tra lại.", false); return; } if (imgAvatar.Width > 500 || imgAvatar.Height > 500) { imgZoom = Image_Function.resizeImage(imgAvatar, new Size(500, 500)); } else { imgZoom = imgAvatar; } if (imgAvatar.Width >= 90 && imgAvatar.Height >= 120) { pbAvatar.Cursor = Cursors.SizeAll; pbAvatar.Enabled = true; if (imgZoom.Width > imgZoom.Height) { iZoom = imgZoom.Width; } else { iZoom = imgZoom.Height; } point_Pic = new Point(imgZoom.Width / 2 - size_PicRec.Width / 2, imgZoom.Height / 2 - size_PicRec.Height / 2); point_PicBound = point_Pic; size_Pic.Width = imgZoom.Width; size_Pic.Height = imgZoom.Height; //pbAvatar.Image.Dispose(); pbAvatar.Image = Image_Function.CropImage(imgZoom, new Rectangle(point_PicBound, size_PicRec), pbAvatar.ClientRectangle); bNewAvatar = true; } else { Form_Notice frm = new Form_Notice("Kích thước ảnh quá nhỏ!", false); } } }
private void LoadPic() { try { pbImport.Image = Image.FromFile(@"Resources\NhanSu\import.png"); pbThem.Image = Image.FromFile(@"Resources\ChucNang\icon_them.png"); pbXoa.Image = Image.FromFile(@"Resources\ChucNang\icon_xoa_disable.png"); pbSua.Image = Image.FromFile(@"Resources\ChucNang\icon_sua_disable.png"); pbTitle.Image = Image.FromFile(@"Resources\NhanSu\icon_qlhoso_hscn_title.png"); pbTiepTuc_LLCN.Image = Image.FromFile(@"Resources\ChucNang\forward_disable.png"); pbHuy_LLCN.Image = Image.FromFile(@"Resources\ChucNang\icon_cancel.png"); pbTiepTuc_LLHD.Image = Image.FromFile(@"Resources\ChucNang\forward.png"); pbTroVe_LLHD.Image = Image.FromFile(@"Resources\ChucNang\back.png"); pbHuy_LLHD.Image = Image.FromFile(@"Resources\ChucNang\icon_cancel.png"); pbTiepTuc_NNKN.Image = Image.FromFile(@"Resources\ChucNang\forward.png"); pbTroVe_NNKN.Image = Image.FromFile(@"Resources\ChucNang\back.png"); pbHuy_NNKN.Image = Image.FromFile(@"Resources\ChucNang\icon_cancel.png"); pbTroVe_HL.Image = Image.FromFile(@"Resources\ChucNang\back.png"); pbHuy_HL.Image = Image.FromFile(@"Resources\ChucNang\icon_cancel.png"); pbHoanTat_HL.Image = Image.FromFile(@"Resources\ChucNang\icon_ok.png"); pbAdd.Image = Image.FromFile(@"Resources\ChucNang\add.png"); pbBrowse.Image = Image.FromFile(@"Resources\ChucNang\icon_browse.png"); //pbCrop.Image = Image.FromFile(@"Resources\ChucNang\icon_crop.png"); } catch { this.Dispose(); frm_Notice = new Form_Notice("Kiểm tra thư mục Resource!", false); } }
private bool LayDSTrachVuTheoMaNhomTrachVu_ComboBox(ComboBox cb, string sMaNhomTrachVu) { XmlNodeList list_Temp = XMLConnection.CreateXmlDocNTV_TV("TrachVu"); if (list_Temp != null) { list_TrachVu.Clear(); cb.Items.Clear(); for (int i = 0; i < list_Temp.Count; i++) { if (list_Temp[i]["MaNhomTrachVu"].InnerText == sMaNhomTrachVu) { list_TrachVu.Add(list_Temp[i].Attributes["Ma"].InnerText); cb.Items.Add(list_Temp[i]["Ten"].InnerText); } } } else { Form_Notice frm = new Form_Notice("Kiểm tra Nhóm trách vụ bị trùng!", false); return false; } return true; }
private void UC_HoSoCaNhan_Load(object sender, EventArgs e) { list_NhomTrachVu = new List<string>(); list_TrachVu = new List<string>(); if (!LayDSNhomTrachVu_ComboBox(cbNhomTrachVu_LLCN)) { this.Visible = false; Form_Notice frm = new Form_Notice("Chưa khởi tạo Nhóm trách vụ!", false); return; } else { this.Visible = true; } if (!LayDSTrachVu_ComboBox(cbTrachVu_LLCN)) { this.Visible = false; Form_Notice frm = new Form_Notice("Chưa khởi tạo Trách vụ!", false); return; } else { this.Visible = true; } LoadPic(); this.Size = new System.Drawing.Size(800, 600); pnQuanLy.Size = new System.Drawing.Size(770, 485); pnQuanLy.Location = SubFunction.SetWidthCenter(this.Size, pnQuanLy.Size, 100); lbTitle.Left = lbSelect.Left; lbSelect.Text = ""; pnLyLich.Size = new System.Drawing.Size(550, 545); pnLyLich.Location = SubFunction.SetWidthCenter(this.Size, pnLyLich.Size, 50); gbLyLichCaNhan.Size = new System.Drawing.Size(550, 545); gbLyLichCaNhan.Location = SubFunction.SetWidthCenter(pnLyLich.Size, gbLyLichCaNhan.Size, 0); gbLyLichHuongDao.Size = new System.Drawing.Size(550, 545); gbLyLichHuongDao.Location = SubFunction.SetWidthCenter(pnLyLich.Size, gbLyLichHuongDao.Size, 0); gbNgheNghiep_KiNang.Size = new System.Drawing.Size(550, 545); gbNgheNghiep_KiNang.Location = SubFunction.SetWidthCenter(pnLyLich.Size, gbNgheNghiep_KiNang.Size, 0); gbHuanLuyen.Size = new System.Drawing.Size(550, 545); gbHuanLuyen.Location = SubFunction.SetWidthCenter(pnLyLich.Size, gbHuanLuyen.Size, 0); pn_gbHuanLuyen.Size = new System.Drawing.Size(540, 430); pn_gbHuanLuyen.Location = SubFunction.SetWidthCenter(gbHuanLuyen.Size, pn_gbHuanLuyen.Size, 50); size_PicRec.Width = 90; size_PicRec.Height = 120; pnAvatar.Left = pnLyLich.Right + 5; pnAvatar.Top = pnLyLich.Top + 10; pbAvatar.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.pbAvatar_MouseWheel); //list_dto = new List<HoSo>(); list_UC_HuanLuyen = new List<UC_HuanLuyen>(); list_UC_HuanLuyen_Insert = new List<UC_HuanLuyen>(); list_UC_HuanLuyen_Delete = new List<int>(); list_UC_HuanLuyen_Update = new List<UC_HuanLuyen>(); //dto_HoSo = new HoSo(); //dto_HuanLuyen = new HuanLuyen(); //dto_LuuTru = new LuuTru(); //dto_HoSo_HuanLuyen = new HoSo_HuanLuyen(); //dto_HoSo_LuuTru = new HoSo_LuuTru(); list_FolderAvatar = new List<string>(); list_FolderAvatar.Add("DB"); list_FolderAvatar.Add("Avatar"); refreshListView(); }
private void cbNhomTrachVu_LLCN_SelectedIndexChanged(object sender, EventArgs e) { if (cbNhomTrachVu_LLCN.Text.Length > 0) { cbTrachVu_LLCN.Items.Clear(); if (!LayDSTrachVuTheoMaNhomTrachVu_ComboBox(cbTrachVu_LLCN, list_NhomTrachVu[cbNhomTrachVu_LLCN.SelectedIndex])) { frm_Notice = new Form_Notice("Chưa có Trách Vụ trong Nhóm trách vụ này!", false); } else { cbTrachVu_LLCN.Enabled = true; } } if (cbTrachVu_LLCN.Text.Length > 0 && tbHoTen_LLCN.Text.Length > 0) { pbTiepTuc_LLCN.Enabled = true; pbTiepTuc_LLCN.Image = Image.FromFile(@"Resources\ChucNang\forward.png"); } else { pbTiepTuc_LLCN.Enabled = false; pbTiepTuc_LLCN.Image = Image.FromFile(@"Resources\ChucNang\forward_disable.png"); } }
private void pbXoa_Click(object sender, EventArgs e) { frm_Confirm = new Form_Confirm("Đồng ý xóa " + lvThongTin.SelectedItems.Count + " dữ liệu?"); if (frm_Confirm.Yes) { for (int i = 0; i < lvThongTin.SelectedItems.Count; i++) { if (!DeleteHoSo(int.Parse(lvThongTin.SelectedItems[i].SubItems[0].Text))) { frm_Notice = new Form_Notice("Không thể xóa Hồ Sơ " + lvThongTin.SelectedItems[i].SubItems[0].Text + "!", "Vẫn còn ...!", false); break; } } refreshListView(); } }
private void pbThem_Click(object sender, EventArgs e) { if (lvThongTin.Items.Count >= 50) { frm_Notice = new Form_Notice("Đã sử dụng hết 50 Hồ sơ.", false); } else { pnQuanLy.Visible = false; pnSelect.Visible = false; pbImport.Visible = false; pnLyLich.Visible = true; lbTitle.Text = "THÊM HỒ SƠ CÁ NHÂN"; lbSelect.Text = "THÊM"; NewAll(); //NewMa(); pnNgayCapNhat.Visible = true; if (list_dto.Count == 0) { iMaHoSo = 1; } else { iMaHoSo = list_dto[list_dto.Count - 1].Ma + 1; } tbHoTen_LLCN.Focus(); } }
private void CreateHoSoData() { XmlDocument XmlDoc = new XmlDocument(); List<XmlElement> list_elem = new List<XmlElement>(); XmlElement Content = XmlDoc.CreateElement("HR-STG"); //Content.SetAttribute("Version", ""); list_elem.Add(XmlDoc.CreateElement("HS")); list_elem.Add(XmlDoc.CreateElement("HL")); list_elem.Add(XmlDoc.CreateElement("HS_HL")); for (int i = 0; i < list_elem.Count; i++) { Content.AppendChild(list_elem[i]); } if (Crypto.EncryptData(Content.OuterXml, "HoSo.hrd")) { //Form_Notice frm = new Form_Notice("Tạo file thành công.", false); //this.Dispose(); } else { Form_Notice frm = new Form_Notice("Tạo HoSo.hrd thất bại!", "Liên hệ với Ban tổ chức.", false); this.Close(); } }