Esempio n. 1
0
        public ActionResult GetRelatedUserZy(int pageIndex, int pageSize)
        {
            int totalCount = 0;

            int[]         RUsers = B_User.GetRelatedUser(UserId);
            List <dto_Zy> list   = B_Zy.GetZyList(RUsers, pageIndex, pageSize, out totalCount);

            if (list != null)
            {
                List <int> ids = B_Answer.GetSubmitedZyIds(UserId, list.Select(a => a.Id).ToArray());
                foreach (var l in list)
                {
                    l.NewId = IdNamingHelper.Encrypt(IdNamingHelper.IdTypeEnum.Zy, l.Id);
                    string subName = "";
                    Const.Subjects.TryGetValue(l.SubjectId, out subName);
                    l.SubjectName = subName;
                    l.TypeName    = l.Type == 0 ? "题库" : "自传";
                    dto_User u = B_UserRedis.GetUser(l.UserId);
                    l.UserName = u.UserName;
                    l.TrueName = u.TrueName;
                    l.Submited = ids == null ? false : ids.Exists(a => a == l.Id);
                    //隐藏真实Id
                    l.Id = 0;
                }
            }
            ViewBag.RelateUserCount = RUsers == null ? 0 : RUsers.Length;
            ViewBag.ZyList          = list;
            ViewBag.PageCount       = Util.GetTotalPageCount(totalCount, pageSize);
            return(PartialView());
        }
Esempio n. 2
0
        /// <summary>
        /// 获取已提交作业
        /// </summary>
        /// <param name="lastId"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public ActionResult GetSubmitedZy(long lastId, int count)
        {
            int           last = lastId == 0 ? 99999999 : IdNamingHelper.Decrypt(IdNamingHelper.IdTypeEnum.Zy, lastId);
            List <dto_Zy> list = null;
            List <int>    ids  = B_Answer.GetSubmitedZyIds(UserId, last, count);

            if (ids != null)
            {
                list = new List <dto_Zy>();
                ids.ForEach(a =>
                {
                    list.Add(B_ZyRedis.GetZy(a));
                });
            }
            if (list != null)
            {
                foreach (var l in list)
                {
                    //隐藏真实Id
                    l.NewId = IdNamingHelper.Encrypt(IdNamingHelper.IdTypeEnum.Zy, l.Id);

                    dto_User u = B_UserRedis.GetUser(l.UserId);
                    l.UserName = u.UserName;
                    l.TrueName = u.TrueName;
                    l.Id       = 0;
                }
            }

            ViewBag.ZyList = list;
            return(PartialView());
        }
Esempio n. 3
0
        public ActionResult GetSubmitedZy(int pageIndex, int pageSize)
        {
            int           totalCount = 0;
            List <dto_Zy> list       = null;
            List <int>    ids        = B_Answer.GetSubmitedZyIds(UserId, pageIndex, pageSize, out totalCount);

            if (ids != null)
            {
                list = new List <dto_Zy>();
                ids.ForEach(a =>
                {
                    list.Add(B_ZyRedis.GetZy(a));
                });
            }
            if (list != null)
            {
                foreach (var l in list)
                {
                    //隐藏真实Id
                    l.NewId = IdNamingHelper.Encrypt(IdNamingHelper.IdTypeEnum.Zy, l.Id);

                    dto_User u = B_UserRedis.GetUser(l.UserId);
                    l.UserName = u.UserName;
                    l.TrueName = u.TrueName;
                    l.Id       = 0;
                }
            }

            ViewBag.ZyList    = list;
            ViewBag.PageCount = Util.GetTotalPageCount(totalCount, pageSize);
            return(PartialView());
        }
Esempio n. 4
0
        /// <summary>
        /// 本班同学
        /// </summary>
        /// <returns></returns>
        public ActionResult MyClassmates()
        {
            dto_User      u    = B_UserRedis.GetUser(UserId);
            List <T_User> list = B_User.GetClassmates(u.SchoolId, u.GradeId, u.ClassId);

            ViewBag.List = list;
            return(PartialView());
        }
Esempio n. 5
0
        public JsonResult GetReplyById(int id)
        {
            dto_Reply r = B_Topic.GetReplyById(id);

            if (r != null)
            {
                T_User u = B_UserRedis.GetUser(r.UserId);
                r.UserName = u == null ? "" : u.UserName;
            }
            return(Json(r));
        }
Esempio n. 6
0
        public baseController()
        {
            string DesUserModel = Util.GetCookie("easyzy.user", "useridentity");
            string DesKey       = Util.GetAppSetting("DesKey");

            UserCookieHelper.UserCookieModel u = UserCookieHelper.DescryptUserCookie(DesUserModel, DesKey);

            UserId = u._id;
            if (UserId != 0)
            {
                UserInfo = B_UserRedis.GetUser(UserId);
            }
            ViewBag.UserInfo = UserInfo;
        }
