/// <summary> /// 获取记录 /// </summary> /// <param name="sw"></param> /// <returns></returns> public static DataTable getDT(ART_DOCUMENT_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM ART_DOCUMENT"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.ARTID) == false) { sb.AppendFormat(" AND ARTID = '{0}'", ClsSql.EncodeSql(sw.ARTID)); } if (string.IsNullOrEmpty(sw.ARTTYPEID) == false) { sb.AppendFormat(" AND ARTTYPEID = '{0}'", ClsSql.EncodeSql(sw.ARTTYPEID)); } if (string.IsNullOrEmpty(sw.ARTCHECKSTATUS) == false) { sb.AppendFormat(" AND ARTCHECKSTATUS = '{0}'", ClsSql.EncodeSql(sw.ARTCHECKSTATUS)); } if (string.IsNullOrEmpty(sw.ARTTITLE) == false) { sb.AppendFormat(" AND ARTTITLE like '%{0}%'", ClsSql.EncodeSql(sw.ARTTITLE)); } if (string.IsNullOrEmpty(sw.ARTTAG) == false) { sb.AppendFormat(" AND ARTTAG like '%{0}%'", ClsSql.EncodeSql(sw.ARTTAG)); } if (string.IsNullOrEmpty(sw.TIMEBegin) == false) { sb.AppendFormat(" AND ARTTIME >= '{0}'", ClsSql.EncodeSql(sw.TIMEBegin)); } if (string.IsNullOrEmpty(sw.TIMEEnd) == false) { sb.AppendFormat(" AND ARTTIME <= '{0}'", ClsSql.EncodeSql(sw.TIMEEnd)); } string sql = ""; if (string.IsNullOrEmpty(sw.TOPS)) { sql = "SELECT ARTID, ARTTYPEID, ARTTITLE, ARTTAG, ARTTIME, ARTCONTENT, ARTCHECKSTATUS, ARTADDUSERID,ARTCHECKTIME, ARTCHECKUSERID,PLANFILENAME" + sb.ToString() + " order by ARTTIME DESC"; } else { sql = "SELECT top " + sw.TOPS + " ARTID, ARTTYPEID, ARTTITLE, ARTTAG, ARTTIME, ARTCHECKSTATUS, ARTADDUSERID,ARTCHECKTIME, ARTCHECKUSERID,PLANFILENAME" + sb.ToString() + " order by ARTTIME DESC"; } DataSet ds = DataBaseClass.FullDataSet(sql); return(ds.Tables[0]); }
/// <summary> /// 判断记录是否存在 /// </summary> /// <param name="sw">参见模型</param> /// <returns>true存在 false不存在</returns> public static bool isExists(ART_DOCUMENT_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("select 1 from ART_DOCUMENT where 1=1"); if (string.IsNullOrEmpty(sw.ARTID) == false) { sb.AppendFormat(" where ARTID= '{0}'", ClsSql.EncodeSql(sw.ARTID)); } return(DataBaseClass.JudgeRecordExists(sb.ToString())); }
/// <summary> /// 获取分页列表 /// </summary> /// <param name="sw"></param> /// <param name="total"></param> /// <returns></returns> public static DataTable getDT(ART_DOCUMENT_SW sw, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM ART_DOCUMENT"); sb.AppendFormat(" WHERE 1=1"); if (string.IsNullOrEmpty(sw.ARTTYPEID) == false) { sb.AppendFormat(" AND ARTTYPEID = '{0}'", ClsSql.EncodeSql(sw.ARTTYPEID)); } if (string.IsNullOrEmpty(sw.ARTCHECKSTATUS) == false) { sb.AppendFormat(" AND ARTCHECKSTATUS = '{0}'", ClsSql.EncodeSql(sw.ARTCHECKSTATUS)); } if (string.IsNullOrEmpty(sw.ARTTITLE) == false) { sb.AppendFormat(" AND ARTTITLE like '%{0}%'", ClsSql.EncodeSql(sw.ARTTITLE)); } if (string.IsNullOrEmpty(sw.ARTTAG) == false) { sb.AppendFormat(" AND ARTTAG like '%{0}%'", ClsSql.EncodeSql(sw.ARTTAG)); } if (string.IsNullOrEmpty(sw.TIMEBegin) == false) { sb.AppendFormat(" AND ARTTIME >= '{0}'", ClsSql.EncodeSql(sw.TIMEBegin)); } if (string.IsNullOrEmpty(sw.TIMEEnd) == false) { sb.AppendFormat(" AND ARTTIME <= '{0}'", ClsSql.EncodeSql(sw.TIMEEnd)); } if (string.IsNullOrEmpty(sw.ARTBigTYPEID) == false) { sb.AppendFormat(" AND ARTTYPEID like '{0}%'", ClsSql.EncodeSql(sw.ARTBigTYPEID)); } if (string.IsNullOrEmpty(sw.BYORGNO) == false) { sb.AppendFormat(" AND BYORGNO = '{0}'", ClsSql.EncodeSql(sw.BYORGNO)); } string sql = "SELECT ARTID, ARTTYPEID, ARTTITLE, ARTTAG, ARTTIME, ARTCHECKSTATUS, ARTADDUSERID,ARTCHECKTIME, ARTCHECKUSERID,PLANFILENAME,BYORGNO" + sb.ToString() + " order by ARTTIME DESC"; string sqlC = "select count(1) " + sb.ToString(); total = int.Parse(DataBaseClass.ReturnSqlField(sqlC)); sw.curPage = PagerCls.getCurPage(new PagerSW { curPage = sw.curPage, pageSize = sw.pageSize, rowCount = total }); DataSet ds = DataBaseClass.FullDataSet(sql, (sw.curPage - 1) * sw.pageSize, sw.pageSize, "a"); return(ds.Tables[0]); }
/// <summary> /// 组合表格 /// </summary> /// <param name="sw"></param> /// <param name="total"></param> /// <returns></returns> private string getDocBigListStr(ART_DOCUMENT_SW sw, string typeid, out int total) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("<table cellpadding=\"0\" cellspacing=\"0\">"); sb.AppendFormat("<thead>"); sb.AppendFormat("<tr>"); sb.AppendFormat("<th style='width:10%;'>序号</th>"); sb.AppendFormat("<th style='width:10%;'>类别</th>"); sb.AppendFormat("<th style='width:30%;'>标题</th>"); sb.AppendFormat("<th style='width:15%;'>添加人</th>"); sb.AppendFormat("<th style='width:15%;'>时间</th>"); sb.AppendFormat("<th style='width:20%;'>管理</th>"); sb.AppendFormat("</tr>"); sb.AppendFormat("</thead>"); sb.AppendFormat("<tbody>"); var result = ART_DOCUMENTCls.getModelList(sw, out total); int i = 0; foreach (var v in result) { if (i % 2 == 0) { sb.AppendFormat("<tr>"); } else { sb.AppendFormat("<tr class='row1'>"); } sb.AppendFormat("<td class=\"center\">{0}</td>", (i + 1).ToString()); sb.AppendFormat("<td class=\"center\">{0}</td>", v.ARTTYPENAME);// v.ARTTYPENAME); sb.AppendFormat("<td class=\"left\"><a href=\"/ArtDocument/DocShow?ID={1}\" target='_blank'>{0}</a></td>", v.ARTTITLE, v.ARTID); sb.AppendFormat("<td class=\"left\">{0}</td>", v.ARTADDUSERName); sb.AppendFormat("<td class=\"center\">{0}</td>", v.ARTTIME); sb.AppendFormat("<td class=\"center\">"); sb.AppendFormat("<a href='#' onclick=\"Mdy('{0}','{1}')\" class=\"searchBox_01 LinkMdy\">修改</a>", v.ARTID, typeid); sb.AppendFormat(" <a href='#' onclick='Manager({0})' class=\"searchBox_01 LinkDel\">删除</a>", v.ARTID); sb.AppendFormat("</td>"); sb.AppendFormat("</tr>"); i++; } sb.AppendFormat("</tbody>"); sb.AppendFormat("</table>"); return(sb.ToString()); }
/// <summary> /// 根据查询条件获取某一条用户信息记录,用于修改、删除、用户登录验证 /// </summary> /// <param name="sw">参见模型</param> /// <returns>参见模型</returns> public static ART_DOCUMENT_Model getModel(ART_DOCUMENT_SW sw) { var result = new List <ART_DOCUMENT_Model>(); DataTable dt = BaseDT.ART_DOCUMENT.getDT(sw);//列表 ART_DOCUMENT_Model m = new ART_DOCUMENT_Model(); DataTable dtUser = BaseDT.T_SYSSEC_USER.getDT(new T_SYSSEC_IPSUSER_SW { }); if (dt.Rows.Count > 0) { int i = 0; m.ARTID = dt.Rows[i]["ARTID"].ToString(); m.ARTTYPEID = dt.Rows[i]["ARTTYPEID"].ToString(); m.ARTTITLE = dt.Rows[i]["ARTTITLE"].ToString(); m.ARTTAG = dt.Rows[i]["ARTTAG"].ToString(); m.ARTTIME = PublicClassLibrary.ClsSwitch.SwitTM(dt.Rows[i]["ARTTIME"].ToString()); m.ARTCHECKSTATUS = dt.Rows[i]["ARTCHECKSTATUS"].ToString(); m.ARTADDUSERID = dt.Rows[i]["ARTADDUSERID"].ToString(); m.ARTCHECKTIME = PublicClassLibrary.ClsSwitch.SwitTM(dt.Rows[i]["ARTCHECKTIME"].ToString()); m.ARTCHECKUSERID = dt.Rows[i]["ARTCHECKUSERID"].ToString(); m.ARTCONTENT = dt.Rows[i]["ARTCONTENT"].ToString(); DataTable dtType = BaseDT.ART_TYPE.getDT(new ART_TYPE_SW { ARTTYPEID = m.ARTTYPEID }); m.ARTTYPENAME = BaseDT.ART_TYPE.getName(dtType, m.ARTTYPEID); m.ARTADDUSERName = BaseDT.T_SYSSEC_USER.getNameByUserList(dtUser, m.ARTADDUSERID); m.ARTCHECKUSERIDName = BaseDT.T_SYSSEC_USER.getNameByUserList(dtUser, m.ARTCHECKUSERID); m.PLANFILENAME = dt.Rows[i]["PLANFILENAME"].ToString(); dtType.Clear(); dtType.Dispose(); } dt.Clear(); dt.Dispose(); dtUser.Clear(); dtUser.Dispose(); return(m); }
private List <ART_DOCUMENT_Model> GetList1(ART_DOCUMENT_SW sw) { var list = ART_DOCUMENTCls.getModelList(sw).ToList(); return(list); }
/// <summary> /// 文档管理Ajax列表 /// </summary> /// <returns></returns> public ActionResult getDocDefaultAjax() { string PageSize = Request.Params["PageSize"]; if (PageSize == "0") { PageSize = ConfigCls.getTableDefaultPageSize(); } string Page = Request.Params["Page"]; string EMAILTITLE = Request.Params["TITLE"]; string typeID = (string.IsNullOrEmpty(Request.Params["typeID"])) ? "" : Request.Params["typeID"].ToString(); string bigTypeID = "";// (string.IsNullOrEmpty(Request.Params["ArtTID"])) ? "" : Request.Params["ArtTID"].ToString(); if (typeID == "006101") { bigTypeID = "013"; //通告公告 } if (typeID == "006102") { bigTypeID = "014"; //防火百科 } if (typeID == "006103") { bigTypeID = "015"; //帮助 } if (typeID == "006024") { bigTypeID = "031"; //有害生物 } int total = 0; ART_DOCUMENT_SW sw = new ART_DOCUMENT_SW { curPage = int.Parse(Page), pageSize = int.Parse(PageSize), ARTTITLE = EMAILTITLE, ARTBigTYPEID = bigTypeID, BYORGNO = SystemCls.getCurUserOrgNo() }; var result = ART_DOCUMENTCls.getModelList(sw, out total); StringBuilder sb = new StringBuilder(); sb.AppendFormat("<table cellpadding=\"0\" cellspacing=\"0\">"); sb.AppendFormat("<thead>"); sb.AppendFormat("<tr>"); sb.AppendFormat("<th style='width:10%;'>序号</th>"); sb.AppendFormat("<th style='width:10%;'>类别</th>"); sb.AppendFormat("<th style='width:30%;'>标题</th>"); sb.AppendFormat("<th style='width:15%;'>添加人</th>"); sb.AppendFormat("<th style='width:15%;'>时间</th>"); sb.AppendFormat("<th style='width:20%;'>管理</th>"); sb.AppendFormat("</tr>"); sb.AppendFormat("</thead>"); sb.AppendFormat("<tbody>"); int i = 0; foreach (var v in result) { if (i % 2 == 0) { sb.AppendFormat("<tr>"); } else { sb.AppendFormat("<tr class='row1'>"); } sb.AppendFormat("<td class=\"center\">{0}</td>", (i + 1).ToString()); sb.AppendFormat("<td class=\"center\">{0}</td>", v.ARTTYPENAME);// v.ARTTYPENAME); sb.AppendFormat("<td class=\"left\"><a href=\"/ArtDocument/DocShow?ID={1}\" target='_blank'>{0}</a></td>", v.ARTTITLE, v.ARTID); sb.AppendFormat("<td class=\"center\">{0}</td>", v.ARTADDUSERName); sb.AppendFormat("<td class=\"center\">{0}</td>", v.ARTTIME); sb.AppendFormat("<td class=\"center\">"); sb.AppendFormat("<a href='#' onclick=\"Mdy('{0}','{1}')\" class=\"searchBox_01 LinkMdy\">修改</a>", v.ARTID, typeID); sb.AppendFormat(" <a href='#' onclick='Manager({0})' class=\"searchBox_01 LinkDel\">删除</a>", v.ARTID); sb.AppendFormat("</td>"); sb.AppendFormat("</tr>"); i++; } sb.AppendFormat("</tbody>"); sb.AppendFormat("</table>"); string pageInfo = PagerCls.getPagerInfoAjax(new PagerSW { curPage = sw.curPage, pageSize = sw.pageSize, rowCount = total }); return(Content(JsonConvert.SerializeObject(new MessagePagerAjax(true, sb.ToString(), pageInfo)), "text/html;charset=UTF-8"));; }