コード例 #1
0
        /// <summary>
        /// 验证用户名是否存在
        /// </summary>
        /// <param name="username"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool CheckIsExist(string code, Int32?id)
        {
            List <object> _listParam = new List <object>();
            String        _sql       = " and name=?";

            _listParam.Add(code);
            if (id != null)
            {
                _sql += " and id<>?";
                _listParam.Add(id);
            }

            int count = ClinicarItemDao.FindCountByHql(_sql, _listParam.ToArray());

            return(count > 0 ? true : false);
        }
コード例 #2
0
        /// <summary>
        /// 验证设备编号是否存在
        /// </summary>
        /// <param name="username"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool CheckIsExistForDeviceCode(string deviceCode, string code)
        {
            List <object> _listParam = new List <object>();
            String        whereSql   = " and device_code =? and enabled = 1 ";

            _listParam.Add(deviceCode);

            if (!string.IsNullOrWhiteSpace(code))
            {
                whereSql += " and code <> ?";
                _listParam.Add(code);
            }

            int count = ClinicarItemDao.FindCountByHql(whereSql, _listParam.ToArray());

            return(count > 0 ? true : false);
        }