public static bool Insert(LuuTru dto) { try { VNSCDataContext VNSC = SQL_Connection.CreateSQlConnection(); VNSC.LuuTrus.InsertOnSubmit(dto); VNSC.SubmitChanges(); return true; } catch (System.Exception ex) { return false; } }
private void NewLuuTru() { dto_LuuTru = new LuuTru(); dto_LuuTru.NgayCapNhat = dto_HoSo.NgayCapNhat; if (cbIDV_LLCN.SelectedIndex > 0) { dto_LuuTru.MaIDV = list_IDV[cbIDV_LLCN.SelectedIndex - 1]; } dto_LuuTru.MaNhomTrachVu = list_NhomTrachVu[cbNhomTrachVu_LLCN.SelectedIndex]; dto_LuuTru.MaTrachVu = list_TrachVu[cbTrachVu_LLCN.SelectedIndex]; dto_LuuTru.HoTen = tbHoTen_LLCN.Text; dto_LuuTru.NgaySinh = dtpNgaySinh_LLCN.Value; if (rbNam.Checked) { dto_LuuTru.GioiTinh = rbNam.Text; } if (rbNu.Checked) { dto_LuuTru.GioiTinh = rbNu.Text; } dto_LuuTru.QueQuan = tbQueQuan_LLCN.Text; dto_LuuTru.TrinhDoHocVan = tbTrinhDoHocVan_LLCN.Text; dto_LuuTru.TonGiao = tbTonGiao_LLCN.Text; dto_LuuTru.DiaChi = tbDiaChi_LLCN.Text; dto_LuuTru.DienThoaiLienLac = tbDienThoaiLienLac_LLCN.Text; dto_LuuTru.Email = tbEmail_LLCN.Text; if (rbAu.Checked) { dto_LuuTru.Nganh = rbAu.Text; } if (rbThieu.Checked) { dto_LuuTru.Nganh = rbThieu.Text; } if (rbKha.Checked) { dto_LuuTru.Nganh = rbKha.Text; } if (rbTrang.Checked) { dto_LuuTru.Nganh = rbTrang.Text; } if (rbKhac.Checked) { dto_LuuTru.Nganh = rbKhac.Text; } dto_LuuTru.DonVi = tbDonVi_LLHD.Text; dto_LuuTru.LienDoan = tbLienDoan_LLHD.Text; dto_LuuTru.Dao = tbDao_LLHD.Text; dto_LuuTru.Chau = tbChau_LLHD.Text; dto_LuuTru.NgayTuyenHua = dtpNgayTuyenHua_LLHD.Value; dto_LuuTru.TruongNhanLoiHua = tbTruongNhanLoiHua_LLHD.Text; dto_LuuTru.TrachVuTaiDonVi = tbTrachVuTaiDonVi_LLHD.Text; dto_LuuTru.TrachVuNgoaiDonVi = tbTrachVuNgoaiDonVi_LLHD.Text; dto_LuuTru.TenRung = tbTenRung_LLHD.Text; dto_LuuTru.GhiChu = tbGhiChu_LLHD.Text; dto_LuuTru.NgheNghiep = tbNgheNghiep_NNKN.Text; if (chbNutDay_NNKN.Checked) //1 { dto_LuuTru.NutDay = 1; } else { dto_LuuTru.NutDay = 0; } if (chbPhuongHuong_NNKN.Checked) //2 { dto_LuuTru.PhuongHuong = 1; } else { dto_LuuTru.PhuongHuong = 0; } if (chbCuuThuong_NNKN.Checked) //3 { dto_LuuTru.CuuThuong = 1; } else { dto_LuuTru.CuuThuong = 0; } if (chbTruyenTin_NNKN.Checked) //4 { dto_LuuTru.TruyenTin = 1; } else { dto_LuuTru.TruyenTin = 0; } if (chbTroChoi_NNKN.Checked) //5 { dto_LuuTru.TroChoi = 1; } else { dto_LuuTru.TroChoi = 0; } if (chbLuaTrai_NNKN.Checked) //6 { dto_LuuTru.LuaTrai = 1; } else { dto_LuuTru.LuaTrai = 0; } dto_LuuTru.SoTruong = tbSoTruong_NNKN.Text; }
private void UC_HoSoCaNhan_Load(object sender, EventArgs e) { list_IDV = new List<int>(); list_NhomTrachVu = new List<string>(); list_TrachVu = new List<string>(); cbIDV_LLCN.Items.Add(" "); LayDSIDV_ComboBox(cbIDV_LLCN); 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); tbPage.Location = new Point(pnPage.Left + 2, pnPage.Top - 1); tbPage.LostFocus += new EventHandler(tbPage_LostFocus); 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); iZoom = 1; 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"); iRows = 20; refreshListView(); Form_Main.CurrentControlName = "UC_HoSoCaNhan"; }
partial void DeleteLuuTru(LuuTru instance);
partial void UpdateLuuTru(LuuTru instance);
partial void InsertLuuTru(LuuTru instance);
public static bool UpdateLuuTruInfo(LuuTru dto) { //try //{ // VNSCDataContext VNSC = SQL_Connection.CreateSQlConnection(); // LuuTru sk = VNSC.LuuTrus.Single(P => P.Ma == dto.Ma); // sk.MaNhomTrachVu = dto.MaNhomTrachVu; // sk.Ten = dto.Ten; // sk.MoTa = dto.MoTa; // VNSC.SubmitChanges(); // return true; //} //catch (System.Exception ex) //{ // return false; //} return false; //Luu tru khong co update }
public static bool Insert(LuuTru dto) { return LuuTru_DAO.Insert(dto); }