Пример #1
0
        //-------------------------------------------------------------------------------------------------------------------
        private List <ImageMediaItems> Init(string LogFilePath, string LogFileName, SqlCommand cmd)
        {
            SqlConnection con = db.getConnection();

            cmd.Connection = con;
            List <ImageMediaItems> l_ImageMediaItems = new List <ImageMediaItems>();

            try
            {
                con.Open();
                SqlDataReader   reader      = cmd.ExecuteReader();
                SmartDataReader smartReader = new SmartDataReader(reader);
                while (smartReader.Read())
                {
                    ImageMediaItems m_ImageMediaItems = new ImageMediaItems(db.ConnectionString);
                    m_ImageMediaItems.ImageMediaItemId = smartReader.GetInt32("ImageMediaItemId");
                    m_ImageMediaItems.ImageId          = smartReader.GetInt32("ImageId");
                    m_ImageMediaItems.MediaItemId      = smartReader.GetInt32("MediaItemId");
                    m_ImageMediaItems.CrUserId         = smartReader.GetInt32("CrUserId");
                    m_ImageMediaItems.CrDateTime       = smartReader.GetDateTime("CrDateTime");
                    l_ImageMediaItems.Add(m_ImageMediaItems);
                }
                smartReader.disposeReader(reader);
                db.closeConnection(con);
            }
            catch (SqlException ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(l_ImageMediaItems);
        }
Пример #2
0
        //--------------------------------------------------------------------------------------------------------------------
        public ImageMediaItems GetByMediaItemId(string LogFilePath, string LogFileName, int MediaItemId)
        {
            ImageMediaItems RetVal = new ImageMediaItems(db.ConnectionString);

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