/// <summary> /// 保存顺序 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OrderBy_Click(object sender, EventArgs e) { for (int i = 0; i < this.RP_con.Items.Count; i++) { FNews fnews = new FNews(); string id = ((RP_con.Items[i].FindControl("HiddenField_")) as HiddenField).Value; string orderby = ((RP_con.Items[i].FindControl("txtOrderBy")) as TextBox).Text; if (SITED.COMMON.PageValidate.IsNumber(orderby)) { SITED.NEWS.Model.ENEWS eNews = fnews.GetDAL().GetModel(Convert.ToInt32(id)); eNews.OrderBy = orderby; fnews.GetDAL().Update(eNews); } } Jscript.RedirectToFrames("Admin_News.aspx"); }
/// <summary> /// 切换新闻类型 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void DD_Type_SelectedIndexChanged(object sender, EventArgs e) { FNews fnews = new FNews(); string sql = " [Language]= '" + DL_lang.SelectedValue + "'"; if (DD_Type.SelectedValue != "0") { sql += " and News_Type =" + DD_Type.SelectedValue; } RP_con.DataSource = fnews.GetDAL().GetList(sql); RP_con.DataBind(); }
/// <summary> /// 删除所选 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LB_Del_Click(object sender, EventArgs e) { FNews fnews = new FNews(); string sb = string.Empty; for (int i = 0; i < this.RP_con.Items.Count; i++) { CheckBox cb = (RP_con.Items[i].FindControl("CheckBox1_")) as CheckBox; if (cb.Checked == true) { string cid = ((RP_con.Items[i].FindControl("HiddenField_")) as HiddenField).Value; sb += cid + ","; } } fnews.GetDAL().DeleteMuli(sb); Jscript.RedirectToFrames("Admin_News.aspx"); }
/// <summary> /// 根据标题搜索 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string strCodition = txtCondition.Text; FNews fnews = new FNews(); string sql = " 1=1 "; if (strCodition.Trim().Length > 0) { sql += " and [Title] like '%" + strCodition + "%'"; } if (DD_Type.SelectedValue != "0") { sql += " and News_Type=" + DD_Type.SelectedValue; } sql += " and [Language]= '" + DL_lang.SelectedValue + "'"; RP_con.DataSource = fnews.GetDAL().GetList(sql); RP_con.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { lang = Request.QueryString["lang"]; if (lang == null) { lang = "cn"; } string con = Request.QueryString["con"]; cid = Request.QueryString["cid"]; if (lang == "cn") { LB_lang.Text = "简体中文"; } else if (lang == "en") { LB_lang.Text = "English"; } if (!IsPostBack) { txtDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); //编辑还是增加 if (con == "add") { // 绑定newsType BindNewsType(lang); } else if (Request.QueryString["con"] == "edit") { //编辑 ENEWS model = new ENEWS(); model = fn.GetDAL().GetModel(Convert.ToInt32(cid)); // 绑定newsType BindNewsType(model.Language); DL_NewsType.SelectedValue = model.News_Type.ToString(); //新闻类型 txtTitle.Text = model.Title; //标题 txtAuthor.Text = model.Author; //作者 txtDate.Text = string.Format("{0:yyyy-MM-dd}", model.Data); //日期 if (model.ISSEO == 1) //是否seo { ISSEO.SelectedValue = "true"; // txtKeyWord.Text = model.SEO_KEYWORD; //自定义seo keyWord } else { ISSEO.SelectedValue = "false"; } txtSummary.Text = model.Summary; //简介 txtContent.Text = model.F_Content; //内容 } else if (Request.QueryString["con"] == "del") { fn.GetDAL().Delete(Convert.ToInt32(cid)); Jscript.RedirectToFrames("Admin_News.aspx"); } else if (Request.QueryString["con"] == "ispub") { ENEWS model = fn.GetDAL().GetModel(Convert.ToInt32(cid)); if (model.ISPublish == 1) { model.ISPublish = 0; } else { model.ISPublish = 1; } fn.GetDAL().Update(model); Jscript.RedirectToFrames("Admin_News.aspx"); } } }
/// <summary> /// 获取数据 /// </summary> /// <param name="strWhere"></param> /// <returns></returns> private DataSet GetData(string strWhere) { FNews news = new FNews(); return(news.GetDAL().GetList(strWhere)); }