//反审核 protected void lbtnReCheck_Click(object sender, EventArgs e) { int success = 0; YouthTalkLg model; for (int i = 0; i < gvwData.Rows.Count; i++) { CheckBox cbx = (CheckBox)gvwData.Rows[i].FindControl("chkbOne"); if (cbx.Checked == true) { model = new YouthTalkLg(); int id = Convert.ToInt32(gvwData.DataKeys[i].Value); model.Talk_id = id; model.Rechecker = Session[Constant.adminName].ToString(); model.Recheck_time = DateTime.Today; model.Is_check = "N"; bll.ReCheckTalkLg(model); success++; } } bindTalkLG(); String message = "成功取消审核" + success + "条记录!"; MyUtil.ShowMessage(this, message); }
protected void bindTalkLg() { int talk_id = Convert.ToInt32(ViewState["talk_id"].ToString()); model = bll.GetListById(talk_id); txtTitle.Text = model.Talk_title; txt_content.Text = model.Talk_content; txt_publisher.Text = model.Publisher; txt_phone.Text = model.Publisher_phone; txt_email.Text = model.Publisher_mail; ddl_source.Items.FindByValue(model.Talk_source.ToString()).Selected = true; }
/// <summary> /// 添加图说理工 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AddTalkLG(YouthTalkLg model) { int rows = dal.AddTalkLG(model); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新图说理工 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdTalkLg(YouthTalkLg model) { int rows = dal.UpdTalkLg(model); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 添加图说理工 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddTalkLG(YouthTalkLg model) { StringBuilder str = new StringBuilder(); str.Append(" insert into talkLG "); str.Append("(talk_title,talk_Img_url,talk_content,publisher,publisher_phone,publisher_mail,publish_time,click_times,talk_source,last_updater,last_update_time,is_check,checker,check_time,rechecker,recheck_time )"); str.Append("values"); str.Append(" (@talk_title,@talk_Img_url,@talk_content,@publisher,@publisher_phone,@publisher_mail,@publish_time,@click_times,@talk_source,@last_updater,@last_update_time,@is_check,@checker,@check_time,@rechecker,@recheck_time ) "); SqlParameter[] parameters = { new SqlParameter("@talk_title", SqlDbType.NVarChar, 50), new SqlParameter("@talk_Img_url", SqlDbType.NVarChar, 50), new SqlParameter("@talk_content", SqlDbType.NText), new SqlParameter("@publisher", SqlDbType.NVarChar, 25), new SqlParameter("@publisher_phone", SqlDbType.NVarChar, 50), new SqlParameter("@publisher_mail", SqlDbType.NVarChar, 50), new SqlParameter("@publish_time", SqlDbType.DateTime), new SqlParameter("@click_times", SqlDbType.Int, 8), new SqlParameter("@talk_source", SqlDbType.Int, 8), new SqlParameter("@last_updater", SqlDbType.NVarChar, 25), new SqlParameter("@last_update_time", SqlDbType.DateTime), new SqlParameter("@is_check", SqlDbType.VarChar, 10), new SqlParameter("@checker", SqlDbType.NVarChar, 25), new SqlParameter("@check_time", SqlDbType.DateTime), new SqlParameter("@rechecker", SqlDbType.NVarChar, 25), new SqlParameter("@recheck_time", SqlDbType.DateTime) }; parameters[0].Value = model.Talk_title; parameters[1].Value = model.Talk_Img_url; parameters[2].Value = model.Talk_content; parameters[3].Value = model.Publisher; parameters[4].Value = model.Publisher_phone; parameters[5].Value = model.Publisher_mail; parameters[6].Value = model.Publish_time; parameters[7].Value = model.Click_times; parameters[8].Value = model.Talk_source; parameters[9].Value = model.Last_updater; parameters[10].Value = model.Last_update_time; parameters[11].Value = model.Is_check; parameters[12].Value = model.Checker; parameters[13].Value = model.Check_time; parameters[14].Value = model.Rechecker; parameters[15].Value = model.Recheck_time; int rows = DbHelperSQL.ExecuteSql(str.ToString(), parameters); return(rows); }
protected void lbtnSave_Click(object sender, EventArgs e) { int talk_id = Convert.ToInt32(ViewState["talk_id"].ToString()); YouthTalkLg original_model = new YouthTalkLg(); original_model = bll.GetListById(talk_id); model.Talk_id = talk_id; model.Talk_title = txtTitle.Text.ToString(); if (fupImage.HasFile) { string fileName = fupImage.FileName; string ext = fileName.Substring(fileName.LastIndexOf('.')); string url = "../upload/SpecialImg/" + DateTime.Now.ToString("yyyyMMddHHmmss") + GenerateSixNum() + ext; fupImage.SaveAs(Server.MapPath(url)); model.Talk_Img_url = url.Substring(3); } else { model.Talk_Img_url = original_model.Talk_Img_url; } model.Talk_content = txt_content.Text.ToString(); model.Publisher = txt_publisher.Text.ToString(); model.Publisher_phone = txt_phone.Text.ToString(); model.Publisher_mail = txt_email.Text.ToString(); model.Publish_time = original_model.Publish_time; model.Click_times = original_model.Click_times; model.Talk_source = Convert.ToInt32(ddl_source.SelectedValue.ToString()); model.Last_updater = Session[Constant.adminName].ToString(); model.Last_update_time = DateTime.Now; model.Is_check = "N"; model.Checker = ""; model.Check_time = original_model.Check_time; model.Rechecker = original_model.Rechecker; model.Recheck_time = original_model.Recheck_time; if (bll.UpdTalkLg(model)) { MyUtil.ShowMessageRedirect(this.Page, "编辑成功", "TuShuoLGList.aspx"); } else { MyUtil.ShowMessage(this.Page, "编辑失败"); } }
protected void bindTalk() { model = talk_bll.GetListById(talk_id); talk_title.Text = model.Talk_title; PublishTime.Text = FormatTime(model.Publish_time); Publisher.Text = model.Publisher; Clicks.Text = model.Click_times.ToString(); //talk_content.InnerHtml = model.Talk_content; talk_content_con = model.Talk_content; //1.正则表达式处理 MatchCollection col = GetCollection(talk_content_con); foreach (Match item in col) { string str = item.ToString(); XmlNodeList xnl = GetNoteList(str, "//img"); //for (int i = 0; i < xnl.Count; i++) //{ talk_alt = xnl[0].Attributes["alt"].Value; talk_src = "<img src='" + xnl[0].Attributes["src"].Value.Trim() + "' height='367' width='668'/>"; // } al_src.Add(talk_src); al_alt.Add(talk_alt); } //2.xml处理 //XmlNodeList xnl = GetNoteList(talk_content_con, "//img"); //for (int i = 0; i < xnl.Count; i++) //{ // talk_alt = xnl[i].Attributes["alt"].Value; // string test = xnl[i].Attributes["src"].Value; // talk_src = "<img src='" + xnl[i].Attributes["src"].Value.Trim() + "' height='367' width='668'/>"; //} updater.Text = model.Last_updater; checker.Text = model.Checker; }
/// <summary> /// 反审核图说理工 /// </summary> /// <param name="model"></param> /// <returns></returns> public int ReCheckTalkLg(YouthTalkLg model) { StringBuilder str = new StringBuilder(); str.Append(" update talkLG set "); str.Append(" is_check=@is_check,"); str.Append(" rechecker=@rechecker,"); str.Append(" recheck_time=@recheck_time "); str.Append(" where talk_id=@talk_id "); SqlParameter[] parameters = { new SqlParameter("@is_check", SqlDbType.VarChar, 10), new SqlParameter("@rechecker", SqlDbType.NVarChar, 25), new SqlParameter("@recheck_time", SqlDbType.DateTime), new SqlParameter("@talk_id", SqlDbType.Int, 8) }; parameters[0].Value = model.Is_check; parameters[1].Value = model.Rechecker; parameters[2].Value = model.Recheck_time; parameters[3].Value = model.Talk_id; int rows = DbHelperSQL.ExecuteSql(str.ToString(), parameters); return(rows); }
/// <summary> /// 更新图说理工 /// </summary> /// <param name="model"></param> /// <returns></returns> public int UpdTalkLg(YouthTalkLg model) { StringBuilder str = new StringBuilder(); str.Append(" update talkLG set "); str.Append(" talk_title=@talk_title, "); str.Append("talk_Img_url=@talk_Img_url,"); str.Append(" talk_content=@talk_content, "); str.Append(" publisher=@publisher, "); str.Append(" publisher_phone=@publisher_phone, "); str.Append(" publisher_mail=@publisher_mail, "); str.Append(" publish_time=@publish_time, "); str.Append(" click_times=@click_times, "); str.Append(" talk_source=@talk_source, "); str.Append(" last_updater=@last_updater, "); str.Append(" last_update_time=@last_update_time, "); str.Append(" is_check=@is_check, "); str.Append(" checker=@checker, "); str.Append(" check_time=@check_time, "); str.Append(" rechecker=@rechecker, "); str.Append(" recheck_time=@recheck_time "); str.Append(" where talk_id=@talk_id "); SqlParameter[] parameters = { new SqlParameter("@talk_title", SqlDbType.NVarChar, 50), new SqlParameter("@talk_Img_url", SqlDbType.NVarChar, 50), new SqlParameter("@talk_content", SqlDbType.NText), new SqlParameter("@publisher", SqlDbType.NVarChar, 25), new SqlParameter("@publisher_phone", SqlDbType.NVarChar, 50), new SqlParameter("@publisher_mail", SqlDbType.NVarChar, 50), new SqlParameter("@publish_time", SqlDbType.DateTime), new SqlParameter("@click_times", SqlDbType.Int, 8), new SqlParameter("@talk_source", SqlDbType.Int, 8), new SqlParameter("@last_updater", SqlDbType.NVarChar, 25), new SqlParameter("@last_update_time", SqlDbType.DateTime), new SqlParameter("@is_check", SqlDbType.VarChar, 10), new SqlParameter("@checker", SqlDbType.NVarChar, 25), new SqlParameter("@check_time", SqlDbType.DateTime), new SqlParameter("@rechecker", SqlDbType.NVarChar, 25), new SqlParameter("@recheck_time", SqlDbType.DateTime), new SqlParameter("@talk_id", SqlDbType.Int, 8) }; parameters[0].Value = model.Talk_title; parameters[1].Value = model.Talk_Img_url; parameters[2].Value = model.Talk_content; parameters[3].Value = model.Publisher; parameters[4].Value = model.Publisher_phone; parameters[5].Value = model.Publisher_mail; parameters[6].Value = model.Publish_time; parameters[7].Value = model.Click_times; parameters[8].Value = model.Talk_source; parameters[9].Value = model.Last_updater; parameters[10].Value = model.Last_update_time; parameters[11].Value = model.Is_check; parameters[12].Value = model.Checker; parameters[13].Value = model.Check_time; parameters[14].Value = model.Rechecker; parameters[15].Value = model.Recheck_time; parameters[16].Value = model.Talk_id; int rows = DbHelperSQL.ExecuteSql(str.ToString(), parameters); return(rows); }
/// <summary> /// 根据id获取图说理工 /// </summary> /// <param name="id"></param> /// <returns></returns> public YouthTalkLg GetListById(int id) { YouthTalkLg model = new YouthTalkLg(); StringBuilder str = new StringBuilder(); str.Append(" select * from talkLG "); str.Append(" where talk_id= " + id); DataSet ds = DbHelperSQL.Query(str.ToString()); if (ds.Tables[0].Rows.Count > 0) { DataRow row = ds.Tables[0].Rows[0]; if (row["talk_id"] != null) { model.Talk_id = Convert.ToInt32(row["talk_id"].ToString()); } if (row["talk_title"] != null) { model.Talk_title = row["talk_title"].ToString(); } if (row["talk_Img_url"] != null) { model.Talk_Img_url = row["talk_Img_url"].ToString(); } if (row["talk_content"] != null) { model.Talk_content = row["talk_content"].ToString(); } if (row["publisher"] != null) { model.Publisher = row["publisher"].ToString(); } if (row["publisher_phone"] != null) { model.Publisher_phone = row["publisher_phone"].ToString(); } if (row["publisher_mail"] != null) { model.Publisher_mail = row["publisher_mail"].ToString(); } if (row["publish_time"] != null) { model.Publish_time = DateTime.Parse(row["publish_time"].ToString()); } if (row["click_times"] != null) { model.Click_times = Convert.ToInt32(row["click_times"].ToString()); } if (row["talk_source"] != null) { model.Talk_source = Convert.ToInt32(row["talk_source"].ToString()); } if (row["last_updater"] != null) { model.Last_updater = row["last_updater"].ToString(); } if (row["last_update_time"] != null) { model.Last_update_time = DateTime.Parse(row["last_update_time"].ToString()); } if (row["is_check"] != null) { model.Is_check = row["is_check"].ToString(); } if (row["checker"] != null) { model.Checker = row["checker"].ToString(); } if (row["check_time"] != null) { model.Check_time = DateTime.Parse(row["check_time"].ToString()); } if (row["rechecker"] != null) { model.Rechecker = row["rechecker"].ToString(); } if (row["recheck_time"] != null) { model.Recheck_time = DateTime.Parse(row["recheck_time"].ToString()); } return(model); } else { return(null); } }