/// <summary> /// 获取数据列表 /// </summary> /// <param name="sw"></param> /// <returns></returns> public static DataTable getDT(FIRELOST_LOSTTYPE_LOSTPROCESS_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM FIRELOST_LOSTTYPE_LOSTPROCESS WHERE 1=1"); if (string.IsNullOrEmpty(sw.LOSTPROCESSID) == false) { sb.AppendFormat(" AND LOSTPROCESSID = '{0}'", ClsSql.EncodeSql(sw.LOSTPROCESSID)); } if (string.IsNullOrEmpty(sw.FIRELOST_FIREINFOID) == false) { sb.AppendFormat(" AND FIRELOST_FIREINFOID = '{0}'", ClsSql.EncodeSql(sw.FIRELOST_FIREINFOID)); } if (string.IsNullOrEmpty(sw.LOSTPROCESSNAME) == false) { sb.AppendFormat(" AND LOSTPROCESSNAME like '%{0}%'", ClsSql.EncodeSql(sw.LOSTPROCESSNAME)); } if (string.IsNullOrEmpty(sw.LOSTPROCESSCODE) == false) { sb.AppendFormat(" AND LOSTPROCESSCODE = '{0}'", ClsSql.EncodeSql(sw.LOSTPROCESSCODE)); } string sql = "SELECT LOSTPROCESSID, FIRELOST_FIREINFOID, LOSTPROCESSNAME, LOSTPROCESSCODE, LOSEMONEYCOUNT, MARK " + sb.ToString() + " ORDER BY LOSTPROCESSID "; DataSet ds = DataBaseClass.FullDataSet(sql); return(ds.Tables[0]); }
/// <summary> /// 获取数据列表 /// </summary> /// <param name="sw"></param> /// <returns></returns> public static IEnumerable <FIRELOST_LOSTTYPE_LOSTPROCESS_Model> getListModel(FIRELOST_LOSTTYPE_LOSTPROCESS_SW sw) { var result = new List <FIRELOST_LOSTTYPE_LOSTPROCESS_Model>(); DataTable dt = BaseDT.FIRELOST_LOSTTYPE_LOSTPROCESS.getDT(sw);//列表 DataTable dt511 = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW { DICTTYPEID = "511" }); //灾后处理费用 for (int i = 0; i < dt.Rows.Count; i++) { FIRELOST_LOSTTYPE_LOSTPROCESS_Model m = new FIRELOST_LOSTTYPE_LOSTPROCESS_Model(); m.LOSTPROCESSID = dt.Rows[i]["LOSTPROCESSID"].ToString(); m.FIRELOST_FIREINFOID = dt.Rows[i]["FIRELOST_FIREINFOID"].ToString(); m.LOSTPROCESSNAME = dt.Rows[i]["LOSTPROCESSNAME"].ToString(); m.LOSTPROCESSCODE = dt.Rows[i]["LOSTPROCESSCODE"].ToString(); m.LOSTPROCESSCODENAME = BaseDT.T_SYS_DICT.getName(dt511, m.LOSTPROCESSCODE); m.LOSEMONEYCOUNT = dt.Rows[i]["LOSEMONEYCOUNT"].ToString(); m.MARK = dt.Rows[i]["MARK"].ToString(); result.Add(m); } dt.Clear(); dt.Dispose(); dt511.Clear(); dt511.Dispose(); return(result); }
/// <summary> /// 获取单条数据 /// </summary> /// <param name="sw">参见模型</param> /// <returns>参见模型</returns> public static FIRELOST_LOSTTYPE_LOSTPROCESS_Model getModel(FIRELOST_LOSTTYPE_LOSTPROCESS_SW sw) { DataTable dt = BaseDT.FIRELOST_LOSTTYPE_LOSTPROCESS.getDT(sw);//列表 DataTable dt511 = BaseDT.T_SYS_DICT.getDT(new T_SYS_DICTSW { DICTTYPEID = "511" }); //灾后处理费用 FIRELOST_LOSTTYPE_LOSTPROCESS_Model m = new FIRELOST_LOSTTYPE_LOSTPROCESS_Model(); if (dt.Rows.Count > 0) { int i = 0; m.LOSTPROCESSID = dt.Rows[i]["LOSTPROCESSID"].ToString(); m.FIRELOST_FIREINFOID = dt.Rows[i]["FIRELOST_FIREINFOID"].ToString(); m.LOSTPROCESSNAME = dt.Rows[i]["LOSTPROCESSNAME"].ToString(); m.LOSTPROCESSCODE = dt.Rows[i]["LOSTPROCESSCODE"].ToString(); m.LOSTPROCESSCODENAME = BaseDT.T_SYS_DICT.getName(dt511, m.LOSTPROCESSCODE); m.LOSEMONEYCOUNT = dt.Rows[i]["LOSEMONEYCOUNT"].ToString(); m.MARK = dt.Rows[i]["MARK"].ToString(); } dt.Clear(); dt.Dispose(); dt511.Clear(); dt511.Dispose(); return(m); }
/// <summary> /// 判断记录是否存在 /// </summary> /// <param name="sw">参见模型</param> /// <returns>true存在 false不存在</returns> public static bool isExists(FIRELOST_LOSTTYPE_LOSTPROCESS_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("select 1 from FIRELOST_LOSTTYPE_LOSTPROCESS where 1=1"); if (string.IsNullOrEmpty(sw.LOSTPROCESSID) == false) { sb.AppendFormat(" and LOSTPROCESSID= '{0}'", ClsSql.EncodeSql(sw.LOSTPROCESSID)); } return(DataBaseClass.JudgeRecordExists(sb.ToString())); }