public string ExecuteToString(string storedProcName, ConnctionType t = ConnctionType.ReadWrite) { DataTable dataTable = ExecuteDataTable(storedProcName, null, t); if (dataTable != null) { return(JsonConvert.SerializeObject(dataTable)); } return(null); }
public int ExecuteRowNumber(string strSql, ConnctionType t = ConnctionType.ReadWrite) { DataTable dataTable = ExecuteDataTable(strSql, t); if (dataTable != null) { return(dataTable.Rows.Count); } return(0); }
public virtual bool OnRunEvent(PackSendData PackSendData, ref ServerGame.Core.Connctions.AbstractServer.StateObject UserSenderAllInfo, ConnctionType ConnctionType) { if (this.onevent != null) { this.onevent(this, new ResEventArgs(PackSendData, ref UserSenderAllInfo, ConnctionType)); return(true); } else { for (int i = 0; i < PackSendData.AllData.Count; i++) { Console.WriteLine("Data Out Put Data[{0}] : {1} ", i.ToString(), PackSendData.AllData[i].DataS.ToString()); } return(true); } }
public DataSet ExecuteDataSet(string storedProcName, IDataParameter[] parameters, ConnctionType t = ConnctionType.ReadOnly) { if (SqlDrConn.State == ConnectionState.Open) { SqlDrConn.Close(); } try { SqlDrConn.Open(); SqlCommand cmd = new SqlCommand(storedProcName, SqlDrConn); cmd.Parameters.Clear(); foreach (IDataParameter parameter in parameters) { cmd.Parameters.Add(parameter); } if (parameters == null) { cmd.CommandType = CommandType.Text; } else { cmd.CommandType = CommandType.StoredProcedure; } SqlDataAdapter adapter = new SqlDataAdapter(cmd); DataSet dataSet = new DataSet(); adapter.Fill(dataSet); if (dataSet != null && dataSet.Tables.Count != 0) { return(dataSet); } return(null); } catch (Exception ex) { throw ex; } finally { SqlDrConn.Close(); } }
public DataSet ExecuteDataSet(string Sql, ConnctionType t = ConnctionType.ReadOnly) { return(ExecuteDataSet(Sql, null, t)); }
public string GetConnectionString(ConnctionType t) { throw new NotImplementedException(); }
public DataTable ExecuteDataTable(string storedProcName, IDataParameter[] parameters, ConnctionType t = ConnctionType.ReadOnly) { DataSet data = ExecuteDataSet(storedProcName, parameters, t); if (data != null && data.Tables.Count != 0) { return(data.Tables[0]); } return(null); }
public bool SendToAllZone(PackSendData PackSendData, ConnctionType ConnctionType) { throw new NotImplementedException(); }
public bool SendToUsers(PackSendData PackSendData, List <IUser> ListUsers, ConnctionType ConnctionType) { throw new NotImplementedException(); }
public int ExecuteRowNumber(string storedProcName, IDataParameter[] parameters, ConnctionType t = ConnctionType.ReadWrite) { DataTable dataTable = ExecuteDataTable(storedProcName, parameters, t); if (dataTable != null) { return(dataTable.Rows.Count); } return(0); }
public int ExecuteReturnValue(string storedProcName, IDataParameter[] parameters, ConnctionType t = ConnctionType.ReadWrite) { DataTable dataTable = ExecuteDataTable(storedProcName, parameters, t); if (dataTable != null) { return((int)dataTable.Rows[0][0]); } return(0); }
public SqlDataReader ExecuteReader(string storedProcName, SqlParameter[] commandParameters, ConnctionType t = ConnctionType.ReadOnly) { if (SqlDrConn.State == ConnectionState.Open) { SqlDrConn.Close(); } try { SqlDrConn.Open(); SqlCommand cmd = new SqlCommand(storedProcName, SqlDrConn); cmd.Parameters.Clear(); foreach (SqlParameter parameter in commandParameters) { cmd.Parameters.Add(parameter); } if (commandParameters == null) { cmd.CommandType = CommandType.Text; } else { cmd.CommandType = CommandType.StoredProcedure; } SqlDataReader reader = cmd.ExecuteReader(); if (reader != null) { return(reader); } return(null); } catch (Exception ex) { throw ex; } finally { SqlDrConn.Close(); } }
public SqlDataReader ExecuteReader(string sql, ConnctionType t = ConnctionType.ReadOnly) { return(ExecuteReader(sql, null, t)); }
public ResEventArgs(PackSendData PackSendData, ref AbstractServer.StateObject UserSenderAllInfo, ConnctionType ConnctionType) { this.PackSendData = PackSendData; this.UserSenderAllInfo = UserSenderAllInfo; this.ConnctionType = ConnctionType; }
public T ExecuteSqlToModel <T>(string sql, ConnctionType t = ConnctionType.ReadOnly) where T : new() { return(ExecuteToModel <T>(sql, null, t)); }
public virtual bool OnRunEvent(PackSendData PackSendData, ref ServerGame.Core.Connctions.AbstractServer.StateObject UserSenderAllInfo, ConnctionType ConnctionType) { for (int i = 0; i < PackSendData.AllData.Count; i++) { Connctions.Server.ServerOject.Sendudp(UserSenderAllInfo.workSocket, PackSendData.AllData[i].DataS.ToString(), UserSenderAllInfo.IPEndPointUDP); #if (DEBUG) Console.WriteLine("Data Out Put Data[{0}] : {1} ", i.ToString(), PackSendData.AllData[i].DataS.ToString()); #endif } return(true); }
/// <summary> /// 执行存储过程 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="storedProcName"></param> /// <param name="parameters"></param> /// <param name="t"></param> /// <returns></returns> public IList <T> ExecuteToList <T>(string storedProcName, IDataParameter[] parameters, ConnctionType t = ConnctionType.ReadOnly) where T : new() { DataTable dt = ExecuteDataTable(storedProcName, parameters, t); if (dt != null) { return(ConvertToList <T>(dt)); } return(null); }
public bool SendToUser(PackSendData PackSendData, IUser User, ConnctionType ConnctionType) { throw new NotImplementedException(); }
public T ExecuteToModel <T>(string storedProcName, IDataParameter[] parameters, ConnctionType t = ConnctionType.ReadOnly) where T : new() { IList <T> result = ExecuteToList <T>(storedProcName, parameters, t); if (result != null) { return(result[0]); } else { return(default(T)); } }
public bool SendToGroupUser(PackSendData PackSendData, IGroup group, ConnctionType ConnctionType) { throw new NotImplementedException(); }
public DataTable ExecuteDataTable(string sql, ConnctionType t = ConnctionType.ReadOnly) { return(ExecuteDataTable(sql, t)); }