Пример #1
0
        /// <summary>
        /// 得到荣耀感悟和荣耀建议
        /// </summary>
        /// <returns></returns>
        public ActionResult GetHonorInfo()
        {
            string     jsonTxt         = "";
            HttpCookie loginUserCookie = Request.Cookies["loginUserInfo"];

            if (loginUserCookie != null)
            {
                string userAccount = loginUserCookie.Values["loginUserAccount"];
                int    honorId     = Convert.ToInt32(Request["HonorId"]);
                string useraccount = Request["userAccount"];
                string userPwd     = Request["userPwd"];
                string userName    = Request["userName"];
                if (honorId != null && userAccount == useraccount)//honorID有值并且账号一致
                {
                    try
                    {
                        var    userInfo = UserService.LoadEntities(u => u.vcUserAccount == useraccount).FirstOrDefault();
                        string userpwd  = userInfo.vcPassWord;
                        if (userPwd == userpwd)
                        {
                            var honor = HonorparticipantmemberService.LoadEntities(hp => hp.iHonorID == honorId && hp.iUserID == userInfo.ID).FirstOrDefault();
                            if (honor != null)
                            {
                                status  = "ok";
                                jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
                            }
                            else
                            {
                                status  = "no";
                                jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
                            }
                        }
                        else  //密码不一致
                        {
                            status  = "no";
                            jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
                        }
                    }
                    catch (Exception ex)
                    {
                        status  = "no";
                        jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
                    }
                }
                else
                {
                    status  = "no";
                    jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
                }
            }
            else  //未登录
            {
                status  = "no";
                jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
            }
            return(Content(jsonTxt));
        }
Пример #2
0
        /// <summary>
        /// 往荣耀成员表中添加荣耀建议和荣耀感悟
        /// </summary>
        /// <returns></returns>
        public ActionResult AddHonorInfo()
        {
            string     jsonTxt         = "";
            HttpCookie loginUserCookie = Request.Cookies["loginUserInfo"];

            if (loginUserCookie != null)
            {
                string userAccount    = loginUserCookie.Values["loginUserAccount"];
                int    honorId        = Convert.ToInt32(Request["honorId"]);
                var    userInfo       = UserService.LoadEntities(u => u.vcUserAccount == userAccount).FirstOrDefault();
                string perHonorFeel   = Request["HonorFell"];
                string perHonorAdvice = Request["HonorAdvice"];
                try
                {
                    var honorPerInfo = HonorparticipantmemberService.LoadEntities(hp => hp.iHonorID == honorId && hp.iUserID == userInfo.ID).FirstOrDefault();
                    honorPerInfo.vcHonorFeel   = perHonorFeel;
                    honorPerInfo.vcHonorAdvice = perHonorAdvice;
                    if (HonorparticipantmemberService.EditEntity(honorPerInfo))
                    {
                        status  = "ok";
                        jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
                    }
                    else
                    {
                        status  = "no";
                        jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
                    }
                }
                catch (Exception ex)
                {
                    status  = "no";
                    jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
                }
            }
            else  //未登录
            {
                status  = "no";
                jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
            }
            return(Content(jsonTxt));
        }
