protected void btn_Submit_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); if (UserAction.HasPostRight(ddl_Class.SelectedValue.ToInt32()) == false) { Js.AlertAndGoback("对不起,对于本栏目您没有提问的权限!如有疑问,请联系管理员"); ent.Dispose(); return; } User u=UserAction.opuser; int rclass = WS.RequestInt("ddl_Class", WS.RequestInt("class")); string content = WS.RequestString("txt_Content").TrimDbDangerousChar().Trim().HtmlDeCode(); string title = WS.RequestString("txt_Title").TrimDbDangerousChar().Trim(); if (rclass < 0) { Js.AlertAndGoback("栏目不能为空"); return; } if (content.IsNullOrEmpty()) { Js.AlertAndGoback("提问内容不能为空"); return; } if (title.IsNullOrEmpty()) { Js.AlertAndGoback("标题不能为空"); return; } Question qs = new Question(); qs.AskTime = DateTime.Now; qs.ClassID = rclass; qs.ClickCount = 0; qs.Content = content; qs.Title = title; qs.UserID = u.ID; qs.UserName = u.UserName; qs.ZtID = 0; ent.AddToQuestion(qs); ent.SaveChanges(); CreatePage.CreateContentPage(qs, qs.GetClass()); CreatePage.CreateListPage(qs.GetClass(), 1); string url = BasePage.GetQuestionUrl(qs, qs.GetClass()); ent.Dispose(); Js.AlertAndChangUrl("提问发布成功!", url); }
protected void Btn_Save_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); int id = 0; try { id = Spe_Tree.SelectedNode.Value.ToInt32(0); } catch { } if (chk_Edit.Checked) { var q = (from l in ent.JobIndustry where l.ID == id select l).FirstOrDefault(); q.Name = txt_Name.Text; } else { JobIndustry spe = new JobIndustry(); spe.ParentID = id; spe.Name = txt_Name.Text; ent.AddToJobIndustry(spe); } ent.SaveChanges(); ent.Dispose(); Spe_Tree.Nodes.Clear(); LoadTree(); }
protected void LoadInfo() { ddl_SysModel.DataSource = TemplateAction.AllSysModel; ddl_SysModel.DataTextField = "ModelName"; ddl_SysModel.DataValueField = "ID"; ddl_SysModel.DataBind(); int id = WS.RequestInt("id"); DataEntities ent = new DataEntities(); TemplateList tl = (from l in ent.TemplateList where l.ID == id select l).FirstOrDefault(); ent.Dispose(); try { txt_TempName.Text = tl.TempName; txt_CutKeywords.Text = tl.CutKeywords.ToS(); txt_CutTitle.Text = tl.CutTitle.ToS(); txt_ShowRecordCount.Text = tl.ShowRecordCount.ToS(); txt_TimeFormat.Text = tl.TimeFormat; txt_Content.Text = tl.Content; txt_Listvar.Text = tl.ListVar; ddl_SysModel.SelectedValue = tl.SysModel.ToS(); } catch { } }
protected void btn_Save_Click(object sender, EventArgs e) { int id = WS.RequestInt("id"); DataEntities ent = new DataEntities(); TemplateList tl ; try { tl = (from l in ent.TemplateList where l.ID == id select l).First(); } catch { tl = new TemplateList(); } tl.TempName = txt_TempName.Text; tl.CutKeywords = txt_CutKeywords.Text.ToInt32(); tl.CutTitle = txt_CutTitle.Text.ToInt32(); tl.ShowRecordCount = txt_ShowRecordCount.Text.ToInt32(); tl.TimeFormat = txt_TimeFormat.Text; tl.Content = txt_Content.Text.Replace("'", "''"); ; tl.ListVar = txt_Listvar.Text.Replace("'", "''"); ; tl.SysModel = ddl_SysModel.SelectedValue.ToInt32(); if (tl.ID <= 0) { tl.GroupID = 1; tl.SysModel = 1; ent.AddToTemplateList(tl); } ent.SaveChanges(); ent.Dispose(); Js.AlertAndGoback("保存成功!"); }
protected void btn_tree_new_Click(object sender, EventArgs e) { int pnID = PanelTree.SelectedNode.Value.ToInt32(0); int parentID = 0; try { parentID=SubTree.SelectedNode.Value.ToInt32(0); } catch { } SysNavTree tree = new SysNavTree(); tree.Group = cbl_tree_group.GetValues(); tree.Icon = ddl_tree_icon.SelectedValue; tree.InnerHtml = txt_tree_html.Text; tree.OrderIndex = txt_tree_orderindex.Text.ToInt32(); tree.PanelID = pnID; tree.ParentID = parentID; tree.Title = txt_tree_title.Text; tree.Url = txt_tree_url.Text; DataEntities ent = new DataEntities(); ent.AddToSysNavTree(tree); ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("新增成功", "SysmenuManagement.aspx"); }
protected void LoadInfo() { DataEntities ent = new DataEntities(); ddl_RegForm.DataSource = from l in ent.UserForm select l; ddl_RegForm.DataTextField = "FormName"; ddl_RegForm.DataValueField = "ID"; ddl_RegForm.DataBind(); int id = WS.RequestInt("id"); UserGroup g = (from l in ent.UserGroup where l.ID == id select l).FirstOrDefault(); if (null==g) { return; } txt_GroupName.Text = g.GroupName; txt_grade.Text = g.Grade.ToS(); txt_MaxPost.Text = g.MaxPost.ToS(); chk_PostAotuAudit.Checked = g.PostAotuAudit.ToBoolean(); chk_EnableReg.Checked = g.EnableReg.ToBoolean(); chk_RegAutoAudit.Checked = g.RegAutoAudit.ToBoolean(); ddl_RegForm.SelectedValue = g.RegForm.ToS(); ent.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { DataEntities ent = new DataEntities(); var chapters = //BookChapterView.GetModelList("enable=1 order by UpdateTime desc", 500); (from l in ent.BookChapter where l.Enable==true orderby l.UpdateTime descending select l).Take(500); var items = new List<Voodoo.other.SEO.RssItem>(); foreach (var chapter in chapters) { items.Add(new Voodoo.other.SEO.RssItem() { Title = chapter.BookTitle + "-" + chapter.Title, PutTime = chapter.UpdateTime, Link = SystemSetting.SiteUrl+GetBookChapterUrl(chapter, chapter.GetClass() ), Description = chapter.BookTitle + "Update to chapter:" + chapter.Title + ", from chanel" + chapter.ClassName }); } var movies = (from l in ent.MovieInfo orderby l.UpdateTime descending select l).Take(800); foreach (var m in movies) { items.Add(new Voodoo.other.SEO.RssItem() { Title = m.Title, PutTime = m.UpdateTime.ToDateTime(), Link = SystemSetting.SiteUrl + GetMovieUrl(m,m.GetClass()),// GetBookChapterUrl(chapter, BookView.GetClass(chapter)), Description = m.Title + "Update to :" + m.LastDramaTitle + ", from chanel" + m.ClassName+", Intro:"+m.Intro }); } ent.Dispose(); Response.Clear(); Voodoo.other.SEO.Rss.GetRss(items, SystemSetting.SiteName, SystemSetting.SiteUrl, SystemSetting.Description, SystemSetting.Copyright); }
protected void btn_Save_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); int id = WS.RequestInt("id"); TemplateVar tl = new TemplateVar(); try { tl = (from l in ent.TemplateVar where l.ID == id select l).First(); } catch { } tl.VarName = txt_VarName.Text; tl.Content = txt_Content.Text.Replace("'", "''"); if (tl.ID==null||tl.ID <= 0) { ent.AddToTemplateVar(tl); } ent.SaveChanges(); var pages = (from l in ent.TemplatePage where l.CreateWith == 5 select l).ToList(); TemplateHelper th = new TemplateHelper(); foreach (var p in pages) { try { string html = th.GetStatisPage(p.id); Voodoo.IO.File.Write(Server.MapPath(p.FileName), html); } catch { } } ent.Dispose(); Js.AlertAndChangUrl("保存成功!", "VarTemplateList.aspx"); }
protected void btn_Save_Click(object sender, EventArgs e) { int id = WS.RequestInt("id"); DataEntities ent = new DataEntities(); Voodoo.Basement.AdGroup q = new Voodoo.Basement.AdGroup(); if (id > 0) { q = (from l in ent.AdGroup where l.ID == id select l).FirstOrDefault(); } q.Name = txt_Name.Text; q.height = txt_Height.Text.ToInt32(); q.width = txt_Width.Text.ToInt32(); if (id > 0 && q != null) { } else { //com.UserID = userid; ent.AddToAdGroup(q); } ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("保存成功!", "List.aspx"); }
protected void BindList() { DataEntities ent = new DataEntities(); switch (type) { case "kuaib": var cpl = from l in ent.MovieUrlKuaib where l.MovieID == id select l; rp_List.DataSource = cpl; rp_List.DataBind(); break; case "baidu": var cpl_baidu = from l in ent.MovieUrlBaidu where l.MovieID == id select l; rp_List.DataSource = cpl_baidu; rp_List.DataBind(); break; case "mag": var cpl_mag = from l in ent.MovieUrlMag where l.MovieID == id select l; rp_List.DataSource = cpl_mag; rp_List.DataBind(); break; default: var df = from l in ent.MovieUrlKuaib where l.MovieID == id select l; rp_List.DataSource = df; rp_List.DataBind(); break; } ent.Dispose(); }
protected void btn_Save_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); int id = WS.RequestInt("id"); UserGroup g = (from l in ent.UserGroup where l.ID == id select l).FirstOrDefault(); if (g == null) { g = new UserGroup(); } g.GroupName = txt_GroupName.Text; g.Grade = txt_grade.Text.ToInt32(); g.MaxPost = txt_MaxPost.Text.ToInt32(); g.PostAotuAudit = chk_PostAotuAudit.Checked; g.EnableReg = chk_EnableReg.Checked; g.RegAutoAudit = chk_RegAutoAudit.Checked; g.RegForm = ddl_RegForm.SelectedValue.ToInt32(); if (g.ID <= 0) { ent.AddToUserGroup(g); } ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("保存成功!", "GroupList.aspx"); }
/// <summary> /// 单集列表 /// </summary> /// <param name="id"></param> protected void Drama(int id) { DataEntities ent = new DataEntities(); MovieDrama d = (from l in ent.MovieDrama where l.id == id select l).FirstOrDefault(); ent.Dispose(); Response.Clear(); Response.Write(CreateDramapage(d,d.GetClass())); }
protected void CreateBook(int bookid) { DataEntities ent = new DataEntities(); Book b = (from l in ent.Book where l.ID == bookid select l).FirstOrDefault(); ent.Dispose(); Voodoo.Basement.CreatePage.CreateContentPage(b, b.GetClass()); }
protected void btn_Save_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); int id = WS.RequestInt("id"); JobPost p = new JobPost(); if (id > 0) { p = (from l in ent.JobPost where l.ID == id select l).FirstOrDefault(); } p.CompanyID = ddl_Company.SelectedValue.ToInt32(); p.Title = txt_Title.Text; p.Province = ddl_Province.SelectedValue.ToInt32(); p.City = ddl_City.SelectedValue.ToInt32(); p.Salary = ddl_Salary.SelectedValue.ToInt32(); p.Expressions = ddl_Expressions.SelectedValue.ToInt32(); p.Edu = ddl_Edu.SelectedValue.ToInt32(); p.EmployNumber = txt_EmployNumber.Text.ToInt32(); p.Intro = txt_Intro.Text; p.PostTime = DateTime.Now; p.IsSetTop = chk_Settop.Checked; p.SetTopTime = DateTime.Now; p.ExpireTime = txt_ExpireTime.Text.ToDateTime(); //绑定教育 List<JobPostEduAndEmployeeCount> edus = new List<JobPostEduAndEmployeeCount>(); foreach (var ed in JobAction.Edu) { edus.Add(new JobPostEduAndEmployeeCount() { Checked = false, key = ed.Key, Number = 0, Text = ed.Value }); } string[] chk = WS.RequestString("chk").Split(','); string[] nums = WS.RequestString("number").Split(','); for (int i = 0; i < chk.Length; i++) { edus[i].Checked = chk[i].ToBoolean(); edus[i].Number = nums[i].ToInt32(); } p.Ext1 = Voodoo.IO.XML.Serialize(edus); if (p.ID <= 0) { //处理城市热度 try { var ct = (from l in ent.City where l.id == p.City select l).FirstOrDefault(); ct.Hot += 1; } catch { } ent.AddToJobPost(p); } ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("保存成功!", refer); }
protected void Page_Load(object sender, EventArgs e) { long id = WS.RequestString("id").ToInt64(); DataEntities ent = new DataEntities(); BookChapter c = (from l in ent.BookChapter where l.ID == id select l).FirstOrDefault(); ent.Dispose(); Response.Clear(); Response.Write(Voodoo.IO.XML.Serialize(c)); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Save_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); int clsid = ddl_Class.SelectedValue.ToInt32(); int quID = WS.RequestInt("id"); Class cls = ObjectExtents.Class(clsid); Question qu = (from l in ent.Question where l.ID == quID select l).FirstOrDefault(); qu.ClassID = ddl_Class.SelectedValue.ToInt32(); qu.Title = txt_Title.Text.TrimDbDangerousChar(); try { qu.UserID = ddl_Author.SelectedValue.ToInt32(); qu.UserName = ddl_Author.SelectedItem.Text; } catch { qu.UserID = 0; qu.UserName = ""; } qu.ClickCount = txt_ClickCount.Text.ToInt32(0); if (qu.ID <= 0) { qu.AskTime = DateTime.Now; } qu.Content = txt_Content.Text.TrimDbDangerousChar(); qu.Title = txt_Title.Text; qu.ZtID = 0; if (qu.ID <= 0) { ent.AddToQuestion(qu); } ent.SaveChanges(); ent.Dispose(); //生成页面 try { CreatePage.CreateContentPage(qu, cls); Question pre = GetPreQuestion(qu, cls); if (pre != null) { CreatePage.CreateContentPage(pre, cls); } CreatePage.CreateListPage(cls, 1); } catch { } Js.AlertAndChangUrl("保存成功!", url); }
/// <summary> /// 内容页 /// </summary> /// <param name="Name"></param> /// <param name="Class"></param> protected void Content(string Name, string Class) { DataEntities ent = new DataEntities(); MovieInfo mv = //MovieInfoView.Find(string.Format("StandardTitle=N'{0}' and ClassName=N'{1}'", Name, Class)); (from l in ent.MovieInfo where l.StandardTitle==Name && l.ClassName==Class select l).FirstOrDefault(); ent.Dispose(); Response.Clear(); Response.Write(CreateContentPage(mv, mv.GetClass())); }
protected void Page_Load(object sender, EventArgs e) { DataEntities ent = new DataEntities(); #region 阅读统计 int model = WS.RequestInt("m"); int id = WS.RequestInt("id"); SysModel sm = //SysModelView.GetModelByID(model.ToS()); (from l in ent.SysModel where l.ID == model select l).FirstOrDefault(); if (sm.ID < 0) { return; } if (id < 0) { return; } string tableName = sm.TableName; string str_sql = string.Format("update {0} set ClickCount=ClickCount+1 where ID={1}; select ClickCount from {0} where ID={1}", tableName, id); Response.Clear(); Response.Write(string.Format("document.write('{0}')",GetHelper().ExecuteScalar(CommandType.Text, str_sql))); //Response.End(); #endregion #region 阅读历史记录 //string bookids = ""; //if (Voodoo.Cookies.Cookies.GetCookie("history") != null) //{ // bookids = Voodoo.Cookies.Cookies.GetCookie("history").Value; //} //string[] ids = bookids.Split(','); //var tids = ids.ToList(); //tids.Add(id.ToS()); //tids = tids.Distinct(p => p).ToList(); //tids = tids.Where(p => p.Trim().Length > 0).ToList(); //tids = tids.Take(5).ToList(); //bookids = ""; //foreach (string str in tids) //{ // if (str.Trim().Length > 0) // { // bookids += str + ","; // } //} //bookids=bookids.TrimEnd(','); //HttpCookie cookie = new HttpCookie("history", bookids); //Voodoo.Cookies.Cookies.SetCookie(cookie); #endregion ent.Dispose(); }
protected void btn_Save_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); var chapters = (from l in ent.BookChapter where l.ID == id select l).ToList(); var chapter = new Voodoo.Basement.BookChapter(); if (chapters.Count > 0) { chapter = chapters.FirstOrDefault(); } chapter.Title = txt_Title.Text; chapter.IsVipChapter = chk_IsVip.Checked; chapter.Enable = chk_IsEnable.Checked; chapter.IsTemp = chk_IsTemp.Checked; chapter.IsFree = chk_IsFree.Checked; chapter.IsImageChapter = chk_IsImageChapter.Checked; if (chapters.Count== 0) { Voodoo.Basement.Book book = (from l in ent.Book where l.ID == bookid select l).FirstOrDefault(); chapter.BookID = book.ID; chapter.BookTitle = book.Title; chapter.ClassID = book.ClassID; chapter.ClassName = book.ClassName; chapter.UpdateTime = DateTime.UtcNow.AddHours(8); ent.AddToBookChapter(chapter); ent.SaveChanges(); book.LastChapterID = chapter.ID; book.LastChapterTitle = chapter.Title; book.UpdateTime = chapter.UpdateTime; if (SystemSetting.EnableStatic) { CreatePage.CreateContentPage(book, book.GetClass()); } } if (chapter.TxtPath.IsNullOrEmpty()) { chapter.TxtPath = BasePage.GetChapterTxtStorePath(chapter, chapter.GetBook()); } ent.SaveChanges(); ent.Dispose(); Voodoo.IO.File.Write( Server.MapPath(chapter.TxtPath), txt_Content.Text); //生成章节页面 if (SystemSetting.EnableStatic) { CreatePage.CreateBookChapterPage(chapter, chapter.GetBook(), chapter.GetClass()); } Response.Redirect(string.Format("ChapterList.aspx?bookid={0}",chapter.BookID)); }
/// <summary> /// 绑定列表 /// </summary> protected void BindList() { int uid = WS.RequestInt("uid"); DataEntities ent = new DataEntities(); var q = from l in ent.JobResumeInfo from c in ent.City from p in ent.Province where l.City == c.id && l.Province == p.ID select new { l.UserID,l.ID,l.Title,l.ChineseName,l.Mobile,l.Email,l.IsMale,l.Province,l.City, p.province1, c.city1,index=0}; if (txt_Key.Text.Length > 0) { q = q.Where(p => p.Title.Contains(txt_Key.Text) || p.ChineseName.Contains(txt_Key.Text) || p.Mobile.Contains(txt_Key.Text) || p.Email.Contains(txt_Key.Text) ); } if (ddl_Province.SelectedValue.Length > 0) { int pro = ddl_Province.SelectedValue.ToInt32(); q = q.Where(p => p.Province == pro); } if (ddl_City.SelectedValue.Length > 0) { int ct = ddl_City.SelectedValue.ToInt32(); q = q.Where(p => p.City == ct); } if (uid > 0) { q = q.Where(p => p.UserID == uid); } pager.PageSize = SystemSetting.MagageListSize; pager.RecordCount = q.Count(); var xx = q.OrderByDescending(p => p.ID) .Skip((pager.CurrentPageIndex - 1) * pager.PageSize).Take(pager.PageSize).ToList().ToDataTable(); for (int i = 0; i < xx.Rows.Count; i++) { xx.Rows[i]["index"] = (pager.CurrentPageIndex - 1) * pager.PageSize + i + 1; } rp_list.DataSource =xx; rp_list.DataBind(); ent.Dispose(); }
protected void btn_Save_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); movieID = WS.RequestInt("movieid", 0); MovieInfo movie = //MovieInfoView.GetModelByID(movieID.ToS()); (from l in ent.MovieInfo where l.id == movieID select l).FirstOrDefault(); #region deal switch (type) { case "kuaib": var kuaibUrl = (from l in ent.MovieUrlKuaib where l.id == id select l).FirstOrDefault(); kuaibUrl.MovieTitle = movie.Title; kuaibUrl.Title = txt_Title.Text; kuaibUrl.Url = txt_Url.Text; kuaibUrl.MovieID = movie.id; kuaibUrl.UpdateTime = DateTime.Now; if (kuaibUrl.id <= 0) { ent.AddToMovieUrlKuaib(kuaibUrl); } break; case "baidu": var baiduUrl = (from l in ent.MovieUrlBaidu where l.id == id select l).FirstOrDefault(); baiduUrl.MovieTitle = movie.Title; baiduUrl.Title = txt_Title.Text; baiduUrl.Url = txt_Url.Text; baiduUrl.MovieID = movie.id; baiduUrl.UpdateTime = DateTime.Now; if (baiduUrl.id <= 0) { ent.AddToMovieUrlBaidu(baiduUrl); } break; case "mag": var magUrl = (from l in ent.MovieUrlMag where l.id == id select l).FirstOrDefault(); magUrl.MovieTitle = movie.Title; magUrl.Title = txt_Title.Text; magUrl.Url = txt_Url.Text; magUrl.MovieID = movie.id; magUrl.UpdateTime = DateTime.Now; if (magUrl.id <= 0) { ent.AddToMovieUrlMag(magUrl); } break; } #endregion ent.SaveChanges(); ent.Dispose(); Response.Redirect("UrlList.aspx?type=" + type + "&movieid="+movieID); }
protected void Button1_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); var ids = WS.RequestString("id").Split(',').ToList(); ; var qs = from l in ent.UserGroup where ids.IndexOf(l.ID.ToString()) > 0 select l; foreach (var q in qs) { ent.DeleteObject(q); } ent.Dispose(); BindList(); }
/// <summary> /// 添加书籍 /// </summary> /// <param name="Title">标题</param> /// <param name="Author">作者</param> /// <param name="ClassID">类别ID</param> /// <param name="Intro">简介</param> /// <param name="Length">长度</param> protected void BookAdd(string Title, string Author, int ClassID, string Intro, long Length) { string ClassName = ObjectExtents.Class(ClassID).ClassName; DataEntities ent=new DataEntities(); Book b = new Book(); if (Title.IsNullOrEmpty() && (from l in ent.Book where l.Title==Title && l.Author==Author select l).Count()>0) { b.ID = int.MinValue; Response.Clear(); Response.Write(Voodoo.IO.XML.Serialize(b)); return; } b.Addtime = DateTime.UtcNow.AddHours(8); b.Author = Author; b.ClassID = ClassID; b.ClassName = ClassName; b.ClickCount = 0; b.CorpusID = 0; b.Enable = true; b.FaceImage = ""; b.Intro = Intro; b.IsFirstPost = false; b.IsVip = false; b.LastChapterID = 0; b.LastVipChapterID = 0; b.Length = Length; b.ReplyCount = 0; b.SaveCount = 0; b.Status = 0;//连载中 b.Title = Title; b.UpdateTime = DateTime.UtcNow.AddHours(8); b.VipUpdateTime = DateTime.UtcNow.AddHours(8); b.ZtID = 0; var books = (from l in ent.Book where l.Title == Title && l.Author == Author select l).ToList(); if (books.Count == 0) { ent.AddToBook(b); ent.SaveChanges(); } else { b = books.FirstOrDefault(); } ent.Dispose(); Response.Clear(); Response.Write(Voodoo.IO.XML.Serialize(b)); }
protected void Page_Load(object sender, EventArgs e) { string Title = WS.RequestString("title"); string Author = WS.RequestString("author"); DataEntities ent = new DataEntities(); Book book = (from l in ent.Book where l.Title == Title && l.Author == Author select l).FirstOrDefault(); ent.Dispose(); Response.Clear(); Response.Write(Voodoo.IO.XML.Serialize(book)); }
protected void LoadTree() { DataEntities ent = new DataEntities(); List<JobIndustry> lst = (from l in ent.JobIndustry select l).ToList(); ent.Dispose(); foreach (var j in lst.Where(p => p.ParentID == 0)) { Spe_Tree.Nodes.Add(GetNode(lst, j.ID)); } }
protected void Button1_Click(object sender, EventArgs e) { var ids = WS.RequestString("id").Split(',').ToList().ToInt64(); DataEntities ent = new DataEntities(); foreach (var id in ids) { var q = (from l in ent.AdGroup where l.ID == id select l).FirstOrDefault(); ent.DeleteObject(q); } ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("删除成功!", "List.aspx"); }
protected void btn_Save_pn_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); int id = PanelTree.SelectedNode.Value.ToInt32(); SysNavPanel pn = (from l in ent.SysNavPanel where l.ID == id select l).FirstOrDefault(); pn.Group = cbl_pn_group.GetValues(); pn.Icon = ddl_ph_icon.SelectedValue; pn.OrderIndex = txt_pn_orderindex.Text.ToInt32(); pn.Title = txt_pn_title.Text; ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("保存成功", "SysmenuManagement.aspx"); }
protected void btn_Del_Click(object sender, EventArgs e) { var ids = WS.RequestString("id").Split(',').ToList(); DataEntities ent = new DataEntities(); var qs = (from l in ent.InfoType where ids.IndexOf(l.id.ToS()) > 0 select l).ToList(); foreach (var q in qs) { ent.DeleteObject(q); } ent.SaveChanges(); ent.Dispose(); }
/// <summary> /// 新增Panel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Pn_new_Click(object sender, EventArgs e) { SysNavPanel pn = new SysNavPanel(); pn.Group = cbl_pn_group.GetValues(); pn.Icon = ddl_ph_icon.SelectedValue; pn.OrderIndex = txt_pn_orderindex.Text.ToInt32(); pn.Title = txt_pn_title.Text; DataEntities ent = new DataEntities(); ent.AddToSysNavPanel(pn); ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("新增成功", "SysmenuManagement.aspx"); }
protected void btn_Del_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); var ids = WS.RequestString("id").Split(',').ToList().Select(p => Convert.ToInt32(p)); ; var qs = from l in ent.TemplateVar where ids.Contains(l.ID) select l; foreach (var q in qs) { ent.DeleteObject(q); } ent.SaveChanges(); ent.Dispose(); BindList(); }