Beispiel #1
0
        /// <summary>
        /// 查询当前库中LoaderCode表中,WholeCode前十六位相同的个数并返回
        /// </summary>
        /// <returns></returns>
        private int JudgeLoaderCodeRepeat(string code)
        {
            object tempObject = null;
            string tempString;
            int    countNum = 0;

            if (code.Length != 16)
            {
                return(0);
            }
            LoaderCodeService loaderCodeService = new LoaderCodeService();

            loaderCodeIdRecord  = (int)loaderCodeService.GetLoaderCodeCount();
            loaderCodeIdRecord += 100;
            for (int id = 100; id < loaderCodeIdRecord; id++)
            {
                if (null == (tempObject = loaderCodeService.GetLoaderCodeDataById(id, (string)paraLCStr[(int)JudgePara.useWholeCode])))
                {
                    break;
                }
                tempString = tempObject.ToString();
                if (tempString.Length < 16)
                {
                    continue;
                }
                tempString = tempString.Substring(0, 16);
                if (String.Compare(tempString, code) == 0)
                {
                    countNum++;
                }
            }
            return(countNum);
        }
Beispiel #2
0
        /// <summary>
        /// 判断车型配置是否和数据库中的LoaderCode表中配置重复
        /// 重复弹出重复的配置表对应条目
        /// 不重复弹出null值,注意:还有一种读不到数据的情况,事后要考虑!
        /// </summary>
        private LoaderCode JudgeLoaderCodeRepeat(LoaderCode newLoaderCode, JudgePara judgePara)
        {
            LoaderCode tempLoaderCode;
            object     tempObject = null;
            string     tempString = null, tempLCstr = null;

            if (judgePara == JudgePara.useWholeCode)
            {
                tempLCstr = newLoaderCode.wholeCode;
            }
            if (judgePara == JudgePara.usewholeConfigration)
            {
                tempLCstr = newLoaderCode.wholeConfigration;
            }
            LoaderCodeService loaderCodeService = new LoaderCodeService();

            loaderCodeIdRecord  = (int)loaderCodeService.GetLoaderCodeCount();
            loaderCodeIdRecord += 100;
            for (int id = 100; id < loaderCodeIdRecord; id++)
            {
                if (null == (tempObject = loaderCodeService.GetLoaderCodeDataById(id, (string)paraLCStr[(int)judgePara])))
                {
                    break;
                }
                tempString = tempObject.ToString();
                if (String.Compare(tempString, tempLCstr) == 0)
                {
                    tempLoaderCode = loaderCodeService.ReaderLoaderCodeById(id);
                    return(tempLoaderCode);
                }
            }
            return(null);
        }