public IEnumerable <ExecuteTransaction> GetAllTransactions() { ExecuteTransaction transaction = null; List <ExecuteTransaction> transactions = new List <ExecuteTransaction>(); using (OracleConnection connection = new OracleConnection(m_connectionString)) { try { connection.Open(); m_selsctCmd.TblName = "V_TBL_GOODIES_ZAHAL_1272"; using (OracleCommand command = new OracleCommand(m_selsctCmd.GetCmd(), connection)) { command.CommandTimeout = 5000; OracleDataReader reader = command.ExecuteReader(); while (reader.Read()) { transaction = new ExecuteTransaction { ID = ReadInt(reader, "ROW_ID"), PRICE = ReadDouble(reader, "PRICE"), AMOUNT = ReadDouble(reader, "AMOUNT"), KOD_MAKOR = ReadInt(reader, "KOD_MAKOR"), KOD_STATION = ReadInt(reader, "KOD_STATION"), KOD_HETKEN = ReadInt(reader, "KOD_HETKEN"), MISPAR_HETKEN = ReadString(reader, "MISPAR_HETKEN"), TIDLUK_DATE = ReadString(reader, "TIDLUK_DATE"), TIDLUK_TIME = ReadString(reader, "TIDLUK_TIME"), KOD_TAZKIK = ReadInt(reader, "KOD_TAZKIK"), STATION_ORDER = ReadString(reader, "STATION_ORDER"), }; transactions.Add(transaction); } reader.Close(); } } catch (Exception ex) { //insert log error message log.Error($"Exception when try to get all transactions, error message: {ex.Message}"); } finally { connection.Close(); } } return(transactions); }
public bool ExecuteTransaction(ExecuteTransaction transaction, string token, out string errorMessage, out string errorcode, out ExecuteTransactionResponse executeTransactionResponse) { errorcode = ""; errorMessage = ""; string apikey = token; //func-ExecuteTransaction string url = ConfigurationManager.AppSettings["ExecuteTransactionUrl"]; string xml = $@"<?xml version=""1.0"" encoding=""utf-8""?> <soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""> <soap:Body> <ExecuteTransaction xmlns=""http://tempuri.org/"" > <Price>{transaction.PRICE}</Price> <Amount>{transaction.AMOUNT}</Amount> <Kod_makor>{transaction.KOD_MAKOR}</Kod_makor> <Kod_station>{transaction.KOD_STATION}</Kod_station> <Kod_hetken>{transaction.KOD_HETKEN}</Kod_hetken> <Mispar_hetken>{transaction.MISPAR_HETKEN}</Mispar_hetken> <Tidluk_date>{transaction.TIDLUK_DATE}</Tidluk_date> <Tidluk_time>{transaction.TIDLUK_TIME}</Tidluk_time> <Kod_tazkik>{transaction.KOD_TAZKIK}</Kod_tazkik> <Station_order>{transaction.STATION_ORDER}</Station_order> </ExecuteTransaction> </soap:Body> </soap:Envelope>"; string ans = POST(url, apikey, xml); if (ans.Contains("Error message")) { errorMessage = ans; executeTransactionResponse = null; return(false); } XmlDocument doc = new XmlDocument(); doc.LoadXml(ans); executeTransactionResponse = new ExecuteTransactionResponse(doc.InnerText); if (executeTransactionResponse.ResponseCode == "2000") { return(true); } errorcode = doc.InnerText; errorMessage = GetErrorMessage(errorcode); return(false); }
public TransactionController(ExecuteTransaction executeTransaction, GetTransactions getTransactios) { _executeTransaction = executeTransaction; _getTransactions = getTransactios; }