Пример #3
0
        /// <summary>
        /// 加载单个荣耀页面
        /// </summary>
        /// <returns></returns>
        public ActionResult GetSingleHonor()
        {
            string jsonTxt = null;

            Model.ViewModel.HonorStripModel.SingleHonor singleHonor = new Model.ViewModel.HonorStripModel.SingleHonor();
            List <int> userId  = new List <int>();
            int        HonorId = Request["HonorId"] != null?int.Parse(Request["HonorId"]) : 1;

            try
            {
                var honor = HonorService.LoadEntities(h => h.ID == HonorId && h.bReviewOfWorks == true && h.IsDel == false).FirstOrDefault();//获取团队表中的信息
                if (honor != null)
                {
                    var team = TeamService.LoadEntities(t => t.ID == honor.iTeamID && t.bCheckedcounselor == true && t.bCheckedTeacher == true && t.IsDel == false).FirstOrDefault();
                    singleHonor.teamName       = team.vcTeamName;
                    singleHonor.honorName      = honor.vcHonorName;
                    singleHonor.honorSlider    = honor.vcHonorSliderAddress;
                    singleHonor.guidTeacher    = honor.vcGuideTeacher;
                    singleHonor.honorIntroduce = honor.vcHonorIntroduce;
                    singleHonor.honorSubmit    = (DateTime)honor.dSubmitTime;
                    if ((bool)honor.bReviewOfWorks)
                    {
                        singleHonor.check = "已审核";
                    }
                    else
                    {
                        singleHonor.check = "未审核";
                    }
                    singleHonor.netLocation      = honor.vcNetConnectAddress;
                    singleHonor.downLoadLoaction = honor.vcDownLoadAddress;
                    var honorMember = HonorparticipantmemberService.LoadEntities(hm => hm.iHonorID == honor.ID && hm.IsDel == false).ToList();
                    foreach (var member in honorMember)
                    {
                        singleHonor.unperHonorName = member.vcNonTeamMember;
                        userId.Add((int)member.iUserID);
                    }

                    List <Model.ViewModel.HonorStripModel.SInglePerson> perList = new List <Model.ViewModel.HonorStripModel.SInglePerson>();
                    var perInfoList = PersonalinformationService.LoadPersonalInformationList(userId).ToList();

                    foreach (var perInfo in perInfoList)
                    {
                        Model.ViewModel.HonorStripModel.SInglePerson singlePer = new Model.ViewModel.HonorStripModel.SInglePerson();
                        singlePer.singlePersonId = perInfo.ID;
                        singlePer.perName        = perInfo.vcName;
                        singlePer.gender         = perInfo.vcGender;
                        singlePer.phone          = perInfo.cPhone;
                        singlePer.perIntroduce   = perInfo.vcPersonalIntroduce;
                        singlePer.perHobby       = perInfo.vcHobby;
                        var user = UserService.LoadEntities(u => u.ID == perInfo.iUserID && u.IsDel == false).FirstOrDefault();
                        singlePer.perLogo = user.vcProfilePhotoAddress;
                        var register = RegisterloginService.LoadEntities(r => r.iUserID == perInfo.iUserID && r.IsDel == false).FirstOrDefault();
                        if (register != null)
                        {
                            if ((int)register.iIdentity == 0)
                            {
                                singlePer.position = "普通用户";
                            }
                            else if ((int)register.iIdentity == (int)Model.EnumType.IdentityEnumType.Member)
                            {
                                singlePer.position = "队员";
                            }
                            else if ((int)register.iIdentity == (int)Model.EnumType.IdentityEnumType.Captain)
                            {
                                singlePer.position = "队长";
                            }
                            else if ((int)register.iIdentity == (int)Model.EnumType.IdentityEnumType.Teacher)
                            {
                                singlePer.position = "老师";
                            }
                            else
                            {
                                singlePer.position = "管理员";
                            }
                        }
                        else
                        {
                            singlePer.position = "游客";
                        }
                        perList.Add(singlePer);
                    }
                    Model.ViewModel.HonorStripModel.SingleModel model = new Model.ViewModel.HonorStripModel.SingleModel();
                    model.singleHonor  = singleHonor;
                    model.singlePerson = perList;
                    var timerConverter = new IsoDateTimeConverter {
                        DateTimeFormat = "yyyy-MM-dd"
                    };
                    jsonTxt = JsonConvert.SerializeObject(model, Newtonsoft.Json.Formatting.Indented);
                }
                else
                {
                    jsonTxt = "空空如也";
                }
            }
            catch (Exception ex)
            {
                jsonTxt = "网络不稳定,请稍后重试" + ex.ToString();
            }
            return(Content(jsonTxt));
        }
