/// <summary> /// 移动好友 /// </summary> /// <param name="userid">用户id</param> /// <param name="friendid">好友id</param> /// <param name="groupid"></param> /// <returns></returns> public static int MoveFriend(string userid, string friendid, string groupid) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; Hashtable hashTable = new Hashtable(); hashTable.Add("UserID", userid); hashTable.Add("FriendID", friendid); hashTable.Add("GroupID", groupid); try { mapper.BeginTransaction(); result = mapper.Update("MoveFriend1", hashTable); mapper.CommitTransaction(); } catch { } if (result == 0) { try { mapper.BeginTransaction(); result = mapper.Update("MoveFriend2", hashTable); mapper.CommitTransaction(); } catch { } } return(result); }
public static object InsertUserToGame(string userid, string gameid) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; Hashtable hashTable = new Hashtable(); hashTable.Add("UserID", userid); hashTable.Add("GameID", gameid); try { mapper.BeginTransaction(); result = mapper.QueryForObject <int>("IsExistUserToGame", hashTable); mapper.CommitTransaction(); } catch { } if (result == 0) { object oj = null; try { mapper.BeginTransaction(); oj = mapper.Insert("InsertUserToGame", hashTable); mapper.CommitTransaction(); } catch { } return(oj); } return(null); }
/// <summary> /// 更新Sheet对应的流程信息 /// </summary> public static int UpdateProcedureMap(int sheetID, string procedureMap) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; try { mapper.BeginTransaction(); result = mapper.QueryForObject <int>("SheetIsExistInProcedure", sheetID); mapper.CommitTransaction(); } catch (Exception ex) { applog.InfoFormat("Access.UpdateProcedureMap()--Search Error:{0}", ex.Message); mapper.RollBackTransaction(); return(result); } Hashtable hashTable = new Hashtable(); hashTable.Add("SheetID", sheetID); hashTable.Add("ProcedureMap", procedureMap); if (result == 0) { try { mapper.BeginTransaction(); mapper.Insert("InsertProcedureMap", hashTable); mapper.CommitTransaction(); result = 1; } catch (Exception ex) { applog.InfoFormat("Access.UpdateProcedureMap()--Insert Error:{0}", ex.Message); mapper.RollBackTransaction(); } } else { try { mapper.BeginTransaction(); mapper.Update("UpdateProcedureMapBySheet", hashTable); mapper.CommitTransaction(); result = 1; } catch (Exception ex) { applog.InfoFormat("Access.UpdateProcedureMap()--Update Error:{0}", ex.Message); mapper.RollBackTransaction(); } } return(result); }
/// <summary> /// 更新用户信息 /// </summary> /// <param name="userInfo">用户信息类</param> /// <returns>影响行数</returns> public static int UpdateUser(UserInfo userInfo) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; try { mapper.BeginTransaction(); result = mapper.Update("UpdateUser", userInfo); mapper.CommitTransaction(); } catch { } return(result); }
/// <summary> /// 根据用户id返回“别人请求添加自己为好友”的该用户的信息集合 /// </summary> /// <param name="userid">用户id</param> /// <returns>消息集合</returns> public static List <UserInfo> GetAddFromByAddTo(int userid) { ISqlMapper mapper = GetSqlMapper.GetMapper(); List <UserInfo> userList = null; try { mapper.BeginTransaction(); userList = mapper.QueryForList <UserInfo>("GetAddFromByAddTo", userid).ToList(); mapper.CommitTransaction(); } catch { } return(userList); }
/// <summary> /// 根据用户所玩游戏信息获取相应成就信息 /// </summary> /// <param name="gameInfo">包含(用户id,游戏名字,游戏表)的信息</param> /// <returns>成就信息</returns> public static AchieveInfo GetAllAchieveByID(GameInfo gameInfo) { ISqlMapper mapper = GetSqlMapper.GetMapper(); AchieveInfo achieveInfo = null; try { mapper.BeginTransaction(); achieveInfo = mapper.QueryForObject <AchieveInfo>("GetAllAchieveByID", gameInfo); mapper.CommitTransaction(); } catch { } return(achieveInfo); }
/// <summary> /// 根据账号或昵称返回用户信息集合 /// </summary> /// <param name="cardorname">账号或昵称</param> /// <returns></returns> public static List <UserInfo> GetUserByIDorName(string cardorname) { ISqlMapper mapper = GetSqlMapper.GetMapper(); List <UserInfo> userList = null; try { mapper.BeginTransaction(); userList = mapper.QueryForList <UserInfo>("GetUserByIDorName", cardorname).ToList(); mapper.CommitTransaction(); } catch { } return(userList); }
/// <summary> /// 账号是否存在 /// </summary> /// <param name="cardword">账号</param> /// <returns>记录数</returns> public static int CardIsExist(string cardword) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; try { mapper.BeginTransaction(); result = mapper.QueryForObject <int>("Card_IsExist", cardword); mapper.CommitTransaction(); } catch { } return(result); }
/// <summary> /// 发布消息,插入数据库 /// </summary> /// <param name="noticeInfo"></param> /// <returns></returns> public static object InsertNotice(NoticeInfo noticeInfo) { ISqlMapper mapper = GetSqlMapper.GetMapper(); object oj = null; try { mapper.BeginTransaction(); oj = mapper.Insert("InsertNotice", noticeInfo); mapper.CommitTransaction(); } catch { } return(oj); }
/// <summary> /// 清空消息 /// </summary> /// <returns></returns> public static int ClearNotice() { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; try { mapper.BeginTransaction(); result = mapper.Delete("ClearNotice", null); mapper.CommitTransaction(); } catch { } return(result); }
/// <summary> /// 返回消息集合 /// </summary> /// <returns>系统消息集合</returns> public static List <NoticeInfo> GetAllMsg() { ISqlMapper mapper = GetSqlMapper.GetMapper(); List <NoticeInfo> noticeList = null; try { mapper.BeginTransaction(); noticeList = mapper.QueryForList <NoticeInfo>("GetAllMsg", null).ToList(); mapper.CommitTransaction(); } catch { } return(noticeList); }
/// <summary> /// 根据用户ID返回好友记录行集合 /// </summary> /// <param name="userid">用户id</param> /// <returns>满足记录集合</returns> public static List <FriendInfo> GetAllFriendByID(int userid) { ISqlMapper mapper = GetSqlMapper.GetMapper(); List <FriendInfo> friendList = null; try { mapper.BeginTransaction(); friendList = mapper.QueryForList <FriendInfo>("GetAllFriendByID", userid).ToList(); mapper.CommitTransaction(); } catch { } return(friendList); }
/// <summary> /// 根据用户id返回所玩游戏信息 /// </summary> /// <param name="userid"></param> /// <returns></returns> public static List <GameInfo> GetAllGameByID(int userid) { ISqlMapper mapper = GetSqlMapper.GetMapper(); List <GameInfo> gameList = null; try { mapper.BeginTransaction(); gameList = mapper.QueryForList <GameInfo>("GetAllGameByID", userid).ToList(); mapper.CommitTransaction(); } catch { } return(gameList); }
/// <summary> /// 根据用户id返回用户信息 /// </summary> /// <param name="listFriend">存放用户id与组id的集合</param> /// <returns>包含(用户信息+所在组id)的集合</returns> public static List <UserInfo> GetAllUserByID(List <Friend> listFriend) { ISqlMapper mapper = GetSqlMapper.GetMapper(); List <UserInfo> userList = null; try { mapper.BeginTransaction(); userList = mapper.QueryForList <UserInfo>("GetAllUserByID", listFriend).ToList(); mapper.CommitTransaction(); } catch { } return(userList); }
/// <summary> /// 根据账号查看状态 /// </summary> /// <param name="cardword">账号</param> /// <returns>用户信息</returns> public static UserInfo StatusIsY(string cardword) { ISqlMapper mapper = GetSqlMapper.GetMapper(); UserInfo userInfo = null; try { mapper.BeginTransaction(); userInfo = mapper.QueryForObject <UserInfo>("Status_IsY", cardword); mapper.CommitTransaction(); } catch { } return(userInfo); }
/// <summary> /// 邮箱是否已经被注册 /// </summary> /// <param name="email">邮箱</param> /// <returns>记录数</returns> public static int MailIsExist(string email) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; try { mapper.BeginTransaction(); result = mapper.QueryForObject <int>("Mail_IsExist", email); mapper.CommitTransaction(); } catch { } return(result); }
/// <summary> /// 更新状态为N /// </summary> /// <param name="userid">用户id</param> /// <returns></returns> public static int UpdateStatus_N(int userid) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; try { mapper.BeginTransaction(); result = mapper.Update("UpdateStatusN", userid); mapper.CommitTransaction(); } catch { } return(result); }
/// <summary> /// 获取游戏版本时间 /// </summary> /// <param name="time"></param> /// <returns></returns> public static string GetGameTime(string gameid) { ISqlMapper mapper = GetSqlMapper.GetMapper(); string gametime = null; try { mapper.BeginTransaction(); gametime = mapper.QueryForObject <string>("GetGameTime", gameid); mapper.CommitTransaction(); } catch { } return(gametime); }
/// <summary> /// 更新用户状态Y /// </summary> /// <param name="cardword">账号</param> /// <returns>影响行数</returns> public static int UpdateStatus_Y(string cardword) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; //更新状态 try { mapper.BeginTransaction(); result = mapper.Update("UpdateStatusY", cardword); mapper.CommitTransaction(); } catch { } return(result); }
/// <summary> /// 返回用户信息 /// </summary> /// <param name="cardword">账号</param> /// <returns>用户信息</returns> public static UserInfo GetUserByCard(string cardword) { ISqlMapper mapper = GetSqlMapper.GetMapper(); UserInfo userInfo = null; //查看账号是否存在 try { mapper.BeginTransaction(); userInfo = mapper.QueryForObject <UserInfo>("GetUserByCard", cardword); mapper.CommitTransaction(); } catch { } return(userInfo); }
/// <summary> /// 1.根据用户id返回“自己请求别人为好友,然后对方同意了”的用户信息集合 /// 2.存在自己添加别人为好友的请求且已经被处理了,删除该记录 /// </summary> /// <param name="userid">用户id</param> /// <returns></returns> public static List <UserInfo> GetAddToByAddFrom(int userid) { ISqlMapper mapper = GetSqlMapper.GetMapper(); List <UserInfo> userList = null; try { mapper.BeginTransaction(); userList = mapper.QueryForList <UserInfo>("GetAddToByAddFrom", userid).ToList(); mapper.Delete("DeleteAgreeByAddFrom", userid); //存在自己添加别人为好友的请求且已经被处理了,删除该记录 mapper.CommitTransaction(); } catch { } return(userList); }
/// <summary> /// 插入用户信息 /// </summary> /// <param name="userInfo">用户信息</param> /// <returns>object</returns> public static object InsertUser(UserInfo userInfo) { ISqlMapper mapper = GetSqlMapper.GetMapper(); object oj = null; try { mapper.BeginTransaction(); oj = mapper.Insert("InsertUser", userInfo); mapper.CommitTransaction(); } catch { mapper.RollBackTransaction(); } return(oj); }
/// <summary> /// 账号是否存在 /// </summary> /// <param name="cardword">账号</param> /// <returns>记录数</returns> public static int CardIsExist(string username) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; try { mapper.BeginTransaction(); result = mapper.QueryForObject <int>("User_IsExist", username); mapper.CommitTransaction(); } catch { mapper.RollBackTransaction(); } return(result); }
/// <summary> /// 删除Salary信息 /// </summary> public static int DeleteSalary(int salaryID) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; try { mapper.BeginTransaction(); result = mapper.Delete("DeleteSalary", salaryID); mapper.CommitTransaction(); } catch (Exception ex) { applog.InfoFormat("Access.DeleteSalary() Error:{0}", ex.Message); mapper.RollBackTransaction(); } return(result); }
/// <summary> /// 返回Sheet所对应收支信息 /// </summary> public static string GetSheetBOPMap(int sheetID) { ISqlMapper mapper = GetSqlMapper.GetMapper(); string bopMap = null; try { mapper.BeginTransaction(); bopMap = mapper.QueryForObject <string>("GetSheetBOPMapBySheet", sheetID); mapper.CommitTransaction(); } catch (Exception ex) { applog.InfoFormat("Access.GetSheetBOPMap() Error:{0}", ex.Message); mapper.RollBackTransaction(); } return(bopMap); }
/// <summary> /// 插入Salary信息 /// </summary> public static int InsertSalary(SalaryInfo salaryInfo) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int id = 0; try { mapper.BeginTransaction(); id = (int)(mapper.Insert("InsertSalary", salaryInfo)); mapper.CommitTransaction(); } catch (Exception ex) { applog.InfoFormat("Access.InsertSalary() Error:{0}", ex.Message); mapper.RollBackTransaction(); } return(id); }
/// <summary> /// 更新Employee信息 /// </summary> public static int UpdateEmployeeInfo(EmployeeInfo employeeInfo) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; try { mapper.BeginTransaction(); result = mapper.Update("UpdateEmployeeInfo", employeeInfo); mapper.CommitTransaction(); } catch (Exception ex) { applog.InfoFormat("Access.UpdateEmployeeInfo() Error:{0}", ex.Message); mapper.RollBackTransaction(); } return(result); }
/// <summary> /// 删除好友 /// </summary> /// <param name="userid">用户id</param> /// <param name="friendid">好友id</param> /// <returns></returns> public static int DeleteFriend(string userid, string friendid) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; Hashtable hashTable = new Hashtable(); hashTable.Add("UserID", userid); hashTable.Add("FriendID", friendid); try { mapper.BeginTransaction(); result = mapper.Delete("DeleteFriend", hashTable); mapper.CommitTransaction(); } catch { } return(result); }
/// <summary> /// 根据用户id,返回用户信息 /// </summary> /// <param name="oneid">用户id</param> /// <param name="otherid">用户id</param> /// <returns>两个用户的信息</returns> public static List <UserInfo> GetUserInfoByID(string oneid, string otherid) { ISqlMapper mapper = GetSqlMapper.GetMapper(); List <UserInfo> userList = null; ArrayList arrayList = new ArrayList(); arrayList.Add(oneid); arrayList.Add(otherid); try { mapper.BeginTransaction(); userList = mapper.QueryForList <UserInfo>("GetUserInfoByID", arrayList).ToList(); mapper.CommitTransaction(); } catch { } return(userList); }
/// <summary> /// 删除该好友请求记录 /// </summary> /// <param name="fromid">请求者id</param> /// <param name="toid">被请求者id</param> /// <returns></returns> public static int DeleteAddFriendInfo(string fromid, string toid) { ISqlMapper mapper = GetSqlMapper.GetMapper(); int result = 0; Hashtable hashTable = new Hashtable(); hashTable.Add("AddFrom", fromid); hashTable.Add("AddTo", toid); try { mapper.BeginTransaction(); result = mapper.Delete("DeleteAddFriendInfo", hashTable); mapper.CommitTransaction(); } catch { } return(result); }