Exemple #1
0
        //-----------------------------------------------------------
        #region Method
        private List <MediaGroups> Init(SqlCommand cmd)
        {
            SqlConnection con = db.getConnection();

            cmd.Connection = con;
            List <MediaGroups> l_MediaGroups = new List <MediaGroups>();

            try
            {
                con.Open();
                SqlDataReader   reader      = cmd.ExecuteReader();
                SmartDataReader smartReader = new SmartDataReader(reader);
                while (smartReader.Read())
                {
                    MediaGroups m_MediaGroups = new MediaGroups();
                    m_MediaGroups.MediaGroupId   = smartReader.GetInt16("MediaGroupId");
                    m_MediaGroups.MediaGroupName = smartReader.GetString("MediaGroupName");
                    m_MediaGroups.MediaGroupDesc = smartReader.GetString("MediaGroupDesc");
                    m_MediaGroups.ParentGroupId  = smartReader.GetInt16("ParentGroupId");
                    m_MediaGroups.CrUserId       = smartReader.GetInt32("CrUserId");
                    m_MediaGroups.CrDateTime     = smartReader.GetDateTime("CrDateTime");
                    l_MediaGroups.Add(m_MediaGroups);
                }
                reader.Close();
                return(l_MediaGroups);
            }
            catch (SqlException err)
            {
                throw new ApplicationException("Data error: " + err.Message);
            }
            finally
            {
                db.closeConnection(con);
            }
        }
Exemple #2
0
        //--------------------------------------------------------------
        public static string Static_GetDisplayString(short MediaGroupId)
        {
            string      RetVal        = "";
            MediaGroups m_MediaGroups = new MediaGroups();

            m_MediaGroups.MediaGroupId = MediaGroupId;
            m_MediaGroups = m_MediaGroups.Get();
            RetVal        = m_MediaGroups.MediaGroupName;
            return(RetVal);
        }
Exemple #3
0
        //--------------------------------------------------------------
        public MediaGroups Get()
        {
            MediaGroups retVal     = new MediaGroups();
            int         RowCount   = 0;
            string      DateFrom   = "";
            string      DateTo     = "";
            string      OrderBy    = "";
            int         PageSize   = 1;
            int         PageNumber = 0;

            try
            {
                List <MediaGroups> list = GetPage(DateFrom, DateTo, OrderBy, PageSize, PageNumber, ref RowCount);
                if (list.Count > 0)
                {
                    retVal = list[0];
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(retVal);
        }