public Result SaveMessage() { Message msg = new Message(); msg.Chat = WS.RequestString("chat"); msg.Content = WS.RequestString("content"); msg.Email = WS.RequestString("email"); msg.MessageTime = DateTime.Now; msg.Tel = WS.RequestString("tel"); msg.Title = WS.RequestString("title"); msg.UserName = WS.RequestString("username"); if (msg.Content.IsNullOrEmpty()) { return new Result { Success=true }; } try { DataEntities ent = new DataEntities(); ent.AddToMessage(msg); ent.SaveChanges(); return new Result { Success = true }; } catch { return new Result { Success = false }; } }
protected void LoadInfo() { using (DataEntities ent = new DataEntities()) { switch (type) { case "kuaib": var kuaibUrl = //MovieUrlKuaibView.GetModelByID(id.ToS()); (from l in ent.MovieUrlKuaib where l.id == id select l).FirstOrDefault(); txt_BookTitle.Text = kuaibUrl.MovieTitle; txt_Title.Text = kuaibUrl.Title; txt_Url.Text = kuaibUrl.Url; movieID = kuaibUrl.MovieID.ToInt32(); break; case "baidu": var baiduUrl = //MovieUrlBaiduView.GetModelByID(id.ToS()); (from l in ent.MovieUrlBaidu where l.id == id select l).FirstOrDefault(); txt_BookTitle.Text = baiduUrl.MovieTitle; txt_Title.Text = baiduUrl.Title; txt_Url.Text = baiduUrl.Url; movieID = baiduUrl.MovieID.ToInt32(); break; case "mag": var magUrl = //MovieUrlMagView.GetModelByID(id.ToS()); (from l in ent.MovieUrlMag where l.id == id select l).FirstOrDefault(); txt_BookTitle.Text = magUrl.MovieTitle; txt_Title.Text = magUrl.Title; txt_Url.Text = magUrl.Url; movieID = magUrl.MovieID.ToInt32(); break; } } }
public void BindData() { DataEntities ent = new DataEntities(); var store = this.GridPanel1.GetStore(); var s = from l in ent.Message select l; if (s_UserName.Text.IsNullOrEmpty() == false){ s=s.Where(p=>p.UserName.Contains(s_UserName.Text)); } if (s_Email.Text.IsNullOrEmpty() == false){ s=s.Where(p=>p.Email.Contains(s_Email.Text)); } if (s_Tel.Text.IsNullOrEmpty() == false){ s=s.Where(p=>p.Tel.Contains(s_Tel.Text)); } if (s_Title.Text.IsNullOrEmpty() == false){ s=s.Where(p=>p.Title.Contains(s_Title.Text)); } if (s_Chat.Text.IsNullOrEmpty() == false){ s=s.Where(p=>p.Chat.Contains(s_Chat.Text)); } if (s_Content.Text.IsNullOrEmpty() == false){ s=s.Where(p=>p.Content.Contains(s_Content.Text)); } if (s_Key.Text.Length > 0) { s = from l in s where l.UserName.Contains(s_Key.Text) || l.Email.Contains(s_Key.Text) || l.Tel.Contains(s_Key.Text) || l.Title.Contains(s_Key.Text) || l.Chat.Contains(s_Key.Text) || l.Content.Contains(s_Key.Text) select l; } store.DataSource = s.OrderByDescending(p => p.ID).ToList(); store.DataBind(); }
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.JobResumeInfo where l.ID == id select l).FirstOrDefault(); var resumeCer=from l in ent.JobResumeCertificate where l.ResumeID==q.ID select l; var resumeEdu = from l in ent.JobResumeEdu where l.ResumeID == q.ID select l; var resumeExp = from l in ent.JobResumeExperience where l.ResumeID == q.ID select l; var resumeFile = from l in ent.JobResumeFile where l.ResumeID == q.ID select l; var resumeLan = from l in ent.JobResumeLanguage where l.ResumeID == q.ID select l; var resumeTrain = from l in ent.JobResumeTrain where l.ResumeID == q.ID select l; ent.DeleteObjects(resumeCer); ent.DeleteObjects(resumeEdu); ent.DeleteObjects(resumeExp); ent.DeleteObjects(resumeFile); ent.DeleteObjects(resumeLan); ent.DeleteObjects(resumeTrain); ent.DeleteObject(q); } ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("删除成功!", "List.aspx?uid="+WS.RequestInt("uid").ToS()); }
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"); }
protected void Page_Load(object sender, EventArgs e) { string ClassName=WS.RequestString("class"); int Model=WS.RequestInt("m",4); if (ClassName.Length == 0) { return; } Class cls = ClassAction.Classes.Where(p => p.ClassName == ClassName && p.ModelID == Model).FirstOrDefault(); if (cls.ID <= 0) { //cls.ClassForder = PinyinHelper.GetPinyin(ClassName); cls.ClassForder = ClassName; cls.ClassKeywords = ClassName; cls.ClassName = ClassName; cls.ModelID = Model; cls.IsLeafClass = true; cls.ModelID = Model; cls.ShowInNav = true; using (DataEntities ent = new DataEntities()) { ent.AddToClass(cls); ent.SaveChanges(); Voodoo.Cache.Cache.Clear("_NewClassList"); } } Response.Clear(); Response.Write(Voodoo.IO.XML.Serialize(cls)); }
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 btn_createPage_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); string[] ids = WS.RequestString("id").Split(','); foreach (string id in ids) { int int_id = id.ToInt32(); News n = //NewsView.GetModelByID(id); (from l in ent.News where l.ID == int_id select l).FirstOrDefault(); CreatePage.CreateContentPage(n, n.GetClass()); News news_pre = GetPreNews(n, n.GetClass()); if (news_pre != null) { CreatePage.CreateContentPage(news_pre, n.GetClass()); } } if (cls > 0) { try { CreatePage.CreateListPage(ObjectExtents.Class(cls), 1); } catch { } } CreatePage.GreateIndexPage(); Js.Jump(url); }
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 = 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 Button1_Click(object sender, EventArgs e) { var ids = WS.RequestString("id").Split(',').ToList(); DataEntities ent = new DataEntities(); switch (type) { case "kuaib": var qs = from l in ent.MovieUrlKuaib where ids.IndexOf(l.id.ToString()) > 0 select l; foreach (var q in qs) { ent.DeleteObject(q); } break; case "baidu": var bs = from l in ent.MovieUrlBaidu where ids.IndexOf(l.id.ToString()) > 0 select l; foreach (var q in bs) { ent.DeleteObject(q); } break; case "mag": var ms = from l in ent.MovieUrlMag where ids.IndexOf(l.id.ToString()) > 0 select l; foreach (var q in ms) { ent.DeleteObject(q); } break; } ent.SaveChanges(); ent.Dispose(); Response.Redirect(string.Format("UrlList.aspx?bookid={0}", id)); }
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 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 GetReadHistory() { string chapters = ""; if (Voodoo.Cookies.Cookies.GetCookie("history") != null) { chapters = Voodoo.Cookies.Cookies.GetCookie("history").Value; } string[] cs = chapters.Split(','); List<Cook> cookie = new List<Cook>(); string ids = ""; foreach (string chapter in cs) { string[] Arr_chapter = chapter.Split('|'); cookie.Add(new Cook() { id = Arr_chapter[0].ToInt64(), time = Arr_chapter[1].ToDateTime() }); ids += Arr_chapter[0] + ","; } ids = ids.TrimEnd(','); var id=ids.Split(',').ToList(); DataEntities ent=new DataEntities(); ReadingChapters = //BookChapterView.GetModelList(string.Format("id in({0})", ids));. (from l in ent.BookChapter where id.IndexOf(l.ID.ToString()) > 0 select l).ToList(); }
public List<Book> BookSearch(string str_sql) { using (DataEntities ent = new DataEntities()) { return ent.CreateQuery<Book>(string.Format("select * from Book where {0}",str_sql)).ToList(); } }
public Voodoo.Basement.Book GetByID(int? id) { using (DataEntities ent = new DataEntities()) { return (from l in ent.Book where l.ID == id select l).FirstOrDefault(); } }
public bool BookExist(string str_sql) { using (DataEntities ent = new DataEntities()) { return ent.CreateQuery<Book>(string.Format("select * from Book where {0}", str_sql)).Count()>0; } }
public Book BookFind(string str_sql) { using (DataEntities ent = new DataEntities()) { return ent.CreateQuery<Book>(string.Format("select * from Book where {0}", str_sql)).FirstOrDefault(); } }
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 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"); }
/// <summary> /// 根据id获取用户 /// </summary> /// <param name="id"></param> /// <returns></returns> public static User GetUserByID(int id) { using (DataEntities ent = new DataEntities()) { return (from l in ent.User where l.ID == id select l).FirstOrDefault(); } }
protected void BindData() { using (DataEntities ent = new DataEntities()) { rp_list.DataSource = from l in ent.UserForm select l; rp_list.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { using (DataEntities ent = new DataEntities()) { DataList1.DataSource = from l in ent.File select l ; DataList1.DataBind(); } }
protected void BindList() { using (DataEntities ent = new DataEntities()) { rp_list.DataSource = from l in ent.Link select l; rp_list.DataBind(); } }
/// <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) { 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(); }