/// <summary> /// 更新用户登录成功相关信息 /// </summary> /// <param name="uExtInfo"></param> public static void UpdateUserWhenSignIn(UserExtInfo uExtInfo) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Users_UpdateUserWhenSignIn", CommandType.StoredProcedure)) { cmd.AddInputParameters("UserId, LastLoginDeviceId, LastLoginAPPChannel, LastLoginAccountChannel, LastLoginDate", uExtInfo.UserId, uExtInfo.LastLoginDeviceId, uExtInfo.LastLoginAPPChannel, uExtInfo.LastLoginAccountChannel, DateTime.Now); cmd.ExecuteNonQuery(); } }
/// <summary> /// 将指定的用户设定为非锁定状态 /// </summary> /// <param name="userId"></param> public static void SetUsesUnLocked(int userId) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Users_UnLockUserAccount", CommandType.StoredProcedure)) { cmd.AddInputParameters("UserId", userId); cmd.ExecuteNonQuery(); } }
/// <summary> /// 更改学校试用用户账号状态信息 /// </summary> /// <param name="userWithSchool">用户相关信息</param> /// <param name="action">更改状态:0-激活,1-过期</param> public static void SchoolTrialUserStatusChanged(UserWithSchool userWithSchool, int action = 0) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Users_SchoolTrialUserStatusChanged", CommandType.StoredProcedure)) { cmd.AddInputParameters("UserId, IsActivated, ActivatedDate, IsExpired, ExpiredDate, Action", userWithSchool.UserId, userWithSchool.IsActivated, userWithSchool.ActivatedDate, userWithSchool.IsExpired, userWithSchool.ExpiredDate, action); cmd.ExecuteNonQuery(); } }
/// <summary> /// 更新游客账号用户名和昵称 /// </summary> /// <param name="uAccount"></param> /// <param name="uInfo"></param> public static void UpdateGuestUserInfo(UserAccount uAccount, UserInfo uInfo) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Users_UpdateGuestAccount", CommandType.StoredProcedure)) { cmd.AddInputParameters("UserId, UserName, NickName", uAccount.UserId, uAccount.UserName, uInfo.NickName); cmd.ExecuteNonQuery(); } }
/// <summary> /// 修改用户密码 /// </summary> /// <param name="uAccount"></param> public static void ChangeUserPassword(UserAccount uAccount) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Users_ChangeUserPassword", CommandType.StoredProcedure)) { cmd.AddInputParameters("UserId, Password, LastPasswordChangedDate", uAccount.UserId, uAccount.Password, uAccount.LastPasswordChangedDate); cmd.ExecuteNonQuery(); } }
/// <summary> /// 更新群组信息(快速加入码和图标文件路径) /// </summary> /// <param name="group"></param> public static void UpdateGroupInfo(GroupInfo group) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Social_UpdateGroupInfo", CommandType.StoredProcedure)) { cmd.AddInputParameters("GroupId, GroupIcon, QuickJoinCode", group.GroupId, group.GroupIcon, group.QuickJoinCode); cmd.ExecuteNonQuery(); } }
/// <summary> /// 用户虚拟币账户余额变更 /// </summary> /// <param name="userId">目标用户编号</param> /// <param name="coinChanged">虚拟币账户余额变化数量</param> public static void UserCoinChanged(int userId, int coinChanged) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Users_UserVirtualCoinChanged", CommandType.StoredProcedure)) { cmd.AddInputParameters("UserId, CoinChanged", userId, coinChanged); cmd.ExecuteNonQuery(); } }
/// <summary> /// 更新用户头像、背景图片信息 /// </summary> /// <param name="userId">用户编号</param> /// <param name="userIcon">用户图标路径</param> /// <param name="iconType">更新类型:0-头像, 1-个人信息背景图片</param> public static void UpdateUserIcon(int userId, string userIcon, byte iconType = 0) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Users_UpdateUserIcon", CommandType.StoredProcedure)) { cmd.AddInputParameters("UserId, IconUrl, Datetime, T", userId, userIcon, DateTime.Now, iconType); cmd.ExecuteNonQuery(); } }
/// <summary> /// 通用存储过程执行方法(仅执行,无返回) /// </summary> /// <param name="procedureName">存储过程名</param> /// <param name="paramNames">输入参数名,多个以英文逗号分隔:“p1, p2, p3 ...”</param> /// <param name="paramValues">输入参数对应的参数值,必须和参数对应</param> public static void ProcedureExecuteNonQuery(string procedureName, string paramNames, params object[] paramValues) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, procedureName, CommandType.StoredProcedure)) { cmd.AddInputParameters(paramNames, paramValues); cmd.ExecuteNonQuery(); } }
/// <summary> /// 用户对指定的目标数据“点赞” /// </summary> /// <param name="userId">用户编号</param> /// <param name="targetId">目标数据编号</param> /// <param name="t">类型:1-帖子,2-回复</param> public static void CreateUserFavoured(int userId, int targetId, byte t) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Bbs_CreateUserFavoured", CommandType.StoredProcedure)) { cmd.AddInputParameters("UserId, DataId, T, Date", userId, targetId, t, DateTime.Now); cmd.ExecuteNonQuery(); } }
/// <summary> /// 更新跟帖内容 /// </summary> /// <param name="postInfo"></param> public static void UpdatePostContent(PostFullInfo postInfo) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Bbs_UpdateReplyContent", CommandType.StoredProcedure)) { cmd.AddInputParameters("PostId, Content", postInfo.PostId, postInfo.Content); cmd.ExecuteNonQuery(); } }
/// <summary> /// 更新帖子内容等 /// </summary> /// <param name="topic"></param> public static void UpdateTopicContent(TopicFullInfo topic) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Bbs_UpdateTopicContent", CommandType.StoredProcedure)) { cmd.AddInputParameters("TopicId, Content, Icon, Voice", topic.TopicId, topic.Content, topic.Icon, topic.Voice); cmd.ExecuteNonQuery(); } }
/// <summary> /// 更新帖子浏览次数 /// </summary> /// <param name="topicId"></param> public static void UpdateTopicViewCount(int topicId) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Bbs_AddTopicViewCount", CommandType.StoredProcedure)) { cmd.AddInputParameters("TopicId", topicId); cmd.ExecuteNonQuery(); } }
/// <summary> /// 更新设备授权码 /// </summary> /// <param name="device"></param> public static void SetDeviceToken(UserDevice device) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Support_DeviceSetToken", CommandType.StoredProcedure)) { cmd.AddInputParameters("DeviceId, Token", device.DeviceId, device.Token); cmd.ExecuteNonQuery(); } }
/// <summary> /// 设置指定帖子的最佳回复 /// </summary> /// <param name="topic"></param> /// <param name="reply"></param> public static void SetTopicBestReply(TopicInfo topic, PostInfo reply) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Bbs_SetBestReply", CommandType.StoredProcedure)) { cmd.AddInputParameters( "TopicId, PostId, Date, ExpChanged, VirtualCoinChanged", topic.TopicId, reply.PostId, reply.SetBestDate, reply.ExpChanged, reply.VirtualCoinChanged ); cmd.ExecuteNonQuery(); } }
/// <summary> /// 更新用户个人信息 /// </summary> /// <param name="userInfo">用户个人信息</param> public static void UpdateUserInfo(UserInfo userInfo) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Users_UpdateUserInfo", CommandType.StoredProcedure)) { cmd.AddInputParameters( "UserId, NickName, Signature, Gender, Birthday, Area, Interests", userInfo.UserId, userInfo.NickName, userInfo.Signature, userInfo.Gender, userInfo.Birthday, userInfo.Area, userInfo.Interests ); cmd.ExecuteNonQuery(); } }
/// <summary> /// 更新用户应用设置 /// </summary> /// <param name="userOptions"></param> public static void UpdateUserAppOptions(UserOptions userOptions) { using (DbCommander cmd = new DbCommander(DbConn.WriteDb, "SP_Users_UpdateUserOptions", CommandType.StoredProcedure)) { cmd.AddInputParameters( "UserId, RemindPrivateMessage, RemindGroupMessage, RemindBeFollowed, RemindTopicBeReply, LastChangeDate", userOptions.UserId, userOptions.RemindPrivateMessage, userOptions.RemindGroupMessage, userOptions.RemindBeFollowed, userOptions.RemindTopicBeReply, userOptions.LastChangeDate ); cmd.ExecuteNonQuery(); } }
public string ExecuteStringCommand(string strCommand) { using (var context = new VnrHrmDataContext()) { var connection = context.Database.Connection; using (DbCommander commander = new DbCommander(connection)) { try { commander.ExecuteNonQuery(strCommand); } catch (Exception e) { if (!e.ToString().Contains("There is already an object named") && !e.ToString().Contains("name is already used by an existing object")) { return(e.ToString()); } } } } return(string.Empty); }
public string ExecuteStringCommand(string strCommand) { using (var context = new VnrHrmDataContext()) { var connection = context.Database.Connection; using (DbCommander commander = new DbCommander(connection)) { try { commander.ExecuteNonQuery(strCommand); } catch (Exception e) { if (!e.ToString().Contains("There is already an object named") && !e.ToString().Contains("name is already used by an existing object")) return e.ToString(); } } } return string.Empty; }