/// <summary> /// 判断记录是否存在 /// </summary> /// <param name="sw">参见模型</param> /// <returns>true存在 false不存在 </returns> public static bool isExists(WILD_ANIMALDYNAMICPROP_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("select 1 from WILD_ANIMALDYNAMICPROP where 1=1"); if (string.IsNullOrEmpty(sw.BIOLOGICALTYPECODE) == false) { sb.AppendFormat(" and BIOLOGICALTYPECODE='{0}'", ClsSql.EncodeSql(sw.BIOLOGICALTYPECODE)); } if (string.IsNullOrEmpty(sw.DYNAMICPROPCODE) == false) { sb.AppendFormat(" and DYNAMICPROPCODE='{0}'", ClsSql.EncodeSql(sw.DYNAMICPROPCODE)); } return(DataBaseClass.JudgeRecordExists(sb.ToString())); }
/// <summary> /// 获取数据列表 /// </summary> /// <param name="sw">参见模型</param> /// <returns>参见模型</returns> public static DataTable getDT(WILD_ANIMALDYNAMICPROP_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("SELECT * FROM WILD_ANIMALDYNAMICPROP WHERE 1=1"); if (!string.IsNullOrEmpty(sw.BIOLOGICALTYPECODE)) { sb.AppendFormat(" AND BIOLOGICALTYPECODE = '{0}'", ClsSql.EncodeSql(sw.BIOLOGICALTYPECODE)); } if (!string.IsNullOrEmpty(sw.DYNAMICPROPCODE)) { sb.AppendFormat(" AND DYNAMICPROPCODE = '{0}'", ClsSql.EncodeSql(sw.DYNAMICPROPCODE)); } DataSet ds = DataBaseClass.FullDataSet(sb.ToString()); return(ds.Tables[0]); }
/// <summary> /// 获取数据列表 /// </summary> /// <param name="sw">参见模型</param> /// <returns>参见模型</returns> public static IEnumerable <WILD_ANIMALDYNAMICPROP_Model> getListModel(WILD_ANIMALDYNAMICPROP_SW sw) { var result = new List <WILD_ANIMALDYNAMICPROP_Model>(); DataTable dt = BaseDT.WILD_ANIMALDYNAMICPROP.getDT(sw); for (int i = 0; i < dt.Rows.Count; i++) { WILD_ANIMALDYNAMICPROP_Model m = new WILD_ANIMALDYNAMICPROP_Model(); m.WILD_ANIMALDYNAMICPROPID = dt.Rows[i]["WILD_ANIMALDYNAMICPROPID"].ToString(); m.BIOLOGICALTYPECODE = dt.Rows[i]["BIOLOGICALTYPECODE"].ToString(); m.DYNAMICPROPCODE = dt.Rows[i]["DYNAMICPROPCODE"].ToString(); m.DYNAMICPROPCONTENT = dt.Rows[i]["DYNAMICPROPCONTENT"].ToString(); result.Add(m); } dt.Clear(); dt.Dispose(); return(result); }
/// <summary> /// 获取单条记录 /// </summary> /// <param name="sw">参见模型</param> /// <returns>参见模型</returns> public static WILD_ANIMALDYNAMICPROP_Model getModel(WILD_ANIMALDYNAMICPROP_SW sw) { DataTable dt = BaseDT.WILD_ANIMALDYNAMICPROP.getDT(sw); WILD_ANIMALDYNAMICPROP_Model m = new WILD_ANIMALDYNAMICPROP_Model(); if (dt.Rows.Count > 0) { int i = 0; //数据库表字段 m.WILD_ANIMALDYNAMICPROPID = dt.Rows[i]["WILD_ANIMALDYNAMICPROPID"].ToString(); m.BIOLOGICALTYPECODE = dt.Rows[i]["BIOLOGICALTYPECODE"].ToString(); m.DYNAMICPROPCODE = dt.Rows[i]["DYNAMICPROPCODE"].ToString(); m.DYNAMICPROPCONTENT = dt.Rows[i]["DYNAMICPROPCONTENT"].ToString(); //扩充字段 } dt.Clear(); dt.Dispose(); return(m); }