Exemple #1
0
        congviec maxoa(string macv)
        {
            congviec ac = tv.congviecs.Where(t => t.macv == macv).FirstOrDefault();

            if (ac != null)
            {
                return(ac);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
 public int suaCV(string macv)
 {
     try
     {
         congviec cv = tv.congviecs.Where(t => t.macv == macv).SingleOrDefault();
         tv.SubmitChanges();
         return(1);
     }
     catch
     {
         return(0);
     }
 }
Exemple #3
0
        //Kiểm tra khóa chính
        bool ktkc(string macv)
        {
            congviec cv = tv.congviecs.Where(t => t.macv == macv).FirstOrDefault();

            if (cv != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        public int XoaAC(string macv)
        {
            if (maxoa(macv) != null)
            {
                congviec ac = tv.congviecs.Where(t => t.macv == macv).FirstOrDefault();
                tv.congviecs.DeleteOnSubmit(ac);
                tv.SubmitChanges();
                return(1);
            }

            else
            {
                return(0);
            }
        }
Exemple #5
0
 public int ThemCV(congviec cv)
 {
     try
     {
         if (ktkc(cv.macv) == true)
         {
             return(2);
         }
         tv.congviecs.InsertOnSubmit(cv);
         tv.SubmitChanges();
         return(1);
     }
     catch
     {
         return(0);
     }
 }
Exemple #6
0
 private void luu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (isthem == true)
     {
         try
         {
             string   macv   = "";
             string   tencv  = txttencv.Text;
             string   loaicv = cmbloaicv.SelectedValue.ToString();
             congviec cv     = new congviec();
             cv.macv   = macv;
             cv.tencv  = tencv;
             cv.maloai = loaicv;
             int kq = congviec.ThemCV(cv);
             if (kq == 2)
             {
                 MessageBox.Show("Đã có công việc này");
             }
             else if (kq == 0)
             {
                 MessageBox.Show("Sai thông tin");
             }
             else
             {
                 MessageBox.Show("Thêm thành công");
             }
             loadcv();
         }
         catch
         {
             MessageBox.Show("Thêm thất bại");
         }
     }
     else
     {
         try
         {
             string   tencv  = txttencv.Text;
             string   loaicv = cmbloaicv.SelectedValue.ToString();
             congviec cv     = new congviec();
             int      kq     = congviec.suaCV(txtmacv.Text);
             if (kq == 2)
             {
                 MessageBox.Show("Công việc chưa có, bạn nên tạo mới");
             }
             else if (kq == 0)
             {
                 MessageBox.Show("Sai thông tin");
             }
             else
             {
                 MessageBox.Show("Thành công");
             }
             loadcv();
         }
         catch
         {
             MessageBox.Show("Không sữa được");
         }
     }
     txttencv.Enabled = false;
 }