public static SponsorTransferRequestDto ToDto(this SponsorTransferRequest sponsorTransferRequest)
 {
     return(new SponsorTransferRequestDto
     {
         NewEstablishment = new SponsorTransferEstablishmentDto
         {
             LaborOfficeId = sponsorTransferRequest.NewEstablishmentLaborOfficeId,
             SequenceNumber = sponsorTransferRequest.NewEstablishmentSequenceNumber,
             Name = sponsorTransferRequest.NewEstablishmentName
         },
         Number = new SponsorTransferRequestNumberDto
         {
             LaborOfficeId = sponsorTransferRequest.LaborOfficeId,
             SequenceNumber = sponsorTransferRequest.SeqeunceNumber,
             Year = sponsorTransferRequest.Year
         },
         OldEstablishment = new SponsorTransferEstablishmentDto
         {
             LaborOfficeId = sponsorTransferRequest.OldEstablishmentLaborOfficeId,
             SequenceNumber = sponsorTransferRequest.OldEstablishmentSequenceNumber,
             Name = sponsorTransferRequest.OldEstablishmentName
         },
         ReqeustDate = sponsorTransferRequest.RequestDate,
         StatusId = (int)sponsorTransferRequest.Status,
         Status = sponsorTransferRequest.Status.ToString()
     });
 }
Example #2
0
        private static void ValidateData(long idNumber, SponsorTransferRequest request)
        {
            if (request == null)
            {
                throw new RequestNotFoundException();
            }

            if (request.IdNumber != idNumber)
            {
                throw new UserNotAuthorizedException();
            }
        }
        public string UpdateSponsorTransferRequest(SponsorTransferRequest request, long userIdNumber)
        {
            var returnValue = string.Empty;

            var connection = new OracleConnection(_connectionString);

            OracleCommand command = new OracleCommand
            {
                CommandType = CommandType.StoredProcedure,
                CommandText = $@"{_schema}.srv_trf_appl$web_upd_order",
                Connection  = connection
            };

            command.Parameters.Add("P_LAB_OFF", request.LaborOfficeId);
            command.Parameters.Add("P_SER_YY", request.Year);
            command.Parameters.Add("P_SER_NO", request.SeqeunceNumber);
            command.Parameters.Add("P_ID_NO", request.IdNumber);
            command.Parameters.Add("P_TRS_STUS", (int)request.Status);
            command.Parameters.Add("o_lab_off_cmpy", request.OldEstablishmentLaborOfficeId);
            command.Parameters.Add("o_cmpy_no", request.OldEstablishmentSequenceNumber);
            command.Parameters.Add("p_user_IdNo", userIdNumber);
            command.Parameters.Add("RetVal", OracleDbType.Varchar2, 200, ParameterDirection.ReturnValue, false, 0, 0, string.Empty, DataRowVersion.Current, string.Empty);

            try
            {
                connection.Open();

                command.ExecuteNonQuery();

                returnValue = command.Parameters["RetVal"].Value.ToString();

                if (string.IsNullOrEmpty(returnValue) || returnValue == "-1" || returnValue == "-2" || returnValue == "-3" || returnValue == "-4" || returnValue == "-5")
                {
                    throw new Exception($"Oracle transaction failed during ST Update, oracle statement return {returnValue}");
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                connection?.Close();
            }

            return(returnValue.Trim());
        }