录播教室预约系统(十)-客户端部门管理员重置本单位其他人员密码
录播教室预约系统(十)-客户端部门管理员重置本单位其他人员密码
创新互联主要从事做网站、网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务头屯河,10年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:028-86922220
客户端代码:
//发出的数据类型为int类型 ItemID为用户对应的ID ResMessage resMessage = tcpConnnection.SendReceiveObject("ReqResetPsw", "ResResetPsw", 5000, itemID); if (resMessage.Message == "操作成功") { paramHelper.ChangeParam("操作成功"); MessageBox.Show("操作成功,用户密码为:123456"); button1.Enabled = false; } else { MessageBox.Show("出现错误,错误信息为:" + resMessage.Message); }
服务器端代码:
//客户端管理员修改用户的密码 NetworkComms.AppendGlobalIncomingPacketHandler("ReqResetPsw", HandleResetPassword);
处理方法:
//根据管理员提供的用户ID修改相应用户的密码 private void HandleResetPassword(PacketHeader header, Connection connection, int itemID) { Users theUser= DoUsers.GetUsers(itemID); //把密码恢复成123456 theUser.Password = "123456"; DoUsers.Save(theUser); ResMessage theMessage = new ResMessage(); theMessage.Message = "操作成功"; connection.SendObject("ResResetPsw", theMessage); }
操作类:
DoUsers
Users类:
[ProtoContract] public class Users { #region Constructors public Users() { } #endregion #region Private Properties private int id = -1; private string userID = string.Empty; private string name = string.Empty; private string password = string.Empty; private string declaring = string.Empty; private int status = -1; private bool isMale = false; private int userLevel = -1; private bool enabled = false; private DateTime registerTime = DateTime.UtcNow; private DateTime lastLoginTime = DateTime.UtcNow; private int depID = -1; private string department = string.Empty; #endregion #region Public Properties [ProtoMember(1)] public int Id { get { return id; } set { id = value; } } [ProtoMember(2)] public string UserID { get { return userID; } set { userID = value; } } [ProtoMember(3)] public string Name { get { return name; } set { name = value; } } [ProtoMember(4)] public string Password { get { return password; } set { password = value; } } [ProtoMember(5)] public string Declaring { get { return declaring; } set { declaring = value; } } [ProtoMember(6)] public int Status { get { return status; } set { status = value; } } [ProtoMember(7)] public bool IsMale { get { return isMale; } set { isMale = value; } } [ProtoMember(8)] public int UserLevel { get { return userLevel; } set { userLevel = value; } } [ProtoMember(9)] public bool Enabled { get { return enabled; } set { enabled = value; } } [ProtoMember(10)] public DateTime RegisterTime { get { return registerTime; } set { registerTime = value; } } [ProtoMember(11)] public DateTime LastLoginTime { get { return lastLoginTime; } set { lastLoginTime = value; } } [ProtoMember(12)] public int DepID { get { return depID; } set { depID = value; } } [ProtoMember(13)] public string Department { get { return department; } set { department = value; } } #endregion }
分享题目:录播教室预约系统(十)-客户端部门管理员重置本单位其他人员密码
本文来源:http://abwzjs.com/article/pocosh.html