Beispiel #1
0
        /// <summary>
        /// 获取活动列表
        /// </summary>
        /// <returns></returns>
        public List <RemotingInterface.PlayInfo> GetPlayList()
        {
            SqlConnection sqlConn = new SqlConnection(Common.strConn);

            if (sqlConn.State == ConnectionState.Closed)
            {
                sqlConn.Open();
            }
            try
            {
                SqlCommand    sqlCmd    = new SqlCommand("SELECT * FROM [Play] ORDER BY PlayID", sqlConn);
                SqlDataReader sqlReader = sqlCmd.ExecuteReader();

                List <RemotingInterface.PlayInfo> listPlay = new List <RemotingInterface.PlayInfo>();
                RemotingInterface.PlayInfo        playInfo = new RemotingInterface.PlayInfo();
                playInfo.Clear();

                while (sqlReader.Read())
                {
                    playInfo.PlayId      = Convert.ToInt32(sqlReader["PlayId"]);
                    playInfo.PlayName    = sqlReader["PlayName"].ToString();
                    playInfo.PlayState   = Convert.ToByte(sqlReader["PlayState"]);
                    playInfo.Description = sqlReader["Description"].ToString();

                    listPlay.Add(playInfo);

                    Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ": Load the play list : PlayId = " + playInfo.PlayId + "\t PlayName = " + playInfo.PlayName);
                }

                return(listPlay);
            }
            catch (Exception ex)
            {
                Loger.Debug(ex.ToString());
                return(null);
            }
            finally
            {
                if (sqlConn.State != ConnectionState.Closed)
                {
                    sqlConn.Close();
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 获取活动列表
        /// </summary>
        /// <returns></returns>
        public List<RemotingInterface.PlayInfo> GetPlayList()
        {
            SqlConnection sqlConn = new SqlConnection(Common.strConn);
            if (sqlConn.State == ConnectionState.Closed)
                sqlConn.Open();
            try
            {
                SqlCommand sqlCmd = new SqlCommand("SELECT * FROM [Play] ORDER BY PlayID", sqlConn);
                SqlDataReader sqlReader = sqlCmd.ExecuteReader();

                List<RemotingInterface.PlayInfo> listPlay = new List<RemotingInterface.PlayInfo>();
                RemotingInterface.PlayInfo playInfo = new RemotingInterface.PlayInfo();
                playInfo.Clear();

                while (sqlReader.Read())
                {
                    playInfo.PlayId = Convert.ToInt32(sqlReader["PlayId"]);
                    playInfo.PlayName = sqlReader["PlayName"].ToString();
                    playInfo.PlayState = Convert.ToByte(sqlReader["PlayState"]);
                    playInfo.Description = sqlReader["Description"].ToString();

                    listPlay.Add(playInfo);

                    Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ": Load the play list : PlayId = " + playInfo.PlayId + "\t PlayName = " + playInfo.PlayName);
                }

                return listPlay;
            }
            catch (Exception ex)
            {
                Loger.Debug(ex.ToString());
                return null;
            }
            finally
            {
                if (sqlConn.State != ConnectionState.Closed)
                    sqlConn.Close();
            }
        }