public static string GetHelpList(string key) { try { key = key.Filter(); DataTable dt = new DataTable(); List <object> listReturn = new List <object>(); string strSql = string.Empty; string strSqlCount = string.Empty; string strWhere = "1=1 "; if (!string.IsNullOrEmpty(key)) { strWhere += " and help_title like '%" + key + "%'"; } strWhere += " order by create_time desc"; BLL_HelpCenter bll = new BLL_HelpCenter(); dt = bll.GetList(strWhere).Tables[0]; int inum = 0; for (int i = 0; i < dt.Rows.Count; i++) { inum++; listReturn.Add(new { inum = (i + 1), help_id = dt.Rows[i]["help_id"].ToString(), help_title = dt.Rows[i]["help_title"].ToString(), help_content = dt.Rows[i]["help_content"].ToString(), create_time = pfunction.ConvertToLongDateTime(dt.Rows[i]["create_time"].ToString(), "yyyy-MM-dd HH:mm:ss"), }); } if (inum > 0) { return(JsonConvert.SerializeObject(new { err = "null", list = listReturn })); } else { return(JsonConvert.SerializeObject(new { err = "暂无数据" })); } } catch (Exception) { return(JsonConvert.SerializeObject(new { err = "error"//ex.Message.ToString() })); } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(help_id)) { BLL_HelpCenter bll = new BLL_HelpCenter(); Model_HelpCenter model = new Model_HelpCenter(); model = bll.GetModel(help_id); model.help_title = this.txt_title.Text.TrimEnd(); model.help_content = this.txt_content.Value; model.create_time = DateTime.Now; if (bll.Update(model)) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>$(function(){layer.ready(function(){layer.msg('修改成功', { time: 2000, icon: 1},function(){parent.loadData();parent.layer.close(index)})})})</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>$(function(){layer.ready(function(){layer.msg('修改失败', { time: 2000, icon: 2})})})</script>"); return; } } else { BLL_HelpCenter bll = new BLL_HelpCenter(); Model_HelpCenter model = new Model_HelpCenter(); model.help_title = this.txt_title.Text.TrimEnd(); model.help_content = this.txt_content.Value; model.help_id = Guid.NewGuid().ToString(); model.create_time = DateTime.Now; model.create_userid = loginUser.SysUser_ID; if (bll.Add(model)) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>$(function(){layer.ready(function(){layer.msg('添加成功', { time: 2000, icon: 1},function(){parent.loadData();parent.layer.close(index)})})})</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>$(function(){layer.ready(function(){layer.msg('添加失败', { time: 2000, icon: 2})})})</script>"); return; } } } catch (Exception ex) { throw; } }
private void LoadData() { try { BLL_HelpCenter bll = new BLL_HelpCenter(); Model_HelpCenter model = new Model_HelpCenter(); model = bll.GetModel(help_id); if (model != null) { this.txt_title.Text = model.help_title; this.txt_content.Value = model.help_content; } } catch (Exception ex) { throw; } }
protected void LoadData() { try { BLL_HelpCenter bll = new BLL_HelpCenter(); Model_HelpCenter model = new Model_HelpCenter(); model = bll.GetModel(help_id); if (model != null) { this.ltl_content.Text = model.help_content; this.ltl_title.Text = model.help_title; this.ltl_titles.Text = model.help_title; ltlHtltel.Text = model.help_title; } } catch (Exception) { } }
public static string delete(string help_id) { try { BLL_HelpCenter bll = new BLL_HelpCenter(); if (bll.Delete(help_id)) { return "1"; } else { return ""; } } catch (Exception ex) { return ""; } }
public static string GetHelpList(string key, int PageIndex, int PageSize) { try { key = key.Filter(); PageIndex = Convert.ToInt32(PageIndex.ToString().Filter()); DataTable dt = new DataTable(); List<object> listReturn = new List<object>(); string strSql = string.Empty; string strSqlCount = string.Empty; string strWhere = "1=1 "; if (!string.IsNullOrEmpty(key)) { strWhere += " and help_title like '%" + key + "%'"; } BLL_HelpCenter bll = new BLL_HelpCenter(); dt = bll.GetListByPage(strWhere, "create_time desc", ((PageIndex - 1) * PageSize + 1), (PageIndex * PageSize)).Tables[0]; int rCount = bll.GetRecordCount(strWhere); int inum = 0; for (int i = 0; i < dt.Rows.Count; i++) { inum++; listReturn.Add(new { inum = (i + 1), help_id = dt.Rows[i]["help_id"].ToString(), help_title = dt.Rows[i]["help_title"].ToString(), help_content = pfunction.GetSubstring(dt.Rows[i]["help_content"].ToString(), 200, true), create_time = pfunction.ConvertToLongDateTime(dt.Rows[i]["create_time"].ToString(), "yyyy-MM-dd HH:mm:ss"), }); } if (inum > 0) { return JsonConvert.SerializeObject(new { err = "null", PageIndex = PageIndex, PageSize = PageSize, TotalCount = rCount, list = listReturn }); } else { return JsonConvert.SerializeObject(new { err = "暂无数据" }); } } catch (Exception ex) { return JsonConvert.SerializeObject(new { err = "error"//ex.Message.ToString() }); } }