Exemple #1
0
 public ActionResult Edit(FormCollection fc, CSF_Partials obj)
 {
     try
     {
         //if (!this.HasPermission) return RedirectToAction("Unauthorized", "Home");
         if (ModelState.IsValid)
         {
             CSF_Partials_DAO objDAO = new CSF_Partials_DAO();
             if (objDAO.CheckExist_PartialsKey(obj))
             {
                 SetAlert("Key đã tồn tại!", AlertType.Error);
             }
             else
             {
                 if (objDAO.Update(obj))
                 {
                     SetAlert("Cập nhật điều khiển thành công", AlertType.Success);
                     return(RedirectToAction("Index", "QT_Partials"));
                 }
                 else
                 {
                     SetAlert("Cập nhật điều không thành công", AlertType.Error);
                 }
             }
         }
         return(View(obj));
     }
     catch (Exception ex)
     {
         SetAlert("Lỗi" + ex.Message.ToString(), AlertType.Error);
         Logs.WriteLog(ex);
         return(View());
     }
 }
Exemple #2
0
 public ActionResult Edit(int id)
 {
     try
     {
         CSF_Partials_DAO objDAO = new CSF_Partials_DAO();
         var Partial             = objDAO.GetPartialsByID(id);
         SetTempData2SelectList((int)Partial.ModuleID, Partial.Controller);
         return(View(Partial));
     }
     catch (Exception ex)
     {
         SetAlert("Lỗi" + ex.Message.ToString(), AlertType.Error);
         Logs.WriteLog(ex);
         return(View());
     }
 }
Exemple #3
0
 public ActionResult Index(string searchString, int?page)
 {
     try
     {
         CSF_Partials_DAO objDAO = new CSF_Partials_DAO();
         var data = objDAO.Search(searchString);
         ViewBag.SearchString = searchString;
         int pageSize   = 10;
         int pageNumber = (page ?? 1);
         return(View(data.ToPagedList(pageNumber, pageSize)));
     }
     catch (Exception ex)
     {
         SetAlert("Lỗi" + ex.Message.ToString(), "error");
         Logs.WriteLog(ex);
         return(View());
     }
 }
Exemple #4
0
 public JsonResult Delete(int id)
 {
     try
     {
         //if (!this.HasPermission) return RedirectToAction("Unauthorized", "Home");
         CSF_Partials_DAO objDAO = new CSF_Partials_DAO();
         if (objDAO.Delete(id))
         {
             SetAlert("Xóa điều khiển thành công", AlertType.Success);
             return(Json(new { status = true, message = "" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { status = false, message = "Lỗi xóa điều khiển" }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         Logs.WriteLog(ex);
         return(Json(new { status = false, message = "Lỗi: " + ex }, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #5
0
 public ActionResult Create(FormCollection fc, CSF_Partials obj)
 {
     try
     {
         if (ModelState.IsValid)
         {
             CSF_Partials_DAO objDAO = new CSF_Partials_DAO();
             if (objDAO.CheckExist_PartialsKey(obj))
             {
                 SetAlert("Key đã tồn tại!", AlertType.Error);
                 return(View());
             }
             int ReturnID = objDAO.Insert(obj);
             //CSF_Users_DAO objUserDao = new CSF_Users_DAO();
             //int intUserID = objUserDao.GetUserIDByUserName(HttpContext.User.Identity.Name);
             //obj.UserCreate = intUserID;
             //int ReturnID = objDAO.Insert(obj);
             if (ReturnID > 0)
             {
                 SetAlert("Thêm page thành công", AlertType.Success);
                 return(RedirectToAction("Index", "QT_Partials"));
             }
             else
             {
                 ModelState.AddModelError("", "Thêm page không thành công");
             }
             return(View("Index"));
         }
         return(View());
     }
     catch (Exception ex)
     {
         SetAlert("Lỗi" + ex.Message.ToString(), AlertType.Error);
         Logs.WriteLog(ex);
         return(View());
     }
 }