public static int updateRoleStart(string nOperatorName, int nVersionNo, long nAccountId, int nServerId, int nRoleId) { string operatorName_ = OperatorAspect.getOperator(nOperatorName, nVersionNo); if ("" == operatorName_) { return(ConstAspect.mOperator); } int result_ = ConstAspect.mFail; SqlConnection sqlConnection_ = new SqlConnection(); sqlConnection_.ConnectionString = ConstAspect.mConnectionString; sqlConnection_.Open(); SqlCommand sqlCommand_ = new SqlCommand(); sqlCommand_.Connection = sqlConnection_; sqlCommand_.CommandType = CommandType.Text; sqlCommand_.CommandText = string.Format(mUpdateRoleStart, nServerId, nRoleId, operatorName_, nAccountId); try { sqlCommand_.ExecuteNonQuery(); result_ = ConstAspect.mSucess; } catch (SqlException) { result_ = ConstAspect.mSql; } sqlConnection_.Close(); return(result_); }
public static int getRoleCount(string nOperatorName, int nVersionNo, long nAccountId, int nServerId) { string operatorName_ = OperatorAspect.getOperator(nOperatorName, nVersionNo); if ("" == operatorName_) { return(0); } SqlConnection sqlConnection_ = new SqlConnection(); sqlConnection_.ConnectionString = ConstAspect.mConnectionString; sqlConnection_.Open(); SqlCommand sqlCommand_ = new SqlCommand(); sqlCommand_.Connection = sqlConnection_; sqlCommand_.CommandType = CommandType.Text; sqlCommand_.CommandText = string.Format(mRoleCount, operatorName_, nAccountId, nServerId); SqlDataReader sqlDataReader_ = sqlCommand_.ExecuteReader(); int roleCount_ = 0; if (sqlDataReader_.Read()) { roleCount_ = sqlDataReader_.GetInt32(0); } sqlDataReader_.Close(); sqlConnection_.Close(); return(roleCount_); }
public static bool createRole(string nOperatorName, int nVersionNo, long nAccountId, int nServerId, string nRoleName, short nRoleRace) { string operatorName_ = OperatorAspect.getOperator(nOperatorName, nVersionNo); if ("" == operatorName_) { return(false); } SqlConnection sqlConnection_ = new SqlConnection(); sqlConnection_.ConnectionString = ConstAspect.mConnectionString; sqlConnection_.Open(); SqlCommand sqlCommand_ = new SqlCommand(); sqlCommand_.Connection = sqlConnection_; sqlCommand_.CommandType = CommandType.Text; sqlCommand_.CommandText = string.Format(mCreateRole, operatorName_, nAccountId, nServerId, nServerId, nRoleName, nRoleRace); bool result_ = false; try { sqlCommand_.ExecuteNonQuery(); result_ = true; } catch (SqlException) { result_ = false; } sqlConnection_.Close(); return(result_); }
public static ServerInfo getServerInfo(string nOperatorName, int nVersionNo, int nServerId) { initServerState(false); string operatorName_ = OperatorAspect.getOperator(nOperatorName, nVersionNo); if ("" == operatorName_) { return(null); } return(mServerStates[operatorName_].getServerInfo(nServerId)); }
public static List <ServerItem> getServerList(string nOperatorName, int nVersionNo) { initServerState(false); string operatorName_ = OperatorAspect.getOperator(nOperatorName, nVersionNo); if ("" == operatorName_) { return(null); } return(mServerStates[operatorName_].getServerList()); }
public static int getServerId(string nOperatorName, int nVersionNo) { initServerState(false); string operatorName_ = OperatorAspect.getOperator(nOperatorName, nVersionNo); if ("" == operatorName_) { return(0); } return(mServerStates[operatorName_].getServerId()); }
public static AgentInfo getIdleAgent(string nOperatorName, int nVersionNo) { initAgent(false); string operatorName_ = OperatorAspect.getOperator(nOperatorName, nVersionNo); if ("" == operatorName_) { return(null); } return(mAgentStates[operatorName_].getIdleAgent()); }
public static List <RoleItem> getRoleList(string nOperatorName, int nVersionNo, long nAccountId) { string operatorName_ = OperatorAspect.getOperator(nOperatorName, nVersionNo); if ("" == operatorName_) { return(null); } List <RoleItem> roleItems_ = null; SqlConnection sqlConnection_ = new SqlConnection(); sqlConnection_.ConnectionString = ConstAspect.mConnectionString; sqlConnection_.Open(); SqlCommand sqlCommand_ = new SqlCommand(); sqlCommand_.Connection = sqlConnection_; sqlCommand_.CommandType = CommandType.Text; sqlCommand_.CommandText = string.Format(mRoleList, operatorName_, nAccountId); SqlDataReader sqlDataReader_ = sqlCommand_.ExecuteReader(); while (sqlDataReader_.Read()) { if (null == roleItems_) { roleItems_ = new List <RoleItem>(); } RoleItem roleItem_ = new RoleItem(); roleItem_.mServerId = sqlDataReader_.GetInt32(0); roleItem_.mRoleId = sqlDataReader_.GetInt32(1); roleItem_.mRoleType = sqlDataReader_.GetInt16(2); roleItem_.mRoleName = sqlDataReader_.GetString(3).Trim(); roleItem_.mRoleRace = sqlDataReader_.GetInt16(4); roleItem_.mRoleStep = sqlDataReader_.GetInt16(5); roleItem_.mRoleLevel = sqlDataReader_.GetInt32(6); roleItems_.Add(roleItem_); } sqlDataReader_.Close(); sqlConnection_.Close(); return(roleItems_); }
public static RoleItem getRoleInfo(string nOperatorName, int nVersionNo, long nAccountId, int nRoleId, int nServerId) { string operatorName_ = OperatorAspect.getOperator(nOperatorName, nVersionNo); if ("" == operatorName_) { return(null); } RoleItem roleItem_ = null; SqlConnection sqlConnection_ = new SqlConnection(); sqlConnection_.ConnectionString = ConstAspect.mConnectionString; sqlConnection_.Open(); SqlCommand sqlCommand_ = new SqlCommand(); sqlCommand_.Connection = sqlConnection_; sqlCommand_.CommandType = CommandType.Text; sqlCommand_.CommandText = string.Format(mRoleInfo, operatorName_, nAccountId, nRoleId, nServerId); SqlDataReader sqlDataReader_ = sqlCommand_.ExecuteReader(); if (sqlDataReader_.Read()) { roleItem_ = new RoleItem(); roleItem_.mServerId = nServerId; roleItem_.mRoleId = nRoleId; roleItem_.mRoleType = sqlDataReader_.GetInt16(0); roleItem_.mRoleName = sqlDataReader_.GetString(1).Trim(); roleItem_.mRoleRace = sqlDataReader_.GetInt16(2); roleItem_.mRoleStep = sqlDataReader_.GetInt16(3); roleItem_.mRoleLevel = sqlDataReader_.GetInt32(4); } sqlDataReader_.Close(); sqlConnection_.Close(); return(roleItem_); }