public long Create(episode episode) { long id = Services.episode.Create(episode); if (id == -1) { return(-1); } else { moderation_episode modepi = new moderation_episode(); modepi.idepisode = id; modepi.review = false; modepi.createdat = modepi.updatedat = DateTime.Now; long idmod = Services.modepi.Create(modepi); if (idmod == -1) { return(-1); } else { return(id); } } }
private void EditEpisodeAudio_Load(object sender, EventArgs e) { episode epi = Businesses.episode.GetByID(idepi); txtTitle.Text = epi.name; txtLink.Text = epi.content; string regexLink = @"(?:https?:\/\/)?(?:www\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([\w\-_]+)\&?"; var match = Regex.Match(txtLink.Text, regexLink); string html = "<html><head>"; html += "<meta content='IE=Edge' http-equiv='X-UA-Compatible'/>"; html += "<iframe id='video' src= 'https://www.youtube.com/embed/{0}' style='width: 100%; height: 420px' frameborder='0' allowfullscreen></iframe>"; html += "</body></html>"; if (match.Value != "") { html = string.Format(html, match.Groups[1]); webBrowser1.Navigate("about:blank"); webBrowser1.Document.OpenNew(false); webBrowser1.Document.Write(html); webBrowser1.Refresh(); } //((Form)this.TopLevelControl).FormClosing += FormDialog_FormClosing; //this.Visible = false; }
public bool Update(long idepisode, moderation_episode input) { try { episode episode = db.episodes.SingleOrDefault(x => x.idepisode == idepisode && x.status >= 0); if (episode != null) { moderation_episode data = db.moderation_episode.SingleOrDefault(x => x.idepisode == idepisode && x.review == false); if (data != null) { data.moderator = input.moderator; data.moderation = input.moderation; data.content = input.content; data.review = true; data.updatedat = DateTime.Now; episode.status = (int)input.moderation; db.SaveChanges(); return(true); } } return(false); } catch { return(false); } }
private void btnEdit_Click(object sender, EventArgs e) { char[] delimiters = new char[] { ' ', '\r', '\n' }; string title = txtTitle.Text; string content = txtContent.Text; long countTitle = title.Split(delimiters, StringSplitOptions.RemoveEmptyEntries).Length; long countContent = content.Split(delimiters, StringSplitOptions.RemoveEmptyEntries).Length; if (countTitle == 0 || countContent == 0) { MessageBox.Show("Vui lòng không để trống!", "Thông báo"); } else if (countTitle > 100) { MessageBox.Show("Tiêu đề không được quá 100 từ!", "Thông báo"); } else { episode epi = new episode(); epi.name = title; epi.content = content; epi.updatedat = DateTime.Now; bool update = Businesses.episode.UpdateEpi(id, epi); if (!update) { MessageBox.Show("Thất bại", "Thông báo"); } else { MessageBox.Show("Thành công", "Thông báo"); ((Form)this.TopLevelControl).Close(); } } }
private void EditEpisodeText_Load(object sender, EventArgs e) { episode epi = Businesses.episode.GetByID(id); txtTitle.Text = epi.name; txtContent.Text = epi.content; //this.Visible = false; }
private string getTypeDownload(episode episode, ICollection <download> downloadedInfo) { foreach (var episodeDownloaded in downloadedInfo) { if (episode.name == episodeDownloaded.name) { return((episodeDownloaded.status == "completed") ? "none" : "update"); } } return("new"); }
private void btnCreate_Click(object sender, EventArgs e) { char[] delimiters = new char[] { ' ', '\r', '\n' }; string title = txtChapterTitle.Text; long countTitle = title.Split(delimiters, StringSplitOptions.RemoveEmptyEntries).Length; List <string> links_data = links.AsEnumerable().Select(row => row.Field <string>("URL")).Where(x => x != null).ToList(); string contentLink = string.Join("|", links_data); bool check_links = links_data.AsEnumerable().All(x => { string regexLink = @"^(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|jpeg|png)$"; bool match = Regex.IsMatch(x, regexLink); return(match); }); if ((countTitle > 0 && countTitle <= 100) && links.Rows.Count > 0) { if (!check_links) { MessageBox.Show("Link nhập vào phải là link ảnh hợp lệ", "Thông báo"); } else { episode epi = new episode(); epi.index = Businesses.episode.GetLastIndex(idbook) + 1; epi.idbook = idbook; epi.name = title; epi.content = contentLink; epi.view = 0; epi.status = 1; epi.createdat = epi.updatedat = DateTime.Now; long idepi = Businesses.episode.Create(epi); if (idepi == -1) { MessageBox.Show("Thất bại", "Thông báo"); } else { MessageBox.Show("Thành công", "Thông báo"); } } } else if (countTitle == 0 || links.Rows.Count == 0) { MessageBox.Show("Vui lòng không để trống!", "Thông báo"); } else if (countTitle > 100) { MessageBox.Show("Tiêu đề không được quá 100 từ!", "Thông báo"); } }
public long Create(episode epi) { try { db.episodes.Add(epi); db.SaveChanges(); return(epi.idepisode); } catch { return((long)-1); } }
public episode newEpisodeInstance(string name, int victimId, string groupName, string episodeHref) { var episode = new episode() { name = name, victimId = victimId, groupName = groupName, episodeHref = episodeHref, alias = UnicodeUtil.convertToAlias(name) }; return(episode); }
private void btnCreate_Click(object sender, EventArgs e) { char[] delimiters = new char[] { ' ', '\r', '\n' }; string title = txtTitle.Text; string contentLink = txtLink.Text; long countTitle = title.Split(delimiters, StringSplitOptions.RemoveEmptyEntries).Length; if ((countTitle > 0 && countTitle <= 100) && contentLink.Trim().Length > 0) { string regexLink = @"(?:https?:\/\/)?(?:www\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([\w\-_]+)\&?"; bool match = Regex.IsMatch(contentLink, regexLink); if (match) { episode epi = new episode(); epi.index = Businesses.episode.GetLastIndex(idbook) + 1; epi.idbook = idbook; epi.name = title; epi.content = contentLink; epi.view = 0; epi.status = 1; epi.createdat = epi.updatedat = DateTime.Now; long idepi = Businesses.episode.Create(epi); if (idepi == -1) { MessageBox.Show("Thất bại", "Thông báo"); } else { MessageBox.Show("Thành công", "Thông báo"); } } else { MessageBox.Show("Link ảnh không hợp lệ", "Thông báo"); } } else if (countTitle == 0 || contentLink.Trim().Length == 0) { MessageBox.Show("Vui lòng không để trống!", "Thông báo"); } else if (countTitle > 100) { MessageBox.Show("Tiêu đề không được quá 100 từ!", "Thông báo"); } }
private void EditEpisodeComic_Load(object sender, EventArgs e) { episode epi = Businesses.episode.GetByID(idepi); links.Columns.Add("URL", typeof(string)); txtChapterTitle.Text = epi.name; List <string> contents = epi.content.Split('|').ToList(); foreach (string content in contents) { DataRow row = links.NewRow(); row.SetField <string>("URL", content); links.Rows.Add(row); } ((Form)this.TopLevelControl).FormClosing += FormDialog_FormClosing; LoadData(); }
private void CensorEpisodeComic_Load(object sender, EventArgs e) { episode epi = Businesses.episode.GetByID(idepi); links.Columns.Add("URL", typeof(string)); txtTitle.Text = epi.name; List <string> contents = epi.content.Split('|').ToList(); foreach (string content in contents) { DataRow row = links.NewRow(); row.SetField <string>("URL", content); links.Rows.Add(row); } dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = links; }
private void btnEdit_Click(object sender, EventArgs e) { char[] delimiters = new char[] { ' ', '\r', '\n' }; string title = txtTitle.Text; string content = txtContent.Text; long countTitle = title.Split(delimiters, StringSplitOptions.RemoveEmptyEntries).Length; long countContent = content.Split(delimiters, StringSplitOptions.RemoveEmptyEntries).Length; if ((countTitle > 0 && countTitle <= 100) && (countContent > 0 && countContent <= 500)) { episode episode = new episode(); episode.index = Businesses.episode.GetLastIndex(idbook) + 1; episode.idbook = idbook; episode.name = title; episode.content = content; episode.view = 0; episode.status = 1; episode.createdat = episode.updatedat = DateTime.Now; long idepi = Businesses.episode.Create(episode); if (idepi == -1) { MessageBox.Show("Thất bại", "Thông báo"); } else { MessageBox.Show("Thành công", "Thông báo"); } } else if (countTitle == 0 || countContent == 0) { MessageBox.Show("Vui lòng không để trống!", "Thông báo"); } else if (countTitle > 100) { MessageBox.Show("Tiêu đề không được quá 100 từ!", "Thông báo"); } else if (countContent > 500) { MessageBox.Show("Nội dung không được quá 500 từ!", "Thông báo"); } }
private void materialFlatButton1_Click(object sender, EventArgs e) { MessageBox.Show("请选择视频下载路径,会将你所有选项下载到里面"); var dialog = new FolderBrowserDialog(); DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { string downloadpath = dialog.SelectedPath; foreach (IntereactiveVideo video in videos) { episode ep = new episode(); ep.aid = aid; ep.cid = video.cid; ep.name = video.name + " (" + video.nodeid + ")"; ep.Download(downloadpath, 120); } Dialog.Show("成功添加下载!"); } return; }
public bool DeleteEpi(long idepi) { episode epi = GetByID(idepi); try { if (epi != null) { epi.updatedat = DateTime.Now; epi.status = -1; db.SaveChanges(); return(true); } else { return(false); } } catch { return(false); } }
public static void readMisson() { try { string json = File.ReadAllText(Environment.CurrentDirectory + "/config/download.session"); List <DownloadSavedMisson> ms = new List <DownloadSavedMisson>(); ms = JsonConvert.DeserializeObject <List <DownloadSavedMisson> >(json); foreach (DownloadSavedMisson dobj in ms) { episode ep = new episode(); ep.aid = dobj.aid; ep.cid = dobj.cid; ep.savedir = dobj.saveto; ep.name = dobj.name; ep.selectedquality = dobj.quality; ep.Download(false); } } catch (Exception e) { //防止报错 } }
public bool UpdateEpi(long idepi, episode input) { episode epi = GetByID(idepi); try { if (epi != null) { epi.name = input.name; epi.content = input.content; epi.updatedat = DateTime.Now; db.SaveChanges(); return(true); } else { return(false); } } catch { return(false); } }
private void CensorEpisodeText_Load(object sender, EventArgs e) { episode = Businesses.episode.GetByID(idepi); txtTitle.Text = episode.name; txtContent.Text = episode.content; }
public bool UpdateEpi(long idepi, episode input) { return(Services.episode.UpdateEpi(idepi, input)); }