예제 #1
0
파일: CommandStruct.cs 프로젝트: 0jpq0/Scut
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="editType"></param>
 public CommandStruct(string tableName, CommandMode editType)
 {
     TableName = tableName;
     EntityType = editType;
     Filter = new CommandFilter();
     Parameters = new IDataParameter[0];
 }
예제 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="editType"></param>
 /// <param name="columns">Inquiry table columns</param>
 public CommandStruct(string tableName, CommandMode editType, string columns = "")
 {
     TableName  = tableName;
     EntityType = editType;
     Columns    = columns;
     Filter     = new CommandFilter();
     Parameters = new IDataParameter[0];
 }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="editType"></param>
 /// <param name="columns">Inquiry table columns</param>
 /// <param name="filter"></param>
 public CommandStruct(string tableName, CommandMode editType, CommandFilter filter, string columns = "")
 {
     TableName   = tableName;
     EntityType  = editType;
     Columns     = columns;
     Filter      = filter;
     Parameters  = new IDataParameter[0];
     CommandType = CommandType.Text;
 }
예제 #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="editType"></param>
 /// <param name="columns">Inquiry table columns</param>
 /// <param name="filter"></param>
 public CommandStruct(string tableName, CommandMode editType, CommandFilter filter, string columns = "")
 {
     TableName = tableName;
     EntityType = editType;
     Columns = columns;
     Filter = filter;
     Parameters = new IDataParameter[0];
     CommandType = CommandType.Text;
 }
예제 #5
0
        /// <summary>
        /// 获取所有
        /// </summary>
        /// <returns></returns>
        private static DataTable GetUserPrizeList(DbBaseProvider dbProvider, CommandFilter condition, int statIndex, int endIndex)
        {
            var command = dbProvider.CreateCommandStruct("UserTakePrize", CommandMode.Inquiry);
            command.Columns = "ID,UserID,ObtainNum,EnergyNum,GameCoin,Gold,ExpNum,VipLv,GainBlessing,ItemPackage,CrystalPackage,SparePackage,EnchantPackage,MailContent,IsTasked,TaskDate,OpUserID,CreateDate,HonourNum,Items";
            command.FromIndex = statIndex;
            command.ToIndex = endIndex;
            command.OrderBy = "ID DESC";
            command.Filter = condition;
            command.Parser();

            DataTable dt = new DataTable();
            using (var reader = dbProvider.ExecuteReader(CommandType.Text, command.Sql, command.Parameters))
            {
                DataColumn col;
                DataRow row;

                for (int i = 0; i < reader.FieldCount; i++)
                {
                    col = new DataColumn();
                    col.ColumnName = reader.GetName(i);
                    dt.Columns.Add(col);
                }

                while (reader.Read())
                {
                    row = dt.NewRow();
                    for (int i = 0; i < dt.Columns.Count; i++)
                    {
                        string colName = dt.Columns[i].ColumnName;
                        row[colName] = reader[colName].ToString();
                    }
                    dt.Rows.Add(row);
                }

            }

            return dt;
        }