Exemplo n.º 1
0
        /// <summary>
        /// 显示管理员的后台页面
        /// </summary>
        /// <returns></returns>
        public ActionResult index(string key = "", int page = 1)
        {
            using (WeiQingEntities db = new WeiQingEntities())
            {
                var efp = new EFPaging <bazijianpi>();
                if (key != null && key.Length > 0)
                {
                    var bl = (from q in db.bazijianpi
                              where (q.name.Contains(key) || q.born_place.Contains(key) || q.bazi.Contains(key))
                              orderby q.state, q.addtime
                              select q);  // 优先查看待简批的八字

                    ViewData["baziList"] = efp.getPageList(bl, "/admin/index", page, 10);
                    ViewData["url"]      = efp.pageUrl;
                }
                else
                {
                    var bl = (from q in db.bazijianpi
                              orderby q.state, q.addtime
                              select q);  // 优先查看待简批的八字
                    ViewData["baziList"] = efp.getPageList(bl, "/admin/index", page, 10);
                    ViewData["url"]      = efp.pageUrl;
                }

                var notice = db.notice.OrderByDescending(x => x.addtime).FirstOrDefault();
                ViewData["notice"] = notice;
            }
            return(View());
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查看帖子详情,一次显示12条
        /// </summary>
        /// <param name="id">帖子表的外键tid (title表的主键)</param>
        /// <param name="page">页码</param>
        /// <returns></returns>
        public ActionResult tiezi(int id = 0, int page = 1)
        {
            if (id > 0)
            {
                using (WeiQingEntities db = new WeiQingEntities())
                {
                    var title = (from t in db.title join us in db.user on t.uid equals us.id where t.id == id && t.state == 1 select new TitleExt()
                    {
                        uname = us.nick_name, id = t.id, addtime = t.addtime, art_title = t.art_title, keywords = t.keywords, state = t.state, uid = t.uid
                    }).FirstOrDefault();
                    ViewData["title"] = title;    // 获取帖子标题
                    ViewData["tid"]   = title.id; // 回帖需要用的参数

                    var q = (from tit in db.title join tz in db.tiezi on tit.id equals tz.tid where tz.state == 1 && tit.state == 1 && tz.tid == id orderby tz.id select new TieZiExt()
                    {
                        id = tz.id, addtime = tz.addtime, content = tz.content, floor = tz.floor, state = tz.state, tid = tz.tid, uid = tz.uid, uname = tz.uname
                    });
                    // ViewData["sql"] = q.ToString();
                    var p = new EFPaging <TieZiExt>();

                    var tzList = p.getPageList(q, "/index/tiezi/" + id, page, 12);    // 获取帖子内容列表, 再获取回复内容列表
                    if (tzList != null && tzList.Count > 0)
                    {
                        foreach (var item in tzList)
                        {
                            var replyList = (from tz in db.tiezi join rep in db.tzreply on tz.id equals rep.tzid where tz.state == 1 && rep.state == 1 && rep.tzid == item.id orderby rep.id select rep).ToList();
                            item.replyList = replyList; // 根据帖子内容的id获取回复的内容列表
                        }
                    }
                    ViewData["tzList"] = tzList;
                    ViewData["url"]    = p.pageUrl;
                }
            }
            return(View());
        }
Exemplo n.º 3
0
        /// <summary>
        /// 分页显示测试题
        /// </summary>
        /// <param name="job_id"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public IActionResult get_exam_data(string job_id, int page = 1)
        {
            ErrorRequestData err = null;

            if (string.IsNullOrWhiteSpace(job_id) || page < 1)
            {
                err = new ErrorRequestData()
                {
                    HttpStatusCode = 401, ErrorMessage = nameof(job_id) + "或者" + nameof(page) + "参数错误"
                };
                return(new ContentResult()
                {
                    Content = err.toJosnString(), ContentType = ConstantTypeString.JsonContentType, StatusCode = err.HttpStatusCode
                });
            }

            try
            {
                var p     = new EFPaging <exam_data>();
                var q     = dbContext.exam_data.Where(x => x.job_id.Equals(job_id) && x.user_id.Equals(signedUser.user_uuid)).OrderByDescending(x => x.is_enabled).OrderBy(x => x.exam_type);
                var list  = p.getPageList(q, "/api/company/get_exam_data?job_id=" + job_id, page);
                var pages = p.pageAjaxHref;

                return(Json(new { list, pages }));
            }
            catch (DbUpdateException dbex)
            {
                if (dbex.InnerException is PostgresException npge)
                {
                    err = new ErrorRequestData()
                    {
                        HttpStatusCode = 500, ErrorMessage = npge.Detail
                    };
                }
                else
                {
                    err = new ErrorRequestData()
                    {
                        HttpStatusCode = 500, ErrorMessage = dbex.Message
                    };
                }
                return(new ContentResult()
                {
                    StatusCode = err.HttpStatusCode, Content = err.toJosnString(), ContentType = ConstantTypeString.JsonContentType
                });
            }
            catch (Exception ex)
            {
                err = new ErrorRequestData()
                {
                    HttpStatusCode = 500, ErrorMessage = ex.Message
                };
                return(new ContentResult()
                {
                    StatusCode = err.HttpStatusCode, Content = err.toJosnString(), ContentType = ConstantTypeString.JsonContentType
                });
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 帖子管理, 显示帖子列表视图页
 /// </summary>
 /// <param name="key"></param>
 /// <param name="page"></param>
 /// <returns></returns>
 public ActionResult tieziList(string key = "", int page = 1)
 {
     using (WeiQingEntities db = new WeiQingEntities())
     {
         if (key != null && key.Length > 0)
         {
             var q = from t in db.title
                     join u in db.user on t.uid equals u.id
                     where t.art_title.Contains(key) || t.keywords.Contains(key)
                     orderby t.top descending, t.sort ascending, t.state descending, t.addtime descending
                 select new TitleUserExt()
             {
                 id        = t.id,
                 addtime   = t.addtime,
                 art_title = t.art_title,
                 keywords  = t.keywords,
                 nick_name = u.nick_name,
                 sort      = t.sort,
                 state     = t.state,
                 top       = t.top,
                 uid       = t.uid
             };
             // var q = db.title.Where(x => x.art_title.Contains(key) || x.keywords.Contains(key)).OrderByDescending(x => x.top).ThenBy(x => x.sort).ThenBy(x => x.state).ThenByDescending(x => x.addtime);
             var p     = new EFPaging <TitleUserExt>();
             var tlist = p.getPageList(q, "/admin/tieziList", page, 20);
             ViewData["tlist"] = tlist;
             ViewData["url"]   = p.pageUrl;
             return(View());
         }
         else
         {
             var q = from t in db.title
                     join u in db.user on t.uid equals u.id
                     orderby t.top descending, t.sort ascending, t.state descending, t.addtime descending
                 select new TitleUserExt()
             {
                 id        = t.id,
                 addtime   = t.addtime,
                 art_title = t.art_title,
                 keywords  = t.keywords,
                 nick_name = u.nick_name,
                 sort      = t.sort,
                 state     = t.state,
                 top       = t.top,
                 uid       = t.uid
             };
             // var q = db.title.OrderByDescending(x => x.top).ThenBy(x => x.sort).ThenBy(x => x.state).ThenByDescending(x => x.addtime);
             var p     = new EFPaging <TitleUserExt>();
             var tlist = p.getPageList(q, "/admin/tieziList", page, 20);
             ViewData["tlist"] = tlist;
             ViewData["url"]   = p.pageUrl;
         }
     }
     return(View());
 }
Exemplo n.º 5
0
 /// <summary>
 /// 根据时间逆序分页显示留言板的内容
 /// </summary>
 /// <returns></returns>
 public ActionResult liuyanList(int page = 1)
 {
     using (WeiQingEntities db = new WeiQingEntities())
     {
         var q    = db.liuyanban.OrderByDescending(x => x.state).ThenByDescending(x => x.addtime);
         var p    = new EFPaging <liuyanban>();
         var list = p.getPageList(q, "/admin/liuyanList", page, 20);
         ViewData["list"] = list;
         ViewData["url"]  = p.pageUrl;
     }
     return(View());
 }
Exemplo n.º 6
0
 /// <summary>
 /// 审批列表页
 /// </summary>
 /// <param name="page"></param>
 /// <returns></returns>
 public ActionResult jubaoshenpi(int page = 1)
 {
     using (WeiQingEntities db = new WeiQingEntities())
     {
         var q = from t in db.tiezi_jubao orderby t.state, t.addtime select t;
         var p    = new EFPaging <tiezi_jubao>();
         var list = p.getPageList(q, "/admin/jubaoshenpi", page, 20);
         ViewData["list"] = list;
         ViewData["url"]  = p.pageUrl;
     }
     return(View());
 }
Exemplo n.º 7
0
 /// <summary>
 /// 分页查看帖子列表
 /// </summary>
 /// <returns></returns>
 public ActionResult titleList(string key = "", int page = 1)
 {
     using (WeiQingEntities db = new WeiQingEntities())
     {
         if (key != null && key.Length > 0)
         {
             var q1 = from t in db.title
                      join u in db.user on t.uid equals u.id
                      where t.state == 1 && (t.art_title.Contains(key) || t.keywords.Contains(key))
                      orderby t.top descending, t.sort ascending, t.state descending, t.addtime descending
                 select new EFDao.EntityExt.TitleUserExt()
             {
                 addtime   = t.addtime,
                 art_title = t.art_title,
                 id        = t.id,
                 keywords  = t.keywords,
                 nick_name = u.nick_name,
                 state     = t.state,
                 uid       = t.uid
             };
             var p = new EFPaging <EFDao.EntityExt.TitleUserExt>();
             ViewData["list"] = p.getPageList(q1, "/index/titleList", page, 20);
             ViewData["url"]  = p.pageUrl;
             return(View());
         }
         else
         {
             var q1 = from t in db.title
                      join u in db.user on t.uid equals u.id
                      where t.state == 1
                      orderby t.top descending, t.sort ascending, t.state descending, t.addtime descending
                 select new EFDao.EntityExt.TitleUserExt()
             {
                 addtime   = t.addtime,
                 art_title = t.art_title,
                 id        = t.id,
                 keywords  = t.keywords,
                 nick_name = u.nick_name,
                 state     = t.state,
                 uid       = t.uid
             };
             var p = new EFPaging <EFDao.EntityExt.TitleUserExt>();
             ViewData["list"] = p.getPageList(q1, "/index/titleList", page, 20);
             ViewData["url"]  = p.pageUrl;
             return(View());
         }
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// 分页查看文章列表
 /// </summary>
 /// <param name="key"></param>
 /// <param name="page"></param>
 /// <returns></returns>
 public ActionResult artList(string key = "", int page = 1)
 {
     using (WeiQingEntities db = new WeiQingEntities())
     {
         if (key != null && key.Length > 0)
         {
             var q = db.article.Where(x => x.state == 1 && (x.title.Contains(key) || x.keywords.Contains(key))).OrderByDescending(x => x.addtime);
             var p = new EFPaging <article>();
             ViewData["list"] = p.getPageList(q, "/index/artList", page, 20);
             ViewData["url"]  = p.pageUrl;
             return(View());
         }
         else
         {
             var q = db.article.Where(x => x.state == 1).OrderByDescending(x => x.addtime);
             var p = new EFPaging <article>();
             ViewData["list"] = p.getPageList(q, "/index/artList", page, 20);
             ViewData["url"]  = p.pageUrl;
         }
     }
     return(View());
 }
Exemplo n.º 9
0
 /// <summary>
 /// 用户当前论坛注册用户的列表,包括被禁止的用户
 /// </summary>
 /// <param name="key">查询条件</param>
 /// <param name="page">页码</param>
 /// <returns></returns>
 public ActionResult userList(string key = "", int page = 1)
 {
     using (WeiQingEntities db = new WeiQingEntities())
     {
         if (key != null && key.Length > 0)
         {
             var q     = db.user.Where(x => x.nick_name.Contains(key) || x.email.Contains(key) || x.mobile.Contains(key) || x.qq.Contains(key) || x.wei_xin.Contains(key)).OrderByDescending(x => x.is_admin).ThenBy(x => x.state).ThenByDescending(x => x.reg_date);
             var p     = new EFPaging <user>();
             var ulist = p.getPageList(q, "/index/userList", page, 20);
             ViewData["ulist"] = ulist;
             ViewData["url"]   = p.pageUrl;
         }
         else
         {
             var q     = db.user.OrderByDescending(x => x.is_admin).ThenBy(x => x.state).ThenByDescending(x => x.reg_date);
             var p     = new EFPaging <user>();
             var ulist = p.getPageList(q, "/index/userList", page, 20);
             ViewData["ulist"] = ulist;
             ViewData["url"]   = p.pageUrl;
         }
     }
     return(View());
 }
Exemplo n.º 10
0
 /// <summary>
 /// 分页查看预测历史的列表
 /// </summary>
 /// <param name="key"></param>
 /// <param name="page"></param>
 /// <returns></returns>
 public ActionResult ycList(string key = "", int page = 1)
 {
     using (WeiQingEntities db = new WeiQingEntities())
     {
         if (key != null && key.Length > 0)
         {
             var q      = db.bazijianpi.Where(x => x.state == 1 && (x.bazi.Contains(key) || x.born_place.Contains(key) || x.name.Contains(key))).OrderByDescending(x => x.addtime);
             var p      = new EFPaging <bazijianpi>();
             var ycList = p.getPageList(q, "/index/yclist", page, 12);
             ViewData["ycList"] = ycList;
             ViewData["url"]    = p.pageUrl;
         }
         else
         {
             var q      = db.bazijianpi.Where(x => x.state == 1).OrderByDescending(x => x.addtime);
             var p      = new EFPaging <bazijianpi>();
             var ycList = p.getPageList(q, "/index/yclist", page, 12);
             ViewData["ycList"] = ycList;
             ViewData["url"]    = p.pageUrl;
         }
     }
     return(View());
 }
Exemplo n.º 11
0
        /// <summary>
        /// 根据岗位id查找 用户的测试题答案
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public IActionResult get_user_answer(string id, int page = 1)
        {
            ErrorRequestData err = null;

            if (string.IsNullOrWhiteSpace(id) || page < 1)
            {
                err = new ErrorRequestData()
                {
                    HttpStatusCode = 401, ErrorMessage = nameof(id) + "或者参数错误"
                };
                return(new ContentResult()
                {
                    Content = err.toJosnString(), ContentType = ConstantTypeString.JsonContentType, StatusCode = err.HttpStatusCode
                });
            }

            try
            {
                var q = from s in dbContext.user_score
                        join u in dbContext.recruit_user on s.user_id equals u.uuid
                        where s.job_id == id
                        select new user_score_info
                {
                    uname           = u.uname,
                    cq_score        = s.cq_score,
                    eq_score        = s.eq_score,
                    invitation_code = s.invitation_code,
                    addtime         = s.addtime,
                    phone           = u.phone,
                    email           = u.email,
                    id = s.id
                };
                var p     = new EFPaging <user_score_info>(); // 需要定义视图模型
                var list  = p.getPageList(q, "/api/company/get_user_answer/" + id, page);
                var pages = p.pageAjaxHref;
                return(Json(new { list, pages }));
            }
            catch (DbUpdateException dbex)
            {
                if (dbex.InnerException is PostgresException npge)
                {
                    err = new ErrorRequestData()
                    {
                        HttpStatusCode = 500, ErrorMessage = npge.Detail
                    };
                }
                else
                {
                    err = new ErrorRequestData()
                    {
                        HttpStatusCode = 500, ErrorMessage = dbex.Message
                    };
                }
                return(new ContentResult()
                {
                    StatusCode = err.HttpStatusCode, Content = err.toJosnString(), ContentType = ConstantTypeString.JsonContentType
                });
            }
            catch (Exception ex)
            {
                err = new ErrorRequestData()
                {
                    HttpStatusCode = 500, ErrorMessage = ex.Message
                };
                return(new ContentResult()
                {
                    StatusCode = err.HttpStatusCode, Content = err.toJosnString(), ContentType = ConstantTypeString.JsonContentType
                });
            }
        }
Exemplo n.º 12
0
        public IActionResult get_company_list(int page = 1)
        {
            ErrorRequestData err = null;

            if (page < 1)
            {
                err = new ErrorRequestData()
                {
                    HttpStatusCode = 401, ErrorMessage = nameof(page) + "参数错误"
                };
                return(new ContentResult()
                {
                    Content = err.toJosnString(), ContentType = ConstantTypeString.JsonContentType, StatusCode = err.HttpStatusCode
                });
            }

            try
            {
                var p     = new EFPaging <recruit_user>(); // 查询公司数据
                var q     = dbContext.recruit_user.Where(x => x.auth_role.Equals("company")).OrderBy(x => x.addtime);
                var temp  = p.getPageList(q, "/api/Recruit/get_company_list", page);
                var pages = p.pageAjaxHref;

                List <object> list = new List <object>();
                temp.ForEach(x =>
                {
                    var a = new
                    {
                        x.company_address,
                        x.company_code,
                        x.company_contact,
                        x.company_name,
                        x.uuid,
                        jobs = dbContext.job_type.Where(m => m.user_id.Equals(x.uuid) && m.is_enabled == true)
                               .Select(t => new { t.uuid, t.job_name }).ToList(),
                        job_id = string.Empty   // 绑定下拉框的字段, 占位用的
                    };
                    list.Add(a);
                });

                return(Json(new { list, pages }));
            }
            catch (DbUpdateException dbex)
            {
                if (dbex.InnerException is PostgresException npge)
                {
                    err = new ErrorRequestData()
                    {
                        HttpStatusCode = 500, ErrorMessage = npge.Detail
                    };
                }
                else
                {
                    err = new ErrorRequestData()
                    {
                        HttpStatusCode = 500, ErrorMessage = dbex.Message
                    };
                }
                return(new ContentResult()
                {
                    StatusCode = err.HttpStatusCode, Content = err.toJosnString(), ContentType = ConstantTypeString.JsonContentType
                });
            }
            catch (Exception ex)
            {
                err = new ErrorRequestData()
                {
                    HttpStatusCode = 500, ErrorMessage = ex.Message
                };
                return(new ContentResult()
                {
                    StatusCode = err.HttpStatusCode, Content = err.toJosnString(), ContentType = ConstantTypeString.JsonContentType
                });
            }
        }
Exemplo n.º 13
0
        public IActionResult search_company_list(string com_type, string keywords, int page = 1)
        {
            ErrorRequestData err = null;

            if (string.IsNullOrWhiteSpace(com_type) || string.IsNullOrWhiteSpace(keywords))
            {
                err = new ErrorRequestData()
                {
                    HttpStatusCode = 401, ErrorMessage = nameof(com_type) + "或" + nameof(keywords) + "参数错误"
                };
                return(new ContentResult()
                {
                    Content = err.toJosnString(), ContentType = ConstantTypeString.JsonContentType, StatusCode = err.HttpStatusCode
                });
            }

            try
            {
                List <recruit_user> temp = null;
                var pages = string.Empty;
                var p     = new EFPaging <recruit_user>();
                if (com_type.Equals("com_name"))
                {
                    var q = dbContext.recruit_user.Where(x => x.auth_role.Equals("company") && x.company_name.Contains(keywords)).OrderBy(x => x.addtime);
                    temp  = p.getPageList(q, string.Format("/api/Recruit/search_company_list?com_type={0}&keywords={1}", com_type, keywords), page);
                    pages = p.pageAjaxHref;
                }
                else if (com_type.Equals("com_code"))
                {
                    var q = dbContext.recruit_user.Where(x => x.auth_role.Equals("company") && x.company_code.Contains(keywords)).OrderBy(x => x.addtime);
                    temp  = p.getPageList(q, string.Format("/api/Recruit/search_company_list?com_type={0}&keywords={1}", com_type, keywords), page);
                    pages = p.pageAjaxHref;
                }
                else if (com_type.Equals("com_addr"))
                {
                    var q = dbContext.recruit_user.Where(x => x.auth_role.Equals("company") && x.company_address.Contains(keywords)).OrderBy(x => x.addtime);
                    temp  = p.getPageList(q, string.Format("/api/Recruit/search_company_list?com_type={0}&keywords={1}", com_type, keywords), page);
                    pages = p.pageAjaxHref;
                }


                List <object> list = new List <object>();
                temp.ForEach(x =>
                {
                    var a = new
                    {
                        x.company_address,
                        x.company_code,
                        x.company_contact,
                        x.company_name,
                        x.uuid,
                        jobs = dbContext.job_type.Where(m => m.user_id.Equals(x.uuid) && m.is_enabled == true)
                               .Select(t => new { t.uuid, t.job_name }).ToList(),
                        job_id = string.Empty   // 绑定下拉框的字段, 占位用的
                    };
                    list.Add(a);
                });

                return(Json(new { list, pages }));
            }
            catch (DbUpdateException dbex)
            {
                if (dbex.InnerException is PostgresException npge)
                {
                    err = new ErrorRequestData()
                    {
                        HttpStatusCode = 500, ErrorMessage = npge.Detail
                    };
                }
                else
                {
                    err = new ErrorRequestData()
                    {
                        HttpStatusCode = 500, ErrorMessage = dbex.Message
                    };
                }
                return(new ContentResult()
                {
                    StatusCode = err.HttpStatusCode, Content = err.toJosnString(), ContentType = ConstantTypeString.JsonContentType
                });
            }
            catch (Exception ex)
            {
                err = new ErrorRequestData()
                {
                    HttpStatusCode = 500, ErrorMessage = ex.Message
                };
                return(new ContentResult()
                {
                    StatusCode = err.HttpStatusCode, Content = err.toJosnString(), ContentType = ConstantTypeString.JsonContentType
                });
            }
        }