public string allotroler() { string usercode = Request["usercode"]; string roleid = Request["roleid"]; UserManage um = new UserManage(); result = um.AllocateTheRole(usercode, roleid); return result; }
protected void Commit_Click(object sender, EventArgs e) { string DefaultStr = @"ctl00$MainContent$"; Dictionary<string, string> userInfo = new Dictionary<string,string>(); userInfo.Add("Name",Request.Form[DefaultStr+"Name"]); userInfo.Add("IdentityID", Request.Form[DefaultStr + "IdentityID"]); userInfo.Add("Phone", Request.Form[DefaultStr + "Phone"]); userInfo.Add("Gender", Request.Form[DefaultStr + "Gender"]); userInfo.Add("Email", Request.Form[DefaultStr + "Email"]); userInfo.Add("Province", Request.Form[DefaultStr + "Province"]); userInfo.Add("University", Request.Form[DefaultStr + "University"]); userInfo.Add("Major", Request.Form[DefaultStr + "Major"]); userInfo.Add("English", Request.Form[DefaultStr + "English"]); userInfo.Add("Skill", Request.Form[DefaultStr + "Skill"]); UserManage um = new UserManage(); Dictionary<string, string> NULL = new Dictionary<string, string>(); if(um.SavaUserInfo(userInfo,user)) { //保存成功 //先清空显示错误数据 ErrorMessage.Text = string.Empty; SuccessMessage.Text = @"信息保存/修改成功"; string applicationID = string.Format(@"0"); ApplyManage am = new ApplyManage(); if (!am.isRepeat(applicationID, user)) { this.ErrorMessage.Text = @"<a href = '/WebForm/participateApply.aspx'>您尚未参加比赛申请,点击到参赛页面</a>"; } this._blindDataForForm(); } else { //业务逻辑错误,请联系技术人员 //先清空显示正确数据 SuccessMessage.Text = string.Empty; ErrorMessage.Text = @"后台业务出现错误,请联系网站维护人员"; } }
private async void btn_Send_Click(object sender, RoutedEventArgs e) { if (UserManage.IsLogin()) { try { string uri = string.Format("http://api.bilibili.com/x/reply/add?_device=wp&build={2}&platform=wp&appkey={0}&access_key={1}", ApiHelper._appKey, ApiHelper.access_key, ApiHelper.build); uri += "&sign=" + ApiHelper.GetSign(uri); Uri ReUri = new Uri(uri); HttpClient hc = new HttpClient(); hc.DefaultRequestHeaders.Referer = new Uri("http://www.bilibili.com/"); string QuStr = "plat=6&jsonp=jsonp&message=" + Uri.EscapeDataString(txt_Comment.Text) + "&type=1&oid=" + _aid; var response = await hc.PostAsync(ReUri, new HttpStringContent(QuStr, Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/x-www-form-urlencoded")); response.EnsureSuccessStatusCode(); string result = await response.Content.ReadAsStringAsync(); JObject json = JObject.Parse(result); if ((int)json["code"] == 0) { pageNum = 1; LoadComment(); Utils.ShowMessageToast("已发送评论!", 3000); txt_Comment.Text = ""; } else { Utils.ShowMessageToast(json["message"].ToString(), 3000); } } catch (Exception ex) { Utils.ShowMessageToast("评论时发生错误\r\n" + ex.Message, 3000); } } else { Utils.ShowMessageToast("请先登录", 3000); } }
private void button6_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "确定批量删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { UserManage deleteuser = new UserManage(); IList <int> deleId = new List <int>(); int delcount = 0; //作为删除条数的记录 int count = Userdataview.Rows.Count; int selectCount = Userdataview.SelectedRows.Count; for (int i = 0; i < count - 1; i++) { if (Userdataview.Rows[i].Selected) { int id = Convert.ToInt32(Userdataview.Rows[i].Cells[0].Value); deleId.Add(id); } } for (int j = 0; j < deleId.Count; j++) { int tt = 0; tt = deleteuser.deleteUser(deleId[j]); if (tt == 1) { delcount++; } } if (delcount == selectCount) { MessageBox.Show("删除成功!", "提示"); InitialData(); } else { MessageBox.Show("删除失败!"); } } }
public ActionResult Modify(int ID) { var _users = new UserManage().FindList(); List <SelectListItem> _userlistItems = new List <SelectListItem>(_users.Count()); foreach (var _user in _users) { _userlistItems.Add(new SelectListItem() { Text = _user.Username, Value = _user.ID.ToString() }); } ViewBag.Users = _userlistItems; var _movies = new MovieManage().FindList(); List <SelectListItem> _movielistItems = new List <SelectListItem>(_movies.Count()); foreach (var _movie in _movies) { _movielistItems.Add(new SelectListItem() { Text = _movie.MovieName, Value = _movie.ID.ToString() }); } ViewBag.Movies = _movielistItems; var comment = commentManage.Find(ID); var _likes = new LikeManage().FindList(); int like = 0; foreach (var _like in _likes) { if (ID == _like.MovieCommentID) { like++; } } comment.Likes = like; return(PartialView(comment)); }
protected void GridView1_OnRowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gRow = (GridViewRow)((Control)e.CommandSource).Parent.Parent; string userId = GridView1.DataKeys[gRow.RowIndex].Value.ToString(); if (e.CommandName == "Edit") { Response.Redirect("UserEdit.aspx?UserId=" + userId + "&Type=1"); } if (e.CommandName == "Del") { if (UserManage.DeleteUser(int.Parse(userId))) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "DeleteSucess", "alert('删除成功!');", true); LoadData(1); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "DeleteError", "alert('删除失败!');", true); } } if (e.CommandName == "ResumePassword") { UserInfo userInfo = new UserInfo(); string beginPassword = GridView1.Rows[gRow.RowIndex].Cells[1].Text; userInfo.JobNo = GridView1.Rows[gRow.RowIndex].Cells[1].Text; userInfo.Password = SHA1.GetSHA1Password(beginPassword); if (UserManage.ChangePassword(userInfo)) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ResumeSucess", "alert('恢复密码成功!');", true); LoadData(1); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ResumeError", "alert('恢复密码失败!');", true); } } }
/// <summary> /// 获取字段长度 /// </summary> //protected void Getfieldlongth() //{ // CourseManage cm = new CourseDll.Bll.CourseManage(); // string tableName = "Modules"; // DataTable dt = cm.GetFieldLongth(tableName); // if (dt.Rows.Count > 0) // { // modulenameL=int.Parse(dt.Rows[1]["长度"].ToString()); // xueshiL = int.Parse(dt.Rows[4]["长度"].ToString()); // startL = int.Parse(dt.Rows[5]["长度"].ToString()); // endL = int.Parse(dt.Rows[6]["长度"].ToString()); // totallong = modulenameL + xueshiL + startL + endL; // gvCourse.Columns[1].HeaderStyle.Width = (int)Math.Round((double)(modulenameL / totallong * 80)) + '%'; // gvCourse.Columns[2].HeaderStyle.Width = (int)Math.Round((double)(modulenameL / totallong * 80)) + '%'; // gvCourse.Columns[3].HeaderStyle.Width = (int)Math.Round((double)(modulenameL / totallong * 80)) + '%'; // gvCourse.Columns[4].HeaderStyle.Width = (int)Math.Round((double)(modulenameL / totallong * 80)) + '%'; // } //} #endregion #region 方法 /// <summary> /// 绑定 /// </summary> public void bindDG() { //判断当前用户是否选课 CourseManage cm = new CourseManage(); UserManage um = new UserManage(); long StudentID = um.GetOrAddUserIDByAccount(StudentNO); DataTable dt = cm.GetCourseManage(StudentID); ViewState["StudentID"] = StudentID; gvCourse.DataSource = dt; gvCourse.DataBind(); // int i = 0; int sum = 0; foreach (DataRow dr in dt.Rows) { if (dr["SCID"].ToString() != "") { i++; sum += int.Parse(dr["ClassHours"].ToString()); } } int studyHour = int.Parse(System.Configuration.ConfigurationManager.AppSettings["StudyHour"]); string des = ""; if (sum >= studyHour) { des = "您已经达到学时要求"; } else { des = "您还差" + (studyHour - sum) + "学时"; } Des.Text = "亲,您已经选择了" + i + "个模块的课程,共" + sum + "学时,本课程要求" + studyHour + "学时," + des; }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { if (Login1.UserName.ToString() == "1") { //Label1.Text = "hell0"; //Response.Write("<script>alert('1')</script>"); } Account account = new Account(); //if(true) if (UserManage.Login(Login1.UserName.ToString(), Login1.Password.ToString(), out account)) { Login1.Visible = false; Response.Redirect("~/default.aspx"); Label1.Text = account.Aname; } else { Label1.Text = "false"; } }
public ActionResult AddUser(AddUserViewModel Model) { UserManage vUserMange = new UserManage(); UsersEF vUserInfo = vUserMange.GetUserInfo(Model.UserName); if (vUserInfo.ID == null || vUserInfo.ID == 0 || vUserInfo.IsUse == false) { if (vUserMange.AddUser(Model.UserName, Model.Password, Model.Power)) return RedirectToAction("UserList", "Admin"); else { ModelState.AddModelError("", "添加用户失败"); Model.PowerList = createPowerSelectList(); return View(Model); } } else { ModelState.AddModelError("", "用户名重复"); Model.PowerList = createPowerSelectList(); return View(Model); } }
public ActionResult SaveFace() { var json = new JsonHelper() { Status = "n", Msg = "上传头像成功!" }; try { var faceBase64 = Request.Form["UserFace"]; var User = UserManage.Get(p => p.ID == CurrentUser.Id); User.FACE_IMG = faceBase64; UserManage.Update(User); CurrentUser.Face_Img = User.FACE_IMG; json.Status = "y"; } catch (Exception e) { json.Msg = "上传头像发生内部错误!"; WriteLog(Common.Enums.enumOperator.Remove, "上传头像:", e); } return(Json(json)); }
public async Task <JsonWebToken> SignIn(string username, string password) { UserManage user = await this.userManager.FindByNameAsync(username); if (user != null && !string.IsNullOrEmpty(password)) { SignInResult signInResult = await this.signInManager.CheckPasswordSignInAsync(user, password, false); if (signInResult.Succeeded) { JsonWebToken jwt = this.jwtHandler.Create(user); string refreshToken = this.passwordHasher.HashPassword(user, Guid.NewGuid().ToString()) .Replace("+", string.Empty).Replace("=", string.Empty).Replace("/", string.Empty); jwt.RefreshToken = refreshToken; user.RefreshToken = refreshToken; await this.repository.UpdateRefreshToken(user); return(jwt); } } return(null); }
public ActionResult UserResetPwd(string loginPwd, string confirmPwd) { string secrecyPwd = DataEncrypt.MD5Encrypt(loginPwd.Trim()); string secrecyPwd2 = DataEncrypt.MD5Encrypt(confirmPwd.Trim()); //新密码是否和确认密码一致 if (secrecyPwd == secrecyPwd2) { //重置密码 if (UserManage.AlterUserPwd(UserId, secrecyPwd)) { return(Json(new { success = 1 })); } else { return(Json(new { success = 2 })); } } else { return(Json(new { success = 3 })); } }
public IHttpActionResult RegisterOauth([FromBody] RequestRegisterOauth request) { var tokenResult = new TokenResult(); var isSuccess = IdentityValid.ValidateSignature(request.Signature, request.TimeStamp, request.Nonce, request.Appid); if (isSuccess) { var userBll = new UserManage(); var user = new User() { IsValid = true, HeadImgUrl = string.Empty, Pwd = string.Empty, UserName = request.UserName, Email = string.Empty }; if (userBll.IsExist(o => o.UserName == request.UserName)) { tokenResult.IsSuccess = true; tokenResult.token = IdentityValid.CreateToken(request.UserName, request.Appid); return(Json(tokenResult)); } else { tokenResult.IsSuccess = userBll.Save(user); tokenResult.token = IdentityValid.CreateToken(request.UserName, request.Appid); return(Json(tokenResult)); } } else { return(Json(new ResponseMsg() { IsSuccess = false, Msg = "签名验证失败!" })); } }
private void initUserInfo(string userId) { UserManage userManage = new UserManage(); UsersEO usersEO = userManage.GetUser(userId); if (usersEO != null) { this.txtLoginName.Text = usersEO.UrLoginName; this.txtName.Text = usersEO.UrName; this.txtParent.Text = usersEO.UrParent; this.txtPhone.Text = usersEO.UrPhone; this.txtArea.Text = usersEO.UrZone; this.txtContactPeople.Text = usersEO.UrPeople; this.txtContact.Text = usersEO.UrContact; this.txtGameId.Text = usersEO.UrGameId; this.lblDiamond.Text = usersEO.UrDiamondNum; this.lblMoney.Text = usersEO.UrMoney; this.txtBankName.Text = usersEO.UrBankName; this.txtBank.Text = usersEO.UrBank; this.txtBankNo.Text = usersEO.UrBankNo; this.txtPercent.Text = string.Format("{0}%", usersEO.UrPercent); this.txtIntrdouce.Text = usersEO.UrIntroducer; } }
public ActionResult Index() { #region 用户登录信息 var userInfo = UserManage.GetCurrentUserInfo(); ViewBag.userInfo = userInfo; #endregion #region 热门职位 int pageCount_hot = 0; int totalCount_hot = 0; PageInfo pageInfo_HotPost = new PageInfo(1, 3); var hotPosts = _View_ServerUser_PostServices.QueryByPage(pageInfo_HotPost.PageIndex, pageInfo_HotPost.PageSize , out pageCount_hot, out totalCount_hot , null, order => order.SeeCount); ViewBag.hotPosts = hotPosts; #endregion #region 最新招聘 PageInfo pageInfo = new PageInfo(); int pageCount = 0; int totalCount = 0; var newsestRecruits = _View_NewsestRecruitServices.QueryByPage(pageInfo.PageIndex, pageInfo.PageSize , out pageCount, out totalCount , null, order => order.CreateTime); ViewBag.newsestRecruits = newsestRecruits; #endregion #region 新闻资讯 类型 var newsTypeList = _NewsTypeServices.QueryOrderByAsc(null, order => order.NewsTypeID); ViewBag.newsTypeList = newsTypeList; #endregion return(View()); }
protected void Button1_Click(object sender, EventArgs e) { if (TextArea1.InnerText.Trim() == "") { Response.Write("<script>alert('留言不能为空哦')</script>"); } else { if (UserManage.GetMyAccount() == null) { Response.Write("<script>alert('请先登录')</script>"); return; } if (TalkingManage.Insert(TextArea1.InnerText.Trim(), UserManage.GetMyAccount().Aid)) { Response.Write("<script>alert('留言成功')</script>"); Response.Redirect("liuyan"); } else { Response.Write("<script>alert('留言失败')</script>"); } } }
public ActionResult ResetPwd(string idList) { var json = new JsonHelper() { Status = "n", Msg = "操作成功" }; try { //校验用户编号是否为空 if (string.IsNullOrEmpty(idList)) { json.Msg = "校验失败,用户编号不能为空"; WriteLog(Common.Enums.enumOperator.Edit, "重置当前用户密码:" + json.Msg, Common.Enums.enumLog4net.ERROR); return(Json(json)); } var idlist1 = idList.Trim(',').Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(p => int.Parse(p)).ToList(); if (idlist1 != null && idlist1.Count > 0) { foreach (var newid in idlist1) { var _user = UserManage.Get(p => p.ID == newid); _user.PASSWORD = new Common.CryptHelper.AESCrypt().Encrypt("111111"); UserManage.Update(_user); } } json.Status = "y"; WriteLog(Common.Enums.enumOperator.Edit, "重置当前用户密码:" + json.Msg, Common.Enums.enumLog4net.INFO); } catch (Exception e) { json.Msg = "操作失败"; WriteLog(Common.Enums.enumOperator.Edit, "重置当前用户密码:", e); } return(Json(json)); }
private void button7_Click(object sender, EventArgs e) { UserManage updateuser = new UserManage(); if (Userdataview.CurrentRow.Cells[0].Value != null) { int id = Convert.ToInt32(Userdataview.CurrentRow.Cells[0].Value); String user_name = Userdataview.CurrentRow.Cells[1].Value.ToString(); String password = Userdataview.CurrentRow.Cells[2].Value.ToString(); int limit = Convert.ToInt32(Userdataview.CurrentRow.Cells[3].Value); if (limit != 1 && limit != 2) { MessageBox.Show("用户权限为1或为2!", "提示"); InitialData(); return; } int tt = updateuser.updateUser(id, user_name, password, limit); if (tt == 1) { MessageBox.Show("修改成功!", "提示"); InitialData(); } } }
public ActionResult Login(LoginViewModel model) { if (ModelState.IsValid) { IUserManage userManage = new UserManage(); if (userManage.Login(model.Email, password: model.Password, out Guid userId)) { //判断使用cookie还是session //跳转 if (model.RememberMe) { Response.Cookies.Add(new HttpCookie(name: "loginName") { Value = model.Email, Expires = DateTime.Now.AddDays(7) }); Response.Cookies.Add(new HttpCookie(name: "userId") { Value = userId.ToString(), Expires = DateTime.Now.AddDays(7) }); } else { Session["loginName"] = model.Email; Session["userId"] = userId; } return(RedirectToAction(nameof(Index))); } else { ModelState.AddModelError(key: "", errorMessage: "您的账号密码有误"); } } return(View(model)); }
public ActionResult Detail(int?id) { try { var _entity = new Domain.SYS_USER(); var Postlist = ""; if (id != null && id > 0) { _entity = UserManage.Get(p => p.ID == id); Postlist = String.Join(",", _entity.SYS_POST_USER.Select(p => p.FK_POSTID).ToList()); } ViewBag.dpt = this.DepartmentManage.GetDepartmentByDetail(); ViewBag.zw = this.CodeManage.LoadAll(p => p.CODETYPE == "ZW").ToList(); ViewData["Postlist"] = Postlist; return(View(_entity)); } catch (Exception e) { WriteLog(Common.Enums.enumOperator.Select, "加载用户详情发生错误:", e); throw e.InnerException; } }
public LoggedController() { LoginUserID = UserManage.GetLoginUserID(); }
/// <summary> /// Update the refresh token of the user session /// </summary> /// <param name="user"></param> public void UpdateRefreshToken(UserManage user) { this.context.Entry(user).State = Microsoft.EntityFrameworkCore.EntityState.Modified; this.context.SaveChanges(); }
public ActionResult Login(string username, string pwd, string idt, string autoLogin) { if (string.IsNullOrWhiteSpace(username)) { //手机号/会员名/邮箱 为空 return(GetJson(0, new { flag = 1 })); } if (string.IsNullOrWhiteSpace(pwd)) { //密码 为空 return(GetJson(0, new { flag = 2 })); } if (string.IsNullOrWhiteSpace(idt) || !new List <string>() { "p", "s" }.Any(item => item == idt)) { //非法操作 return(GetJson(0, new { flag = 3 })); } //是否勾选 '7天自动登录' bool isChecked = false; if (!string.IsNullOrWhiteSpace(autoLogin) && autoLogin == "1") { isChecked = true; } pwd = pwd.ToMd5(); Model.User.UserInfo userInfo = null; if (idt == "p") //求职者登录 { Model.Person person = _PersonServices.QueryWhere(item => (item.Phne == username || item.Email == username || item.RealName == username) && item.Password.Equals(pwd, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); if (person == null) { //用户名或密码错误 return(GetJson(2, new { flag = 1, idt = idt })); } else { userInfo = new Model.User.UserInfo() { IdentityType = Model.User.IdentityType.Person, UserId = person.PerID, RealName = person.RealName, Phone = person.Phne, Email = person.Email }; //求职者登录成功 UserManage.SetCurrentUserInfo(userInfo); } } else if (idt == "s") //经纪人登录 { Model.ServerUser serverUser = _ServerUserServices.QueryWhere(item => (item.Phone == username || item.Email == username || item.RealName == username) && item.Password.Equals(pwd, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); if (serverUser == null) { //用户名或密码错误 return(GetJson(2, new { flag = 1, idt = idt })); } else { userInfo = new Model.User.UserInfo() { IdentityType = Model.User.IdentityType.ServerUser, UserId = serverUser.SerUserID, RealName = serverUser.RealName, Phone = serverUser.Phone, Email = serverUser.Email }; //求职者登录成功 UserManage.SetCurrentUserInfo(userInfo); } } else { //非法操作 return(GetJson(0, new { flag = 3 })); } //登录成功 //设置cookie值,7天内自动登录 if (isChecked) { //字符串连接 '用户名|身份标识' string userCookieStr = UserManage.GetUserCookieStr(userInfo.UserId, userInfo.IdentityType); CookieHelper.Set(Keys.UserInfo, userCookieStr.EncryptStr(), DateTime.Now.AddDays(7)); } else { CookieHelper.Remove(Keys.UserInfo); } return(GetJson(1)); }
private void _biliapp_CloseBrowserEvent(object sender, string e) { UserManage.Logout(); this.Hide(); }
//登录界面->登录按钮 private void btnLogin_Click(object sender, EventArgs e) { if (tboxZh.Text.Trim() == "" || tboxPwd.Text.Trim() == "") { MessageBox.Show("用户名或密码为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtValidCode.Text.Trim() == "") { MessageBox.Show("请输入验证码!"); } else if (!txtValidCode.Text.Equals(validCode.CheckCode)) { MessageBox.Show("验证码不正确!"); txtValidCode.Text = ""; } else { //密码md5加密 MD5 md5 = new MD5CryptoServiceProvider(); byte[] palindata = Encoding.Default.GetBytes(tboxPwd.Text.Trim()); //将要加密的字符串转换为字节数组 byte[] encryptdata = md5.ComputeHash(palindata); //将字符串加密后也转换为字符数组 string userPwd = Convert.ToBase64String(encryptdata); //将加密后的字节数组转换为加密字符串 User u = new User(tboxZh.Text.Trim(), userPwd); Admin u2 = new Admin(tboxZh.Text.Trim(), userPwd); if (comboxSelect.SelectedIndex == 0) //学生 { if (UserManage.UserLogin(u)) { this.Hide(); UserInterface UserInterfaceForm = new UserInterface(); UserInterfaceForm.Show(); } else { MessageBox.Show("用户名或密码有误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (comboxSelect.SelectedIndex == 1) //社团管理员 { if (UserManage.CorUserLogin(u)) { this.Hide(); FrmCorAdmin CorAdmin = new FrmCorAdmin(); CorAdmin.Show(); } else { MessageBox.Show("用户名或密码有误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (comboxSelect.SelectedIndex == 2) //超级管理员 { if (UserManage.AdminUserLogin(u2)) { this.Hide(); FrmAdmin AdminForm = new FrmAdmin(); AdminForm.Show(); } else { MessageBox.Show("用户名或密码有误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else //出现选择其他的情况 { MessageBox.Show("请正确选择!"); } } //密码框设置空,获取焦点 tboxPwd.Text = ""; tboxPwd.Focus(); picValidCode_Click(sender, e); }
public ActionResult UserInfo() { UserManage.JudgeUserIdentityOpt(IdentityType.Person); return(View()); }
/// <summary> /// Value 1:用户名 2:Token /// </summary> /// <param name="value"></param> /// <returns></returns> // POST: api/Logout public bool Post([FromBody] string[] value) { UserManage vUserManage = new UserManage(); return(vUserManage.Logout(value[0], value[1])); }
protected void Commit_Click(object sender, EventArgs e) { string DefaultStr = @""; Dictionary<string, string> userInfo = new Dictionary<string, string>(); userInfo.Add("Name", Request.Form[DefaultStr + "Name"]); userInfo.Add("IdentityID", Request.Form[DefaultStr + "IdentityID"]); userInfo.Add("Phone", Request.Form[DefaultStr + "Phone"]); userInfo.Add("Gender", Request.Form[DefaultStr + "Gender"]); userInfo.Add("Email", Request.Form[DefaultStr + "Email"]); userInfo.Add("Province", Request.Form[DefaultStr + "Province"]); userInfo.Add("University", Request.Form[DefaultStr + "University"]); userInfo.Add("Major", Request.Form[DefaultStr + "Major"]); userInfo.Add("English", Request.Form[DefaultStr + "English"]); userInfo.Add("Skill", Request.Form[DefaultStr + "Skill"]); //以上为基本信息 Dictionary<string, string> userAddition = new Dictionary<string, string>(); userAddition.Add("universityone", Request.Form[DefaultStr + "universityone"]); userAddition.Add("degreeone", Request.Form[DefaultStr + "degreeone"]); userAddition.Add("lodone", Request.Form[DefaultStr + "lodone"]); userAddition.Add("academicdurationone", Request.Form[DefaultStr + "academicdurationone"]); userAddition.Add("majorone", Request.Form[DefaultStr + "majorone"]); userAddition.Add("minorone", Request.Form[DefaultStr + "minorone"]); userAddition.Add("gpaone", Request.Form[DefaultStr + "gpaone"]); userAddition.Add("universitytwo", Request.Form[DefaultStr + "universitytwo"]); userAddition.Add("degreetwo", Request.Form[DefaultStr + "degreetwo"]); userAddition.Add("lodtwo", Request.Form[DefaultStr + "lodtwo"]); userAddition.Add("academicdurationtwo", Request.Form[DefaultStr + "academicdurationtwo"]); userAddition.Add("majortwo", Request.Form[DefaultStr + "majortwo"]); userAddition.Add("minortwo", Request.Form[DefaultStr + "minortwo"]); userAddition.Add("gpatwo", Request.Form[DefaultStr + "gpatwo"]); userAddition.Add("universitythree", Request.Form[DefaultStr + "universitythree"]); userAddition.Add("degreethree", Request.Form[DefaultStr + "degreethree"]); userAddition.Add("lodthree", Request.Form[DefaultStr + "lodthree"]); userAddition.Add("academicdurationthree", Request.Form[DefaultStr + "academicdurationthree"]); userAddition.Add("majorthree", Request.Form[DefaultStr + "majorthree"]); userAddition.Add("minorthree", Request.Form[DefaultStr + "minorthree"]); userAddition.Add("gpathree", Request.Form[DefaultStr + "gpathree"]); userAddition.Add("projectname", Request.Form[DefaultStr + "projectname"]); userAddition.Add("projectdescription", Request.Form[DefaultStr + "projectdescription"]); userAddition.Add("projectduration", Request.Form[DefaultStr + "projectduration"]); userAddition.Add("papername", Request.Form[DefaultStr + "papername"]); userAddition.Add("journal", Request.Form[DefaultStr + "journal"]); userAddition.Add("advisor", Request.Form[DefaultStr + "advisor"]); userAddition.Add("workdescription", Request.Form[DefaultStr + "workdescription"]); userAddition.Add("raduration", Request.Form[DefaultStr + "raduration"]); userAddition.Add("jobtitle", Request.Form[DefaultStr + "jobtitle"]); userAddition.Add("company", Request.Form[DefaultStr + "company"]); userAddition.Add("responsibility", Request.Form[DefaultStr + "responsibility"]); userAddition.Add("weduration", Request.Form[DefaultStr + "weduration"]); userAddition.Add("eaname", Request.Form[DefaultStr + "eaname"]); userAddition.Add("eanameother", Request.Form[DefaultStr + "eanameother"]); userAddition.Add("eatitle", Request.Form[DefaultStr + "eatitle"]); userAddition.Add("awardnameone", Request.Form[DefaultStr + "awardnameone"]); userAddition.Add("awardlevelone", Request.Form[DefaultStr + "awardlevelone"]); userAddition.Add("awarddateone", Request.Form[DefaultStr + "awarddateone"]); userAddition.Add("awardnametwo", Request.Form[DefaultStr + "awardnametwo"]); userAddition.Add("awardleveltwo", Request.Form[DefaultStr + "awardleveltwo"]); userAddition.Add("awarddatetwo", Request.Form[DefaultStr + "awarddatetwo"]); userAddition.Add("awardnamethree", Request.Form[DefaultStr + "awardnamethree"]); userAddition.Add("awardlevelthree", Request.Form[DefaultStr + "awardlevelthree"]); userAddition.Add("awarddatethree", Request.Form[DefaultStr + "awarddatethree"]); userAddition.Add("languagename", Request.Form[DefaultStr + "languagename"]); userAddition.Add("languageproficiency",Request.Form[DefaultStr + "languageproficiency"]); userAddition.Add("testname", Request.Form[DefaultStr + "testname"]); userAddition.Add("testnameother", Request.Form[DefaultStr + "testnameother"]); userAddition.Add("testscore", Request.Form[DefaultStr + "testscore"]); userAddition.Add("codingablity", Request.Form[DefaultStr + "codingablity"]); UserManage um = new UserManage(); if (um.SavaUserInfo(userInfo,userAddition, user)) { //保存成功 //先清空显示错误数据 ErrorMessage.Text = string.Empty; SuccessMessage.Text = @"信息保存/修改成功"; string applicationID = string.Format(@"0"); ApplyManage am = new ApplyManage(); this._blindDataForForm(); } else { //业务逻辑错误,请联系技术人员 //先清空显示正确数据 SuccessMessage.Text = string.Empty; ErrorMessage.Text = @"后台业务出现错误,请联系网站维护人员"; } }
protected BaseController(UserManage userManage, CarrierManage carrierManage, CustomerManage customerManage) { _userManage = userManage; _customerManage = customerManage; _carrierManage = carrierManage; }
public ActionResult UserInfo(int?userid) { try { //是否为人事部 var IsMatters = true; var entity = new Domain.SYS_USERINFO(); var UserName = CurrentUser.Name; if (userid != null && userid > 0) { entity = UserInfoManage.Get(p => p.USERID == userid) ?? new Domain.SYS_USERINFO() { USERID = int.Parse(userid.ToString()) }; UserName = UserManage.Get(p => p.ID == userid).NAME; if ((CurrentUser.DptInfo != null && CurrentUser.DptInfo.NAME != "人事部") || !CurrentUser.IsAdmin) { IsMatters = false; } } else { entity = UserInfoManage.Get(p => p.USERID == CurrentUser.Id) ?? new Domain.SYS_USERINFO() { USERID = CurrentUser.Id }; } ViewData["UserName"] = UserName; ViewBag.IsMatters = IsMatters; Dictionary <string, string> dic = Common.Enums.ClsDic.DicCodeType; var dictype = this.CodeManage.GetDicType(); //在岗状态 string zgzt = dic["在岗状态"]; ViewData["zgzt"] = dictype.Where(p => p.CODETYPE == zgzt).ToList(); //婚姻状况 string hyzk = dic["婚姻状况"]; ViewData["hunyin"] = dictype.Where(p => p.CODETYPE == hyzk).ToList(); //政治面貌 string zzmm = dic["政治面貌"]; ViewData["zzmm"] = dictype.Where(p => p.CODETYPE == zzmm).ToList(); //民族 string mz = dic["民族"]; ViewData["mz"] = dictype.Where(p => p.CODETYPE == mz).ToList(); //职称级别 string zcjb = dic["职称"]; ViewData["zcjb"] = dictype.Where(p => p.CODETYPE == zcjb).ToList(); //学历 string xl = dic["学历"]; ViewData["xl"] = dictype.Where(p => p.CODETYPE == xl).ToList(); return(View(entity)); } catch (Exception e) { WriteLog(Common.Enums.enumOperator.Select, "加载人员档案:", e); throw e.InnerException; } }
/// <summary> /// 绑定用户数据,只在已存在数据时候使用 /// </summary> private void _blindDataForForm() { UserManage um = new UserManage(); DataRow dr = um.getUserProfile(user); this.Name.Text = dr[1].ToString(); this.Phone.Text = dr[2].ToString(); this.Gender.Text = dr[3].ToString(); this.Email.Text = dr[4].ToString(); this.Province.SelectedValue = dr[5].ToString(); this.University.Text = dr[6].ToString(); this.Major.Text = dr[7].ToString(); this.English.Text = dr[8].ToString(); this.Skill.Text = dr[9].ToString(); this.IdentityID.Text = dr[11].ToString(); }
public ActionResult Add(AddArticelViewModel articleViewModel, HttpPostedFileBase banner) { var MaxId = articleManage.ArticleId(p => p.ID); var articleID = MaxId + 1; if (banner != null) { var bannerName = Path.Combine(Request.MapPath("/ArticleImg"), articleID + ".jpg"); if (System.IO.File.Exists(bannerName)) { System.IO.File.Delete(bannerName); } banner.SaveAs(bannerName); } if (ModelState.IsValid) { Article _article = new Article(); _article.UserID = articleViewModel.UserID; _article.MovieID = articleViewModel.MovieID; _article.Releasetime = articleViewModel.Releasetime; _article.Title = articleViewModel.Title; _article.Content = articleViewModel.Content; _article.Auditstatus = Article.Status.待审核; var _resp = articleManage.Add(_article); if (_resp.Code == 1) { return(View("Prompt", new Prompt() { Title = "添加文章成功", Message = "您成功的添加了当前文章", Buttons = new List <string>() { "<a href=\"" + Url.Action("Index", "Article") + "\" class=\"btn btn-default\">文章管理</a>", "<a href=\"" + Url.Action("Add", "Article") + "\" class=\"btn btn-default\">继续添加</a>" } } )); } else { ModelState.AddModelError("", _resp.Message); } } else { return(View(articleViewModel)); } var _users = new UserManage().FindList(); List <SelectListItem> _userlistItems = new List <SelectListItem>(_users.Count()); foreach (var _user in _users) { _userlistItems.Add(new SelectListItem() { Text = _user.Username, Value = _user.ID.ToString() }); } ViewBag.Users = _userlistItems; var _movies = new MovieManage().FindList(); List <SelectListItem> _movielistItems = new List <SelectListItem>(_movies.Count()); foreach (var _movie in _movies) { _movielistItems.Add(new SelectListItem() { Text = _movie.MovieName, Value = _movie.ID.ToString() }); } ViewBag.Movies = _movielistItems; return(View(articleViewModel)); }
public ActionResult SavePerInfo(FormCollection forms) { var userInfo = UserManage.GetCurrentUserInfo(); if (userInfo == null) { //未登录 return(GetJson(-1, new { flag = 1 })); } if (userInfo.IdentityType == IdentityType.Person) { var person = _PersonServices.QueryWhere(where => where.PerID == userInfo.UserId).FirstOrDefault(); if (person == null) { //求职者不存在 return(GetJson(2, new { flag = 1 })); } //保存 string realname = forms["realname"] ?? ""; string gender = forms["gender"] ?? ""; string residence = forms["residence"] ?? ""; string education = forms["education"] ?? ""; string workLife = forms["workLife"] ?? ""; string phone = forms["phone"] ?? ""; string email = forms["email"] ?? ""; if (string.IsNullOrWhiteSpace(realname)) { //姓名不能为空 return(GetJson(0, new { flag = 1 })); } if (string.IsNullOrWhiteSpace(gender)) { gender = "1"; } bool sex = true; //默认男 if (gender == "2") { sex = false; } if (string.IsNullOrWhiteSpace(residence)) { residence = ""; } if (string.IsNullOrWhiteSpace(education)) { //学历不能为空 return(GetJson(0, new { flag = 2 })); } if (string.IsNullOrWhiteSpace(workLife)) { //工作经验不能为空 return(GetJson(0, new { flag = 3 })); } if (string.IsNullOrWhiteSpace(phone) || !Regex.IsMatch(phone, @"^1\d{10}$")) { //手机号码非法 return(GetJson(0, new { flag = 4 })); } if (string.IsNullOrWhiteSpace(email) || !Regex.IsMatch(email, @"^(\w)+(\.\w+)*@(\w)+((\.\w+)+)$")) { //邮箱非法 return(GetJson(0, new { flag = 5 })); } person.RealName = realname; person.Sex = sex; person.City = residence; person.Education = education; person.WorkLife = workLife; person.Phne = phone; person.Email = email; var properties = new string[] { "RealName", "Sex", "City", "Education", "WorkLife", "Phne", "Email" }; _PersonServices.Edit(person, properties); if (_PersonServices.SaveChanges() > 0) { //保存成功 return(GetJson(1)); } else { //保存失败 return(GetJson(3)); } } else { //身份错误 return(GetJson(2, new { flag = 2 })); } }
/// <summary> /// 删除注册信息 /// 删除申请信息 /// 删除引用关联(团队成员、团队) /// </summary> /// <returns></returns> public string deleteUser() { string userid = Request["usercode"]; UserManage um = new UserManage(); ApplyManage am = new ApplyManage(); TeamManage tm = new TeamManage(); bool judge = false; if(!tm.deleteTeamMemberByUserid(userid)) { return @"无法删除该用户在团队的信息"; } if(!tm.deleteTeamByTeamLeaderUsercode(userid)) { return @"该用户是队伍创建者,需要先删除其队伍所有信息"; } if(!am.DeleteApplyByUserID(userid)) { return @"无法删除该用户的申请信息"; } judge = um.DeleteUserByUserCode(userid); if(judge) { return @"删除成功"; } else { return @"删除失败"; } }
public ActionResult Login(Domain.SYS_USER item) { var json = new JsonHelper() { Msg = "登录成功", Status = "n" }; try { //获取表单验证码 var code = Request.Form["code"]; if (Session["gif"] != null) { //判断用户输入的验证码是否正确 if (!string.IsNullOrEmpty(code) && code.ToLower() == Session["gif"].ToString().ToLower()) { //调用登录验证接口 返回用户实体类 var users = UserManage.UserLogin(item.ACCOUNT.Trim(), item.PASSWORD.Trim()); if (users != null) { //是否锁定 if (users.ISCANLOGIN) { json.Msg = "用户已锁定,禁止登录,请联系管理员进行解锁"; log.Warn(Utils.GetIP(), item.ACCOUNT, Request.Url.ToString(), "Login", "系统登录,登录结果:" + json.Msg); return(Json(json)); } var acconut = this.UserManage.GetAccountByUser(users); //系统访问正常 if (acconut.System_Id.Count > 0) { //是否启用单用户登录 if (System.Configuration.ConfigurationManager.AppSettings["IsSingleLogin"] == "True") { var UserOnline = UserOnlineManage.LoadListAll(p => p.FK_UserId == users.ID).FirstOrDefault(); if (UserOnline != null && UserOnline.IsOnline) { json.Msg = "当前用户已登录,系统不允许重复登录!登录IP:" + UserOnline.UserIP; log.Error(Utils.GetIP(), item.ACCOUNT, Request.Url.ToString(), "Login", "重复登录:" + json.Msg); } else { //写入Session 当前登录用户 SessionHelper.SetSession("CurrentUser", acconut); //记录用户信息到Cookies string cookievalue = "{\"id\":\"" + acconut.Id + "\",\"username\":\"" + acconut.LogName + "\",\"password\":\"" + acconut.PassWord + "\",\"ToKen\":\"" + Session.SessionID + "\"}"; CookieHelper.SetCookie("cookie_rememberme", new Common.CryptHelper.AESCrypt().Encrypt(cookievalue), null); json.Status = "y"; json.ReUrl = "/Sys/Home/Index"; log.Info(Utils.GetIP(), item.ACCOUNT, Request.Url.ToString(), "Login", "系统登录,登录结果:" + json.Msg); } } else { //写入Session 当前登录用户 SessionHelper.SetSession("CurrentUser", acconut); //记录用户信息到Cookies string cookievalue = "{\"id\":\"" + acconut.Id + "\",\"username\":\"" + acconut.LogName + "\",\"password\":\"" + acconut.PassWord + "\",\"ToKen\":\"" + Session.SessionID + "\"}"; CookieHelper.SetCookie("cookie_rememberme", new Common.CryptHelper.AESCrypt().Encrypt(cookievalue), null); json.Status = "y"; json.ReUrl = "/Sys/Home/Index"; log.Info(Utils.GetIP(), item.ACCOUNT, Request.Url.ToString(), "Login", "系统登录,登录结果:" + json.Msg); } } else { json.Msg = "站点来源不可信,系统拒绝登录"; log.Warn(Utils.GetIP(), "其他系统访问者", "", "Login", "其他系统登录失败,原因:系统验证错误,系统拒绝登录"); } } else { json.Msg = "用户名或密码不正确"; log.Error(Utils.GetIP(), item.ACCOUNT, Request.Url.ToString(), "Login", "系统登录,登录结果:" + json.Msg); } } else { json.Msg = "验证码不正确"; log.Error(Utils.GetIP(), item.ACCOUNT, Request.Url.ToString(), "Login", "系统登录,登录结果:" + json.Msg); } } else { json.Msg = "验证码已过期,请刷新验证码"; log.Error(Utils.GetIP(), item.ACCOUNT, Request.Url.ToString(), "Login", "系统登录,登录结果:" + json.Msg); } } catch (Exception e) { json.Msg = e.Message; log.Error(Utils.GetIP(), item.ACCOUNT, Request.Url.ToString(), "Login", "系统登录,登录结果:" + json.Msg); } return(Json(json, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 绑定用户数据,只在已存在数据时候使用 /// /// </summary> private void _blindDataForForm() { UserManage um = new UserManage(); DataRow dr = um.getUserProfile(user); //基本信息 1->11 int i = 1; this.Name.Text = dr[i++].ToString(); this.Phone.Text = dr[i++].ToString(); this.Gender.Text = dr[i++].ToString(); this.Email.Text = dr[i++].ToString(); this.Province.SelectedValue = dr[i++].ToString(); this.University.Text = dr[i++].ToString(); this.Major.Text = dr[i++].ToString(); this.English.Text = dr[i++].ToString(); this.Skill.Text = dr[i++].ToString(); this.IdentityID.Text = dr[++i].ToString(); //其他信息 14->64 i = 14; this.universityone.Value=dr[i++].ToString(); this.degreeone.Value=dr[i++].ToString(); this.lodone.Value = dr[i++].ToString(); this.academicdurationone.Value = dr[i++].ToString(); this.majorone.Value = dr[i++].ToString(); this.minorone.Value = dr[i++].ToString(); this.gpaone.Value = dr[i++].ToString(); this.universitytwo.Value = dr[i++].ToString(); this.degreetwo.Value = dr[i++].ToString(); this.lodtwo.Value = dr[i++].ToString(); this.academicdurationtwo.Value = dr[i++].ToString(); this.majortwo.Value = dr[i++].ToString(); this.minortwo.Value = dr[i++].ToString(); this.gpatwo.Value = dr[i++].ToString(); this.universitythree.Value = dr[i++].ToString(); this.degreethree.Value = dr[i++].ToString(); this.lodthree.Value = dr[i++].ToString(); this.academicdurationthree.Value = dr[i++].ToString(); this.majorthree.Value = dr[i++].ToString(); this.minorthree.Value = dr[i++].ToString(); this.gpathree.Value = dr[i++].ToString(); this.projectname.Value = dr[i++].ToString(); this.projectdescription.Value = dr[i++].ToString(); this.projectduration.Value = dr[i++].ToString(); this.papername.Value = dr[i++].ToString(); this.journal.Value=dr[i++].ToString(); this.advisor.Value=dr[i++].ToString(); this.workdescription.Value=dr[i++].ToString(); this.raduration.Value=dr[i++].ToString(); this.jobtitle.Value=dr[i++].ToString(); this.company.Value=dr[i++].ToString(); this.responsibility.Value=dr[i++].ToString(); this.weduration.Value=dr[i++].ToString(); this.eaname.Value=dr[i++].ToString(); this.eanameother.Value=dr[i++].ToString(); this.eatitle.Value=dr[i++].ToString(); this.awardnameone.Value=dr[i++].ToString(); this.awardlevelone.Value=dr[i++].ToString(); this.awarddateone.Value=dr[i++].ToString(); this.awardnametwo.Value=dr[i++].ToString(); this.awardleveltwo.Value=dr[i++].ToString(); this.awarddatetwo.Value=dr[i++].ToString(); this.awardnamethree.Value=dr[i++].ToString(); this.awardlevelthree.Value=dr[i++].ToString(); this.awarddatethree.Value=dr[i++].ToString(); this.languagename.Value=dr[i++].ToString(); this.languageproficiency.Value=dr[i++].ToString(); this.testname.Value=dr[i++].ToString(); this.testnameother.Value=dr[i++].ToString(); this.testscore.Value=dr[i++].ToString(); this.codingablity.Value=dr[i++].ToString(); }