/// <summary> /// 判断记录是否存在 /// </summary> /// <param name="sw">参见模型</param> /// <returns>true存在 false不存在 </returns> public static bool isExists(WILD_BOTANYDYNAMICPROP_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("select 1 from WILD_BOTANYDYNAMICPROP 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_BOTANYDYNAMICPROP_SW sw) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("SELECT * FROM WILD_BOTANYDYNAMICPROP 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_BOTANYDYNAMICPROP_Model> getListModel(WILD_BOTANYDYNAMICPROP_SW sw) { var result = new List <WILD_BOTANYDYNAMICPROP_Model>(); DataTable dt = BaseDT.WILD_BOTANYDYNAMICPROP.getDT(sw); for (int i = 0; i < dt.Rows.Count; i++) { WILD_BOTANYDYNAMICPROP_Model m = new WILD_BOTANYDYNAMICPROP_Model(); m.WILD_BOTANYDYNAMICPROPID = dt.Rows[i]["WILD_BOTANYDYNAMICPROPID"].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_BOTANYDYNAMICPROP_Model getModel(WILD_BOTANYDYNAMICPROP_SW sw) { DataTable dt = BaseDT.WILD_BOTANYDYNAMICPROP.getDT(sw); WILD_BOTANYDYNAMICPROP_Model m = new WILD_BOTANYDYNAMICPROP_Model(); if (dt.Rows.Count > 0) { int i = 0; //数据库表字段 m.WILD_BOTANYDYNAMICPROPID = dt.Rows[i]["WILD_BOTANYDYNAMICPROPID"].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); }