本文整理汇总了C#中OracleConnection.OpenAsync方法的典型用法代码示例。如果您正苦于以下问题:C# OracleConnection.OpenAsync方法的具体用法?C# OracleConnection.OpenAsync怎么用?C# OracleConnection.OpenAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OracleConnection
的用法示例。
在下文中一共展示了OracleConnection.OpenAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QueryBBC
public static async Task<List<TaxBill>> QueryBBC(string criterion, DateTime startDate, DateTime endDate)
{
Dictionary<String, TaxBill> groups = new Dictionary<string, TaxBill>();
List<TaxBill> results = new List<TaxBill>();
using (OracleConnection dbcon = new OracleConnection(bbcConnString))
{
await dbcon.OpenAsync();
OracleCommand dbcmd = dbcon.CreateCommand();
string sql = "select ORDERDOCID as \"receiver_id\", " +
"ORDERID as \"order_id\", " +
"TRANSPORT_NO as \"freight_id\", " +
"HANDLE_DATE as \"last_updated\", " +
"EBSTATUS as \"status\", " +
"RATEABLE_TOTAL as \"tax_total\", " +
//"PRINT_DATE as \"date_of_issue\", " +
"sysdate as \"date_of_issue\", " +
"TAX_NUMBER as \"tax_bill_id\" " +
"from KJECCUS.V_EBILL_FOR_WECHAT " +
"where ORDERDOCID = :criterion " +
"and LIST_NO is not NULL " +
"and ( HANDLE_DATE is null or HANDLE_DATE between :startDate and :endDate )" +
"order by HANDLE_DATE desc";
dbcmd.CommandText = sql;
dbcmd.Parameters.Add(new OracleParameter("criterion", criterion));
dbcmd.Parameters.Add(new OracleParameter("startDate", startDate));
dbcmd.Parameters.Add(new OracleParameter("endDate", endDate));
OracleDataReader reader = dbcmd.ExecuteReader();
while (await reader.ReadAsync())
{
string tax_bill_id = reader["tax_bill_id"] as string;
if (tax_bill_id != null)
{
if (!groups.ContainsKey(tax_bill_id))
{
groups.Add(tax_bill_id, new TaxBill()
{
tax_bill_id = tax_bill_id,
date_of_issue = reader["date_of_issue"] as DateTime?,
tax_total = (Decimal)reader["tax_total"],
orders = new List<Order>()
});
}
TaxBill tb = groups[(string)reader[7]];
tb.orders.Add(new Order()
{
order_id = reader["order_id"] as string,
freight_id = reader["freight_id"] as string,
status = reader["status"] as string,
last_updated = reader["last_updated"] as DateTime?
});
}
else
{
results.Add(new TaxBill()
{
date_of_issue = reader["last_updated"] as DateTime?,
orders = new List<Order>() { new Order() {
order_id = reader["order_id"] as string,
freight_id = reader["freight_id"] as string,
status = reader["status"] as string,
last_updated = reader["last_updated"] as DateTime?
} }
});
}
}
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
}
foreach (var tb in groups.Values)
{
if (tb.date_of_issue == null)
{
tb.date_of_issue = tb.orders.Max(x => x.last_updated);
}
}
results.AddRange(groups.Values);
return results;
}
示例2: QueryBC
public static async Task<List<TaxBill>> QueryBC(string criterion, DateTime startDate, DateTime endDate)
{
Dictionary<String, TaxBill> groups = new Dictionary<string, TaxBill>();
List<TaxBill> results = new List<TaxBill>();
using (OracleConnection dbcon = new OracleConnection(bcConnString))
{
await dbcon.OpenAsync();
OracleCommand dbcmd = dbcon.CreateCommand();
string sql = "select V_RECEIVER_CARDNO as \"receiver_id\", " +
"V_ORDER_NO as \"order_id\", " +
"V_FREIGHT_NO as \"freight_id\", " +
"D_LASTEDITTIME as \"last_updated\", " +
"V_STATUS as \"status\", " +
"N_TAX_MONEY as \"tax_total\", " +
"D_PERSONTAXDATE as \"date_of_issue\", " +
"V_TAX_NO as \"tax_bill_id\" " +
"from V_CONSIGNOR_INFO " +
"where V_RECEIVER_CARDNO = :criterion " +
"and ( D_PERSONTAXDATE is null or D_PERSONTAXDATE between :startDate and :endDate )" +
"order by D_PERSONTAXDATE desc";
dbcmd.CommandText = sql;
dbcmd.Parameters.Add(new OracleParameter("criterion", criterion));
dbcmd.Parameters.Add(new OracleParameter("startDate", startDate));
dbcmd.Parameters.Add(new OracleParameter("endDate", endDate));
OracleDataReader reader = dbcmd.ExecuteReader();
while (await reader.ReadAsync())
{
string tax_bill_id = reader["tax_bill_id"] as string;
if (tax_bill_id != null)
{
if (!groups.ContainsKey(tax_bill_id))
{
groups.Add(tax_bill_id, new TaxBill()
{
tax_bill_id = tax_bill_id,
date_of_issue = reader["date_of_issue"] as DateTime?,
tax_total = (Decimal)reader["tax_total"],
orders = new List<Order>()
});
}
TaxBill tb = groups[(string)reader[7]];
tb.orders.Add(new Order()
{
order_id = reader["order_id"] as string,
freight_id = reader["freight_id"] as string,
status = reader["status"] as string,
last_updated = reader["last_updated"] as DateTime?
});
}
else
{
results.Add(new TaxBill()
{
date_of_issue = reader["last_updated"] as DateTime?,
orders = new List<Order>() { new Order() {
order_id = reader["order_id"] as string,
freight_id = reader["freight_id"] as string,
status = reader["status"] as string,
last_updated = reader["last_updated"] as DateTime?
} }
});
}
}
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
}
foreach (var tb in groups.Values)
{
if (tb.date_of_issue == null)
{
tb.date_of_issue = tb.orders.Max(x => x.last_updated);
}
}
results.AddRange(groups.Values);
return results;
}