/// <summary> /// 获取离线消息 /// </summary> /// <param name="aHostEmail">接受者邮箱</param> /// <param name="aFriendEmail">发送者邮箱</param> /// <returns></returns> public DataTable GetOffMessage(string aHostEmail) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_Message"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("@mFunctionName", "GetOffMessage"); mSqlStoreCommand.AddParameters("@mReceiverEmail", aHostEmail); DataTable mGetOffMessage = mSqlStoreCommand.ExecuteDataTable(); return mGetOffMessage; }
/// <summary> /// 个人主页显示个人信息 /// </summary> public DataTable ShowSelfMessage(string aUserEmail) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_User"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("@mFunctionName", "SearchOne"); mSqlStoreCommand.AddParameters("@mUserEmail", aUserEmail); DataTable mShowSelfMessage = mSqlStoreCommand.ExecuteDataTable(); return mShowSelfMessage; }
/// <summary> /// 删除离线消息 /// </summary> /// <param name="aHostEmail">接受者邮箱</param> /// <param name="aFriendEmail">发送者邮箱</param> /// <returns></returns> public void DeleteOffMessage(string aHostEmail, string aFriendEmail) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_Message"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("@mFunctionName", "DeleteOffMessage"); mSqlStoreCommand.AddParameters("@mReceiverEmail", aHostEmail); mSqlStoreCommand.AddParameters("@mSenderEmail", aFriendEmail); mSqlStoreCommand.ExecuteNonQuery(); }
/// <summary> /// 检测注册账号是否重复 /// </summary> /// <param name="aUserEmail">用户邮箱</param> /// <returns></returns> public int CheckUserRegist(string aUserEmail) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_User"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("@mFunctionName", "CheckInsert"); mSqlStoreCommand.AddParameters("@mUserEmail", aUserEmail); int mCheckUserRegist = Convert.ToInt32(mSqlStoreCommand.ExecuteFunction()); return mCheckUserRegist; }
/// <summary> /// 验证是否重复添加好友 /// </summary public int CheckAddFriendMessage(string aUserEmail,string aFriendEmail) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_Friend"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("@mFunctionName", "CheckInsertToFr"); mSqlStoreCommand.AddParameters("@mHostEmail", aUserEmail); mSqlStoreCommand.AddParameters("@mFriendEmail", aFriendEmail); int mCheckAddFriendMessage = Convert.ToInt32(mSqlStoreCommand.ExecuteFunction()); return mCheckAddFriendMessage; }
/// <summary> /// 同意添加好友 /// </summary> public int AgreeAddFriend(string aUserEmail,string aFriendEmail) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_Friend"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("@mFunctionName","AdmmitOrNot1"); mSqlStoreCommand.AddParameters("@mHostEmail", aUserEmail); mSqlStoreCommand.AddParameters("@mFriendEmail",aFriendEmail); mSqlStoreCommand.ExecuteNonQuery(); return 1; }
/// <summary> /// 添加好友 /// </summary> /// <param name="userEmail">好友邮箱</param> public int AddFriends(string aUserEmail,string aFriendEmail) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_Friend"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("@mFunctionName", "InsertIntoFr"); mSqlStoreCommand.AddParameters("@mHostEmail",aUserEmail); mSqlStoreCommand.AddParameters("@mFriendEmail",aFriendEmail); int mAddFriends = mSqlStoreCommand.ExecuteNonQuery(); return mAddFriends; }
/// <summary> /// 验证登陆 /// </summary> /// <param name="aUserEmail">用户邮箱</param> /// <param name="aUserPassword">密码</param> public int CheckLogin(string aUserEmail, string aUserPassword) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_User"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("@mFunctionName", "Check"); mSqlStoreCommand.AddParameters("@mUserEmail", aUserEmail); mSqlStoreCommand.AddParameters("@mUserPassword", Encryption.EncryptString(aUserPassword, "jingyetankey")); int mCheckLogin = Convert.ToInt32(mSqlStoreCommand.ExecuteFunction()); return mCheckLogin; }
/// <summary> /// 插入离线消息 /// </summary> /// <param name="mMessage"></param> /// <returns></returns> public void OffMessage(string aHostEmail, string aFriendEmail, string aMessage) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_Message"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("@mFunctionName", "InsertInToOff"); mSqlStoreCommand.AddParameters("@mSenderEmail", aHostEmail); mSqlStoreCommand.AddParameters("@mReceiverEmail", aFriendEmail); mSqlStoreCommand.AddParameters("@mMessage", aMessage); mSqlStoreCommand.AddParameters("@mTime", System.DateTime.Now); mSqlStoreCommand.ExecuteNonQuery(); }
/// <summary> /// 注册 /// </summary> /// <param name="userEmail">用户邮箱</param> /// <param name="userName">用户名</param> /// <param name="userPassWord">密码</param> public int UserRegist(string aUserName, string aUserEmail, string aUserPassWord, string aRemark) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_User"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("@mFunctionName", "Insert"); mSqlStoreCommand.AddParameters("@mUserName", aUserName); mSqlStoreCommand.AddParameters("@mUserEmail", aUserEmail); mSqlStoreCommand.AddParameters("@mUserPassWord", Encryption.EncryptString(aUserPassWord, "jingyetankey"));//密码加密后存到数据库 mSqlStoreCommand.AddParameters("@mRemark", aRemark); mSqlStoreCommand.AddParameters("@mCreateTime", System.DateTime.Now); mSqlStoreCommand.AddParameters("@mModifyTime", System.DateTime.Now); int mUserRegist= Convert.ToInt32(mSqlStoreCommand.ExecuteFunction()); return mUserRegist; }
/// <summary> /// 修改密码 /// </summary> /// <param name="aUserEmail">用户邮箱</param> /// <param name="aUserPassword">原密码</param> /// <param name="aUserNewPassword">所要修改的密码</param> /// <returns></returns> public int UpdatePassword(string aUserEmail,string aUserPassword,string aUserNewPassword) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_User"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("mFunctionName", "GetPassword"); mSqlStoreCommand.AddParameters("@mUserEmail", aUserEmail); if (Encryption.EncryptString(aUserPassword, "jingyetankey").Equals(Convert.ToString(mSqlStoreCommand.ExecuteFunction()))) { mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("mFunctionName", "UpdatePassword"); mSqlStoreCommand.AddParameters("@mUserEmail", aUserEmail); mSqlStoreCommand.AddParameters("@mNuserPassword", Encryption.EncryptString(aUserNewPassword, "jingyetankey")); } int mUpdatePassword = mSqlStoreCommand.ExecuteNonQuery(); return mUpdatePassword; }
/// <summary> /// 获取好友列表 /// </summary> /// <param name="aUserEmail">用户账号</param> /// <returns></returns> public DataTable FriendsList(string aUserEmail) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_Friend"; //motified by stf & pzb mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("@mFunctionName", "GetFriends"); mSqlStoreCommand.AddParameters("@mHostEmail", aUserEmail); DataTable mFriendsList = mSqlStoreCommand.ExecuteDataTable(); return mFriendsList; }
/// <summary> /// 获取用户名 /// </summary> /// <param name="aUserEmail">用户邮箱</param> /// <returns></returns> public string SearchName(string aUserEmail) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand .StoreProdureName = "Chat_User"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("@mFunctionName", "SearchName"); mSqlStoreCommand.AddParameters("@mUserEmail", aUserEmail); string mSearchName = Convert.ToString(mSqlStoreCommand.ExecuteFunction()); return mSearchName; }
/// <summary> /// 修改个人信息 /// </summary> /// <param name="aUserEmail">用户邮箱</param> /// <param name="aUserName">用户昵称</param> /// <param name="aRemark">备注</param> public int UpdateSelfMessage(string aUserEmail,string aUserName,string aRemark) { SqlStoreCommand mSqlStoreCommand = new SqlStoreCommand(); mSqlStoreCommand.StoreProdureName = "Chat_User"; mSqlStoreCommand.ClearParameters(); mSqlStoreCommand.AddParameters("mFunctionName", "Update"); mSqlStoreCommand.AddParameters("@mUserEmail",aUserEmail); mSqlStoreCommand.AddParameters("@mUserName",aUserName); mSqlStoreCommand.AddParameters("@mRemark", aRemark); mSqlStoreCommand.AddParameters("@mModifyTime",System.DateTime.Now); int mUpdateSelfMessage=mSqlStoreCommand.ExecuteNonQuery(); return mUpdateSelfMessage; }