/// <summary> /// 获取单条记录 /// </summary> /// <param name="sw">参见模型</param> /// <returns>参见模型</returns> public static WILD_LOCALANIMAL_Model getModel(WILD_LOCALANIMAL_SW sw) { DataTable dt = BaseDT.WILD_LOCALANIMAL.getDT(sw); DataTable dtORG = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW { SYSFLAG = ConfigCls.getSystemFlag() }); //获取单位 DataTable dtBiolo = BaseDT.T_SYS_BIOLOGICALTYPE.getDT(new T_SYS_BIOLOGICALTYPE_SW()); WILD_LOCALANIMAL_Model m = new WILD_LOCALANIMAL_Model(); if (dt.Rows.Count > 0) { int i = 0; m.WILD_LOCALANIMALID = dt.Rows[i]["WILD_LOCALANIMALID"].ToString(); m.BYORGNO = dt.Rows[i]["BYORGNO"].ToString(); m.ORGNONAME = BaseDT.T_SYS_ORG.getName(dtORG, m.BYORGNO); m.BIOLOGICALTYPECODE = dt.Rows[i]["BIOLOGICALTYPECODE"].ToString(); m.BIOLOGICALTYPECODENAME = BaseDT.T_SYS_BIOLOGICALTYPE.getName(dtBiolo, m.BIOLOGICALTYPECODE); m.PESTKECODE = m.BIOLOGICALTYPECODE.Substring(0, 10) + "0000"; m.PESTKENAME = BaseDT.T_SYS_BIOLOGICALTYPE.getName(dtBiolo, m.PESTKECODE); m.PESTSHUCODE = m.BIOLOGICALTYPECODE.Substring(0, 12) + "00"; m.PESTSHUNAME = BaseDT.T_SYS_BIOLOGICALTYPE.getName(dtBiolo, m.PESTSHUCODE); } dtORG.Clear(); dtORG.Dispose(); dtBiolo.Clear(); dtBiolo.Dispose(); dt.Clear(); dt.Dispose(); return(m); }
/// <summary> /// 获取数据列表 /// </summary> /// <param name="sw">参见模型</param> /// <returns>参见模型</returns> public static IEnumerable <WILD_LOCALANIMAL_Model> getListModel(WILD_LOCALANIMAL_SW sw) { var result = new List <WILD_LOCALANIMAL_Model>(); DataTable dtORG = BaseDT.T_SYS_ORG.getDT(new T_SYS_ORGSW { SYSFLAG = ConfigCls.getSystemFlag() }); //获取单位 DataTable dtBiolo = BaseDT.T_SYS_BIOLOGICALTYPE.getDT(new T_SYS_BIOLOGICALTYPE_SW()); DataTable dt = BaseDT.WILD_LOCALANIMAL.getDT(sw); for (int i = 0; i < dt.Rows.Count; i++) { WILD_LOCALANIMAL_Model m = new WILD_LOCALANIMAL_Model(); m.WILD_LOCALANIMALID = dt.Rows[i]["WILD_LOCALANIMALID"].ToString(); m.BYORGNO = dt.Rows[i]["BYORGNO"].ToString(); m.ORGNONAME = BaseDT.T_SYS_ORG.getName(dtORG, m.BYORGNO); m.BIOLOGICALTYPECODE = dt.Rows[i]["BIOLOGICALTYPECODE"].ToString(); m.BIOLOGICALTYPECODENAME = BaseDT.T_SYS_BIOLOGICALTYPE.getName(dtBiolo, m.BIOLOGICALTYPECODE); m.PESTKECODE = m.BIOLOGICALTYPECODE.Substring(0, 10) + "0000"; m.PESTKENAME = BaseDT.T_SYS_BIOLOGICALTYPE.getName(dtBiolo, m.PESTKECODE); m.PESTSHUCODE = m.BIOLOGICALTYPECODE.Substring(0, 12) + "00"; m.PESTSHUNAME = BaseDT.T_SYS_BIOLOGICALTYPE.getName(dtBiolo, m.PESTSHUCODE); result.Add(m); } dtORG.Clear(); dtORG.Dispose(); dtBiolo.Clear(); dtBiolo.Dispose(); dt.Clear(); dt.Dispose(); return(result); }
/// <summary> /// 获取所有科级及以下生物及对应地区已关联的生物列表 /// </summary> /// <param name="sw">sw</param> /// <returns></returns> public static IEnumerable <T_SYS_BIOLOGICALTYPE_WILD_LOCALANIMAL_Model> GetWILD_LOCALANIMALModel(WILD_LOCALANIMAL_SW sw) { List <WILD_LOCALANIMAL_Model> joinList = getListModel(new WILD_LOCALANIMAL_SW { BYORGNO = sw.BYORGNO }).ToList(); DataTable dtbiolog = BaseDT.T_SYS_BIOLOGICALTYPE.getDT(new T_SYS_BIOLOGICALTYPE_SW { BIOLOCODE = "01000000000000", IsOnlyGetKe = true }); return(GetWILD_LOCALANIMALModel(joinList, dtbiolog, "")); }