本文整理汇总了C#中DB.GetTable方法的典型用法代码示例。如果您正苦于以下问题:C# DB.GetTable方法的具体用法?C# DB.GetTable怎么用?C# DB.GetTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB.GetTable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WorkCrawlerCollection
private void WorkCrawlerCollection(object sender, DoWorkEventArgs e)
{
Int32 ThreadProgress = 0;
logWrite = null;
logWatch = null;
BackgroundWorker init = sender as BackgroundWorker;
DB database;
DataTable db_customer = new DataTable();
try
{
// if(!App.DebugMode) this.LogRecheck();
// Sentinel Crawler
init.ReportProgress(0, StateTravox.InitDatabase);
database = new DB("travox_global");
String db = "SELECT id, code, database_name, [description] FROM site_customer ";
db += "WHERE[status] = 'ACTIVE' AND ISNULL(database_name,'') <> '' AND sentinel = 'Y'";
db_customer = database.GetTable(db);
DBTotal = db_customer.Rows.Count;
// Initinalize Database Travox
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Travox Sentinel " + App.PublishVersion.ToString(), MessageBoxButton.OK, MessageBoxImage.Exclamation);
e.Cancel = true;
return;
}
HandlerItems[] TaskAgrs = new HandlerItems[DBTotal];
init.ReportProgress(0, StateTravox.LoadDatabase);
CtrlTotal = this.CrawlerTravoxDBInitialize().Count;
for (Int32 db = 0; db < DBTotal; db++)
{
TaskAgrs[db] = new HandlerItems();
TaskAgrs[db].Items = new List<HandlerCrawler>();
Thread.Sleep(10);
init.ReportProgress(ThreadProgress++, StateTravox.LoadDatabase);
CrawlerDatabase = "Initialize " + db_customer.Rows[db]["description"].ToString();
foreach (Controller item in this.CrawlerTravoxDBInitialize())
{
if (!item.OnceTime || db_customer.Rows[db]["database_name"].ToString() == item.DBName)
{
HandlerCrawler CreatedCrawler = new HandlerCrawler();
CreatedCrawler.Crawler = item;
CreatedCrawler.Crawler.State = new HandlerState();
CreatedCrawler.Crawler.State.ThreadId = Idx;
CreatedCrawler.Crawler.State.DatabaseName = db_customer.Rows[db]["database_name"].ToString();
CreatedCrawler.Crawler.State.CompanyName = db_customer.Rows[db]["description"].ToString();
CreatedCrawler.Crawler.State.CompanyCode = db_customer.Rows[db]["code"].ToString();
CreatedCrawler.Crawler.State.CompanyID = db_customer.Rows[db]["id"].ToString();
CreatedCrawler.Task = Task.Factory.StartNew((object state) => { }, null);
TaskAgrs[db].Items.Add(CreatedCrawler);
this.Task_HandlerControl((object)CreatedCrawler.Crawler);
Idx++;
}
}
}
init.ReportProgress(ThreadProgress++, StateTravox.LoadDatabase);
Thread.Sleep(100); //100
init.ReportProgress(0, StateTravox.InitSuccess);
db_customer.Clear();
db_customer = null;
do
{
for (Int32 db = 0; db < DBTotal; db++)
{
if (!CrawlerRunning) break;
for (Int32 i = 0; i < TaskAgrs[db].Items.Count; i++)
{
if (!CrawlerRunning || !TaskAgrs[db].Items[i].Crawler.SetEnabled) break;
switch (TaskAgrs[db].Items[i].Task.Status)
{
case TaskStatus.Canceled:
case TaskStatus.Faulted:
case TaskStatus.RanToCompletion:
TaskAgrs[db].Items[i].Task.Dispose();
TaskAgrs[db].Items[i].Crawler.IsStarted = true;
TaskAgrs[db].Items[i].Task = Task.Factory.StartNew(Task_HandlerControl, TaskAgrs[db].Items[i].Crawler);
break;
}
}
}
this.WriteLineConsoleCheck();
// Thread Sleep Manual.
init.ReportProgress(0, StateTravox.OnStatus);
Stopwatch SleepTime = new Stopwatch();
TimeSpan _TimeInterval = new TimeSpan(0, 0, 3);
SleepTime.Start();
do { Thread.Sleep(128); } while (CrawlerRunning && SleepTime.ElapsedMilliseconds < _TimeInterval.TotalMilliseconds);
SleepTime.Stop();
// Thread Sleep Manual.
//.........这里部分代码省略.........
示例2: GetPNR
private void GetPNR(object item)
{
String StartMonth = DateTime.Now.AddDays(DateTime.Now.Day * -1).ToString("dd-MM-yyyy");
StateTask State = (StateTask)item;
SQLCollection param = new SQLCollection("@code", DbType.String, State.DB);
param.ANDBetween("TICKET_DATE", "ticket_date", StartMonth, null, DbType.Date);
switch(State.Type)
{
case Business.B2C:
State.DB = new DB("travoxb2b_global", State.DNS, "travox").GetField("SELECT name FROM db_initial WHERE wholesale_code = @code ", param);
break;
case Business.B2B: State.DB = "travoxb2b"; break;
}
DB GD = new DB(State.DB, State.DNS, "travox");
foreach (DataRow PNR in GD.GetTable(base.GetResource("GetPNR(view_header).sql"), param).Rows)
{
param.Add("@booking_info_id", DbType.String ,PNR["ref_id"].ToString());
String booking_pnr_id = GD.Execute("", WithBookingPNR(PNR));
param.Add("@booking_pnr_id", DbType.String, booking_pnr_id);
// PR_view_header_Item.airline_code = PNR["airline_code"].ToString();
// PR_view_header_Item.airline_name = PNR["airline_name"].ToString();
// PR_view_header_Item.gds = PNR["gds"].ToString();
// PR_view_header_Item.client_deadline = PNR["client_deadline"].ToString();
// PR_view_header_Item.airline_deadline = PNR["airline_deadline"].ToString();
// PR_view_header_Item.ticket_date = PNR["ticket_date"].ToString();
// PR_view_header_Item.operate_by_code = PNR["operate_by_code"].ToString();
// PR_view_header_Item.pnr = PNR["pnr"].ToString();
// PR_view_header_Item.ad_cost = PNR["ad_cost")
// PR_view_header_Item.ch_cost = PNR["ch_cost")
// PR_view_header_Item.inf_cost = loopHeader
// PR_view_header_Item.ad_price = PNR["ad_price")
// PR_view_header_Item.ch_price = PNR["ch_price")
// PR_view_header_Item.inf_price = loopHeader
// PR_view_header_Item.ad_tax = PNR["ad_tax")
// PR_view_header_Item.ch_tax = PNR["ch_tax")
// PR_view_header_Item.inf_tax = loopHeader
// PR_view_header_Item.currency = PNR["currency"].ToString();
// PR_view_header_Item.credit_card_success = PNR["credit_card_success"].ToString();
// PR_view_header_Item.service_charge = PNR["service_charge")
// PR_view_header_Item.invoice_name = PNR["invoice_name"].ToString();
// PR_view_header_Item.invoice_address = PNR["invoice_address"].ToString();
// PR_view_header_Item.invoice_district = PNR["invoice_district"].ToString();
// PR_view_header_Item.invoice_province = PNR["invoice_province"].ToString();
// PR_view_header_Item.invoice_postcode = PNR["invoice_postcode"].ToString();
// PR_view_header_Item.invoice_country = PNR["invoice_country"].ToString();
// PR_view_header_Item.invoice_tel = PNR["invoice_tel"].ToString();
// PR_view_header_Item.invoice_fax = PNR["invoice_fax"].ToString();
// PR_view_header_Item.invoice_email = PNR["invoice_email"].ToString();
// PR_view_header_Item.payment_type = PNR["payment_type"]
// PR_view_header_Item.agent_name = PNR["agent_name"].ToString();
// PR_view_header_Item.agent_address = PNR["agent_address"].ToString();
// PR_view_header_Item.insurance_code = PNR["insurance_code"].ToString();
// PR_view_header_Item.insurance_price = PNR["insurance_price"].ToString();
// PR_view_header_Item.import_by = schema_name.ToString()
// 'PR_view_header.Add(PR_view_header_Item)
// iReturn = dtReturn.Rows(0)("ref_id")
}
mres[State.ID].Set();
}