Пример #4
0
        /// <summary>
        /// 个人信息展示
        /// </summary>
        /// <returns></returns>
        public ActionResult ShowPerson()
        {
            string jsonTxt = "";
            /// <summary>
            /// 根据Cookie拿到UserID
            /// </summary>
            HttpCookie loginUserCookie = Request.Cookies["loginUserInfo"];
            string     strId           = Request["userId"];

            if (loginUserCookie != null && strId != null)
            {
                Model.ViewModel.PerStripModel.PerInfo perInfo = new Model.ViewModel.PerStripModel.PerInfo();
                int userId = Convert.ToInt32(strId);
                /// <summary>
                /// 根据UserId拿到所有与UserId对应的HonorId
                /// </summary>
                try
                {
                    var per  = PersonalinformationService.LoadEntities(p => p.iUserID == userId).FirstOrDefault();
                    var user = UserService.LoadEntities(u => u.ID == userId).FirstOrDefault();
                    if (per != null && user != null)
                    {
                        perInfo.perEmail        = per.vcEmail;
                        perInfo.perGrade        = per.vcGrade;
                        perInfo.perMajor        = per.vcMajor;
                        perInfo.perName         = per.vcName;
                        perInfo.perNickName     = user.vcNickName;
                        perInfo.perPhone        = per.cPhone;
                        perInfo.perPhotoAddress = user.vcProfilePhotoAddress;
                        perInfo.perQQ           = per.vcQQ;
                        perInfo.perWechat       = per.vcWeChat;
                        perInfo.perIntroduce    = per.vcPersonalIntroduce;
                        perInfo.perHobby        = per.vcHobby;
                        Model.ViewModel.PerStripModel.PerHonorModel model = new Model.ViewModel.PerStripModel.PerHonorModel();
                        model.perInfo = perInfo;
                        jsonTxt       = JsonConvert.SerializeObject(model, Newtonsoft.Json.Formatting.Indented);
                    }
                    var teamapplicant = TeamapplicantService.LoadEntities(ta => ta.iUserID == userId).FirstOrDefault();
                    var team          = TeamService.LoadEntities(t => t.ID == teamapplicant.iTeamID).FirstOrDefault();
                    perInfo.perTeamLogo = team.vcTeamLogoAddress;
                    List <Model.ViewModel.PerStripModel.PerHonor> perHonorList = new List <Model.ViewModel.PerStripModel.PerHonor>();
                    var honorPer = HonorparticipantmemberService.LoadEntities(hp => hp.iUserID == userId).ToList();
                    if (honorPer != null)
                    {
                        foreach (var honorper in honorPer)
                        {
                            Model.ViewModel.PerStripModel.PerHonor perHonor = new Model.ViewModel.PerStripModel.PerHonor();
                            var honorInfo = HonorService.LoadEntities(h => h.ID == honorper.iHonorID).FirstOrDefault();
                            perHonor.honorFell   = honorper.vcHonorFeel;
                            perHonor.honorAdvice = honorper.vcHonorAdvice;
                            if (honorInfo != null)
                            {
                                perHonor.honorId      = honorInfo.ID;
                                perHonor.honorLogo    = honorInfo.vcPreviewAddress;
                                perHonor.honorName    = honorInfo.vcHonorName;
                                perHonor.honorSubmit  = (DateTime)honorInfo.dSubmitTime;
                                perHonor.honorTeacher = honorInfo.vcGuideTeacher;
                                var teamInfo = TeamService.LoadEntities(t => t.ID == honorInfo.iTeamID).FirstOrDefault();
                                if (teamInfo != null)
                                {
                                    perHonor.teamName = teamInfo.vcTeamName;
                                }
                                else
                                {
                                    perHonor.teamName = "数据库无此荣耀团队数据";
                                }
                            }
                            else
                            {
                                perHonor.honorId     = 0;
                                perHonor.honorLogo   = "../img/aboutUs/large/cover.jpg";
                                perHonor.honorName   = "数据库无此荣耀名称数据";
                                perHonor.honorSubmit = DateTime.Now.Date;
                            }
                            perHonorList.Add(perHonor);
                        }
                        Model.ViewModel.PerStripModel.PerHonorModel model = new Model.ViewModel.PerStripModel.PerHonorModel();
                        model.perInfo      = perInfo;
                        model.perHonorList = perHonorList;
                        var timerConverter = new IsoDateTimeConverter {
                            DateTimeFormat = "yyyy-MM-dd"
                        };
                        jsonTxt = JsonConvert.SerializeObject(model, Newtonsoft.Json.Formatting.Indented);
                    }
                    else  //查询数据失败
                    {
                        status  = "no";
                        jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
                    }
                }
                catch (Exception ex)  //网络连接故障
                {
                    if (jsonTxt != null)
                    {
                        return(Content(jsonTxt));
                    }
                    else
                    {
                        status  = "no";
                        jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
                    }
                }
            }
            else //未登录
            {
                status  = "no";
                jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "}";
            }
            return(Content(jsonTxt));
        }
        public ActionResult GetHonorInfo()
        {
            string jsonTxt = "";
            int    HonorId = Request["HonorId"] != null?int.Parse(Request["HonorId"]) : 1;

            try
            {
                var           honorinfo = HonorService.LoadEntities(h => h.ID == HonorId && h.IsDel == false).FirstOrDefault();
                BackHonorInfo honorInfo = new BackHonorInfo();
                honorInfo.honorName     = honorinfo.vcHonorName;
                honorInfo.guidTeacher   = honorinfo.vcGuideTeacher;
                honorInfo.technicalType = honorinfo.vcTechnicalType;
                if ((bool)honorinfo.bReviewOfWorks)
                {
                    honorInfo.isChecked = "已审核";
                }
                else
                {
                    honorInfo.isChecked = "未审核";
                }
                honorInfo.honorSubmit    = (DateTime)honorinfo.dSubmitTime;
                honorInfo.honorIntroduce = honorinfo.vcHonorIntroduce;
                List <int> UserId = new List <int>();
                List <BackHonorInfoPer> HonorInfoPer = new List <BackHonorInfoPer>();
                var honorPer = HonorparticipantmemberService.LoadEntities(hp => hp.iHonorID == honorinfo.ID && hp.IsDel == false).ToList();
                foreach (var honorper in honorPer)
                {
                    UserId.Add((int)honorper.iUserID);
                    honorInfo.NonTeamMember = honorper.vcNonTeamMember;
                }
                foreach (int userId in UserId)
                {
                    BackHonorInfoPer honorInfoPer = new BackHonorInfoPer();
                    var per = PersonalinformationService.LoadEntities(p => p.iUserID == userId && p.IsDel == false).FirstOrDefault();
                    honorInfoPer.Name   = per.vcName;
                    honorInfoPer.Gender = per.vcGender;
                    honorInfoPer.Grade  = per.vcGrade;
                    honorInfoPer.Major  = per.vcMajor;
                    var reg = RegisterloginService.LoadEntities(r => r.iUserID == userId && r.IsDel == false).FirstOrDefault();
                    if (reg.iIdentity == (int)Model.EnumType.IdentityEnumType.Captain)
                    {
                        honorInfoPer.Identity = "队长";
                    }
                    else if (reg.iIdentity == (int)Model.EnumType.IdentityEnumType.Member)
                    {
                        honorInfoPer.Identity = "队员";
                    }
                    else
                    {
                        honorInfoPer.Identity = "身份出错";
                    }
                    var user = UserService.LoadEntities(u => u.ID == userId && u.IsDel == false).FirstOrDefault();
                    honorInfoPer.Account = user.vcUserAccount;
                    HonorInfoPer.Add(honorInfoPer);
                }
                BackHonorInfoModel HonorInfoModel = new BackHonorInfoModel();
                HonorInfoModel.HonorInfo    = honorInfo;
                HonorInfoModel.HonorInfoPer = HonorInfoPer;
                var timerConverter = new IsoDateTimeConverter {
                    DateTimeFormat = "yyyy-MM-dd"
                };
                jsonTxt = JsonConvert.SerializeObject(HonorInfoModel, Newtonsoft.Json.Formatting.Indented);
            }
            catch (Exception ex)
            {
                jsonTxt = "no" + ex.ToString();
            }
            return(Content(jsonTxt));
        }