Exemplo n.º 1
0
        //-------------------------------------------------------------------------------------------------------------------
        private List <MediaItems> Init(string LogFilePath, string LogFileName, SqlCommand cmd)
        {
            SqlConnection con = db.getConnection();

            cmd.Connection = con;
            List <MediaItems> l_MediaItems = new List <MediaItems>();

            try
            {
                con.Open();
                SqlDataReader   reader      = cmd.ExecuteReader();
                SmartDataReader smartReader = new SmartDataReader(reader);
                while (smartReader.Read())
                {
                    MediaItems m_MediaItems = new MediaItems(db.ConnectionString);
                    m_MediaItems.MediaItemId      = smartReader.GetInt32("MediaItemId");
                    m_MediaItems.SubjectTypeId    = smartReader.GetByte("SubjectTypeId");
                    m_MediaItems.MediaItemContent = smartReader.GetString("MediaItemContent");
                    m_MediaItems.CrUserId         = smartReader.GetInt32("CrUserId");
                    m_MediaItems.CrDateTime       = smartReader.GetDateTime("CrDateTime");
                    l_MediaItems.Add(m_MediaItems);
                }
                smartReader.disposeReader(reader);
                db.closeConnection(con);
            }
            catch (SqlException ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(l_MediaItems);
        }
Exemplo n.º 2
0
        //--------------------------------------------------------------------------------------------------------------------
        public MediaItems Get(string LogFilePath, string LogFileName, int MediaItemId)
        {
            MediaItems RetVal = new MediaItems(db.ConnectionString);

            try
            {
                List <MediaItems> list = GetListByMediaItemId(LogFilePath, LogFileName, MediaItemId);
                if (list.Count > 0)
                {
                    RetVal = (MediaItems)list[0];
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }