protected void Page_Load(object sender, EventArgs e) { User u = UserAction.opuser; if (u.ID <= 0) { Js.AlertAndChangUrl("对不起,您没有登录,请登陆后进行投稿!", "/"); return; } UserGroup g = UserGroupView.GetModelByID(u.Group.ToS()); if (g.MaxPost <= 0) { Js.AlertAndGoback("对不起,您没有投稿的权限!如有疑问,请联系管理员"); return; } lb_UserName.Text = u.UserName; txt_Author.Text = u.UserName; if (!IsPostBack) { var cls = NewsAction.NewsClass; cls = cls.Where(p => p.EnablePost && p.IsLeafClass && p.ModelID == 1).ToList(); ddl_Class.DataSource = cls; ddl_Class.DataTextField = "ClassName"; ddl_Class.DataValueField = "id"; ddl_Class.DataBind(); } LoadInfo(); }
protected void LoadInfo() { int id = WS.RequestInt("id"); if (id < 0) { return; } News n = NewsView.GetModelByID(id.ToS()); if (n.ID < 0) { Js.Jump("?"); return; } if (n.AutorID != UserAction.opuser.ID) { Js.AlertAndChangUrl("这不是您投递的文章,无权修改", "PostList.aspx"); return; } ddl_Class.SelectedValue = n.ClassID.ToS(); txt_Title.Text = n.Title; txtFtitle.Text = n.FTitle; txt_Keyword.Text = n.KeyWords; txt_Description.Text = n.Description; txt_Author.Text = n.Author; txt_Source.Text = n.Source; txt_Content.Text = n.Content; }
/// <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="sender"></param> /// <param name="e"></param> protected void btn_Save_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); long id = WS.RequestLong("id"); JobResumeInfo r = new JobResumeInfo(); if (id > 0) { r = (from l in ent.JobResumeInfo where l.ID == id select l).FirstOrDefault(); } r.Title = txt_Title.Text; r.UserID = ddl_User.SelectedValue.ToInt32(); r.ChineseName = txt_ChineseName.Text; r.Birthday = txt_Birthday.Text.ToDateTime(); 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.Address = txt_Address.Text; r.Tel = txt_Tel.Text; r.Marriage = ddl_Marriage.SelectedValue.ToInt32(); r.Mobile = txt_Mobile.Text; r.Email = txt_Email.Text; r.Country = txt_Country.Text; r.CardType = ddl_CardType.SelectedValue.ToInt32(); r.CardNumber = txt_CardNo.Text; r.HomeCity = ddl_CityHome.SelectedValue.ToInt32(); r.Nation = ddl_Nation.SelectedValue; r.Political = ddl_Political.SelectedValue.ToInt32(); r.QQ = txt_QQ.Text; r.MSN = txt_MSN.Text; r.Intro = txt_Intro.Text; r.IsResumeOpen = chk_Enable.Checked; 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("保存成功!", "List.aspx"); }
protected void btn_Save_Click(object sender, EventArgs e) { int id = WS.RequestInt("id"); Class cls = ClassView.GetModelByID(id.ToString()); cls.ClassName = txt_ClassName.Text; cls.Alter = txt_Alter.Text; if (cls.Alter.IsNullOrEmpty()) { cls.Alter = txt_ClassName.Text; } cls.ParentID = lbox_ParentID.SelectedValue.ToInt32(); cls.IsLeafClass = chk_IsLeafClass.Checked; cls.ParentClassForder = txt_ParentClassForder.Text; cls.ClassForder = txt_ClassForder.Text; cls.ModelID = ddl_ModelID.SelectedValue.ToInt32(); cls.ClassICON = txt_ClassICON.Text; cls.ClassKeywords = txt_ClassKeywords.Text; cls.ClassDescription = txt_ClassDescription.Text; cls.ShowInNav = chk_ShowInNav.Checked; cls.EnablePost = chk_EnablePost.Checked; cls.NavIndex = txt_NavIndex.Text.ToInt32(); cls.VisitRole = cbl_VisitRole.GetValues(); //--cbl_VisitRole.SetValue(cls.VisitRole.Split(',')); cls.PostRoles = cbl_PostRoles.GetValues(); //--cbl_PostRoles.SetValue(cls.PostRoles.Split(',')); cls.PostcreateList = ddl_PostcreateList.SelectedValue.ToInt32(); cls.PostAddCent = txt_PostAddCent.Text.ToInt32(); cls.PostManagement = ddl_PostManagement.SelectedValue.ToInt32(); cls.EditcreateList = ddl_EditcreateList.SelectedValue.ToInt32(); cls.AutoAudt = chk_AutoAudt.Checked; cls.EnableReply = chk_EnableReply.Checked; cls.ReplyNeedAudit = chk_ReplyNeedAudit.Checked; cls.ModelID = ddl_ModelID.SelectedValue.ToInt32(); if (cls.ID > 0) { ClassView.Update(cls); } else { ClassView.Insert(cls); } Voodoo.Cache.Cache.Clear("_NewClassList"); Js.AlertAndChangUrl("保存成功!", "ClassList.aspx"); }
protected void LoadInfo() { DataEntities ent = new DataEntities(); if (u.ID < 0) { Js.AlertAndChangUrl("您还没有登录,请登录或注册后进入简历管理!", "/"); } 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; long id = WS.RequestLong("id"); var q = (from l in ent.JobResumeEdu where l.ID == id select l).FirstOrDefault(); if (WS.RequestString("action") == "edit") { lb_edu_id.Text = q.ID.ToS(); txt_Edu_SchoolName.Text = q.SchoolName; ddl_edu_StartTime_Year.Text = q.StartTime.ToDateTime().Year.ToS(); ddl_edu_StartTime_Month.Text = q.StartTime.ToDateTime().Month.ToS(); ddl_edu_LeftTime_Year.Text = q.LeftTime.ToDateTime().Year.ToS(); ddl_edu_LeftTime_Month.Text = q.LeftTime.ToDateTime().Month.ToS(); ddl_edu_Edu.SetValue(q.Edu.ToS()); ddl_edu_Specialty.SetValue(q.Specialty.ToS()); txt_edu_Intro.Text = q.Intro; } else if (WS.RequestString("action") == "del" && q != null) { ent.DeleteObject(q); ent.SaveChanges(); Response.Redirect("ResumeEdu.aspx"); } var list = from l in ent.JobResumeEdu where l.ResumeID == r.ID select l; rp_listEdu.DataSource = list; rp_listEdu.DataBind(); ent.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { try { QQLogin(); } catch { Js.AlertAndChangUrl("登录过程出现异常,请重新登录!", "/e/OAuth/QQlogin/"); } }
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; }
protected void Button1_Click(object sender, EventArgs e) { string ids = WS.RequestString("id"); GetHelper().ExecuteNonQuery(CommandType.Text, string.Format("delete from news where id in({0})", ids)); if (cls > 0) { CreatePage.CreateListPage(ClassView.GetModelByID(cls.ToS()), 1); } CreatePage.GreateIndexPage(); Js.AlertAndChangUrl("删除成功!", url); }
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 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 != null && file.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; ckl_sex.SetValue(r.IsMale == true ? "1" : "0"); ddl_Province.SetValue(r.Province.ToS()); ddl_City.SetValue(r.City.ToS()); txt_Mobile.Text = r.Mobile; txt_Email.Text = r.Email; ddl_CityWork.ForceSetValue(r.WorkPlace.ToS(), ""); ckl_Enable.SetValue(r.IsResumeOpen == true ? "1" : "0"); ddl_Year.SetValue(r.Birthday.ToDateTime().Year.ToString()); ddl_Month.SetValue(r.Birthday.ToDateTime().Month.ToString()); ddl_Day.SetValue(r.Birthday.ToDateTime().Day.ToString()); txt_Keywords.Text = r.Keywords; ResumeOpen = r.IsResumeOpen == true ? "简历完全开放" : "简历关闭"; Image = r.Image; }
/// <summary> /// 保存资料 /// </summary> protected void SaveInfo() { SysUser su = SysUserAction.LocalUser; DataEntities ent = new DataEntities(); int id = WS.RequestInt("id"); SysUser user = new SysUser(); if (id > 0) { user = (from l in ent.SysUser where l.ID == id select l).FirstOrDefault(); } else if (txt_Password.Text.Length == 0) { Js.AlertAndGoback("新增用户时,密码不能为空"); } user.UserName = txt_UserName.Text; if (txt_Password.Text.Length > 0) { user.UserPass = Voodoo.Security.Encrypt.Md5(txt_Password.Text); } user.Email = txt_Email.Text; user.TelNumber = txt_TelNumber.Text; user.Department = su.Department; user.UserGroup = su.UserGroup; user.ChineseName = txt_ChineseName.Text; user.Enabled = chk_Enable.Checked; if (id <= 0) { user.LastLoginTime = DateTime.Now; user.LastLoginIP = WS.GetIP(); Result r = SysUserAction.UserAdd(user); if (r.Success) { Js.AlertAndChangUrl(r.Text, "List.aspx"); } else { Js.AlertAndGoback(r.Text); } } else { ent.SaveChanges(); Js.AlertAndChangUrl("修改成功!", "List.aspx"); } ent.Dispose(); }
protected void Button1_Click(object sender, EventArgs e) { string ids = WS.RequestString("id"); ImageAction.DeleteImageAlbum(string.Format("id in ({0})", ids)); if (cls > 0) { CreatePage.CreateListPage(ClassView.GetModelByID(cls.ToS()), 1); } CreatePage.GreateIndexPage(); Js.AlertAndChangUrl("删除成功!", url); }
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> /// 保存资料 /// </summary> protected void SaveInfo() { SysUser user = new SysUser(); if (WS.RequestInt("id") > 0) { user = SysUserView.GetModelByID(WS.RequestInt("id").ToString()); } else if (txt_Password.Text.Length == 0) { Js.AlertAndGoback("新增用户时,密码不能为空"); } user.UserName = txt_UserName.Text; if (txt_Password.Text.Length > 0) { user.UserPass = Voodoo.Security.Encrypt.Md5(txt_Password.Text); } user.SafeQuestion = ddl_Question.SelectedValue; user.SafeAnswer = txt_Answer.Text; user.Email = txt_Email.Text; user.TelNumber = txt_TelNumber.Text; user.Department = ddl_Department.SelectedValue.ToInt32(); user.UserGroup = ddl_Group.SelectedValue.ToInt32(); user.ChineseName = txt_ChineseName.Text; user.Enabled = chk_Enable.Checked; if (WS.RequestInt("id") > 0) { //修改 SysUserView.Update(user); Js.AlertAndChangUrl("修改成功!", "SysUserList.aspx"); } else { user.LastLoginTime = DateTime.Now; user.LastLoginIP = WS.GetIP(); Result r = SysUserAction.UserAdd(user); if (r.Success) { Js.AlertAndChangUrl(r.Text, "SysUserList.aspx"); } else { Js.AlertAndGoback(r.Text); } } }
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 Page_Load(object sender, EventArgs e) { User u = UserAction.opuser; if (u.ID <= 0) { Js.AlertAndGoback("对不起,您没有登录,请登录后回答!"); return; } int qid = WS.RequestInt("qid"); string content = WS.RequestString("content"); if (qid <= 0) { Js.AlertAndGoback("对不起,参数错误,如有疑问,请联系管理员!"); return; } Class cls = QuestionView.GetModelByID(qid.ToS()).GetClass(); if (UserAction.HasPostRight(cls.ID) == false) { Js.AlertAndGoback("对不起,对于本栏目您没有回答权限,如有疑问,请联系管理员!"); return; } Answer a = new Answer(); a.Agree = 0; a.AnswerTime = DateTime.Now; a.Content = content; a.QuestionID = qid; a.UserID = u.ID; a.UserName = u.UserName; AnswerView.Insert(a); Question q = QuestionView.GetModelByID(a.QuestionID.ToS()); CreatePage.CreateContentPage(q, q.GetClass());//创建内容页 string url = BasePage.GetQuestionUrl(q, q.GetClass()); Js.AlertAndChangUrl("回答成功!", url); }
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(); }
/// <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"); }
/// <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("删除成功!", "List.aspx"); }
/// <summary> /// 启用 /// </summary> /// <param name="ids"></param> protected void Enable(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 = true; } ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("操作成功!", "SysUserList.aspx"); }
protected void Page_Load(object sender, EventArgs e) { DataEntities ent = new DataEntities(); User u = UserAction.opuser; if (u.ID <= 0) { Js.AlertAndGoback("对不起,您没有登录,请登录后回答!"); return; } int qid = WS.RequestInt("qid"); string content = WS.RequestString("content"); if (qid <= 0) { Js.AlertAndGoback("对不起,参数错误,如有疑问,请联系管理员!"); return; } Question q = (from l in ent.Question where l.ID == qid select l).FirstOrDefault(); Class cls = q.GetClass(); if (UserAction.HasPostRight(cls.ID) == false) { Js.AlertAndGoback("对不起,对于本栏目您没有回答权限,如有疑问,请联系管理员!"); return; } Answer a = new Answer(); a.Agree = 0; a.AnswerTime = DateTime.Now; a.Content = content; a.QuestionID = qid; a.UserID = u.ID; a.UserName = u.UserName; ent.AddToAnswer(a); CreatePage.CreateContentPage(q, q.GetClass());//创建内容页 ent.Dispose(); string url = BasePage.GetQuestionUrl(q, q.GetClass()); Js.AlertAndChangUrl("回答成功!", url); }
protected void btn_enable_Click(object sender, EventArgs e) { enable = WS.RequestInt("enable", -1); group = WS.RequestInt("group", -1); url = string.Format("UserList.aspx?ebable={0}&group={1}", enable.ToString(), group.ToString()); string ids = WS.RequestString("id"); if (ids.IsNullOrEmpty()) { Js.AlertAndGoback("您没有选择任何项"); return; } GetHelper().ExecuteNonQuery(CommandType.Text, string.Format("update [User] set Enable=1 where id in({0})", ids)); Js.AlertAndChangUrl("设置成功!", url); }
protected void Button1_Click(object sender, EventArgs e) { enable = WS.RequestInt("enable", -1); group = WS.RequestInt("group", -1); url = string.Format("UserList.aspx?ebable={0}&group={1}", enable.ToString(), group.ToString()); //删除 string ids = WS.RequestString("id"); if (ids.IsNullOrEmpty()) { Js.AlertAndGoback("您没有选择任何项"); return; } UserView.Del(string.Format("id in {0}", ids)); Js.AlertAndChangUrl("删除成功!", url); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Save_Click(object sender, EventArgs e) { Class cls = ClassView.GetModelByID(ddl_Class.SelectedValue); Question qu = QuestionView.GetModelByID(WS.RequestString("id")); qu.ClassID = ddl_Class.SelectedValue.ToInt32(); qu.Title = txt_Title.Text.TrimDbDangerousChar(); qu.UserID = ddl_Author.SelectedValue.ToInt32(); qu.UserName = ddl_Author.SelectedItem.Text; 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) { QuestionView.Update(qu); } else { QuestionView.Insert(qu); } //生成页面 CreatePage.CreateContentPage(qu, cls); Question pre = GetPreQuestion(qu, cls); if (pre != null) { CreatePage.CreateContentPage(pre, cls); } CreatePage.CreateListPage(cls, 1); Js.AlertAndChangUrl("保存成功!", url); }
protected void Button1_Click(object sender, EventArgs e) { string ids = WS.RequestString("id"); #region 除目录 List <Voodoo.Model.Book> books = BookView.GetModelList(string.Format("id in ({0})", ids)); foreach (var book in books) { BookChapter firstChapter = BookChapterView.Find(string.Format("BookID={0}", book.ID.ToS())); DirectoryInfo dir = new FileInfo( Server.MapPath( GetBookUrl( book, BookView.GetClass(book) ) ) ).Directory; if (dir.Exists) { dir.Delete(true); } DirectoryInfo dirTxt = new FileInfo( Server.MapPath( GetBookChapterTxtUrl(firstChapter, BookView.GetClass(book)) ) ).Directory; if (dirTxt.Exists) { dirTxt.Delete(true); } } #endregion 除目录 GetHelper().ExecuteNonQuery(CommandType.Text, string.Format("delete from Book where id in({0}); delete from BookChapter where BookId in({0})", ids)); if (cls > 0) { CreatePage.CreateListPage(ClassView.GetModelByID(cls.ToS()), 1); } CreatePage.GreateIndexPage(); Js.AlertAndChangUrl("删除成功!", url); }
protected void Button1_Click(object sender, EventArgs e) { var ids = WS.RequestString("id").Split(',').ToList(); DataEntities ent = new DataEntities(); #region 除目录 List <Voodoo.Basement.Book> books = (from l in ent.Book where ids.IndexOf(l.ID.ToString()) > 0 select l).ToList(); foreach (var book in books) { Voodoo.Basement.BookChapter firstChapter = (from l in ent.BookChapter where l.BookID == book.ID select l).FirstOrDefault(); DirectoryInfo dir = new FileInfo( Server.MapPath( GetBookUrl( book, book.GetClass() ) ) ).Directory; if (dir.Exists) { dir.Delete(true); } DirectoryInfo dirTxt = new FileInfo( Server.MapPath( GetBookChapterTxtUrl(firstChapter, book.GetClass()) ) ).Directory; if (dirTxt.Exists) { dirTxt.Delete(true); } } #endregion 除目录 GetHelper().ExecuteNonQuery(CommandType.Text, string.Format("delete from Book where id in({0}); delete from BookChapter where BookId in({0})", ids)); if (cls > 0) { CreatePage.CreateListPage(ObjectExtents.Class(cls), 1); } CreatePage.GreateIndexPage(); Js.AlertAndChangUrl("删除成功!", url); }
protected void btn_createPage_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); string ids = WS.RequestString("id"); var qus = ent.CreateQuery <Question>(string.Format("select * from Question where id in ({0})", ids)).ToList(); foreach (var qu in qus) { CreatePage.CreateContentPage(qu, qu.GetClass()); } CreatePage.CreateListPage(ObjectExtents.Class(cls), 1); Js.AlertAndChangUrl("生成成功!", url); }
protected void btn_Save_Click(object sender, EventArgs e) { DataEntities ent = new DataEntities(); int id = WS.RequestInt("id"); UserForm f = (from l in ent.UserForm where l.ID == id select l).FirstOrDefault(); f.FormName = txt_FormName.Text; f.Content = txt_Content.Text.TrimDbDangerousChar(); if (f.ID <= 0) { ent.AddToUserForm(f); } ent.SaveChanges(); ent.Dispose(); Js.AlertAndChangUrl("保存成功!", "UserFormList.aspx"); }
protected void btn_createPage_Click(object sender, EventArgs e) { string ids = WS.RequestString("id"); var qus = QuestionView.GetModelList(string.Format("id in ({0})", ids)); foreach (var qu in qus) { CreatePage.CreateContentPage(qu, qu.GetClass()); } Class cls = ClassView.GetModelByID(WS.RequestString("class")); if (cls.ID > 0) { CreatePage.CreateListPage(cls, 1); } Js.AlertAndChangUrl("生成成功!", url); }