Пример #1
0
        /// <summary>
        /// 个人信息
        /// </summary>
        /// <returns></returns>
        public ActionResult AddPerIntroduce()
        {
            string jsonTxt = "";

            try
            {
                string datasize            = Request["perInfoJson"];
                JavaScriptSerializer jss   = new JavaScriptSerializer();
                PerInfo    perInfoSize     = jss.Deserialize <PerInfo>(datasize);
                HttpCookie loginUserCookie = Request.Cookies["loginUserInfo"];
                int        userId          = Convert.ToInt32(loginUserCookie.Values["loginUserId"]);//用户的ID
                var        userInfo        = UserService.LoadEntities(u => u.ID == userId).FirstOrDefault();
                userInfo.vcNickName = perInfoSize.nickName;
                if (UserService.EditEntity(userInfo))
                {
                    var per = PersonalinformationService.LoadEntities(p => p.iUserID == userId).FirstOrDefault();
                    //把个人信息添加到数据库中
                    per.vcName              = perInfoSize.name;
                    per.cPhone              = perInfoSize.phone;
                    per.vcGender            = perInfoSize.gender;
                    per.dBirthday           = perInfoSize.birthday;
                    per.vcWeChat            = perInfoSize.wechat;
                    per.vcEmail             = perInfoSize.Email;
                    per.vcQQ                = perInfoSize.QQ;
                    per.vcHobby             = perInfoSize.hobby;
                    per.vcPersonalIntroduce = perInfoSize.introduce;
                    per.vcAddress           = perInfoSize.address;
                    per.vcMajor             = perInfoSize.major;
                    per.vcGrade             = perInfoSize.grade;
                    per.IsDel               = false;
                    if (PersonalinformationService.EditEntity(per))
                    {
                        status  = "ok";
                        result  = "添加成功";
                        jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "," + "\"" + "result" + "\"" + ":" + "\"" + result + "\"" + "}";
                    }
                    else
                    {
                        status  = "no";
                        result  = "添加失败";
                        jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "," + "\"" + "result" + "\"" + ":" + "\"" + result + "\"" + "}";
                    }
                }
                else
                {
                    status  = "no";
                    result  = "请先登录";
                    jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "," + "\"" + "result" + "\"" + ":" + "\"" + result + "\"" + "}";
                }
            }
            catch (Exception ex)
            {
                status  = "no";
                result  = "添加失败";
                jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "," + "\"" + "result" + "\"" + ":" + "\"" + result + "\"" + "}";
            }
            return(Content(jsonTxt));
        }
Пример #2
0
        /// <summary>
        /// 获取全部个人信息
        /// </summary>
        /// <returns></returns>
        public ActionResult GetPersonList()
        {
            string jsonTxt   = "";
            string id        = Request["personId"];
            int    pageIndex = Request["currentPage"] != null?int.Parse(Request["currentPage"]) : 1; //当前页数

            int pageSize = Request["PageSize"] != null?int.Parse(Request["PageSize"]) : 1;           //一页有几条数据

            int  totalCount;                                                                         //总页数
            bool?Istrue = false;

            if (id != null)
            {
                try
                {
                    var PersonInfoList = PersonalinformationService.LoadPageEntities <int>(pageIndex, pageSize, out totalCount, p => p.IsDel == Istrue, p => p.ID, true).ToList();
                    List <BackPersonInfo> perInfoList = new List <BackPersonInfo>();
                    foreach (var persons in PersonInfoList)
                    {
                        BackPersonInfo perInfo = new BackPersonInfo();
                        perInfo.UserId = persons.ID;
                        perInfo.Name   = persons.vcName;
                        var user = UserService.LoadEntities(u => u.ID == persons.iUserID).FirstOrDefault();
                        perInfo.UserName            = user.vcNickName;
                        perInfo.ProfilePhotoAddress = user.vcProfilePhotoAddress;
                        perInfo.Gender            = persons.vcGender;
                        perInfo.Birthday          = (DateTime)persons.dBirthday;
                        perInfo.Major             = persons.vcMajor;
                        perInfo.PersonalIntroduce = persons.vcPersonalIntroduce;
                        perInfoList.Add(perInfo);
                    }
                    BackPersonModel model = new BackPersonModel();
                    model.PersonInfoList = perInfoList;
                    model.totalPage      = pageSize;
                    model.PageNavigate   = Common.PageBarHelper.CreatePageNavigator(pageSize, pageIndex, totalCount);//调用分页的方法
                    var timerConverter = new IsoDateTimeConverter {
                        DateTimeFormat = "yyyy-MM-dd"
                    };
                    jsonTxt = JsonConvert.SerializeObject(model, Newtonsoft.Json.Formatting.Indented);
                }
                catch (Exception ex)
                {
                    throw;
                    jsonTxt = "no";
                }
            }
            else
            {
                jsonTxt = "no";
            }
            return(Content(jsonTxt));
        }
