/// <summary> /// 获取记录 /// </summary> /// <param name="sw"></param> /// <returns></returns> public static DataTable getDT(JC_FIRE_PROP_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(" FROM JC_FIRE_PROP"); sb.AppendFormat(" WHERE 1=1 "); if (string.IsNullOrEmpty(sw.JC_FIRE_PROPID) == false) { sb.AppendFormat(" AND JC_FIRE_PROPID = '{0}'", ClsSql.EncodeSql(sw.JC_FIRE_PROPID)); } if (string.IsNullOrEmpty(sw.JCFID) == false) { sb.AppendFormat(" AND JCFID = '{0}'", ClsSql.EncodeSql(sw.JCFID)); } if (string.IsNullOrEmpty(sw.FIRELEVEL) == false) { sb.AppendFormat(" AND FIRELEVEL = '{0}'", ClsSql.EncodeSql(sw.FIRELEVEL)); } string sql = ""; sql = "SELECT JC_FIRE_PROPID, JCFID, GHMJ, GHLDMJ, SHSLMJ, RYS, RYW, MGSD, ZDQY, GJJL, ZZH, QHS, SSJB,FIRELEVEL,FIRECODE" + sb.ToString() + " order by JC_FIRE_PROPID DESC"; DataSet ds = DataBaseClass.FullDataSet(sql); return(ds.Tables[0]); }
/// <summary> /// 根据查询条件获取某一条用户信息记录,用于修改、删除 /// </summary> /// <param name="sw">参见模型</param> /// <returns>参见模型</returns> public static JC_FIRE_PROP_Model getModel(JC_FIRE_PROP_SW sw) { DataTable dt = BaseDT.JC_FIRE_PROP.getDT(sw);//列表 JC_FIRE_PROP_Model m = new JC_FIRE_PROP_Model(); if (dt.Rows.Count > 0) { int i = 0; m.JC_FIRE_PROPID = dt.Rows[i]["JC_FIRE_PROPID"].ToString(); m.JCFID = dt.Rows[i]["JCFID"].ToString(); m.GHMJ = dt.Rows[i]["GHMJ"].ToString(); m.GHLDMJ = dt.Rows[i]["GHLDMJ"].ToString(); m.SHSLMJ = dt.Rows[i]["SHSLMJ"].ToString(); m.RYS = dt.Rows[i]["RYS"].ToString(); m.RYW = dt.Rows[i]["RYW"].ToString(); m.MGSD = dt.Rows[i]["MGSD"].ToString(); m.ZDQY = dt.Rows[i]["ZDQY"].ToString(); m.GJJL = dt.Rows[i]["GJJL"].ToString(); m.ZZH = dt.Rows[i]["ZZH"].ToString(); m.QHS = dt.Rows[i]["QHS"].ToString(); m.SSJB = dt.Rows[i]["SSJB"].ToString(); m.FIRELEVEL = dt.Rows[i]["FIRELEVEL"].ToString(); m.FIRECODE = dt.Rows[i]["FIRECODE"].ToString(); } dt.Clear(); dt.Dispose(); return(m); }
/// <summary> /// 获取所有 /// </summary> /// <param name="sw"></param> /// <returns></returns> public static IEnumerable <JC_FIRE_PROP_Model> getListModel(JC_FIRE_PROP_SW sw) { var result = new List <JC_FIRE_PROP_Model>(); DataTable dt = BaseDT.JC_FIRE_PROP.getDT(sw);//列表 for (int i = 0; i < dt.Rows.Count; i++) { JC_FIRE_PROP_Model m = new JC_FIRE_PROP_Model(); m.JC_FIRE_PROPID = dt.Rows[i]["JC_FIRE_PROPID"].ToString(); m.JCFID = dt.Rows[i]["JCFID"].ToString(); m.GHMJ = dt.Rows[i]["GHMJ"].ToString(); m.GHLDMJ = dt.Rows[i]["GHLDMJ"].ToString(); m.SHSLMJ = dt.Rows[i]["SHSLMJ"].ToString(); m.RYS = dt.Rows[i]["RYS"].ToString(); m.RYW = dt.Rows[i]["RYW"].ToString(); m.MGSD = dt.Rows[i]["MGSD"].ToString(); m.ZDQY = dt.Rows[i]["ZDQY"].ToString(); m.GJJL = dt.Rows[i]["GJJL"].ToString(); m.ZZH = dt.Rows[i]["ZZH"].ToString(); m.QHS = dt.Rows[i]["QHS"].ToString(); m.SSJB = dt.Rows[i]["SSJB"].ToString(); m.FIRELEVEL = dt.Rows[i]["FIRELEVEL"].ToString(); result.Add(m); } dt.Clear(); dt.Dispose(); return(result); }
/// <summary> /// 判断记录是否存在 /// </summary> /// <param name="sw">参见模型</param> /// <returns>true存在 false不存在</returns> public static bool isExists(JC_FIRE_PROP_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("select 1 from JC_FIRE_PROP where 1=1"); if (!string.IsNullOrEmpty(sw.JC_FIRE_PROPID)) { sb.AppendFormat(" AND JC_FIRE_PROPID= '{0}'", ClsSql.EncodeSql(sw.JC_FIRE_PROPID)); } return(DataBaseClass.JudgeRecordExists(sb.ToString())); }