Пример #1
0
 public ActionResult List(int page)
 {
     if (Session["UserLogin"] != null)
     {
         UserLogin        em = (UserLogin)Session["UserLogin"];
         AuthorizationDao au = new AuthorizationDao();
         if (au.CheckAccess(em.GroupEmployeeID, 9) == true)
         {
             //OrderDao order_dao = new OrderDao();
             //IEnumerable<Order> list = order_dao.ListOrder();
             //return View("List", list);
             OrderDao            order_dao = new OrderDao();
             IEnumerable <Order> list      = order_dao.ListOrder_Paging(page, 10);
             ViewBag.Count        = order_dao.CountOrder();
             ViewBag.RequiredPage = page;
             return(View("List", list));
         }
         else
         {
             return(RedirectToAction("Error", "Error"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login", new { Area = "" }));
     }
 }
Пример #2
0
 public ActionResult Add()
 {
     if (Session["UserLogin"] != null)
     {
         UserLogin        em = (UserLogin)Session["UserLogin"];
         AuthorizationDao au = new AuthorizationDao();
         if (au.CheckAccess(em.GroupEmployeeID, 14) == true)
         {
             return(View("Add"));
         }
         else
         {
             return(RedirectToAction("Error", "Error"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login", new { Area = "" }));
     }
 }
Пример #3
0
 public ActionResult Delete(int id)
 {
     if (Session["UserLogin"] != null)
     {
         UserLogin        em = (UserLogin)Session["UserLogin"];
         AuthorizationDao au = new AuthorizationDao();
         if (au.CheckAccess(em.GroupEmployeeID, 12) == true)
         {
             OrderDao order_dao = new OrderDao();
             order_dao.DeleteOrder(id);
             return(RedirectToAction("List", new { RequiredPage = 1 }));
         }
         else
         {
             return(RedirectToAction("Error", "Error"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login", new { Area = "" }));
     }
 }
Пример #4
0
 public ActionResult Details(int id)
 {
     if (Session["UserLogin"] != null)
     {
         UserLogin        em = (UserLogin)Session["UserLogin"];
         AuthorizationDao au = new AuthorizationDao();
         if (au.CheckAccess(em.GroupEmployeeID, 15) == true)
         {
             EmployeeDao my       = new EmployeeDao();
             Employee    employee = my.FindEmployeeByID(id);
             return(View("Details", employee));
         }
         else
         {
             return(RedirectToAction("Error", "Error"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login", new { Area = "" }));
     }
 }
Пример #5
0
 public ActionResult Delete(int id)
 {
     if (Session["UserLogin"] != null)
     {
         UserLogin        em = (UserLogin)Session["UserLogin"];
         AuthorizationDao au = new AuthorizationDao();
         if (au.CheckAccess(em.GroupEmployeeID, 16) == true)
         {
             EmployeeDao dao = new EmployeeDao();
             dao.DeleteEmployee(id);
             return(RedirectToAction("List"));
         }
         else
         {
             return(RedirectToAction("Error", "Error"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login", new { Area = "" }));
     }
 }
Пример #6
0
 //[HttpPost]
 //public ActionResult List(int RecordsPerPage)
 //{
 //    OrderDao order_dao = new OrderDao();
 //    IEnumerable<Order> list = order_dao.ListOrder_Paging(5, RecordsPerPage);
 //    return View("List", list);
 //}
 public ActionResult Details(int id)
 {
     if (Session["UserLogin"] != null)
     {
         UserLogin        em = (UserLogin)Session["UserLogin"];
         AuthorizationDao au = new AuthorizationDao();
         if (au.CheckAccess(em.GroupEmployeeID, 10) == true)
         {
             OrderDao order_dao = new OrderDao();
             Order    order     = order_dao.FindOrderByID(id); // Cái này gửi sang cũng chẳng để làm gì , phương án cũ , ko dùng
             ViewBag.OrderItem = order_dao.ListOrderItem(id);
             return(View("Details", order));
         }
         else
         {
             return(RedirectToAction("Error", "Error"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login", new { Area = "" }));
     }
 }
Пример #7
0
 //
 // GET: /Employee/
 //public ActionResult Index()
 //{
 //    return View("List");
 //}
 public ActionResult List(int page)
 {
     if (Session["UserLogin"] != null)
     {
         UserLogin        em = (UserLogin)Session["UserLogin"];
         AuthorizationDao au = new AuthorizationDao();
         if (au.CheckAccess(em.GroupEmployeeID, 13) == true)
         {
             EmployeeDao            employee_dao = new EmployeeDao();
             IEnumerable <Employee> list         = employee_dao.ListEmployee_GetPage(page, 10);
             ViewBag.Count        = employee_dao.CountEmployee();
             ViewBag.RequiredPage = page;
             return(View("List", list));
         }
         else
         {
             return(RedirectToAction("Error", "Error"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login", new { Area = "" }));
     }
 }
 public ActionResult Edit(int id)
 {
     if (Session["UserLogin"] != null)
     {
         UserLogin        em = (UserLogin)Session["UserLogin"];
         AuthorizationDao au = new AuthorizationDao();
         if (au.CheckAccess(em.GroupEmployeeID, 19) == true)
         {
             GroupEmployeeDao            dao           = new GroupEmployeeDao();
             GroupEmployee               employee_edit = dao.FindGroupEmployeeByID(id);
             IEnumerable <Authorization> list_access   = dao.ListAuthorization(id);
             ViewBag.ListAuthorization = list_access;
             return(View("Edit", employee_edit));
         }
         else
         {
             return(RedirectToAction("Error", "Error"));
         }
     }
     else
     {
         return(RedirectToAction("Index", "Login", new { Area = "" }));
     }
 }