Ejemplo n.º 1
0
 private void btnCapnhat1_Click(object sender, EventArgs e)
 {
     if (txtMaNV.Text != "" && txtTenNV.Text != "" && txtDiaChi.Text != "")
     {
         if (them)
         {
             NhanVien nv = new NhanVien();
             nv.Manv   = int.Parse(txtMaNV.Text);
             nv.Tennv  = txtMaNV.Text;
             nv.Diachi = txtDiaChi.Text;
             //nv.Mapb = cboPhongBan.SelectedValue.ToString();
             qlnv.NhanViens.InsertOnSubmit(nv);
             qlnv.SubmitChanges();
             setEnableControl1(false);
             cboPhongBan_SelectedIndexChanged(cboPhongBan, null);
         }
         else
         {
             NhanVien nv = qlnv.NhanViens.Single(p => p.Manv == Convert.ToInt32(txtMaNV.Text));
             nv.Tennv  = txtTenNV.Text;
             nv.Diachi = txtDiaChi.Text;
             qlnv.SubmitChanges();
             cboPhongBan_SelectedIndexChanged(cboPhongBan, null);
             setEnableControl1(false);
         }
     }
 }
Ejemplo n.º 2
0
 private void Form2_FormClosing(object sender, FormClosingEventArgs e)
 {
     qlnv.SubmitChanges();
 }