コード例 #1
0
 public override BaseResponseMessage ValidateInput()
 {
     #region Validation HeaderRequest
     BaseResponseMessage resp = new BaseResponseMessage();
     resp.header = new ResponseHeader();
     if (this.request.Header.ApiKey != CommonDefinitions.APIKEY)
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.API_KEY_NOT_MATCH;
     }
     else if (this.request.Header.Device == 0)
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.DEVICE_INFORMATION_NOT_FOUND;
     }
     else if (String.IsNullOrEmpty(this.request.Header.RequestId))
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.REQUEST_ID_NOT_FOUND;
     }
     else if (!ValidateIdentificationNumber.CheckIdentificationNumber(this.request.IDENTIFICATION_ID.ToString()))
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.IDENTIFICATION_ID_NOT_VALID;
     }
     else if (this.request.PASSWORD_HASH.Length < 1)
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.PASSWORD_NOT_VALID;
     }
     else if (this.request.Header.OperationTypes != (int)OperationType.OperationTypes.ADD)
     {
         if (!Tokenizer.checkToken(this.request.Header.TokenId, this.request.CUSTOMER_NUMBER))
         {
             resp.header.IsSuccess       = false;
             resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
             resp.header.ResponseMessage = CommonDefinitions.TOKEN_NOT_VALID;
         }
         else
         {
             resp.header.IsSuccess       = true;
             resp.header.ResponseCode    = CommonDefinitions.SUCCESS;
             resp.header.ResponseMessage = CommonDefinitions.SUCCESS_MESSAGE;
         }
     }
     else
     {
         resp.header.IsSuccess       = true;
         resp.header.ResponseCode    = CommonDefinitions.SUCCESS;
         resp.header.ResponseMessage = CommonDefinitions.SUCCESS_MESSAGE;
     }
     #endregion
     return(resp);
 }
コード例 #2
0
 public override BaseResponseMessage ValidateInput()
 {
     #region Validation HeaderRequest
     BaseResponseMessage resp = new BaseResponseMessage();
     resp.header = new ResponseHeader();
     if (this.request.Header.ApiKey != CommonDefinitions.APIKEY)
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.API_KEY_NOT_MATCH;
     }
     else if (this.request.Header.Device == 0)
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.DEVICE_INFORMATION_NOT_FOUND;
     }
     else if (String.IsNullOrEmpty(this.request.Header.RequestId))
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.REQUEST_ID_NOT_FOUND;
     }
     else if (!ValidateIdentificationNumber.CheckIdentificationNumber(this.request.IDENTIFICATION_ID.ToString()))
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.IDENTIFICATION_ID_NOT_VALID;
     }
     else if (String.IsNullOrEmpty(this.request.PHONE_NUMBER))
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.PHONE_NUMBER_NOT_FOUND;
     }
     else if (String.IsNullOrEmpty(this.request.CAPTAIN_NAME))
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.INVALID_NAME;
     }
     else if (String.IsNullOrEmpty(this.request.CAPTAIN_SURNAME))
     {
         resp.header.IsSuccess       = false;
         resp.header.ResponseCode    = CommonDefinitions.INTERNAL_SYSTEM_VALIDATION_ERROR;
         resp.header.ResponseMessage = CommonDefinitions.INVALID_NAME;
     }
     else
     {
         resp.header.IsSuccess       = true;
         resp.header.ResponseCode    = CommonDefinitions.SUCCESS;
         resp.header.ResponseMessage = CommonDefinitions.SUCCESS_MESSAGE;
     }
     #endregion
     return(resp);
 }