private static void SetTimer(object video) { video temp = video as video; string sn = temp.SN; string RTMPhd = temp.RTMPhd; bool isOnline = false; //判断设备是否在线,在线的话执行一次SaveVideo,执行完了再判断是否在线 while (true) { while (!isOnline) { System.Threading.Thread.Sleep(2000);//每2秒判断一次设备是否在线 string res = HTMLHelper.GetHtml(@"https://www.skytraveler7.com/SmartSite/v1/CamInfo/isOnline?SN=" + sn, null, null); var result = JsonConvert.DeserializeObject <dynamic>(res); if (result.status[0].ToString() == "1") { isOnline = true; } else { isOnline = false; } } SaveVideo(sn, RTMPhd); isOnline = false; } /* * SaveVideo(sn, RTMPhd); * Timer timer = new Timer(20 * 60 * 1000); //10分钟存储一次 * timer.Enabled = true; * timer.Elapsed += (sender, e) => SaveVideo(sn, RTMPhd);*/ }
public ActionResult Delete(int VideoID) { ViewBag.VideoID = VideoID; video video = VideoRepository.GetVideoByID(VideoID); return(PartialView(video)); }
/************************************************************* * @type: file upload * @usage: this will be used on the next stage of my project * @return: returns true if everything is successful * **************************************************************/ public bool UploadVideo(FileUpload fu) { bool rtn = false; try { if (fu.PostedFile != null && fu.PostedFile.FileName != string.Empty) { using (BlogEntities be = new BlogEntities()) { byte[] blob = new byte[fu.PostedFile.ContentLength]; Stream fill = fu.FileContent; fill.Read(blob, 0, fu.PostedFile.ContentLength); video vinit = video.Createvideo(be.posts.Max(i => i.post_id) + 1, fu.PostedFile.FileName, blob, be.posts.Max(i => i.post_id) + 1, DateTime.Now); be.AddTovideos(vinit); be.SaveChanges(); } rtn = true; } else { throw new UnableToUploadFile(); } } catch { throw new UnableToAddObject(); } return(rtn); }
public ActionResult Edit(video video, string CallerType = "") { if (video.Description == null) { video.Description = ""; } try { if (ModelState.IsValid) { db.Entry(video).State = EntityState.Modified; db.SaveChanges(); TempData["Message2"] = string.Format("Vodeo update successfully."); GetData(video.ministryID); if (CallerType == "Ministry") { return(RedirectToAction("Details", new { ministryID = video.ministryID, CallerType = "Ministry" })); } else { return(RedirectToAction("Details", new { })); } } } catch (Exception ex) { TempData["Message2"] = string.Format("Error editing video."); } GetData(video.ministryID); return(PartialView(video)); }
private void LopvaChuongPage_AfterLogin_Loaded(object sender, RoutedEventArgs e) { txtblock_tenKhoaHoc.Text = "Bạn đang xem khóa học: " + khoahocdangxem.tenKhoaHoc; User_btn.Content = "Xin chào, " + UserSession.userlogined.tenNguoiDung; ws = new kidmathwebserviceSoapClient(); dschuong = ws.getDataChuongAsync().Result.Body.getDataChuongResult.ToList <chuong>(); dschuong = dschuong.FindAll(chuong => chuong.maKhoaHoc == khoahocdangxem.maKhoaHoc); dstenchuong.ItemsSource = dschuong; chuongduocchon = dschuong[0]; ws = new kidmathwebserviceSoapClient(); dsbai = ws.getDataBaiAsync().Result.Body.getDataBaiResult.ToList <bai>(); dsbai = dsbai.FindAll(bai => bai.maChuong == chuongduocchon.maChuong); listbox_dsbaihoctrong1chuong.ItemsSource = dsbai; baiduocchon = dsbai[0]; tenbaihienthi.Text = baiduocchon.tenBai; ws = new kidmathwebserviceSoapClient(); videoduocchon = (ws.getDatavideoAsync().Result.Body.getDatavideoResult.ToList <video>()).Find(video => video.maBai == baiduocchon.maBai); VideoPage.videoduocchon = videoduocchon; Active_frame.Navigate((typeof(VideoPage))); ws = new kidmathwebserviceSoapClient(); dsbaithi = ws.getDataDanhSachCauHoiAsync().Result.Body.getDataDanhSachCauHoiResult.ToList <danhSachCauHoi>(); dsbaithi = dsbaithi.FindAll(baithi => baithi.maBai == baiduocchon.maBai); }
public ActionResult DeleteConfirmed(byte id) { using (treca_aplikacija_model db = new treca_aplikacija_model()) { video video = db.videos.Find(id); List <video_like_dislike> vld = db.video_like_dislike.Where(x => x.video_id == id).ToList(); foreach (var x in vld) { db.video_like_dislike.Remove(x); db.SaveChanges(); } List <comment> vc = db.comments.Where(x => x.comment_video_id == id).ToList(); foreach (var x in vc) { db.comments.Remove(x); db.SaveChanges(); } db.videos.Remove(video); db.SaveChanges(); return(RedirectToAction("Index")); } }
private void videoClick(object sender, EventArgs e) { ListItemVideo v = sender as ListItemVideo; thisVideo = v.ThisVideo; videoPlayer_Load(sender, e); }
public ActionResult ChangeStatus() { int id = Int32.Parse(Request["order_id"]); order order = db.order.SingleOrDefault(o => o.order_id == id); order.order_status = Request["order_status"].ToString(); db.SaveChanges(); string status = Request["order_status"].ToString(); if (status == "user" || status == "returned") { var listorder = db.videolist.Where(o => o.videolist_id_order == id); foreach (var item in listorder) { video video = db.video.SingleOrDefault(o => o.video_id == item.videolist_id_video); if (status == "user") { video.video_quantity -= 1; } else { video.video_quantity += 1; } } } db.SaveChanges(); return(RedirectToAction("OrderDetailsAdmin", new { id = Int32.Parse(Request["order_id"]) })); }
public ActionResult Edit(int VideoID, string CallerType = "") { ViewBag.CallerType = CallerType; video video = VideoRepository.GetVideoByID(VideoID); GetData(video.ministryID); return(PartialView(video)); }
internal void sleep() { if (currState != video.sleep) { sleepState = currState; currState = video.sleep; } }
//Constructor public Laptop(string brand, float displayDiagonal, string processor, int internalMemory, video card) { this.brand = brand; this.displayDiagonal = displayDiagonal; this.processor = processor; this.internalMemory = internalMemory; this.card = card; }
public ActionResult DeleteConfirmed(int id) { video video = db.videos.Find(id); db.videos.Remove(video); db.SaveChanges(); return(RedirectToAction("Index")); }
//Main form controls///////////////////////////////////////// public videoPlayer(int videoId, int userId, int channelId) { InitializeComponent(); thisVideo = bl.getVideo(videoId); thisUser = bl.getUser(userId); thisChannel = bl.getChannel(channelId); buildToolBar(); }
private void buttonAddNew_Click(object sender, EventArgs e) { modifyVid = new video(); textBoxName.Text = modifyVid.getName(); textBoxPath.Text = modifyVid.getURL(); textBoxDescription.Text = modifyVid.getDescription(); labelVideoId.Text = "Video ID: New Video"; buttonSave.Enabled = true; }
public string upvideo(int id) { video models = new video(); models = _video.GetById(id); models.del = 0; _video.Update(models); return("1"); }
public EmptyResult AddNewVideo() { video video = new video(); int video_id = (from m in db.video select m.video_id).ToList().Last() + 1; video.video_id = video_id; video.video_name = Request["name"]; video.video_year = Int32.Parse(Request["year"]); video.video_description = Request["description"]; video.video_price_per_day = Double.Parse(Request["price"]); video.video_country = Request["country"]; video.video_quantity = Int32.Parse(Request["quantity"]); db.video.Add(video); db.SaveChanges(); string [] genre = Request["genre"].Split(','); int videoGenreId = (from m in db.videogenre select m.videogenre_id).ToList().Last(); for (int i = 0; i < genre.Length; i++) { videogenre videoGenre = new videogenre(); videoGenre.videogenre_id = ++videoGenreId; videoGenre.videogenre_id_video = video_id; videoGenre.videogenre_id_genre = Int32.Parse(genre[i]); db.videogenre.Add(videoGenre); db.SaveChanges(); } string producer = Request["producer"]; producer findProducer = db.producer.FirstOrDefault(p => p.producer_name == producer); videoproducer vp = new videoproducer(); vp.videoproducer_id = (from m in db.videoproducer select m.videoproducer_id).ToList().Last() + 1; vp.videoproducer_id_video = video_id; if (findProducer == null) { producer pr = new producer(); int id = (from m in db.producer select m.producer_id).ToList().Last() + 1; pr.producer_id = id; pr.producer_name = producer; db.producer.Add(pr); db.SaveChanges(); vp.videoproducer_id_producer = id; } else { vp.videoproducer_id_producer = findProducer.producer_id; } db.videoproducer.Add(vp); db.SaveChanges(); return(new EmptyResult()); }
public ActionResult Edit([Bind(Include = "id,cat_id,name,des,url,date_time,is_hot")] video video) { if (ModelState.IsValid) { db.Entry(video).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(video)); }
public ActionResult Unban(int id) { using (treca_aplikacija_model db = new treca_aplikacija_model()) { video v = db.videos.Find(id); v.video_banned = false; db.SaveChanges(); return(Json(new { message = "success" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult AddView(int id) { using (treca_aplikacija_model db = new treca_aplikacija_model()) { video v = db.videos.Find(id); v.video_views = (byte)((int)v.video_views + 1); db.SaveChanges(); return(Json(new { message = "success" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult Edit([Bind(Include = "video_id,video_name,video_year,video_description,video_price_per_day,video_quantity,video_cover_url,video_country")] video video) { if (ModelState.IsValid) { db.Entry(video).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(video)); }
public ActionResult addvideo(int?id = 0) { video model = new video(); if (id != 0) { model = _video.GetById((int)id); } return(View(model)); }
public override String GetVideoUrl(VideoInfo video) { if (video.PlaybackOptions == null) { video videoInfo = Agent.BeitragsDetail(ConfigurationHelper.GetBeitragsDetailsServiceUrl(RestAgent.Configuration), video.VideoUrl, video.Other.ToString()); var sortedPlaybackOptions = new SortedDictionary <uint, List <KeyValuePair <string, string> > >(); foreach (var vid in videoInfo.formitaeten) { if (vid.url.StartsWith("http://") && (vid.url.EndsWith(".asx") || vid.url.EndsWith(".mp4") || vid.url.EndsWith(".webm") || vid.url.EndsWith(".f4m")) && !vid.url.Contains("hbbtv")) { if (vid.facets != null && vid.facets.Any(s => s == "restriction_useragent")) { continue; } string myUrl = vid.url.EndsWith(".asx") ? Helpers.AsxUtils.ParseASX(GetWebData(vid.url))[0] : vid.url; string extensions = myUrl.Substring(myUrl.LastIndexOf('.')); myUrl = vid.url.EndsWith(".f4m") ? vid.url + "?g=" + Helpers.StringUtils.GetRandomLetters(12) + "&hdcore=3.0.3" : vid.url; uint bitrate = vid.bruttoBitrateSpecified ? vid.bruttoBitrate : vid.audioBitrate + vid.videoBitrate; if (!sortedPlaybackOptions.ContainsKey(bitrate)) { sortedPlaybackOptions[bitrate] = new List <KeyValuePair <string, string> >(); } sortedPlaybackOptions[bitrate].Add(new KeyValuePair <string, string>( string.Format("{0} | {1,3:d}x{2,3:d} | {3,4:d} kbps | {4}:// | {5}", vid.quality.ToString().Replace("OBSOLETE_", "").PadLeft(8, ' '), vid.width, vid.height, bitrate / 1024, myUrl.Substring(0, myUrl.IndexOf("://")), extensions), myUrl)); } } video.PlaybackOptions = new Dictionary <string, string>(); foreach (KeyValuePair <string, string> e in sortedPlaybackOptions.Values.SelectMany(e => e)) { video.PlaybackOptions.Add(e.Key, e.Value); } } if (video.PlaybackOptions == null || video.PlaybackOptions.Count == 0) { return(string.Empty); } else if (video.PlaybackOptions.Count == 1) { return(video.PlaybackOptions.First().Value); } else { string qualitytoMatch = videoQuality.ToString().Replace("OBSOLETE_", ""); string firstUrl = video.PlaybackOptions.FirstOrDefault(p => p.Key.Contains(qualitytoMatch)).Value; if (!string.IsNullOrEmpty(firstUrl)) { return(firstUrl); } else { return(video.PlaybackOptions.First().Value); } } }
public ActionResult videoPage(int id) { video videoModel = new video(); using (DbBaza db = new DbBaza()) { videoModel = db.videoFile.Where(x => x.videoID == id).FirstOrDefault(); } return(View(videoModel)); }
public ActionResult Create(video videoModel) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Login", "Account")); } using (treca_aplikacija_model db = new treca_aplikacija_model()) { int NewVideoId = db.videos.Count() > 0 ? db.videos.ToList().Last().video_id + 1 : 0; string Extension = Path.GetExtension(videoModel.ImageFile.FileName); string FileName = NewVideoId.ToString() + Extension; //Spliting embed tag string[] UrlStrings = videoModel.video_url.Split(' '); foreach (string s in UrlStrings) { Debug.WriteLine("Url string " + s); if (s.Contains("src")) { videoModel.video_url = s.Substring(5, s.Length - 6); } } //Assigning video icon videoModel.video_icon = FileName; //Saving video thumbnail FileName = Path.Combine(Server.MapPath("~/Content/VideoImages/"), FileName); videoModel.ImageFile.SaveAs(FileName); //Asigning user string LoggedInUserName = User.Identity.GetApplicationUserUsername(); foreach (var x in db.users) { if (x.user_username.Equals(LoggedInUserName)) { videoModel.video_user_id = x.users_id; } } //Assigning 'created' videoModel.video_created = DateTime.Now; db.videos.Add(videoModel); db.SaveChanges(); } ModelState.Clear(); return(RedirectToAction("Index", "Video")); }
public ActionResult BanConfirmed(int id) { using (treca_aplikacija_model db = new treca_aplikacija_model()) { video v = db.videos.Find(id); v.video_banned = true; db.SaveChanges(); return(RedirectToAction("Index", "Video")); } }
public ActionResult Edit([Bind(Include = "Id,Name,Src,CourseId")] video video) { if (ModelState.IsValid) { db.Entry(video).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseId = new SelectList(db.Courses, "Id", "Name", video.CourseId); return(View(video)); }
public ActionResult Create([Bind(Include = "id,cat_id,name,des,url,date_time,is_hot")] video video) { if (ModelState.IsValid) { db.videos.Add(video); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(video)); }
public ActionResult Edit([Bind(Include = "Vid_id,U_id,Vid_title,Vid_body")] video video) { if (ModelState.IsValid) { db.Entry(video).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.U_id = new SelectList(db.user_t, "U_id", "Username", video.U_id); return(View(video)); }
public ActionResult Create([Bind(Include = "Id,Name,Src,CourseId")] video video) { if (ModelState.IsValid) { db.videos.Add(video); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseId = new SelectList(db.Courses, "Id", "Name", video.CourseId); return(View(video)); }
public Laptop(string brand, float displayDiagonal, string processor, int internalMemory, string resolution, bool dvdPlayer, video card, bool touchScreen) { this.brand = brand; this.displayDiagonal = DisplayDiagonal; this.processor = processor; this.internalMemory = internalMemory; this.resolution = resolution; this.dvdPlayer = dvdPlayer; this.card = card; this.touchScreen = touchScreen; }
public ActionResult Create([Bind(Include = "Vid_id,U_id,Vid_title,Vid_body")] video video) { if (ModelState.IsValid) { db.videos.Add(video); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.U_id = new SelectList(db.user_t, "U_id", "Username", video.U_id); return(View(video)); }
public IHttpActionResult UpdateVideoCout(video v) { var videoupdate = db.videoList.Find(v.videoID); videoupdate.videoID = v.videoID; videoupdate.videoName = v.videoName; videoupdate.videoPic = v.videoPic; videoupdate.videoSource = v.videoSource; videoupdate.videoListened = v.videoListened; videoupdate.videoTimerelease = v.videoTimerelease; db.Entry(videoupdate).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(Ok(videoupdate)); }
public string getVideoNav() { string res = string.Empty; string lb = Request.QueryString.Get("sid"); string newsid = Request.QueryString.Get("id"); videoManager mgr = new videoManager(); if (!string.IsNullOrEmpty(newsid)) { WhereClip where = new WhereClip(); where = where && video._.id == newsid; video model = new video(); model = mgr.GetvideoItemById(where); if (model != null) { lb = model.sid.ToString(); } } if (!string.IsNullOrEmpty(lb)) { videoclass modelclass = new videoclass(); WhereClip where2 = new WhereClip(); where2 = where2 && videoclass._.id == lb; modelclass = mgr.GetItemById(where2); res = string.Format(@"<a href='Category.aspx?type=video'>视频频道</a> > <a href='Category.aspx?sid={0}&type=video'>{1}</a>", modelclass.id, modelclass.classname); } else { res = "<a href='Category.aspx?type=video'>视频频道</a>"; } return res; }