コード例 #1
0
ファイル: CacheGameProject.cs プロジェクト: 0jpq0/Scut
    protected override bool InitCache()
    {
        try
        {
            string con = ConfigContext.GetInstance().DataBaseSettingProvider.SimpleManagerConnstring;
                string sSql = "select * from SnsCenter.dbo.ConfigGameProject order by gameid";
                using (SqlDataReader reader = SqlHelper.ExecuteReader(con, CommandType.Text, sSql))
                {
                    if (reader == null) throw new Exception();
                    if (reader.HasRows)
                    {
                        List<BaseGameProject> tmplist = new List<BaseGameProject>();
                        while (reader.Read())
                        {
                            BaseGameProject oTmpBaseAsp = new BaseGameProject();
                            oTmpBaseAsp.InitData(reader);
                            tmplist.Add(oTmpBaseAsp);
                        }
                        this.addCache(tmplist);
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }

        }
        catch (Exception ex)
        {
            this.SaveLog(ex);
            return false;
        }
    }
コード例 #2
0
ファイル: CacheGameProject.cs プロジェクト: dongliang/Scut
 protected override bool InitCache()
 {
     try
     {
         string con  = ConfigContext.GetInstance().DataBaseSettingProvider.SimpleManagerConnstring;
         string sSql = "select * from SnsCenter.dbo.ConfigGameProject order by gameid";
         using (SqlDataReader reader = SqlHelper.ExecuteReader(con, CommandType.Text, sSql))
         {
             if (reader == null)
             {
                 throw new Exception();
             }
             if (reader.HasRows)
             {
                 List <BaseGameProject> tmplist = new List <BaseGameProject>();
                 while (reader.Read())
                 {
                     BaseGameProject oTmpBaseAsp = new BaseGameProject();
                     oTmpBaseAsp.InitData(reader);
                     tmplist.Add(oTmpBaseAsp);
                 }
                 this.addCache(tmplist);
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (Exception ex)
     {
         this.SaveLog(ex);
         return(false);
     }
 }