Пример #1
0
        public MediaGroup GetMediaGroupForWeb(int MediaID)
        {
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetMediaGroup";

            cmd.Parameters.AddWithValue("@MediaID", MediaID);

            DataTable dt = db.Execute(cmd);

            DataRow dr = dt.Rows[0];
            MediaGroup mediagroup = new MediaGroup
            {
                MediaID = Int32.Parse(dr["MediaID"].ToString()),
                MediaTitle = dr["MediaTitle"].ToString(),
                MediaType = dr["MediaType"].ToString(),
                ProductID = Int32.Parse(dr["ProductID"].ToString()),
                Active = bool.Parse(dr["Active"].ToString()),
                DateCreated = DateTime.Parse(dr["DateCreated"].ToString())
            };

            db = new DB();
            cmd.CommandText = "GetMediaGroupItemsForWeb";

            DataTable dtitems = db.Execute(cmd);

            foreach (DataRow dritems in dtitems.Rows)
            {
                MediaGroupItem mediagroupitem = new MediaGroupItem
                {
                    MediaID = Int32.Parse(dritems["MediaID"].ToString()),
                    AssetID = dritems["AssetID"].ToString(),
                    VimeoID = dritems["VimeoID"].ToString(),
                    PlayURL = dritems["PlayURL"].ToString(),
                    FileName = dritems["FileName"].ToString(),
                    PreviewImageURL = dritems["PreviewImage"].ToString(),
                    FilePath = dritems["FilePath"].ToString(),
                    PermanentLinkURL = dritems["PermanentLink"].ToString(),
                    Sort = Int32.Parse(dritems["Sort"].ToString())
                };

                mediagroup.Items.Add(mediagroupitem);

            }

            return mediagroup;
        }
Пример #2
0
        public MediaGroupItem GetMediaGroupItem(string AssetID)
        {
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetMediaGroupItem";
            cmd.Parameters.AddWithValue("@AssetID", AssetID);

            DataTable dt = db.Execute(cmd);

            foreach (DataRow dr in dt.Rows)
            {
                MediaGroupItem mediagroupitem = new MediaGroupItem
                {
                    MediaID = Int32.Parse(dr["MediaID"].ToString()),
                    VimeoID = dr["VimeoID"].ToString(),
                    AssetID = dr["AssetID"].ToString(),
                    FileName = dr["FileName"].ToString(),
                    PreviewImageURL = dr["PreviewImage"].ToString(),
                    FilePath = dr["FilePath"].ToString(),
                    PermanentLinkURL = dr["PermanentLink"].ToString(),
                    FullDownLoadURL = dr["FullDownLoadURL"].ToString(),
                    Sort = Int32.Parse(dr["Sort"].ToString()),
                    Comments = dr["Comments"].ToString()
                };

                return mediagroupitem;
            }

            return null;
        }
Пример #3
0
        public AudioVideoGroup GetMediaAudioVideo(int GroupID, string Type)
        {
            string AudioVideoGroupTitle = string.Empty;
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetMediaAudioVideo";

            cmd.Parameters.AddWithValue("@ID", GroupID);
            cmd.Parameters.AddWithValue("@Type", Type);

            DataTable dt = db.Execute(cmd);

            List<MediaGroupItem> MediaGroupItems = new List<MediaGroupItem>();

            foreach (DataRow dr in dt.Rows)
            {
                MediaGroupItem mediaGroupItem = new MediaGroupItem
                {
                    MediaID = Int32.Parse(dr["MediaID"].ToString()),
                    AssetID = dr["AssetID"].ToString(),
                    FileName = dr["FileName"].ToString(),
                    PreviewImageURL = dr["PreviewImage"].ToString(),
                    FilePath = dr["FilePath"].ToString(),
                    PermanentLinkURL = dr["PermanentLink"].ToString(),
                    Sort = Int32.Parse(dr["Sort"].ToString())
                };

                AudioVideoGroupTitle = dr["Title"].ToString();
                MediaGroupItems.Add(mediaGroupItem);

            }

            AudioVideoGroup group = new AudioVideoGroup
            {
                Title = AudioVideoGroupTitle,
                mediagroupitems = MediaGroupItems
            };

            return group;
        }