コード例 #1
0
        public WIP_Models.ReturnBody <T2> Validate <T1, T2>(T1 param, ref ExceptionInfoEntity exception)
        {
            ReturnBody <T2> retBody = null;

            #region 验证

            retBody = ValidateDataHelper.CommonValidateIsNULL <T1, T2>(param, ref exception);
            if (retBody != null)
            {
                return(retBody);
            }


            string _userName = param as string;

            if (string.IsNullOrEmpty(_userName))
            {
                retBody = new ReturnBody <T2>()
                {
                    resCode = ResCode.PARAMETERNOEMPTY,
                    resMsg  = "查询登录名不能为空"
                };
            }

            #endregion

            return(retBody);
        }
コード例 #2
0
        public WIP_Models.ReturnBody <T2> Validate <T1, T2>(T1 param, ref ExceptionInfoEntity exception)
        {
            ReturnBody <T2> retBody = null;

            #region 验证

            retBody = ValidateDataHelper.CommonValidateIsNULL <T1, T2>(param, ref exception);
            if (retBody != null)
            {
                return(retBody);
            }

            /*
             * ValidateInStoreParam _param = param as ValidateInStoreParam;
             *
             * List<ValidateModel> columnsList = new List<ValidateModel>() {
             *  new ValidateModel(){ ChinaName="流转卡号", DataType=typeof(string), DataValue=_param.processCardNumber },
             *  new ValidateModel(){ ChinaName="设备号", DataType=typeof(string), DataValue=_param.equipId },
             *  new ValidateModel(){ ChinaName="时间戳", DataType=typeof(DateTime), DataValue=_param.timestamp }
             * };
             * retBody = ValidateDataHelper.CommonValidate<T1, T2>(param, ref exception, columnsList);
             * if (retBody != null)
             * {
             *  return retBody;
             * }
             * //*/

            #endregion

            return(retBody);
        }
コード例 #3
0
        /// <summary>
        /// 公共校验
        /// </summary>
        /// <typeparam name="T1"></typeparam>
        /// <typeparam name="T2"></typeparam>
        /// <param name="param"></param>
        /// <param name="exception"></param>
        /// <param name="columnsList"></param>
        /// <returns></returns>
        public static WIP_Models.ReturnBody <T2> CommonValidate <T1, T2>(T1 param, ref ExceptionInfoEntity exception, List <ValidateModel> columnsList)
        {
            ReturnBody <T2> retBody = null;

            if (param == null)
            {
                exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY;
                retBody = BLLHelpler.GetReturnBody <T2>(ResCode.PARAMETERNOEMPTY, ResMsg.PARAMETERNOEMPTY, exception);
                return(retBody);
            }
            ValidateResModel res = ValidateDataHelper.ValidateNullOrEmpty(columnsList);

            if (res != null && !res.IsValidate)
            {
                exception.exceptionMsg = res.ValidateMsg;
                return(BLLHelpler.GetReturnBody <T2>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception));
            }
            return(retBody);
        }