protected void btnSave_Click(object sender, EventArgs e) { if (this.txtName.Text == "") { JscriptPrint("没有选择任何文档!", "", "Success"); } else { Entities mydb = new Entities(); string allids = Request.QueryString["ids"]; string[] allidss = allids.Remove(allids.Length - 1).Split('-'); foreach (var item in allidss) { int newid = int.Parse(item); int fid = int.Parse(this.DropDownList1.SelectedValue); L_Newss onenews = mydb.L_Newss.Single(p => p.NID == newid); L_Newss ln = new L_Newss(); ln.ClassId = fid; ln.Title = onenews.Title; ln.Author=onenews.Author; ln.From=onenews.From; ln.Tag=onenews.Tag; ln.ZhaiYao=onenews.ZhaiYao; ln.Img=onenews.Img; ln.Content=onenews.Content; ln.Click=onenews.Click; ln.Url=onenews.Url; ln.Time=DateTime.Now; ln.IsTop=onenews.IsTop; ln.IsHot=onenews.IsHot; ln.IsSlide=onenews.IsSlide; ln.IsLock=onenews.IsLock; ln.IsRed=onenews.IsRed; mydb.L_Newss.AddObject(ln); mydb.SaveChanges(); } JscriptPrint("复制完成!", "", "Success"); } }
/// <summary> /// 获取单个视频 /// </summary> /// <param name="ClassID"></param> /// <param name="Width"></param> /// <param name="Height"></param> /// <returns></returns> public static string LnVideo(string ClassID, string Width, string Height) { string result = ""; string vpath = ""; int _cLassid = Convert.ToInt32(ClassID); Entities mydb = new Entities(); L_Newss ln = mydb.L_Newss.Where(p => p.ClassId == _cLassid).OrderByDescending(p => p.NID).First(); string biaoda = @"value=""([\s\S]*?.wmv)"""; Regex regimg = new Regex(biaoda); MatchCollection mcimg = regimg.Matches(ln.Content.ToString()); if (mcimg.Count > 0) { //AllPic += mcimg[0].ToString().Replace("src=", "").Replace("\"", "") + "|"; vpath = mcimg[0].ToString().Replace("value=", "").Replace("\"", ""); } result = string.Format("<object style='width:{0}px; height: {1}px' codebase='http://activex.microsoft.com/activex/ controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902' type='application/x-oleobject' height='{1}' standby='Loading Microsoft Windows Media Player components...' width='{0}' classid='CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95'><param name='FileName' value='{2}' /><param name='autoStart' value='1' /><param name='showControls' value='1' /><param name='showstatusbar' value='0' /><param name='windowlessvideo' value='false' /><embed name='MediaPlayer1' src='{2}' autostart='1' showcontrols='1' showstatusbar='0' windowlessvideo='false' width='{0}' height='{1}' type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer' ></embed> </object>", Width, Height, vpath); mydb.Dispose(); return(result); }
protected void btnSave_Click(object sender, EventArgs e) { if (this.txtName.Text == "") { JscriptPrint("没有选择任何文档!", "", "Success"); } else { Entities mydb = new Entities(); string allids = Request.QueryString["ids"]; string[] allidss = allids.Remove(allids.Length - 1).Split('-'); foreach (var item in allidss) { int newid = int.Parse(item); int fid = int.Parse(this.DropDownList1.SelectedValue); L_Newss onenews = mydb.L_Newss.Single(p => p.NID == newid); L_Newss ln = new L_Newss(); ln.ClassId = fid; ln.Title = onenews.Title; ln.Author = onenews.Author; ln.From = onenews.From; ln.Tag = onenews.Tag; ln.ZhaiYao = onenews.ZhaiYao; ln.Img = onenews.Img; ln.Content = onenews.Content; ln.Click = onenews.Click; ln.Url = onenews.Url; ln.Time = DateTime.Now; ln.IsTop = onenews.IsTop; ln.IsHot = onenews.IsHot; ln.IsSlide = onenews.IsSlide; ln.IsLock = onenews.IsLock; ln.IsRed = onenews.IsRed; mydb.L_Newss.AddObject(ln); mydb.SaveChanges(); } JscriptPrint("复制完成!", "", "Success"); } }
private void ShowInfo(int _id) { Entities mydb = new Entities(); { L_Newss _news = mydb.L_Newss.First(p => p.NID == _id); txtTitle.Text = _news.Title; txtAuthor.Text = _news.Author; txtForm.Text = _news.From; txtKeyword.Text = _news.Tag; txtZhaiyao.Text = _news.ZhaiYao; ddlClassId.SelectedValue = _news.ClassId.ToString(); txtImgUrl.Text = _news.Img; txtContent.Value = _news.Content; txtUrl.Text = _news.Url; if (_news.Click != null) { txtClick.Text = _news.Click.ToString(); } if (_news.IsTop == 1) { cblItem.Items[1].Selected = true; } if (_news.IsRed == 1) { cblItem.Items[2].Selected = true; } if (_news.IsHot == 1) { cblItem.Items[3].Selected = true; } if (_news.IsSlide == 1) { cblItem.Items[4].Selected = true; } txtRQ.Text = _news.Time.ToString(); } }
protected void btnSave_Click(object sender, EventArgs e) { if (this.txtName.Text == "") { JscriptPrint("没有选择任何文档!", "", "Success"); } else { Entities mydb = new Entities(); string allids = Request.QueryString["ids"]; string[] allidss = allids.Remove(allids.Length - 1).Split('-'); foreach (var item in allidss) { int newid = int.Parse(item); int fid = int.Parse(this.DropDownList1.SelectedValue); L_Newss onenews = mydb.L_Newss.Single(p => p.NID == newid); onenews.ClassId = fid; mydb.SaveChanges(); } JscriptPrint("移动完成!", "", "Success"); } }
//保存 protected void btnSave_Click(object sender, EventArgs e) { Entities mydb = new Entities(); { L_Newss _news = new L_Newss(); if (_Id != 0) _news = mydb.L_Newss.First(p => p.NID == _Id); _news.Title = txtTitle.Text.Trim(); _news.Author = txtAuthor.Text.Trim(); _news.From = txtForm.Text.Trim(); _news.Url = txtUrl.Text.Trim(); //自动提取关健字 if (txtKeyword.Text.Trim() != string.Empty) { _news.Tag = txtKeyword.Text.Trim(); } else { _news.Tag = txtTitle.Text.Trim(); } //自动提取摘要 if (txtZhaiyao.Text.Trim() != string.Empty) { _news.ZhaiYao = Utils.DropHTML(txtZhaiyao.Text, 250); } else { _news.ZhaiYao = Utils.DropHTML(txtContent.Value, 250); } //自动提取导读 _news.Img = txtImgUrl.Text.Trim(); _news.Content = txtContent.Value; _news.Click = txtClick.Text.Trim(); _news.ClassId = int.Parse(this.ddlClassId.SelectedValue); _news.IsTop = "0"; _news.IsRed = "0"; _news.IsHot = "0"; _news.IsSlide = "0"; _news.IsLock = "0"; if (cblItem.Items[0].Selected == true) { _news.IsLock = "1"; } if (cblItem.Items[1].Selected == true) { _news.IsTop = "1"; } if (cblItem.Items[2].Selected == true) { _news.IsRed = "1"; } if (cblItem.Items[3].Selected == true) { _news.IsHot = "1"; } if (cblItem.Items[4].Selected == true) { _news.IsSlide = "1"; } if (txtRQ.Text.Trim() != string.Empty) { _news.Time = DateTime.Parse(txtRQ.Text.ToString()); } else { _news.Time = DateTime.Now; } if (_Id == 0) { mydb.L_Newss.AddObject(_news); mydb.SaveChanges(); JscriptPrint("文章发布成功啦!", "list.aspx", "Success"); } else { mydb.SaveChanges(); JscriptPrint("文章修改成功啦!", "list.aspx", "Success"); } } // bll.Add(model); //保存日志 //SaveLogs("[资讯模块]添加文章:" + model.Title); }
/// <summary> /// 用于向 L_Newss EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToL_Newss(L_Newss l_Newss) { base.AddObject("L_Newss", l_Newss); }
/// <summary> /// 创建新的 L_Newss 对象。 /// </summary> /// <param name="nID">NID 属性的初始值。</param> public static L_Newss CreateL_Newss(global::System.Int64 nID) { L_Newss l_Newss = new L_Newss(); l_Newss.NID = nID; return l_Newss; }
protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); Entities bll = new Entities(); L_Newss model = bll.L_Newss.First(p => p.NID == id); switch (e.CommandName.ToLower()) { case "ibtntop": if (model.IsTop == 1) { model.IsTop = 0; } else { model.IsTop = 1; } break; case "ibtnred": if (model.IsRed == 1) { model.IsRed = 0; } else { model.IsRed = 1; } break; case "ibtnhot": if (model.IsHot == 1) { model.IsHot = 0; } else { model.IsHot = 1; } break; case "ibtnslide": if (model.IsSlide == 1) { model.IsSlide = 0; } else { model.IsSlide = 1; } break; case "ibtnlock": if (model.IsLock == 1) { model.IsLock = 0; } else { model.IsLock = 1; } break; case "del": bll.DeleteObject(model); break; } bll.SaveChanges(); myDatabind(); //RptBind("Id>0" + CombSqlTxt(this.kindId, this.classId, this.keywords, this.property), "AddTime desc"); }
//保存 protected void btnSave_Click(object sender, EventArgs e) { Entities mydb = new Entities(); { L_Newss _news = new L_Newss(); if (_Id != 0) { _news = mydb.L_Newss.First(p => p.NID == _Id); } _news.Title = txtTitle.Text.Trim(); _news.Author = txtAuthor.Text.Trim(); _news.From = txtForm.Text.Trim(); _news.Url = txtUrl.Text.Trim(); //自动提取关健字 if (txtKeyword.Text.Trim() != string.Empty) { _news.Tag = txtKeyword.Text.Trim(); } else { _news.Tag = txtTitle.Text.Trim(); } //自动提取摘要 if (txtZhaiyao.Text.Trim() != string.Empty) { _news.ZhaiYao = Utils.DropHTML(txtZhaiyao.Text, 250); } else { _news.ZhaiYao = Utils.DropHTML(txtContent.Value, 250); } //自动提取导读 _news.Img = txtImgUrl.Text.Trim(); _news.Content = txtContent.Value; _news.Click = Convert.ToInt32(txtClick.Text.Trim()); _news.ClassId = int.Parse(this.ddlClassId.SelectedValue); _news.IsTop = 0; _news.IsRed = 0; _news.IsHot = 0; _news.IsSlide = 0; _news.IsLock = 0; if (cblItem.Items[0].Selected == true) { _news.IsLock = 1; } if (cblItem.Items[1].Selected == true) { _news.IsTop = 1; } if (cblItem.Items[2].Selected == true) { _news.IsRed = 1; } if (cblItem.Items[3].Selected == true) { _news.IsHot = 1; } if (cblItem.Items[4].Selected == true) { _news.IsSlide = 1; } if (txtRQ.Text.Trim() != string.Empty) { _news.Time = DateTime.Parse(txtRQ.Text.ToString()); } else { _news.Time = DateTime.Now; } if (_Id == 0) { mydb.L_Newss.AddObject(_news); mydb.SaveChanges(); JscriptPrint("文章发布成功啦!", "list.aspx?CID=" + _news.ClassId, "Success"); } else { mydb.SaveChanges(); JscriptPrint("文章修改成功啦!", "list.aspx?CID=" + _news.ClassId, "Success"); } } // bll.Add(model); //保存日志 //SaveLogs("[资讯模块]添加文章:" + model.Title); }