예제 #1
0
 static public void Export(string filename,ref ShopItemCollection shopitems)
 {
     if (filename == "" && null == shopitems && shopitems.Count <= 0)
     {
         return;
     }
     string str = string.Empty;
     StreamWriter sw = new StreamWriter(filename,false,Encoding.ASCII);
     str = "TabType\tItemIndex\tRandSeed\tCountLimit\tReputeLevel\tPrice";
     sw.WriteLine(str);
     foreach (ShopItem item in shopitems)
     {
         str = item.TabType + "\t"
                 + item.ItemIndex + "\t"
                 + item.RandSeed + "\t"
                 + item.CountLimit + "\t"
                 + item.ReputeLevel + "\t"
                 + item.Price;
         sw.WriteLine(str);
     }
     sw.Flush();
     sw.Close();
 }
예제 #2
0
 private ShopItemCollection _getShopItems(string sql, int pPageIndex, int pPageSize)
 {
     ShopItemCollection retobjs = new ShopItemCollection();
     SqlDataReader sdr = null;
     ShopItem obj = null;
     m_db.RunSql(sql, out sdr);
     if (null == sdr) return null;
     int _curRecPos = 0;
     //计算页记录///
     long _startpos = 0;
     long _endpos = 0;
     if (pPageIndex > -1)
     {
         _startpos = pPageIndex * pPageSize;
         _endpos = _startpos + pPageSize;
     }
     while (sdr.Read())
     {
         if (_curRecPos > _endpos) break;
         if (_curRecPos >= _startpos && _curRecPos < _endpos)
         {
             obj = this._buildShopItem(ref sdr);
             if (null != obj)
             {
                 retobjs.Add(obj);
             }
         }
         _curRecPos++;
     }
     sdr.Close();
     if (retobjs.Count > 0)
     {
         return retobjs;
     }
     else
     {
         return null;
     }
 }
예제 #3
0
 private ShopItemCollection _getShopItems(string sql)
 {
     ShopItemCollection retobjs = new ShopItemCollection();
     SqlDataReader sdr = null;
     m_db.RunSql(sql, out sdr);
     if (null == sdr) return null;
     while (sdr.Read())
     {
         retobjs.Add(this._buildShopItem(ref sdr));
     }
     sdr.Close();
     return retobjs;
 }