Esempio n. 7
0
        public ActionResult GetUserInfo()
        {
            dto_User UserInfo = B_UserRedis.GetUser(UserId);

            ViewBag.UserInfo = UserInfo;

            if (UserInfo.SchoolId == 0)
            {
                ViewBag.Provinces = Const.Provinces;
            }

            ViewBag.Grades = Const.Grades;

            return(PartialView());
        }
Esempio n. 8
0
        public JsonResult GetTop5Topics()
        {
            DateTime         FirstCycleDay = DateTime.Now.AddDays(1 - Convert.ToInt32(DateTime.Now.DayOfWeek.ToString("d"))).Date;
            List <dto_Topic> tl            = B_Topic.GetTop5Topics(FirstCycleDay);

            if (tl != null)
            {
                foreach (var t in tl)
                {
                    t.CreateDateString = t.CreateDate.ToString("yyyy-MM-dd HH:mm:ss");
                    T_User u = B_UserRedis.GetUser(t.UserId);
                    t.UserName = u == null ? "" : u.UserName;
                    t.TrueName = u == null ? "" : u.TrueName;
                }
            }
            return(Json(tl));
        }
Esempio n. 9
0
        /// <summary>
        /// 我的关注
        /// </summary>
        /// <returns></returns>
        public ActionResult MyRelation()
        {
            //关注列表
            List <dto_RelateUser> list = B_User.GetRelateUser(UserId);

            if (list != null)
            {
                foreach (var l in list)
                {
                    T_User u = B_UserRedis.GetUser(l.RUserId);
                    l.RUserName = u.UserName;
                    l.RTrueName = u.TrueName;
                }
            }
            ViewBag.List = list;
            return(PartialView());
        }
Esempio n. 10
0
        /// <summary>
        /// 查看详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult detail(int id)
        {
            dto_Topic t = B_Topic.GetTopic(id);

            if (t != null)
            {
                T_User u = B_UserRedis.GetUser(t.UserId);
                t.UserName = u == null ? "" : u.UserName;
                t.TrueName = u == null ? "" : u.TrueName;
                string GradeName = "", SubjectName = "";
                Const.Grades.TryGetValue(t.GradeId, out GradeName);
                Const.Subjects.TryGetValue(t.SubjectId, out SubjectName);
                t.GradeName   = GradeName;
                t.SubjectName = SubjectName;
            }
            ViewBag.TopicInfo = t;
            return(View());
        }
Esempio n. 11
0
        public ActionResult GetReplyList(int id, int pageIndex, int pageSize)
        {
            int totalCount = 0;
            var ReplyList  = B_Topic.GetReplyList(id, pageSize, pageIndex, out totalCount);

            if (ReplyList != null)
            {
                foreach (var r in ReplyList)
                {
                    T_User u = B_UserRedis.GetUser(r.UserId);
                    r.UserName = u == null ? "" : u.UserName;
                    r.TrueName = u == null ? "" : u.TrueName;
                }
            }
            ViewBag.pageIndex = pageIndex;
            ViewBag.PageCount = Util.GetTotalPageCount(totalCount, pageSize);
            ViewBag.ReplyList = ReplyList;
            return(PartialView());
        }
Esempio n. 12
0
        public BaseController()
        {
            string DesUserModel = Util.GetCookie("easyzy.user", "useridentity");
            string DesKey       = Util.GetAppSetting("DesKey");

            UserCookieHelper.UserCookieModel u = UserCookieHelper.DescryptUserCookie(DesUserModel, DesKey);

            UserId = u._id;
            int invites = 0;

            if (UserId != 0)
            {
                UserInfo = B_UserRedis.GetUser(UserId);
                invites  = B_Topic.GetInviteCount(UserInfo.UserName);
            }

            ViewBag.UserInfo = UserInfo;
            ViewBag.Invites  = invites;
        }
Esempio n. 13
0
        public JsonResult GetTop5Activities()
        {
            DateTime FirstCycleDay   = DateTime.Now.AddDays(1 - Convert.ToInt32(DateTime.Now.DayOfWeek.ToString("d"))).Date;
            Dictionary <int, int> d  = B_Topic.GetTop5Activities(FirstCycleDay);
            List <dto_KeyValue>   d2 = new List <dto_KeyValue>();

            if (d != null)
            {
                foreach (var s in d)
                {
                    T_User t = B_UserRedis.GetUser(s.Key);
                    d2.Add(new dto_KeyValue()
                    {
                        key = string.Concat(t == null ? "" : string.Concat(t.UserName, "【", t.TrueName, "】")), value = s.Value.ToString()
                    });
                }
            }
            return(Json(d2));
        }
Esempio n. 14
0
        /// <summary>
        /// 修改学校信息,如果已经被改过,则不能重复修改
        /// </summary>
        /// <param name="userClass"></param>
        /// <returns></returns>
        public int UpdateUserSchool(int provinceId, int cityId, int districtId, int schoolId)
        {
            if (provinceId == 0 || cityId == 0 || districtId == 0 || schoolId == 0)
            {
                return(1);
            }
            dto_User du = B_UserRedis.GetUser(UserId);

            if (du.SchoolId != 0)
            {
                return(1);
            }
            if (B_User.UpdateSchool(UserId, provinceId, cityId, districtId, schoolId))
            {
                B_UserRedis.ReloadUserCache(UserId);
                return(0);
            }
            return(1);
        }
