Ejemplo n.º 1
0
        public static FundTransferResponse TranslateAsFTResponse(this SqlDataReader reader, bool isList = false)
        {
            if (!isList)
            {
                if (!reader.HasRows)
                {
                    return(null);
                }
                reader.Read();
            }
            var item = new FundTransferResponse();

            if (reader.IsColumnExists("ReferenceNumber"))
            {
                item.ReferenceNumber = SqlHelper.GetNullableString(reader, "ReferenceNumber");
            }

            if (reader.IsColumnExists("ValueDate"))
            {
                item.ValueDate = SqlHelper.GetNullableString(reader, "ValueDate");
            }


            return(item);
        }
Ejemplo n.º 2
0
        public Response <FundTransferResponse> TransferFunds(FundTransferModel model)
        {
            Response <FundTransferResponse> response = new Response <FundTransferResponse>();

            var outStatus = new SqlParameter("@Status", SqlDbType.NVarChar, 20)
            {
                Direction = ParameterDirection.Output
            };
            var outMessage = new SqlParameter("@Message", SqlDbType.NVarChar, -1)
            {
                Direction = ParameterDirection.Output
            };

            SqlParameter[] param =
            {
                new SqlParameter("@customerid",  model.CustomerId),
                new SqlParameter("@fromAccount", model.FromAccount),
                new SqlParameter("@toaccount",   model.ToAccount),
                new SqlParameter("@amount",      model.Amount),
                new SqlParameter("@remarks",     model.Remarks),
                outStatus,
                outMessage
            };


            FundTransferResponse result = SqlHelper.ExtecuteProcedureReturnData <FundTransferResponse>
                                              ("sp_TranferFunds",
                                              r => r.TranslateAsFTResponse(), param);


            response.Data    = result;
            response.Status  = outStatus.Value.ToString();
            response.Message = outMessage.Value.ToString();

            return(response);
        }