public string DeleteDonvitochuc(DonViToChuc position)
        {
            NguoiDung       nd = (NguoiDung)Session["Taikhoan"];
            List <Rel_CV_Q> re = db.Rel_CV_Qs.OrderBy(n => n.IdChucVu).Where(n => n.IdChucVu == nd.IdChucVu).ToList();

            foreach (var a in re)
            {
                if (nd != null && a.Quyen.MoTa == "xdvtc")
                {
                    DonViToChuc p = db.DonViToChucs.SingleOrDefault(n => n.IdDonViToChuc == position.IdDonViToChuc);
                    p.XoaTam = true;

                    try
                    {
                        UpdateModel(p);
                        db.SubmitChanges();
                    }
                    catch (Exception ex)
                    {
                        return(ex.Message);
                    }
                    return("ok");
                }
            }
            return("Bạn không có quyền xóa");
        }
 public ActionResult ThemMoi(DonViToChuc ds)
 {
     if (Session["Taikhoan"] == null || Session["Taikhoan"].ToString() == "")
     {
         return(RedirectToAction("Index", "Login"));
     }
     else
     {
         NguoiDung       nd = (NguoiDung)Session["Taikhoan"];
         List <Rel_CV_Q> re = db.Rel_CV_Qs.OrderBy(n => n.IdChucVu).Where(n => n.IdChucVu == nd.IdChucVu).ToList();
         foreach (var a in re)
         {
             if (nd != null && a.Quyen.MoTa == "tdvtc")
             {
                 if (ModelState.IsValid)
                 {
                     ds.XoaTam = false;
                     db.DonViToChucs.InsertOnSubmit(ds);
                     db.SubmitChanges();
                 }
             }
         }
         return(RedirectToAction("Index", "QuanlyDonvitochuc"));
     }
 }
        public string AddDonvitochuc(DonViToChuc position)
        {
            NguoiDung       nd = (NguoiDung)Session["Taikhoan"];
            List <Rel_CV_Q> re = db.Rel_CV_Qs.OrderBy(n => n.IdChucVu).Where(n => n.IdChucVu == nd.IdChucVu).ToList();

            foreach (var a in re)
            {
                if (nd != null && a.Quyen.MoTa == "tdvtc")
                {
                    try
                    {
                        position.XoaTam = false;
                        db.DonViToChucs.InsertOnSubmit(position);
                        db.SubmitChanges();
                    }
                    catch (Exception ex)
                    {
                        return(ex.Message);
                    }
                    return("ok");
                }
            }
            return("Bạn không có quyền thêm");
        }