Esempio n. 15
0
        public JsonResult AddModifyRequest(int schoolId, string reason)
        {
            dto_User u = B_UserRedis.GetUser(UserId);

            dto_ModifyRequest mr = new dto_ModifyRequest()
            {
                UserId = UserId, FromSchoolId = u.SchoolId, ToSchoolId = schoolId, Reason = reason, CreateDate = DateTime.Now, Status = 0
            };
            int i = B_User.AddModifyRequest(mr);

            if (i != 0)
            {
                mr.Id             = i;
                mr.CreateDateStr  = mr.CreateDate.ToString("yyyy-MM-dd HH:mm:ss");
                mr.FromSchoolName = B_BaseRedis.GetSchool(mr.FromSchoolId).SchoolName;
                mr.ToSchoolName   = B_BaseRedis.GetSchool(mr.ToSchoolId).SchoolName;
                return(Json(mr));
            }
            return(null);
        }
Esempio n. 16
0
        /// <summary>
        /// 关注我的
        /// </summary>
        /// <returns></returns>
        public ActionResult RelateMe()
        {
            //被关注列表
            List <dto_RelateUser> list = B_User.GetBeRelatedUser(UserId);

            if (list != null)
            {
                foreach (var l in list)
                {
                    T_User u = B_UserRedis.GetUser(l.UserId);
                    l.UserName = u.UserName;
                    l.TrueName = u.TrueName;
                }
            }
            ViewBag.List = list;

            T_UserExtend tue = B_User.GetUserExtend(UserId);

            ViewBag.Extend = tue;
            return(PartialView());
        }
Esempio n. 17
0
        /// <summary>
        /// 提交统计
        /// </summary>
        /// <param name="zyId"></param>
        /// <returns></returns>
        public ActionResult GetSubmitBar(long zyId, int schoolId, int gradeId, int classId)
        {
            int id = IdNamingHelper.Decrypt(IdNamingHelper.IdTypeEnum.Zy, zyId);

            dto_Echart_Bar deb = B_Analyze.GetStudentPoint(id, schoolId, gradeId, classId);

            if (deb != null)
            {
                for (int i = 0; i < deb.x.Count; i++)
                {
                    if (deb.x[i] == "0")
                    {
                        deb.x[i] = "试用学生";
                    }
                    else
                    {
                        string tname = B_UserRedis.GetUser(int.Parse(deb.x[i])).TrueName;
                        deb.x[i] = string.IsNullOrEmpty(tname) ? "未设姓名" : tname;
                    }
                }

                ViewBag.xData = string.Join(",", deb.x);
                ViewBag.yData = string.Join(",", deb.y);
            }
            int ObjectiveCount = JsonConvert.DeserializeObject <List <dto_ZyQuestion> >(B_ZyRedis.GetQdbZyQuesJson(id)).Count(a => Const.OBJECTIVE_QUES_TYPES.Contains(a.PTypeId));

            ViewBag.ObjectiveCount = ObjectiveCount;
            int SubmitCount = deb == null ? 0 : deb.x.Count;

            ViewBag.SubmitCount = SubmitCount;
            double ScoreRate = 0;

            ScoreRate         = (SubmitCount == 0 || ObjectiveCount == 0 || deb == null) ? 0 : Math.Round((deb.y.Sum(a => int.Parse(a)) * 1.0 / (ObjectiveCount * SubmitCount)), 4) * 100;
            ViewBag.ScoreRate = ScoreRate;
            dto_Zy zy = B_ZyRedis.GetZy(id);

            ViewBag.InTime   = deb == null ? 0 : deb.o.Count(a => a <= zy.DueDate);
            ViewBag.OverTime = deb == null ? 0 : deb.o.Count(a => a > zy.DueDate);
            return(PartialView());
        }
Esempio n. 18
0
        public ActionResult gettopics(int gradeId, int subjectId, int pageIndex, int pageSize)
        {
            int totalCount      = 0;
            List <dto_Topic> tl = B_Topic.GetTopics(gradeId, subjectId, pageIndex, pageSize, out totalCount);

            if (tl != null)
            {
                foreach (var t in tl)
                {
                    T_User u = B_UserRedis.GetUser(t.UserId);
                    t.UserName = u == null ? "" : u.UserName;
                    t.TrueName = u == null ? "" : u.TrueName;
                    string GradeName = "", SubjectName = "";
                    Const.Grades.TryGetValue(t.GradeId, out GradeName);
                    Const.Subjects.TryGetValue(t.SubjectId, out SubjectName);
                    t.GradeName   = GradeName;
                    t.SubjectName = SubjectName;
                }
            }
            ViewBag.List      = tl;
            ViewBag.PageCount = Util.GetTotalPageCount(totalCount, pageSize);
            return(PartialView());
        }