Esempio n. 1
0
 public ActionResult Info()
 {
     if (UserService.QssGetUserByAccount(User.Identity.Name, out User user) != QssResult.Success)
     {
         return(Content(QssReturnHepler.QssGetReturnContent("获取当前用户失败!", "/Account/LogOff")));
     }
     return(View(user));
 }
Esempio n. 2
0
 /// <summary>
 /// Content通用返回方法
 /// </summary>
 /// <param name="result">处理结果</param>
 /// <param name="message">处理结果信息</param>
 /// <param name="successUrl">成功消息/跳转链接</param>
 /// <returns></returns>
 protected ActionResult QssContentCommonReturn(QssResult result, string message, string failUrl, string successUrl)
 {
     return(Json(
                result == QssResult.Error ? RedirectToAction("LogOff", "Account") as ActionResult :
                result == QssResult.Fail ? Content(QssReturnHepler.QssGetReturnContent(message, failUrl)) :
                Content(QssReturnHepler.QssGetReturnContent(message, successUrl))
                ));
 }
Esempio n. 3
0
 public ActionResult ManageUser(int id, int page = 1, int pageSize = 50)
 {
     if (OrganizeService.GetOrgUserList(id, out string message, out IEnumerable <ManageUserModel> model, out Organize organize) != QssResult.Success)
     {
         return(Content(QssReturnHepler.QssGetReturnContent(message, "/Account/LogOff")));
     }
     ViewBag.CurrentOrg = organize;
     return(View(model.ToPagedList(page, pageSize)));
 }
Esempio n. 4
0
        /// <summary>
        /// 组织管理
        /// </summary>
        /// <param name="page">页数</param>
        /// <param name="pageNum">每页显示条数</param>
        /// <param name="strSearch">搜索内容</param>
        /// <returns></returns>
        public ActionResult OrganizeList(int page = 1, int pageSize = 15, string strSearch = "", string isCreate = "false")
        {
            ViewBag.IsCreate = isCreate;

            if (OrganizeService.QssGetOrgList(isCreate == "true" ? QssGetOrgType.create : QssGetOrgType.join, out string message, out IQueryable <Organize> model) != QssResult.Success)
            {
                return(Content(QssReturnHepler.QssGetReturnContent(message, "/Account/LogOff")));
            }
            return(View(model.OrderBy(p => p.Id).ToPagedList(page, pageSize)));
        }
Esempio n. 5
0
        public ActionResult Create()
        {
            var result = UserService.QssCheckHaveEmail();

            if (result == QssResult.Error)
            {
                return(RedirectToAction("LogOff", "Account"));
            }
            if (result == QssResult.Fail)
            {
                return(Content(QssReturnHepler.QssGetReturnContent("请先绑定邮箱!", Url.Action("RegisterEmail", "Account"))));
            }
            return(View());
        }
Esempio n. 6
0
        /// <summary>
        /// 问卷管理
        /// </summary>
        /// <param name="page">页数</param>
        /// <param name="pageSize">每页显示条数</param>
        /// <param name="strSearch">搜索内容</param>
        /// <returns></returns>
        public ActionResult QuesList(string strSearch, string type = "all", int page = 1, int pageSize = 6)
        {
            ViewBag.QType = type;

            // 获取问卷列表类型
            QssGetQuesVoteType _type =
                type == QssGetQuesVoteType.all.ToString() ? QssGetQuesVoteType.all :
                type == QssGetQuesVoteType.audit.ToString() ? QssGetQuesVoteType.audit :
                type == QssGetQuesVoteType.create.ToString() ? QssGetQuesVoteType.create :
                QssGetQuesVoteType.write;

            // 和自己相关的所有问卷:创建、审核、填写、查看
            if (QuestionService.GetList(_type, strSearch, out string message, out IEnumerable <QuesAndVoteModel> model) != Common.QssResult.Success)
            {
                return(Content(QssReturnHepler.QssGetReturnContent(message, "/Account/LogOff")));
            }

            // 分页返回
            return(View(model.OrderByDescending(p => p.Id).ToPagedList(page, pageSize)));
        }
Esempio n. 7
0
        public ActionResult Create(CreateOrgModel model)
        {
            // 组织类型
            QssOrganizeType type =
                model.OrgType == QssOrganizeType.Association.ToString() ? QssOrganizeType.Association :
                model.OrgType == QssOrganizeType.Campus.ToString() ? QssOrganizeType.Campus :
                model.OrgType == QssOrganizeType.Class.ToString() ? QssOrganizeType.Class :
                model.OrgType == QssOrganizeType.College.ToString() ? QssOrganizeType.College :
                model.OrgType == QssOrganizeType.Department.ToString() ? QssOrganizeType.Department :
                model.OrgType == QssOrganizeType.Major.ToString() ? QssOrganizeType.Major :
                model.OrgType == QssOrganizeType.School.ToString() ? QssOrganizeType.School :
                QssOrganizeType.Temp;

            if (ModelState.IsValid)
            {
                QssResult result = OrganizeService.QssCreateOrganize(type, model.OrgName, model.Password, model.ComPassword, out string message);
                switch (result)
                {
                case QssResult.Success:
                    return(Content(QssReturnHepler.QssGetReturnContent(message, "/Users/OrganizeList")));

                case QssResult.Fail:
                    return(Content(QssReturnHepler.QssGetReturnContent(message, "/Organize/Create")));

                case QssResult.Error:
                default:
                    return(RedirectToAction("LogOff", "Account"));
                }
            }

            string errmsg = "";

            foreach (var item in ModelState.Values)
            {
                foreach (var _item in item.Errors)
                {
                    errmsg += _item.ErrorMessage;
                }
            }
            return(Content(QssReturnHepler.QssGetReturnContent(errmsg, "/Organize/Create")));
        }
Esempio n. 8
0
        public ActionResult RegisterEmail(RegisterEmailModel model)
        {
            if (ModelState.IsValid)
            {
                string code = Guid.NewGuid().ToString().Replace("-", "");
                string url  = new UriBuilder(Request.Url)
                {
                    Path  = Url.Action("ActivateEmail", "Account", new { id = code }),
                    Query = ""
                }.ToString();
                QssResult result = UserService.QssRegisterEmail(model.Email, url, code, out string _result);
                if (result == QssResult.Success)
                {
                    return(Content(QssReturnHepler.QssGetReturnContent(_result, "/Users")));
                }

                ModelState.AddModelError("", _result);
                return(View(model));
            }
            return(View(model));
        }
Esempio n. 9
0
 public ActionResult Delete(int id)
 {
     VoteService.QssDeleteVote(id, out string message);
     return(Content(QssReturnHepler.QssGetReturnContent(message, "/Users/VoteList")));
 }