Esempio n. 1
0
        public ActionResult GetPM()
        {
            if (!AppData.IsManagerLogin)
            {
                return(Json(new { success = false, msg = "您未登录后台或会话已过期" }));
            }
            if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 21))
            {
                return(Json(new { success = false, msg = "您没有执行该操作的权限" }));
            }

            Validation vld = new Validation();

            dynamic result;
            PM      pm   = new PM();
            int     pmID = vld.GetInt("pmID");

            if (pmID != 0)
            {
                result = pm.GetPM(pmID);
                return(Json(new { success = true, data = result }));
            }
            else
            {
                int      page     = vld.GetInt("page");
                int      pageSize = vld.GetInt("pageSize");
                string   userName = vld.Get("userName");
                DateTime dtFrom   = vld.GetDateTime("dtFrom");
                DateTime dtTo     = vld.GetDateTime("dtTo");
                int      total;
                result = pm.GetPM(page, pageSize, out total, userName: userName, dtFrom: dtFrom, dtTo: dtTo);
                return(Json(new { success = true, data = result, total = total }));
            }
        }
Esempio n. 2
0
        public ActionResult GetPM(int page, int pageSize)
        {
            UserObj user = AppData.SessionUser;

            if (user == null)
            {
                return(Json(new { success = false, msg = "您还未登录" }));
            }
            PM pm = new PM();

            int total;
            var res = pm.GetPM(page, pageSize, out total, userID: (int?)user.UserID);

            return(Json(new { success = true, data = res, total = total }));
        }
Esempio n. 3
0
        public ActionResult PM(int id)
        {
            UserObj user = AppData.SessionUser;

            if (user == null)
            {
                return(Redirect("/Login.html"));
            }
            PM pm = new PM();

            pm.ReadPM(id, user.UserID);

            ViewBag.pmInfo = pm.GetPM(id);
            return(View());
        }
Esempio n. 4
0
        public ActionResult ModifyPM()
        {
            if (Request.HttpMethod == "GET")
            {
                if (!AppData.IsManagerLogin)
                {
                    return(Redirect("/Manage/Error/1.html"));
                }
                if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 2103))
                {
                    return(Redirect("/Manage/Error/2.html"));
                }

                return(View());
            }

            if (!AppData.IsManagerLogin)
            {
                return(Json(new { success = false, msg = "您未登录后台或会话已过期" }));
            }
            if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 2103))
            {
                return(Json(new { success = false, msg = "您没有执行该操作的权限" }));
            }

            Validation vld    = new Validation();
            int        pmID   = vld.GetInt("id");
            PM         pm     = new PM();
            PMInfo     pmInfo = pm.GetPM(pmID);

            if (pmInfo == null)
            {
                return(Json(new { success = false, msg = "该短消息不存在!" }));
            }
            pmInfo.Title      = vld.Get("title");
            pmInfo.Content    = HttpUtility.UrlDecode(vld.Get("content"), Encoding.UTF8);
            pmInfo.UserIDFrom = AppData.SessionUser.UserID;

            UserBLL userBLL = new UserBLL();

            pm.ModifyPM(pmInfo);

            return(Json(new { success = true }));
        }
Esempio n. 5
0
        public ActionResult DeletePM(int id)
        {
            if (!AppData.IsManagerLogin)
            {
                return(Json(new { success = false, msg = "您未登录后台或会话已过期" }));
            }
            if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 2102))
            {
                return(Json(new { success = false, msg = "您没有执行该操作的权限" }));
            }

            PM     pm     = new PM();
            PMInfo pmInfo = pm.GetPM(id);

            if (pmInfo == null)
            {
                return(Json(new { success = false, msg = "该短消息不存在!" }));
            }

            pm.DeletePM(id);
            return(Json(new { success = true }));
        }
Esempio n. 6
0
        public ActionResult DeletePM(int id)
        {
            UserObj user = AppData.SessionUser;

            if (user == null)
            {
                return(Json(new { success = false, msg = "您还未登录" }));
            }

            PM     pm     = new PM();
            PMInfo pmInfo = pm.GetPM(id);

            if (pmInfo == null)
            {
                return(Json(new { success = false, msg = "该短消息不存在!" }));
            }
            if (pmInfo.UserID != user.UserID)
            {
                return(Json(new { success = false, msg = "该短消息不存在1!" }));
            }

            pm.DeletePM(id);
            return(Json(new { success = true }));
        }