Ejemplo n.º 1
0
        /// <summary>
        /// 头像上传
        /// </summary>
        /// <returns></returns>
        public ActionResult UploadIcon()
        {
            var    file     = Request.Files["file"];
            String filePath = System.Configuration.ConfigurationManager.AppSettings["DefaultIconSavePath"];
            string dirPath  = Request.MapPath(filePath);

            if (Common.FileUpload.FileHelper.ImageUpload(file, dirPath, filePath, out string fileName))
            {
                OrganizeInfo organizeInfo = OrganizeInfoService.GetEntities(u => u.OrganizeInfoID == LoginOrganize.OrganizeInfoID).FirstOrDefault();
                organizeInfo.OrganizeInfoIcon = fileName;
                organizeInfo.ModfiedOn        = DateTime.Now;
                if (OrganizeInfoService.Update(organizeInfo))
                {
                    LoginOrganize.OrganizeInfoIcon = fileName;
                    return(Json(new { src = fileName, msg = "success" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { msg = "fail" }, JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json(new { msg = "fail" }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 2
0
        public ActionResult ResetPwd(int id)
        {
            OrganizeInfo organize = OrganizeInfoService.GetEntities(u => u.OrganizeInfoID == id).FirstOrDefault();

            organize.OrganizeInfoPwd = Common.Encryption.MD5Helper.Get_MD5("000000");
            if (OrganizeInfoService.Update(organize))
            {
                return(Content("success"));
            }
            else
            {
                return(Content("fail"));
            }
        }
Ejemplo n.º 3
0
        //返回页面
        public ActionResult ValName()
        {
            string   loginId  = Request["name"];
            UserInfo userInfo = UserInfoService.GetEntities(u => u.UserInfoLoginId == loginId).FirstOrDefault();

            if (userInfo == null)
            {
                OrganizeInfo organizeInfo = OrganizeInfoService.GetEntities(u => u.OrganizeInfoLoginId == loginId).FirstOrDefault();
                if (organizeInfo == null)
                {
                    return(Content("success"));
                }
            }
            return(Content("fail"));
        }
Ejemplo n.º 4
0
        //注册时进行判断
        public Boolean ValidateName(string loginId)
        {
            bool     flag     = false;
            UserInfo userInfo = UserInfoService.GetEntities(u => u.UserInfoLoginId == loginId).FirstOrDefault();

            if (userInfo == null)
            {
                OrganizeInfo organizeInfo = OrganizeInfoService.GetEntities(u => u.OrganizeInfoLoginId == loginId).FirstOrDefault();
                if (organizeInfo == null)
                {
                    flag = true;
                }
            }
            return(flag);
        }
Ejemplo n.º 5
0
        public ActionResult Edit(int id)
        {
            //非最高等级团队用户欲编辑其他用户信息
            if (LoginOrganize.OrganizeInfoManageId != null && LoginOrganize.OrganizeInfoID != id)
            {
                return(Redirect("/OrganizeInfo/Index"));
            }
            OrganizeInfo organizeInfo = OrganizeInfoService.GetEntities(p => p.OrganizeInfoID == id && p.Status == delNormal).FirstOrDefault();

            if (organizeInfo == null)
            {
                return(Redirect("/OrganizeInfo/Index"));
            }
            return(View(organizeInfo));
        }
Ejemplo n.º 6
0
 public ActionResult OrgIndex()
 {
     if (LoginOrganize.OrganizeInfoManageId == null)
     {
         ViewBag.OrganizeInfoList = OrganizeInfoService.GetEntities(u => u.Status == delNormal && u.OrganizeInfoManageId != null).ToList();
     }
     else
     {
         ViewBag.OrganizeInfoList = new List <OrganizeInfo>()
         {
             LoginOrganize
         };
     }
     return(View());
 }
Ejemplo n.º 7
0
        // GET: Register
        public ActionResult Index()
        {
            var allPolitical = PoliticalService.GetEntities(u => u.Status == delNormal).ToList();

            ViewData["PoliticalList"] = (from u in allPolitical
                                         select new SelectListItem()
            {
                Selected = false, Text = u.PoliticalName, Value = u.PoliticalID + ""
            }).ToList();
            var allOrganizeInfo = OrganizeInfoService.GetEntities(u => u.Status == delNormal && u.OrganizeInfoManageId != null).ToList();

            ViewData["OrganizeInfoList"] = (from u in allOrganizeInfo
                                            select new SelectListItem()
            {
                Selected = false, Text = u.OrganizeInfoShowName, Value = u.OrganizeInfoID + ""
            }).ToList();
            return(View());
        }
Ejemplo n.º 8
0
        public ActionResult Test()
        {
            var allActivityType = ActivityTypeService.GetEntities(u => u.Status == delNormal).AsQueryable();
            var allOrganizeInfo = OrganizeInfoService.GetEntities(u => u.Status == delNormal).AsQueryable();

            ViewBag.ActivityTypeID          = (from u in allActivityType select new SelectListItem()
            {
                Selected = false, Text = u.ActivityTypeName, Value = u.ActivityTypeID + ""
            }).ToList();
            ViewBag.ActivityApplyOrganizeID = (from u in allOrganizeInfo select new SelectListItem()
            {
                Selected = false, Text = u.OrganizeInfoShowName, Value = u.OrganizeInfoID + ""
            }).ToList();
            ViewBag.MajorDict      = MajorService.GetEntities(u => u.Status == delNormal).AsQueryable().ToDictionary(u => u.MajorID, u => u.MajorName);
            ViewBag.PoliticalDict  = PoliticalService.GetEntities(u => u.Status == delNormal).AsQueryable().ToDictionary(u => u.PoliticalID, u => u.PoliticalName);
            ViewBag.DepartmentDict = DepartmentService.GetEntities(u => u.Status == delNormal).AsQueryable().ToDictionary(u => u.DepartmentID, u => u.DepartmentName);
            return(View());
        }
Ejemplo n.º 9
0
        public ActionResult ProcessLogin()
        {
            String name         = Request["LoginCode"];
            String pwd          = MD5Helper.Get_MD5(Request["LoginPwd"]);
            short  delDeleted   = (short)DelFlagEnum.Deleted;
            short  delInvalid   = (short)DelFlagEnum.Invalid;
            var    organizeInfo = OrganizeInfoService.GetEntities(o => o.OrganizeInfoLoginId == name && o.OrganizeInfoPwd == pwd && o.Status != delInvalid).FirstOrDefault();

            if (organizeInfo != null)
            {
                if (organizeInfo.Status == (short)Model.Enum.DelFlagEnum.Auditing)
                {
                    return(Content("Auditing"));
                }
                if (organizeInfo.Status == delDeleted)
                {
                    return(Content("Delete"));
                }
                organizeInfo.OrganizeInfoLastTime = DateTime.Now;
                OrganizeInfoService.Update(organizeInfo);
                UserToCache(organizeInfo);
                return(Content("OrganizeInfo"));
            }
            var userInfo = UserInfoService.GetEntities(u => u.UserInfoLoginId == name && u.UserInfoPwd == pwd && u.Status != delInvalid).FirstOrDefault();

            if (userInfo != null)
            {
                if (userInfo.Status == delDeleted)
                {
                    return(Content("Delete"));
                }
                UserToCache(userInfo);
                return(Content("Userinfo"));
            }
            return(Content("fail"));
        }
Ejemplo n.º 10
0
        public ActionResult OrgEditUser(int id)
        {
            UserInfo user = UserInfoService.GetEntities(u => u.UserInfoID == id).FirstOrDefault();

            if (user == null)
            {
                return(Redirect("/Login/Index"));
            }
            var allMajor = MajorService.GetEntities(u => u.Status == delNormal).AsQueryable();

            ViewBag.MajorList = (from u in allMajor select new SelectListItem()
            {
                Selected = false, Text = u.MajorName, Value = u.MajorID + ""
            }).ToList();
            var allPolitical = PoliticalService.GetEntities(u => u.Status == delNormal).AsQueryable();

            ViewBag.PoliticalList = (from u in allPolitical select new SelectListItem()
            {
                Text = u.PoliticalName, Value = u.PoliticalID + ""
            }).ToList();
            var allDepartment = DepartmentService.GetEntities(u => u.Status == delNormal).AsQueryable();

            ViewBag.DepartmentList = (from u in allDepartment select new SelectListItem()
            {
                Selected = false, Text = u.DepartmentName, Value = u.DepartmentID + ""
            }).ToList();
            var allOrganizeInfo = OrganizeInfoService.GetEntities(u => u.Status == delNormal && u.OrganizeInfoManageId != null).AsQueryable();

            ViewBag.OrganizeinfoList = (from u in allOrganizeInfo select new SelectListItem()
            {
                Selected = false, Text = u.OrganizeInfoShowName, Value = u.OrganizeInfoID + ""
            }).ToList();
            ViewBag.Status           = user.Status;
            ViewData.Model           = user;
            return(View());
        }
Ejemplo n.º 11
0
        public ActionResult UserEditUser()
        {
            var allDepartment = DepartmentService.GetEntities(u => u.Status == delNormal).AsQueryable();

            ViewData["DepartmentList"] = (from u in allDepartment
                                          select new SelectListItem()
            {
                Text = u.DepartmentName, Value = u.DepartmentID + ""
            }).ToList();

            var allMajor = MajorService.GetEntities(u => u.Status == delNormal).AsQueryable();

            ViewData["MajorList"] = (from u in allMajor
                                     select new SelectListItem()
            {
                Text = u.MajorName, Value = u.MajorID + ""
            }).ToList();

            var allPolitical = PoliticalService.GetEntities(u => u.Status == delNormal).AsQueryable();

            ViewData["UpdatePoliticalList"] = (from u in allPolitical
                                               select new SelectListItem()
            {
                Text = u.PoliticalName, Value = u.PoliticalID + ""
            }).ToList();
            var allOrganizeInfo = OrganizeInfoService.GetEntities(u => u.Status == delNormal && u.OrganizeInfoManageId != null).AsQueryable();

            ViewData["OrganizeinfoList"] = (from u in allOrganizeInfo
                                            select new SelectListItem()
            {
                Text = u.OrganizeInfoShowName, Value = u.OrganizeInfoID + ""
            }).ToList();
            LoginUser = UserInfoService.GetEntities(u => u.UserInfoID == LoginUser.UserInfoID).FirstOrDefault();
            UpdateCaching(LoginUser);
            return(View(LoginUser));
        }
Ejemplo n.º 12
0
        public ActionResult Create() //给出默认/可选择选项
        {
            var allMajor = MajorService.GetEntities(u => u.Status == delNormal).AsQueryable();

            ViewBag.MajorID = (from u in allMajor select new SelectListItem()
            {
                Selected = false, Text = u.MajorName, Value = u.MajorID + ""
            }).ToList();
            var allPolitical = PoliticalService.GetEntities(u => u.Status == delNormal).AsQueryable();

            ViewBag.PoliticalID = (from u in allPolitical select new SelectListItem()
            {
                Text = u.PoliticalName, Value = u.PoliticalID + ""
            }).ToList();
            var allDepartment = DepartmentService.GetEntities(u => u.Status == delNormal).AsQueryable();

            ViewBag.DepartmentID = (from u in allDepartment select new SelectListItem()
            {
                Selected = false, Text = u.DepartmentName, Value = u.DepartmentID + ""
            }).ToList();
            var allOrganizeInfo = OrganizeInfoService.GetEntities(u => u.Status == delNormal && u.OrganizeInfoManageId != null).AsQueryable();

            if (LoginOrganize.OrganizeInfoManageId != null)
            {
                allOrganizeInfo = allOrganizeInfo.Where(u => u.OrganizeInfoID == LoginOrganize.OrganizeInfoID).AsQueryable();
            }
            ViewBag.OrganizeInfoID = (from u in allOrganizeInfo select new SelectListItem()
            {
                Selected = false, Text = u.OrganizeInfoShowName, Value = u.OrganizeInfoID + ""
            }).ToList();
            UserInfo userInfo = new UserInfo();

            userInfo.UserInfoIcon = userInfo.UserInfoIcon = System.Configuration.ConfigurationManager.AppSettings["DefaultIconPath"];
            ViewData.Model        = userInfo;
            return(View());
        }
Ejemplo n.º 13
0
        public ActionResult OrganizeRegister(string loginname, string pwd, string nickname, string people, string phone)
        {
            if (!ValidateName(loginname))
            {
                return(Content("exist"));
            }
            //验证
            //登录名
            Regex regex  = new Regex(@"^[A-Za-z0-9]{6,12}$");
            Regex regex1 = new Regex(@"^[0-9]{6,12}$");

            if (!regex.IsMatch(loginname) || regex1.IsMatch(loginname))
            {
                return(Content("fail"));
            }
            //密码
            regex = new Regex(@"^[A-Za-z0-9]{6,12}$");
            if (!regex.IsMatch(pwd))
            {
                return(Content("fail"));
            }
            //昵称
            regex = new Regex(@"^[\u4e00-\u9fa5]{2,15}$");
            if (!regex.IsMatch(nickname))
            {
                return(Content("fail"));
            }

            regex = new Regex(@"^[\u4e00-\u9fa5]{2,10}$");
            if (!regex.IsMatch(people))
            {
                return(Content("fail"));
            }
            //电话号码
            regex = new Regex(@"^\d{11}$");
            if (!regex.IsMatch(phone))
            {
                return(Content("fail"));
            }

            OrganizeInfo organize = new OrganizeInfo
            {
                OrganizeInfoLoginId  = loginname,
                OrganizeInfoPwd      = Common.Encryption.MD5Helper.Get_MD5(pwd),
                OrganizeInfoShowName = nickname,
                OrganizeInfoPeople   = people,
                OrganizeInfoPhone    = phone,
                Status               = (short)Model.Enum.DelFlagEnum.Auditing,
                ModfiedOn            = DateTime.Now,
                CreateTime           = DateTime.Now,
                OrganizeInfoLastTime = DateTime.Now,
                OrganizeInfoManageId = OrganizeInfoService.GetEntities(u => u.OrganizeInfoManageId == null).FirstOrDefault().OrganizeInfoID,
                OrganizeInfoIcon     = System.Configuration.ConfigurationManager.AppSettings["DefaultIconPath"],
                ActivityCount        = 0
            };

            if (OrganizeInfoService.Add(organize) != null)
            {
                return(Content("organize"));
            }
            else
            {
                return(Content("fail"));
            }
        }
Ejemplo n.º 14
0
 public ActionResult OrganizeDetail(int id)
 {
     ViewData.Model = OrganizeInfoService.GetEntities(o => o.OrganizeInfoID == id).FirstOrDefault();
     return(View());
 }
Ejemplo n.º 15
0
        public JsonResult CheckUserName(string username)
        {
            var reslut = OrganizeInfoService.GetEntities(u => u.OrganizeInfoLoginId.Equals(username)).AsQueryable().Count() == 0;

            return(Json(reslut, JsonRequestBehavior.AllowGet));
        }