Пример #3
0
        /// <summary>
        /// 获取一个人的全部个人信息
        /// </summary>
        /// <returns></returns>
        public ActionResult ManagePersonPageHead()
        {
            string jsonTxt = "";
            string id      = Request["personId"];

            if (id != null)
            {
                try
                {
                    int            perId   = Convert.ToInt32(id);
                    var            persons = PersonalinformationService.LoadEntities(p => p.ID == perId).FirstOrDefault();
                    BackPersonInfo perInfo = new BackPersonInfo();
                    //perInfo.TeamName = "BAR团队";
                    var team = TeamService.LoadEntities(t => t.ID == persons.iUserID).FirstOrDefault();
                    perInfo.TeamName = team.vcTeamName;
                    perInfo.Name     = persons.vcName;
                    var user1 = UserService.LoadEntities(u => u.ID == persons.iUserID).FirstOrDefault();
                    perInfo.ProfilePhotoAddress = user1.vcProfilePhotoAddress;
                    perInfo.UserAccount         = user1.vcUserAccount;
                    perInfo.UserName            = user1.vcNickName;
                    perInfo.Gender            = persons.vcGender;
                    perInfo.Grade             = persons.vcGrade;
                    perInfo.Birthday          = (DateTime)persons.dBirthday;
                    perInfo.Major             = persons.vcMajor;
                    perInfo.WeChat            = persons.vcWeChat;
                    perInfo.QQ                = persons.vcQQ;
                    perInfo.Email             = persons.vcEmail;
                    perInfo.Phone             = persons.cPhone;
                    perInfo.PersonalIntroduce = persons.vcPersonalIntroduce;
                    perInfo.Hobby             = persons.vcHobby;
                    perInfo.Address           = persons.vcAddress;
                    BackPersonModel model = new BackPersonModel();
                    model.PersonInfoList = perInfoList;
                    var timerConverter = new IsoDateTimeConverter {
                        DateTimeFormat = "yyyy-MM-dd"
                    };
                    jsonTxt = JsonConvert.SerializeObject(model, Newtonsoft.Json.Formatting.Indented);
                }
                catch (Exception ex)
                {
                    jsonTxt = "no";
                }
            }
            else
            {
                jsonTxt = "no";
            }
            return(Content(jsonTxt));
        }
Пример #4
0
        /// <summary>
        /// 获取个人信息  get请求
        /// </summary>
        /// <returns></returns>
        public ActionResult GetPerInfo()
        {
            string     jsonTxt         = "";
            HttpCookie loginUserCookie = Request.Cookies["loginUserInfo"];

            if (loginUserCookie != null)
            {
                int userId = Convert.ToInt32(loginUserCookie.Values["loginUserId"]);
                var per    = PersonalinformationService.LoadEntities(p => p.iUserID == userId).FirstOrDefault();
                var user   = UserService.LoadEntities(u => u.ID == userId).FirstOrDefault();
                if (per != null && user != null)
                {
                    Per perInfo = new Per();
                    if (!String.IsNullOrEmpty(user.vcNickName))
                    {
                        perInfo.nickName = user.vcNickName;
                    }
                    if (!String.IsNullOrEmpty(per.vcName))
                    {
                        perInfo.name = per.vcName;
                    }
                    if (!String.IsNullOrEmpty(user.vcProfilePhotoAddress))
                    {
                        perInfo.perLogo = user.vcProfilePhotoAddress;
                    }
                    if (!String.IsNullOrEmpty(per.vcGender))
                    {
                        perInfo.gender = per.vcGender;
                    }
                    if (!String.IsNullOrEmpty(per.vcGrade))
                    {
                        perInfo.grade = per.vcGrade;
                    }
                    if (!String.IsNullOrEmpty(per.vcMajor))
                    {
                        perInfo.major = per.vcMajor;
                    }
                    if (per.dBirthday != null)
                    {
                        perInfo.birthday = (DateTime)per.dBirthday;
                    }
                    if (!String.IsNullOrEmpty(per.cPhone))
                    {
                        perInfo.phone = per.cPhone;
                    }
                    if (!String.IsNullOrEmpty(per.vcWeChat))
                    {
                        perInfo.wechat = per.vcWeChat;
                    }
                    if (!String.IsNullOrEmpty(per.vcQQ))
                    {
                        perInfo.QQ = per.vcQQ;
                    }
                    if (!String.IsNullOrEmpty(per.vcEmail))
                    {
                        perInfo.Email = per.vcEmail;
                    }
                    if (!String.IsNullOrEmpty(per.vcHobby))
                    {
                        perInfo.hobby = per.vcHobby;
                    }
                    if (!String.IsNullOrEmpty(per.vcAddress))
                    {
                        perInfo.address = per.vcAddress;
                    }
                    if (!String.IsNullOrEmpty(per.vcPersonalIntroduce))
                    {
                        perInfo.introduce = per.vcPersonalIntroduce;
                    }
                    var timerConverter = new IsoDateTimeConverter {
                        DateTimeFormat = "yyyy-MM-dd"
                    };
                    jsonTxt = JsonConvert.SerializeObject(perInfo, Newtonsoft.Json.Formatting.Indented);
                }
                else  //未找到数据
                {
                    status  = "no";
                    result  = "未找到数据";
                    jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "," + "\"" + "result" + "\"" + ":" + "\"" + result + "\"" + "}";
                }
            }
            else //未登录
            {
                status  = "no";
                result  = "未登录";
                jsonTxt = "{" + "\"" + "status" + "\"" + ":" + "\"" + status + "\"" + "," + "\"" + "result" + "\"" + ":" + "\"" + result + "\"" + "}";
            }
            return(Content(jsonTxt));
        }
Пример #5
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));
        }
Пример #6
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));
        }