예제 #1
0
파일: BAL.cs 프로젝트: lchambaka/WorkPad
        public List<OnDemandVideo> GetOnDemandAudioVideos()
        {
            DB db = new DB();

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

            List<OnDemandVideo> medias = new List<OnDemandVideo>();
            DataTable dt = db.Execute(cmd);

            foreach (DataRow dr in dt.Rows)
            {
                OnDemandVideo media = new OnDemandVideo
                {
                    ID = Int32.Parse(dr["ID"].ToString()),
                    Location = dr["Location"].ToString(),
                    DateCreated = Convert.ToDateTime(dr["DateCreated"].ToString()),
                    PreviewImageURL = dr["PreviewImageURL"].ToString(),
                    Sort = Int32.Parse(dr["Sort"].ToString()),
                    Active = Convert.ToBoolean(dr["Active"]),
                    Message = dr["Message"].ToString(),
                    Url = dr["Url"].ToString(),

                };

                medias.Add(media);

            }

            return medias;
        }
예제 #2
0
파일: BAL.cs 프로젝트: lchambaka/WorkPad
        public OnDemandVideo GetOnDemandAudioVideo(int location_id)
        {
            DB db = new DB();

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

            DataTable dt = db.Execute(cmd);

            DataRow dr = dt.Rows[0];

            OnDemandVideo TheOnDemandVideo = new OnDemandVideo
                {
                    ID = Int32.Parse(dr["ID"].ToString()),
                    Location = dr["Location"].ToString(),
                    DateCreated = Convert.ToDateTime(dr["DateCreated"].ToString()),
                    PreviewImageURL = dr["PreviewImageURL"].ToString(),
                    Sort = Int32.Parse(dr["Sort"].ToString()),
                    Active = Convert.ToBoolean(dr["Active"]),
                    Message = dr["Message"].ToString(),
                    Url = dr["Url"].ToString(),

                };

            TheOnDemandVideo.VideoItems = GetOnDemandAudioVideoItems(location_id);

            return TheOnDemandVideo;
        }