public string GetTopMenuJson() { var menus = RoleFunc.Modules(); string str = menus.ToJsonIgnoreLoop(false); return(str); }
public string GetMenuJson(int id) { List <OAFuncDTO> menus = RoleFunc.Children(id); string str = menus.ToJsonIgnoreLoop(false); return(str); }
public string GetFirstMenuJson() { List <OAFuncDTO> menus = RoleFunc.FirstChildren(); string str = menus.ToJsonIgnoreLoop(false); return(str); }
public void delete(RoleFunc acc) { SqlConnection con = null; con = Connector.getConnection(); con.Open(); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = DELETE; cmd.Parameters.Add("@id", SqlDbType.Int).Value = acc.id; int rowCount = cmd.ExecuteNonQuery(); Console.WriteLine("Row Count affected = " + rowCount); } catch (Exception e) { Console.WriteLine("khong the ket noi"); Console.WriteLine(e.StackTrace); } finally { con.Close(); con.Dispose(); con = null; } }
public void create(RoleFunc acc) { SqlConnection con = null; con = Connector.getConnection(); con.Open(); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = CREATE; cmd.Parameters.Add("@role", SqlDbType.NVarChar).Value = acc.roleID; cmd.Parameters.Add("@func", SqlDbType.Decimal).Value = acc.funcID; int rowCount = cmd.ExecuteNonQuery(); Console.WriteLine("Row Count affected = " + rowCount); } catch (Exception e) { Console.WriteLine("khong the ket noi"); Console.WriteLine(e.StackTrace); } finally { con.Close(); con.Dispose(); con = null; } }
protected override bool CreateUserRole(out IUser user) { user = null; GameUser gameUser = new GameDataCacheSet <GameUser>().FindKey(UserId.ToString()); if (gameUser == null) { var roleFunc = new RoleFunc(); string msg; if (roleFunc.VerifyRange(UserName, out msg) || roleFunc.VerifyKeyword(UserName, out msg) || roleFunc.IsExistNickName(UserName, out msg)) { ErrorCode = Language.Instance.ErrorCode; ErrorInfo = msg; return(false); } gameUser = CreateRole(); roleFunc.OnCreateAfter(gameUser); } user = new SessionUser(gameUser); UserLoginLog userLoginLog = new UserLoginLog(); userLoginLog.UserId = UserId.ToString(); userLoginLog.SessionID = Sid; userLoginLog.MobileType = (short)MobileType; userLoginLog.ScreenX = ScreenX; userLoginLog.ScreenY = ScreenY; userLoginLog.RetailId = RetailID; userLoginLog.AddTime = DateTime.Now; userLoginLog.State = (short)LoginStatus.Logined; userLoginLog.DeviceID = DeviceID; userLoginLog.Ip = GetRealIP(); userLoginLog.Pid = gameUser.Pid; userLoginLog.UserLv = gameUser.UserLv; var sender = DataSyncManager.GetDataSender(); sender.Send(new[] { userLoginLog }); return(true); }
public override bool TakeAction() { GameUser user = new GameDataCacheSet <GameUser>().FindKey(Uid); if (user == null) { var roleFunc = new RoleFunc(); string msg; if (roleFunc.VerifyRange(UserName, out msg) || roleFunc.VerifyKeyword(UserName, out msg) || roleFunc.IsExistNickName(UserName, out msg)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = msg; return(false); } user = CreateRole(); roleFunc.OnCreateAfter(user); } Current.User = user; UserLoginLog userLoginLog = new UserLoginLog(); userLoginLog.UserId = Uid; userLoginLog.SessionID = Sid; userLoginLog.MobileType = (short)MobileType; userLoginLog.ScreenX = ScreenX; userLoginLog.ScreenY = ScreenY; userLoginLog.RetailId = RetailID; userLoginLog.AddTime = DateTime.Now; userLoginLog.State = (short)LoginStatus.Logined; userLoginLog.DeviceID = DeviceID; userLoginLog.Ip = GetRealIP(); userLoginLog.Pid = user.Pid; userLoginLog.UserLv = user.UserLv; var sender = DataSyncManager.GetDataSender(); sender.Send(userLoginLog); return(true); }
public override bool TakeAction() { try { var roleFunc = new RoleFunc(); string msg; if (roleFunc.VerifyRange(_nickName, out msg) || roleFunc.IsExistNickName(_nickName, out msg)) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St1005_NickNameExist; return(false); } return(true); } catch (Exception ex) { SaveLog(ex); return(false); } }