public override Task OnConnectedAsync() { var userInfor = new UserInfor(Context.ConnectionId, GetCurrentUserId()); userInfors.Add(userInfor); return(base.OnConnectedAsync()); }
public string ToUsername() //获取用户名那些 { StringBuilder sb1 = new StringBuilder(); try { UserInfor User = UserInforDAL.m_UserInforDal.GetModel("Binding='" + Onew.Author + "'"); sb1.Append(string.Format(@"<div class='xiazai-tx-text col-lg-6 col-md-6 col-sm-6 col-xs-6 fr'>")); sb1.Append(string.Format(@"<h4 class='neicheng'>{0}", User.UserName)); if (User.Gender) { sb1.Append(string.Format(@"<i class='layui-icon male'></i>"));//男 } else { sb1.Append(string.Format(@"<i class='layui-icon female'></i>"));//女 } sb1.Append(string.Format(@"</h4><a target='_blank' class='chakanzz col-sm-8 col-xs-12' href='user/personal.aspx?uid={0}'>查看作者</a></div>", User.Binding)); //sb1.Append(string.Format(@"<h4 class='neicheng'>初心 <i class='layui-icon male'></i><i class='layui-icon female'></i></h4>'>")); return(sb1.ToString()); } catch (Exception) { return("网站正在维护中……"); } }
/// <summary> /// 创建XML /// </summary> /// <param name="filePath">路径</param> /// <param name="content">内容</param> /// <param name="datetimeStr">时间戳</param> private void CreatDoc(UserInfor user) { XmlDocument doc = new XmlDocument(); //3、创建第一个行描述信息,并且添加到doc文档中 XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", null); doc.AppendChild(dec); //4、创建根节点 XmlElement books = doc.CreateElement("UserInfors"); //将根节点添加到文档中 doc.AppendChild(books); //5、给根节点Books创建子节点 XmlElement book = doc.CreateElement("UserInfor"); //将book添加到根节点 books.AppendChild(book); //6、给Book1添加子节点 XmlElement name = doc.CreateElement("Infor"); name.SetAttribute("ClientId", user.ClientId); name.SetAttribute("User", user.User); book.AppendChild(name); doc.Save(filePath); }
private ReturnMessage Updateuserinfo(string nickname, string email, string selfdes) { UserInfor user = UserInforDAL.CurrentUser(); if (user != null) { if (user.Nickname.Length <= 3) { user.Nickname = nickname; user.Uemail = email; user.Uselfdes = selfdes; } else { user.Uemail = email; user.Uselfdes = selfdes; } if (UserInforDAL.m_UserInforDAL.Update(user)) { rm.Info = "true"; } else { rm.Info = "false"; } } return(rm); }
public async Task <IActionResult> PutUserInfor(int id, UserInfor userInfor) { if (id != userInfor.UserInfoID) { return(BadRequest()); } _context.Entry(userInfor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserInforExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public UserInfor GetUserInforLogin(UserLogin userLogin) { var userInfor = new UserInfor(); var user = _userLoginRepository.GetSingleByCondition(x => x.Username == userLogin.Username); if (user == null) { return(null); } else { var passwordDecrypt = CommonUltils.DecryptStringAES(userLogin.Password); var validPw = CommonUltils.VerifyPasswordHash(passwordDecrypt, user.PasswordHash, user.PasswordSalt); if (validPw == false) { return(null); } else { string[] includes = new string[1] { "Role" }; userInfor = _userRepository.GetSingleByCondition(x => x.UserId == user.UserId, includes); } } return(userInfor); }
private ReturnMessage Updateuserinfo(string oldpwd, string newpwd) { UserInfor user = UserInforDAL.CurrentUser(); if (user != null) { if (user.password == oldpwd) { user.password = newpwd; } else { rm.Info = "incorrect"; return(rm); } if (UserInforDAL.m_UserInforDAL.Update(user)) { rm.Info = "true"; } else { rm.Info = "false"; } } return(rm); }
/// <summary> /// 读取分数 /// </summary> private void getTestUser() { string sql = "select a.userId,b.userName from tbl_Test_User a,tbl_User b where a.userId=b.ID and a.testId=" + testId.ToString(); DataSet ds = db.ReturnDataSet(sql); if (ds.Tables[0].Rows.Count > 0) { int userCount = ds.Tables[0].Rows.Count; if (userCount > Max_User_Count) { userCount = Max_User_Count; } userInfors = new UserInfor[userCount]; for (int i = 0; i < userCount; i++) { userInfors[i] = new UserInfor(db); string userName = (string)ds.Tables[0].Rows[i]["userName"]; userInfors[i].setUserInfor(userName, 0, 0); int userId = (int)ds.Tables[0].Rows[i]["userId"]; userInfors[i].setUserId(userId); userInfors[i].Parent = this; userInfors[i].Top = 300 + i * (userInfors[i].Height + 2); userInfors[i].Left = 44; userInfors[i].OnClick += new UserInfor.ClickHandler(btn_OnClick); userInfors[i].BringToFront(); } } else { MessageBox.Show("没有参赛者!"); } }
public ReturnMessage checklogin() { try { if (UserInforDAL.CurrentUser() != null) { UserInfor user = UserInforDAL.CurrentUser(); rm.Success = true; rm.Info = user.Uavatar; } else { rm.Info = "no"; rm.Redirect = "../login.aspx"; } return(rm); } catch (Exception) { rm.Info = "no"; return(rm); throw; } }
protected void gotoStuInfo(object sender, EventArgs e) { if (Session["currentuser"] != null) { UserInfor myses = (UserInfor)Session["currentuser"]; StudentInfo data1 = new StudentInfo { //emailAddress = email.Text, studentFirstName = FirName.Text, studentLastName = LasName.Text, studentId = StuId.Text, schoolName = Scl.Text, emailAddress = myses.EmailAddress }; UserInfor UserObj = (UserInfor)Session["currentuser"]; string emailId = UserObj.emailAddress; List <UserInfor> allUsersList = Application["AllUsersList"] as List <UserInfor>; if (allUsersList != null) { var item = allUsersList.FirstOrDefault(p => p.emailAddress == emailId); if (item != null) { item.myStudents.Add(data1); } } } update_db(); Server.Transfer("~/stuInfo.aspx"); }
/// <summary> /// 读取XML文件 /// </summary> /// <param name="file"></param> /// <returns></returns> public UserInfor ReadDoc(string user) { UserInfor info = new UserInfor(); XmlDocument doc = new XmlDocument(); if (File.Exists(filePath)) { //如果文件存在 加载XML doc.Load(filePath); //获得文件的根节点 XmlNodeList xnl = doc.SelectNodes("/UserInfors/UserInfor/Infor"); if (xnl.Count > 0) { foreach (XmlNode item in xnl) { if (item.Attributes["User"].Value == user) { info.ClientId = item.Attributes["ClientId"].Value; info.User = item.Attributes["User"].Value; } } } } return(info); }
public async Task <ActionResult <UserInfor> > PostUserInfor(UserInfor userInfor) { _context.UserInfors.Add(userInfor); await _context.SaveChangesAsync(); return(CreatedAtAction("GetUserInfor", new { id = userInfor.UserInfoID }, userInfor)); }
protected void addtolist(object sender, EventArgs e) { List <UserInfor> allUsersList = Application["AllUsersList"] as List <UserInfor>; UserInfor uinfo = Session["currentUser"] as UserInfor; var flag = uinfo.MyStudents.Find(x => x.StudentId == studentid.Text); if (flag != null) { Response.Write("<script>alert('The student is already in your list.');</script>"); } else { StudentInfor sinfo = new StudentInfor(); SqlConnection db_conn = new SqlConnection("Data Source=dcm.uhcl.edu;Initial Catalog=c432017sp02errabellyr;Persist Security Info=True;User ID=errabellyr;Password=1472539;Asynchronous Processing=true;MultipleActiveResultSets=True"); String query_builder = "INSERT INTO Errabelly_WADSP17_STUDENT(EmailAddress,StudentId,StudentFirstName,StudentLastName,SchoolName) VALUES(" + "'" + uinfo.EmailAddress + "', '" + studentid.Text + "', '" + fname.Text + "', '" + lname.Text + "', '" + sname.Text + "')"; SqlCommand sql_query = new SqlCommand(query_builder, db_conn); try { db_conn.Open(); sql_query.ExecuteNonQuery(); } finally { db_conn.Close(); } sinfo.StudentFirstName = fname.Text; sinfo.StudentLastName = lname.Text; sinfo.StudentId = studentid.Text; sinfo.SchoolName = sname.Text; uinfo.MyStudents.Add(sinfo); Application["AllUsersList"] = allUsersList; Response.Redirect("~/MyStudents.aspx"); } }
public ReturnMessage Getuserinfo() { UserInfor user = UserInforDAL.CurrentUser(); List <object> list = new List <object>(); if (user != null) { list.Add(user.Nickname); list.Add(user.Realname); list.Add(user.UIdentity); if (user.Udepartment == null) { list.Add("-"); } else { list.Add(user.Udepartment); } list.Add(user.Ucash); list.Add(getdayoff(user.CreatedTime) + "天"); list.Add(user.Uemail); list.Add(user.Sex); list.Add(user.Uselfdes); rm.Data = list; } return(rm); }
public static IList <JobInfo> GetMyJobsWorker(int status, int resolve) { string sql = ""; UserInfor user = UserInforBLL.CurrentUser; if (status >= 0 && resolve >= 0) { sql = string.Format("select * from jobs where worker = '{0}' and jobStatus = '{1}' and resolve = '{2}' ", user.UserId, status, resolve); } else if (status < 0 && resolve < 0) { sql = string.Format("select * from jobs where worker = '{0}'", user.UserId); } else { if (status == -1) { sql = string.Format("select * from jobs where worker = '{0}' and resolve = '{1}' ", user.UserId, resolve); } else { sql = string.Format("select * from jobs where worker = '{0}' and jobStatus = '{1}' ", user.UserId, status); } } return(TcarSystem.DAL.JobInfoService.GetJobsBySQL(sql)); }
public static IList <JobInfo> GetAllJobInfos() { UserInfor user = UserInforBLL.CurrentUser; //Outlet outlets = new Outlet(); string sql = ""; if (user.Identity == "manager") { sql = string.Format("select * from jobs where outlet ='{0}'", user.outlet.Id); // return TcarSystem.DAL.JobInfoService.GetAllJobInfos(UserInforBLL.CurrentUser.outlet); } else if (user.Identity == "hpdesk") { sql = string.Format("select * from jobs where jobStatus = 0"); } else if (user.Identity == "work") { sql = string.Format("select * from jobs where worker = '{0}' and jobStatus = 1", user.UserId); } else { sql = string.Format("select * from jobs where customer = '{0}'", user.UserId); } return(TcarSystem.DAL.JobInfoService.GetJobsBySQL(sql)); }
public string checkUtype(string loginName) { UserInfor user = dal.IsLoginByLoginName(loginName); string gettype = user.Identity; return(gettype); }
public AddUser() { InitializeComponent(); ModiUser = null; ModiLinqUser = null; isEFSearch = true; }
public ActionResult DeleteConfirmed(int id) { UserInfor userInfor = db.UserInfor.Find(id); db.UserInfor.Remove(userInfor); db.SaveChanges(); return(RedirectToAction("Index")); }
public int UserAdd(UserInfor user) { using (var db = base.GetDbContext()) { db.Set <UserInfor>().Add(user); return(db.SaveChanges()); } }
private void userpage_Load(object sender, EventArgs e) { userControlAddReport1.Hide(); userControlCheckReport1.Show(); UserInfor user = UserInforBLL.CurrentUser; //load welcome infor; labelWelcome.Text = "Welcome" + " " + user.UserName + "!"; }
public static IList <JobInfo> GetMyJobsManager(int status, int resolve, int workerid) { string sql = ""; UserInfor user = UserInforBLL.CurrentUser; sql = string.Format("select * from jobs where manager = '{0}' and jobStatus = '{1}' and resolve = '{2}' and worker = '{3}'", user.UserId, status, resolve, workerid); return(TcarSystem.DAL.JobInfoService.GetJobsBySQL(sql)); }
public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Phone,UserId")] UserInfor userInfor) { if (ModelState.IsValid) { db.Entry(userInfor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userInfor)); }
public static IList <JobInfo> GetAllJobInfos() { UserInfor user = UserInforBLL.CurrentUser; string sql = ""; if (user.Identity == "user") { sql = string.Format("select * from jobs where customer = '{0}'", user.UserId); } return(TcarSystem.DAL.JobInfoService.GetJobsBySQL(sql)); }
//登陆函数 public string Tologin(string Email, string Pwd) { try { if (string.IsNullOrEmpty(Email) || string.IsNullOrEmpty(Pwd))//判断是否为空 { rm.Success = false; rm.Info = "用户名或者密码不能为空!"; string sresult = jss.Serialize(rm);//吧 rm 对象 转换 return(sresult); } else { List <dbParam> list = new List <dbParam>() { new dbParam() { ParamName = "@UserEmail", ParamValue = Email }, new dbParam() { ParamName = "@Pwd", ParamValue = Pwd } }; //获取到了这个条件下的一个对象 判断不为空 UserInfor user = UserInforDAL.m_UserInforDal.GetModel("UserEmail=@UserEmail and UserPwd=@Pwd", list); if (user != null) //登陆成功 { context.Session["userkey"] = user.Binding.ToString(); //保存Session key 用户唯一识别码 rm.Success = true; rm.Info = "登录成功!"; string sresult = jss.Serialize(rm);//吧 rm 对象 转换 return(sresult); } else { rm.Success = false; rm.Info = "用户名或密码错误!"; string sresult = jss.Serialize(rm);//吧 rm 对象 转换 return(sresult); } } } catch (Exception ex) { rm.Success = false; rm.Info = "系统异常,请联系客服!"; string sresult = jss.Serialize(rm);//吧 rm 对象 转换 return(sresult); } }
protected void Page_Load(object sender, EventArgs e) { if (Page.PreviousPage != null) { if (Session["currentuser"] != null) { UserInfor UserObj1 = (UserInfor)Session["currentuser"]; string firstname = UserObj1.firstName; string lastname = UserObj1.lastName; lbname.Text = firstname + " " + lastname; UserInfor UserObj = (UserInfor)Session["currentuser"]; string emailId = UserObj.emailAddress; List <UserInfor> allUsersList = Application["AllUsersList"] as List <UserInfor>; if (allUsersList != null) { var item = allUsersList.FirstOrDefault(p => p.emailAddress == emailId); if (item.myStudents.Count != 0) { foreach (StudentInfo item1 in item.myStudents) { TableRow row = new TableRow(); TableCell cell1 = new TableCell(); TableCell cell2 = new TableCell(); TableCell cell3 = new TableCell(); TableCell cell4 = new TableCell(); cell1.Text = item1.studentFirstName; cell2.Text = item1.studentLastName; cell3.Text = item1.studentId; cell4.Text = item1.schoolName; row.Cells.Add(cell1); row.Cells.Add(cell2); row.Cells.Add(cell3); row.Cells.Add(cell4); myTable.Rows.Add(row); } } else { TableRow row = new TableRow(); TableCell cell1 = new TableCell(); cell1.Text = "No Records Found"; row.Cells.Add(cell1); myTable.Rows.Add(row); } } } } }
public UserInfor Get(string loginId, string x) { Member member = MembershipService.GetUserByUserName(loginId).MemberDetail; string pernr = member.Empno; UserInfor user = new UserInfor(); user.EMPNO = pernr; user.WERKS = PlantService.GetWERKS(pernr); return(user); }
/* * public void cancelButton(object sender, EventArgs e) * { * * Response.Redirect("login.aspx"); * } * } */ protected void rcvrbtn_Click(object sender, EventArgs e) { String checkMail = recoverEmail.Text; UserInfor S1 = null; if (Application["AllUsersList"] != null) { List <UserInfor> allUsersList = Application["AllUserList"] as List <UserInfor>; if (allUsersList != null) { for (int i = 0; i < allUsersList.Count; i++) { if (allUsersList[i].EmailAddress == checkMail) { S1 = allUsersList[i] as UserInfor; } } } } if (S1 != null) { String msgTo = checkMail; String msgSubject = "We have recovered your password!"; String msgBody = "Dear " + S1.FirstName + ",<br/><br/>You are receiving this email because a you requested to recover your password.<br/><br/>Your current password is: " + S1.Password + "<br/><br/>Thank You.<br/>Gateway School Account Administration Team"; MailMessage mailObj = new MailMessage(); mailObj.Body = msgBody; mailObj.From = new MailAddress("*****@*****.**", "GateWaySchoolAccount Team "); mailObj.To.Add(new MailAddress(msgTo)); mailObj.Subject = msgSubject; mailObj.IsBodyHtml = true; SmtpClient SMTPClient = new SmtpClient(); SMTPClient.Host = "smtp.gmail.com"; SMTPClient.Port = 587; SMTPClient.Credentials = new NetworkCredential("*****@*****.**", "wad@2017"); SMTPClient.EnableSsl = true; try { SMTPClient.Send(mailObj); ClientScript.RegisterStartupScript(this.GetType(), "callfunction", "alert(' Thank You for your comments.An email has been sent to the address you entered. Please feel free to contact us anytime in future so we will address your concerns ')", true); } catch (Exception) { Response.Write("Helloo"); } } else { String url = "Signup.aspx"; ClientScript.RegisterStartupScript(this.GetType(), "callfunction", "alert(' Sorry we cannot find a matching email.Please Sign Up. '); window.location.href = '" + url + "'; ", true); } ClientScript.RegisterStartupScript(this.GetType(), "callfunction", "alert(' Thank You.An email notification has also been sent to the address we have in our file ')", true); }
public UserInfor toUobj()//获取发帖人 信息 { try { UserInfor NEW = UserInforDAL.m_UserInforDal.GetModel("Binding='" + Onew.Author + "'"); return(NEW); } catch (Exception) { return(null); } }
protected void Application_Start(object sender, EventArgs e) { Application["AllUsersList"] = new List <UserInfor>(); Application["AllStudentList"] = new List <StudentInfor>(); List <UserInfor> allUsersList = Application["AllUsersList"] as List <UserInfor>; if (allUsersList == null) { allUsersList = new List <UserInfor>(); } List <StudentInfor> allStudentsList = Application["AllStudentList"] as List <StudentInfor>; if (allStudentsList == null) { allStudentsList = new List <StudentInfor>(); } SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["dcmweb.c432017sp02kamireddig.dbo"].ToString()); cn.Open(); String query = "SELECT * from Kamireddig_WADsp17_StudentInfor"; String query1 = "SELECT * from Kamireddig_WADsp17_UserInfor"; SqlCommand cmd = new SqlCommand(query, cn); SqlCommand cmd1 = new SqlCommand(query1, cn); SqlDataReader sqlReader = cmd.ExecuteReader(); SqlDataReader sqlReader1 = cmd1.ExecuteReader(); while (sqlReader.Read()) { UserInfor obj = new UserInfor(); obj.EmailAddress = (string)sqlReader["EmailAddress"]; obj.Password = (string)sqlReader["Password"]; obj.FirstName = (string)sqlReader["FirstName"]; obj.LastName = (string)sqlReader["LastName"]; obj.SecurityQuestion = (string)sqlReader["SecurityQuestion"]; obj.SecurityQuestionAnswer = (string)sqlReader["SecurityQAnswer"]; obj.StateOrProvince = (string)sqlReader["StateOrProvince"]; obj.SchoolDistrictName = (string)sqlReader["SchoolDistName"]; allUsersList.Add(obj); } Application["AllUsersList"] = allUsersList; while (sqlReader1.Read()) { StudentInfor obj1 = new StudentInfor(); obj1.EmailAddress = (string)sqlReader1["EmailAddress"]; obj1.StudentFirstName = (string)sqlReader1["StudentFirstName"]; obj1.StudentId = (string)sqlReader1["StudentId"]; obj1.StudentLastName = (string)sqlReader1["StudentLastName"]; obj1.SchoolName = (string)sqlReader1["SchoolName"]; allStudentsList.Add(obj1); } Application["AllStudentList"] = allStudentsList; cn.Close(); }