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)); }
protected void btn_Save_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); var books = (from l in ent.Book where l.ID == id select l).ToList(); Voodoo.Basement.Book book = new Voodoo.Basement.Book(); if (books.Count > 0) { book = books.FirstOrDefault(); } book.Title = txt_Title.Text; book.Author = txt_Author.Text; book.ClassID = ddl_CLass.SelectedValue.ToInt32(); book.ClassName = ddl_CLass.SelectedItem.Text; book.ClickCount = txt_ClickCount.Text.ToInt32(); book.CorpusID = 0; book.CorpusTitle = ""; book.Enable = chk_Enable.Checked; //book.FaceImage= book.Intro = txt_Intro.Text; book.IsFirstPost = chk_IsFirstpost.Checked; book.IsVip = chk_IsVip.Checked; book.Length = txt_Length.Text.ToInt32(); book.ReplyCount = txt_Replycount.Text.ToInt32(); book.SaveCount = txt_SaveCount.Text.ToInt32(); book.Status = ddl_Status.SelectedValue.ToByte(); book.TjCount = txt_TjCount.Text.ToInt32(); book.ZtID = 0; book.ZtName = ""; if (books.Count == 0) { book.Addtime = DateTime.UtcNow.AddHours(8); book.UpdateTime = DateTime.UtcNow.AddHours(8); book.VipUpdateTime = DateTime.UtcNow.AddHours(8); ent.AddToBook(book); ent.SaveChanges(); } //Deal Book face image if (file_Bookfacefile.FileName.IsNullOrEmpty() == false) { file_Bookfacefile.SaveAs(Server.MapPath("/Book/BookFace/" + book.ID + ".jpg")); book.FaceImage = "/Book/BookFace/" + book.ID + ".jpg"; ent.SaveChanges(); } CreatePage.CreateContentPage(book, book.GetClass()); Response.Redirect("BookList.aspx?class=" + cls.ToS()); }
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 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 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"); }
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 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 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 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 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); }
/// <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); }
public Book BookInsert(Book book) { using (DataEntities ent = new DataEntities()) { ent.AddToBook(book); ent.SaveChanges(); return book; } }
public void BookUpdate(Book book) { using (DataEntities ent = new DataEntities()) { var b = (from l in ent.Book where l.ID == book.ID select l).FirstOrDefault(); b = book; ent.SaveChanges(); } }
protected void btn_Save_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); long id = WS.RequestLong("id"); JobResumeInfo r = (from l in ent.JobResumeInfo where l.UserID == UserAction.opuser.ID select l).FirstOrDefault(); r.ChineseName = txt_ChineseName.Text; r.Birthday = new DateTime(ddl_Year.SelectedValue.ToInt32(), ddl_Month.SelectedValue.ToInt32(), ddl_Day.SelectedValue.ToInt32()); r.IsMale = ckl_sex.SelectedValue == "1"; r.Province = ddl_Province.SelectedValue.ToInt32(); r.City = ddl_City.SelectedValue.ToInt32(); r.WorkPlace = ddl_CityWork.SelectedValue.ToInt32(); r.Mobile = txt_Mobile.Text; r.Email = txt_Email.Text; r.IsResumeOpen = ckl_Enable.SelectedValue == "1"; r.Keywords = txt_Keywords.Text; if (r.ID <= 0) { ent.AddToJobResumeInfo(r); } ent.SaveChanges(); if (file_Face.HasFile) { string path = string.Format("/u/ResumeFace/{0}.jpg", r.ID.ToS()); var result = BasePage.UpLoadImage(file_Face.PostedFile, path, 96, 96); if (result.Success) { r.Image = path; } ent.SaveChanges(); } ent.Dispose(); Js.AlertAndChangUrl("保存成功!", "Home.aspx"); }
protected void LoadInfo() { id = WS.RequestLong("id"); if (id < 0) { return; } DataEntities ent = new DataEntities(); if (u.ID > 0) { ViewHistory his = new ViewHistory(); try { his = (from l in ent.ViewHistory where l.ItemID == id && l.UserID == u.ID && l.ModelID==5 select l).First(); } catch { } his.ViewTime = DateTime.Now; his.ModelID = 5; his.ItemID = id; his.UserID = u.ID; if (his.ID <= 0) { ent.AddToViewHistory(his); } ent.SaveChanges(); } var j = (from l in ent.JobPost where l.ID == id select l).FirstOrDefault(); var c = (from l in ent.JobCompany where l.ID == j.CompanyID select l).FirstOrDefault(); Title=j.Title; CompanyID = c.ID; CompanyName=c.CompanyName; PostTime=j.PostTime.ToDateTime().ToString("yyyy-MM-dd"); Province = JobAction.GetProviceName(j.Province.ToInt32()); City = JobAction.GetCityName(j.City.ToInt32()); Exp = JobAction.GetExpressionsName(j.Expressions.ToInt32()); Salary = JobAction.GetSalaryDegreeName(j.Salary.ToInt32()); Edu = j.GetPostEdu(); //JobAction.GetEduName(j.Edu.ToInt32()); EmpCount = j.GetPostEduAndNumber(); //j.EmployNumber == 0 ? "若干" : j.EmployNumber.ToS(); Intro = j.Intro; CompIntro = c.Intro; JobAction.AddCityHot(j.City.ToInt32()); RelaJobs = Functions.getpostlist("5", "0", string.Format("t.Title='{0}' and t.Id!={1}",j.Title,j.ID), "t.id desc", "<tr><td height=\"80\"style=\"border-bottom: 1px solid #eeeeee\"><table width=\"810\"align=\"center\"border=\"0\"cellspacing=\"0\"cellpadding=\"0\"><tr><td align=\"left\"><table width=\"680\"border=\"0\"cellspacing=\"0\"cellpadding=\"0\"align=\"left\"><tr><td align=\"left\"class=\"job_title\"><a href=\"Job.aspx?id={id}\">{title}</a></td></tr><tr><td align=\"left\"><table width=\"610\"border=\"0\"cellspacing=\"0\"cellpadding=\"0\"><tr><td align=\"left\"class=\"job_compangy\"><a href=\"Company.aspx?id={companyid}\">{companyname}</a></td><td align=\"left\"class=\"job_qt\">规模{employeecount}/学历{edu}/经验{expressions}</td><td align=\"left\"class=\"job_qt1\">月薪<span>{salary}</span></td></tr></table></td></tr></table></td><td width=\"100\"align=\"center\"style=\"line-height: 24px; color: #666666\"><input type=\"button\"onclick=\"post({id})\"value=\"一键投递\"style=\"background: url(/skin/job/img/td.gif) no-repeat; width: 60px;height: 22px; color: #FFFFFF; border: 0px;\"/><br/>{posttime}</td></tr></table></td></tr>"); }
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); }
/// <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 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(); }
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(); }
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"); }
/// <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_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_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) { long id = WS.RequestLong("id"); using (DataEntities ent = new DataEntities()) { Voodoo.Basement.Ad ad = new Voodoo.Basement.Ad(); try { ad = (from l in ent.Ad where l.ID == id select l).First(); } catch { } ad.GroupID = ddl_Group.SelectedValue.ToInt32(); ad.Title = txt_Title.Text; ad.Url = txt_Url.Text; var adgroup = (from l in ent.AdGroup where l.ID == ad.GroupID select l).FirstOrDefault(); ad.width = adgroup.width; ad.height = adgroup.height; if (ad.ID <= 0) { ent.AddToAd(ad); } ent.SaveChanges(); if (FileUpload1.HasFile) { string fileName = string.Format("/u/Ad/{0}.jpg", ad.ID.ToS()); BasePage.UpLoadImage(FileUpload1.PostedFile, fileName, ad.width.ToInt32(), ad.height.ToInt32()); ad.Image = fileName; ent.SaveChanges(); } } Js.AlertAndChangUrl("保存成功!", "List.aspx"); }
/// <summary> /// 删除 /// </summary> /// <param name="ids"></param> protected void Delete(string ids) { DataEntities ent = new DataEntities(); var id = ids.Split(',').ToList(); var qs = from l in ent.SysUser where id.IndexOf(l.ID.ToString()) > 0 select l; foreach (var q in qs) { ent.DeleteObject(q); } ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("删除成功!", "SysUserList.aspx"); }
/// <summary> /// 停用 /// </summary> /// <param name="ids"></param> protected void Disable(string ids) { DataEntities ent = new DataEntities(); var id = ids.Split(',').ToList(); var qs = from l in ent.SysUser where id.IndexOf(l.ID.ToString()) > 0 select l; foreach (var q in qs) { q.Enabled = false; } ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("操作成功!", "List.aspx"); }
protected void LoadInfo() { User u = UserAction.opuser; if (u.ID < 0) { Js.AlertAndChangUrl("您还没有登录,请登录或注册后进入简历管理!", "/"); } DataEntities ent = new DataEntities(); JobResumeInfo r = new JobResumeInfo(); try { r = (from l in ent.JobResumeInfo where l.UserID == u.ID select l).First(); } catch { r.UserID = u.ID; r.IsResumeOpen = true; r.Image = "/u/ResumeFace/0.jpg"; r.Title = u.UserName + "的简历"; ent.AddToJobResumeInfo(r); ent.SaveChanges(); } var file = u.DefaultResumeFile(); if (u.ID > 0) { file_resume = string.Format("<a href='{0}' target='_blank'>{1}</a>", file.FilePath, file.FileName); } else { file_resume = "还没有上传简历"; } txt_ChineseName.Text = r.ChineseName; txt_Sex.Text=r.IsMale==true?"男":"女"; txt_LivePlace.Text=JobAction.GetProviceName(r.Province.ToInt32())+"-"+JobAction.GetCityName(r.City.ToInt32()); txt_Mobile.Text = r.Mobile; txt_Email.Text = r.Email; txt_WorkPlace.Text = JobAction.GetCityName(r.WorkPlace.ToInt32()); txt_Birth.Text = r.Birthday.ToDateTime().ToString("yyyy年MM月dd日"); ResumeOpen = r.IsResumeOpen == true ? "简历完全开放" : "简历关闭"; Image = r.Image; }
/// <summary> /// 设置阅读记录 /// </summary> /// <param name="id"></param> protected void ProcessHistory(long id) { DataEntities ent = new DataEntities(); try { long chapterid = id; BookChapter bc = (from l in ent.BookChapter where l.ID == id select l).FirstOrDefault(); bc.ClickCount = bc.ClickCount > 0 ? bc.ClickCount + 1 : 1; ent.SaveChanges(); //写入Cookie List<Cook> cookies = new List<Cook>(); if (Voodoo.Cookies.Cookies.GetCookie("history") != null) { string[] chapters = Voodoo.Cookies.Cookies.GetCookie("history").Value.Split(','); foreach (string chapter in chapters) { string[] arr_chapter = chapter.Split('|'); cookies.Add(new Cook() { id = arr_chapter[0].ToInt64(), time = arr_chapter[1].ToDateTime(), bookid = arr_chapter[2].ToInt32() }); } } cookies = cookies.Where(p => p.bookid != bc.BookID).OrderByDescending(p => p.time).Take(4).ToList(); cookies.Add(new Cook() { id = chapterid, time = DateTime.Now, bookid = bc.BookID }); StringBuilder sb = new StringBuilder(); foreach (Cook c in cookies) { sb.Append(string.Format("{0}|{1}|{2},", c.id, c.time.ToString(), c.bookid.ToS())); } sb = sb.TrimEnd(','); HttpCookie _cookie = new HttpCookie("history", sb.ToString()); _cookie.Expires = DateTime.Now.AddYears(1); Voodoo.Cookies.Cookies.SetCookie(_cookie); }//end try catch { Voodoo.Cookies.Cookies.Remove("history"); } finally { ent.Dispose(); } }
protected void Page_Load(object sender, EventArgs e) { if (u.ID < 0) { Js.AlertAndChangUrl("您还没有登录,请登录或注册后进入简历管理!", "/"); } DataEntities ent = new DataEntities(); JobResumeInfo r = new JobResumeInfo(); try { r = (from l in ent.JobResumeInfo where l.UserID == u.ID select l).First(); } catch { r.UserID = u.ID; r.IsResumeOpen = true; r.Image = "/u/ResumeFace/0.jpg"; r.Title = u.UserName + "的简历"; ent.AddToJobResumeInfo(r); ent.SaveChanges(); } ResumeOpen = r.IsResumeOpen == true ? "简历完全开放" : "简历关闭"; Image = r.Image; var list = from l in ent.JobApplicationRecord from com in ent.JobCompany from p in ent.JobPost where l.UserID == u.ID && l.CompanyID == com.ID && l.PostID == p.ID select new { l.ID, l.CompanyID, com.CompanyName, Pid=p.ID, p.Title, l.ApplicationTime }; pager.RecordCount = list.Count(); count = pager.RecordCount.ToS(); int page=WS.RequestInt("page",1); rp_lis.DataSource = list.OrderByDescending(p => p.ApplicationTime).Skip((page - 1) * pager.PageSize).Take(pager.PageSize); rp_lis.DataBind(); }