Example #1
0
        private RESTfulModel ClientValidateIP(string ip)
        {
            if (ValidateHelper.IsNullOrEmpty(ip))
            {
                return(new RESTfulModel()
                {
                    Code = (int)CodeEnum.客户端IP不能为空, Msg = codeMsgDAL.GetByCode((int)CodeEnum.客户端IP不能为空)
                });
            }

            if (ValidateHelper.IP(ip))
            {
                return(new RESTfulModel()
                {
                    Code = (int)CodeEnum.成功, Msg = codeMsgDAL.GetByCode((int)CodeEnum.成功)
                });
            }
            else
            {
                return(new RESTfulModel()
                {
                    Code = (int)CodeEnum.客户端IP格式错误, Msg = codeMsgDAL.GetByCode((int)CodeEnum.客户端IP格式错误)
                });
            }
        }
Example #2
0
        private BaseModel ClientValidateIP(string ip)
        {
            #region 非数据库端验证ip
            if (ValidateHelper.IsNullOrEmpty(ip))
            {
                return(new BaseModel()
                {
                    Code = (int)CodeEnum.IP不能为空, Msg = CodeMsgDAL.GetByCode((int)CodeEnum.IP不能为空)
                });
            }
            if (!ValidateHelper.IP(ip))
            {
                return(new BaseModel()
                {
                    Code = (int)CodeEnum.IP格式错误, Msg = CodeMsgDAL.GetByCode((int)CodeEnum.IP格式错误)
                });
            }
            #endregion

            return(new BaseModel()
            {
                Code = (int)CodeEnum.成功, Msg = string.Format(CodeMsgDAL.GetByCode((int)CodeEnum.成功), "成功")
            });
        }