Beispiel #1
0
        /// <summary>
        /// 判断记录是否存在下级
        /// </summary>
        /// <param name="sw">参见模型</param>
        /// <returns>true存在 false不存在 </returns>
        public static bool isExistsChild(T_SYS_BIOLOGICALTYPE_SW sw)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("Select 1 from T_SYS_BIOLOGICALTYPE Where 1=1");
            if (string.IsNullOrEmpty(sw.BIOLOCODE) == false)
            {
                string code = "";
                if (PublicCls.BioCodeIsJie(sw.BIOLOCODE))
                {
                    code = PublicCls.GetJieBioCode(sw.BIOLOCODE);
                }
                if (PublicCls.BioCodeIsMen(sw.BIOLOCODE))
                {
                    code = PublicCls.GetMenBioCode(sw.BIOLOCODE);
                }
                if (PublicCls.BioCodeIsGang(sw.BIOLOCODE))
                {
                    code = PublicCls.GetGangBioCode(sw.BIOLOCODE);
                }
                if (PublicCls.BioCodeIsMu(sw.BIOLOCODE))
                {
                    code = PublicCls.GetMuBioCode(sw.BIOLOCODE);
                }
                if (PublicCls.BioCodeIsKe(sw.BIOLOCODE))
                {
                    code = PublicCls.GetKeBioCode(sw.BIOLOCODE);
                }
                if (PublicCls.BioCodeIsShu(sw.BIOLOCODE))
                {
                    code = PublicCls.GetShuBioCode(sw.BIOLOCODE);
                }
                if (PublicCls.BioCodeIsZHong(sw.BIOLOCODE))
                {
                    code = PublicCls.GetZhongBioCode(sw.BIOLOCODE);
                }
                sb.AppendFormat(" AND Substring(BIOLOCODE,1,{0})= '{1}' AND BIOLOCODE <> '{2}'", ClsSql.EncodeSql(code).Length, ClsSql.EncodeSql(code), ClsSql.EncodeSql(sw.BIOLOCODE));
            }
            return(DataBaseClass.JudgeRecordExists(sb.ToString()));
        }