//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpHelp JpHelp = new TPortalClass.JpHelp(); string ls_tip = "删除成功!"; for (int i = 0; i < rptList.Items.Count; i++) { string id = ((HiddenField)rptList.Items[i].FindControl("hidId")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { JpHelp.id = int.Parse(id); JpHelp.Delete(); } } string pageUrl = JpCommon.CombUrlTxt("list_help_sh.aspx", "page={0}&rnd={1}", "" + this.txtPage.Text + "", "" + System.Guid.NewGuid().ToString() + ""); //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "删除", "批量删除帮办记录", Session["uid"].ToString(), Session["uname"].ToString()); Response.Write("<script>alert('" + ls_tip + "');window.location='" + pageUrl + "';</script>"); }
public string RptBind() { string ls_where = ""; string ls_order = ""; if (strType == "1") { ls_where = " and (hy_ifsh ='1' or hy_ifsh='2') "; } else if (strType == "2") { ls_where = " and hy_ifsh ='0' "; } ls_order = " order by hy_addtime desc"; JpHelp jpHelp = new JpHelp(); int colcous = 1; //获取数据 StringBuilder stringBuilder = new StringBuilder(); DataTable dt = jpHelp.SearchdocsByKey(ls_where, ls_order, 1, 5); string strTitle = ""; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { strTitle = dt.Rows[i]["hy_content"].ToString(); if (strTitle.Length > 18) { strTitle = strTitle.Substring(0, 18) + "..."; } stringBuilder.Append("<a onclick=\"locationDetail('help_detail.aspx?aid=" + dt.Rows[i]["id"].ToString() + "','" + locationType + "','0')\"><li><img src=\"" + dt.Rows[i]["hy_images"].ToString() + "\"><h1>"); stringBuilder.Append("" + strTitle + "</h1><p class=\"fleft\">" + JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["hy_addtime"].ToString())) + "</p></li></a>"); } } return stringBuilder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { string strType = "", ls_page = "1", la_pagesize = "10"; TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); //获取参数 if (this.Request.QueryString["type"] != null) { strType = this.Request.QueryString["type"].ToString(); } if (this.Request.QueryString["page"] != null) { ls_page = this.Request.QueryString["page"].ToString(); } if (this.Request.QueryString["pagesize"] != null) { la_pagesize = this.Request.QueryString["pagesize"].ToString(); } string ls_where = "", ls_order = ""; //构造sql if (strType == "1") { ls_where = " and (hy_ifsh ='1' or hy_ifsh='2') "; } else if (strType == "2") { ls_where = " and hy_ifsh ='0' "; } ls_order = " order by hy_addtime desc"; JpHelp jpHelp = new JpHelp(); //获取数据 DataTable dt = jpHelp.SearchdocsByKey(ls_where, ls_order, int.Parse(ls_page), int.Parse(la_pagesize)); //复制一个DataTalbe DataTable tempTable = dt.Clone(); //在现有的DatatTable增加一列 DataColumn col = new DataColumn("showTime", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(col); //循环 对DataTable重新赋值 for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[tempTable.Columns[j].ColumnName] = dt.Rows[i][j]; } //获得间隔的时间 dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["hy_addtime"].ToString())); tempTable.Rows.Add(dr); } //转换成json格式 string strJson = JsonConvert.SerializeObject(tempTable); //数据抛出 Response.Write(strJson); }
protected void btn_save_Click(object sender, EventArgs e) { JpHelp JpHelp = new JpHelp(); JpHelp.hy_content = this.txtData.Value; JpHelp.hy_ifsh = 0; JpHelp.hy_images = "images/1-1_nr3_ad3.png"; JpHelp.hy_sort = 1; JpHelp.hy_tel = ""; JpHelp.hy_addtime = DateTime.Now.ToString(); JpHelp.docid = this.txtDocid.Value; JpHelp.hy_reply = ""; JpHelp.hy_replytime = DateTime.Now.ToString(); JpHelp.Insert(); Response.Write("<script>alert('保存成功!');</script>"); }
protected void Page_Load(object sender, EventArgs e) { JpHelp jpHelp = new JpHelp(); if (this.Request.QueryString["type"] != null) { strType = this.Request.QueryString["type"].ToString(); } this.pageSize = 10; //每页数量 if (strType == "1") { pis_totalCount = jpHelp.getHandleCount(); } else if (strType == "2") { pis_totalCount = jpHelp.getNoHandleCount(); } }
protected void Page_Load(object sender, EventArgs e) { if (this.Request.QueryString["aid"] != null) { aid = this.Request.QueryString["aid"].ToString(); } if (this.Request.QueryString["cid"] != null) { cid = this.Request.QueryString["cid"].ToString(); } this.txtcid.Value = cid; this.txtaid.Value = aid; this.lb_type.Text = "帮教帮办"; StringBuilder stringBuilder = new StringBuilder(); JpHelp jpHelp = new JpHelp(); DataTable dt = jpHelp.Getdocbyid(Convert.ToInt32(aid)); if (dt.Rows.Count > 0) { this.lb_time.Text = Convert.ToDateTime(dt.Rows[0]["hy_addtime"].ToString()).ToString("yyyy年MM月dd日"); this.lb_title.Text = dt.Rows[0]["hy_content"].ToString(); imgPath = dt.Rows[0]["hy_images"].ToString(); this.lb_article.Text = dt.Rows[0]["hy_content"].ToString(); } }
private void RptBind() { if (this.Request.QueryString["page"] != null) this.page = int.Parse(this.Request.QueryString["page"].ToString()); else this.page = 1; this.txtKeywords.Text = this.keywords; txtPageNum.Text = this.pageSize.ToString(); txtPage.Text = this.page.ToString(); TPortalClass.JpHelp JpHelp = new TPortalClass.JpHelp(); TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string ls_key = JpCommon.Filter(this.txtKeywords.Text.Trim()); DataTable dt = new DataTable(); string ls_where = " and hy_content like '%" + ls_key + "%' "; dt = JpHelp.SearchdocsByKey(ls_where, " order by hy_ifsh ", Convert.ToInt32(txtPage.Text), 10); this.totalCount = JpHelp.SearchdocsByKeyNum(ls_where); rptList.DataSource = dt; rptList.DataBind(); string pageUrl = JpCommon.CombUrlTxt("list_help_sh.aspx", "page={0}&rnd={1}&keywords={2}", "__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtKeywords.Text + ""); PageContent.InnerHtml = JpCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
private void DataPlay() { if (this.Request.QueryString["op"] != null) { this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改 } if (this.Request.QueryString["id"] != null) { this.txtid.Value = this.Request.QueryString["id"].ToString(); //文档ID } TPortalClass.JpHelp JpHelp = new TPortalClass.JpHelp(); //旧文档 if (this.txtop.Value == "modify") { DataTable dt = JpHelp.Getdocbyid(int.Parse(this.txtid.Value)); if (dt.Rows.Count > 0) { this.txtid.Value = dt.Rows[0]["id"].ToString(); this.txthy_tel.Text = dt.Rows[0]["hy_tel"].ToString(); this.txthy_reply.Text = dt.Rows[0]["hy_reply"].ToString(); this.txthy_content.Text = dt.Rows[0]["hy_content"].ToString(); this.txthy_addtime.Text = Convert.ToDateTime(dt.Rows[0]["hy_addtime"].ToString()).ToString("yyyy-MM-dd"); this.txthy_sort.Text = dt.Rows[0]["hy_sort"].ToString(); if (dt.Rows[0]["hy_ifsh"].ToString() == "0") { this.txthy_replytime.Text = ""; this.txthy_accepttime.Text = ""; } if (dt.Rows[0]["hy_ifsh"].ToString() == "1") { this.txthy_replytime.Text = ""; this.txthy_accepttime.Text = Convert.ToDateTime(dt.Rows[0]["hy_accepttime"].ToString()).ToString("yyyy-MM-dd"); } if (dt.Rows[0]["hy_ifsh"].ToString() == "2") { this.txthy_replytime.Text = Convert.ToDateTime(dt.Rows[0]["hy_replytime"].ToString()).ToString("yyyy-MM-dd"); this.txthy_accepttime.Text = Convert.ToDateTime(dt.Rows[0]["hy_accepttime"].ToString()).ToString("yyyy-MM-dd"); } } } else { TPortalClass.DAO db = new TPortalClass.DAO(); string sql = "select top 1 hy_sort from hy_help order by hy_sort desc "; DataTable dt = db.GetDataTable(sql); if (dt.Rows.Count > 0) { this.txthy_sort.Text = (Convert.ToInt32(dt.Rows[0]["hy_sort"].ToString()) + 1).ToString(); } else { this.txthy_sort.Text = "1"; } } }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["hyuid"] == null || this.Session["hyuid"].ToString() == "") { ifLogin = "******"; } StringBuilder stringBuilder = new StringBuilder(); JpHelp jpHelp = new JpHelp(); DateTime ls_now = DateTime.Now; DataTable dt = jpHelp.getHandle(5); //头部大图显示 if (dt.Rows.Count > 0) { stringBuilder.Append("<a onclick=\"locationDetail('help_detail.aspx?aid=" + dt.Rows[0]["id"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "','" + locationType + "','0')\" ><h1>" + dt.Rows[0]["hy_content"].ToString() + "</h1>"); stringBuilder.Append("<span><img src=\"" + dt.Rows[0]["hy_images"].ToString() + "\"></span>"); stringBuilder.Append("<div class=\"jptxbt\">" + dt.Rows[0]["hy_content"].ToString() + "</div></a>"); } this.lb_head.Text = stringBuilder.ToString(); //清空字节流 stringBuilder.Remove(0, stringBuilder.Length); //中间列表显示 if (dt.Rows.Count > 1) { for (int i = 1; i < dt.Rows.Count; i++) { DateTime ls_date = DateTime.Parse(dt.Rows[i]["hy_addtime"].ToString()); stringBuilder.Append("<li><a onclick=\"locationDetail('help_detail.aspx?aid=" + dt.Rows[i]["id"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "','" + locationType + "','0')\"><img src=\"" + dt.Rows[i]["hy_images"].ToString() + "\">"); stringBuilder.Append("<h2>" + dt.Rows[i]["hy_content"].ToString() + "</h2>"); try { stringBuilder.Append("<p class=\"fleft\">" + JpCommon.DateDiff(ls_now, ls_date) + "</p>"); } catch (Exception) { } if (dt.Rows[i]["hy_ifsh"].ToString() == "1") { stringBuilder.Append("<p class=\"fright\">已处理</p></a></li>"); } else if (dt.Rows[i]["hy_ifsh"].ToString() == "2") { stringBuilder.Append("<p class=\"fright\">已答复</p></a></li>"); } } this.lb_center.Text = stringBuilder.ToString(); } //清空字节流 stringBuilder.Remove(0, stringBuilder.Length); dt.Clear(); dt = jpHelp.getNoHandle(5); if (dt.Rows.Count > 0) { for (int i = 1; i < dt.Rows.Count; i++) { DateTime ls_date = DateTime.Parse(dt.Rows[i]["hy_addtime"].ToString()); stringBuilder.Append("<li><a onclick=\"locationDetail('help_detail.aspx?aid=" + dt.Rows[i]["id"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "','" + locationType + "','0')\"><img src=\"" + dt.Rows[i]["hy_images"].ToString() + "\">"); stringBuilder.Append("<h2>" + dt.Rows[i]["hy_content"].ToString() + "</h2>"); try { stringBuilder.Append("<p class=\"fleft\">" + JpCommon.DateDiff(ls_now, ls_date) + "</p>"); } catch (Exception) { throw; } stringBuilder.Append("<p class=\"fright\">未处理</p></a></li>"); } this.lb_footer.Text = stringBuilder.ToString(); } }