本文整理汇总了C#中Operation.GetCustomData方法的典型用法代码示例。如果您正苦于以下问题:C# Operation.GetCustomData方法的具体用法?C# Operation.GetCustomData怎么用?C# Operation.GetCustomData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operation
的用法示例。
在下文中一共展示了Operation.GetCustomData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: using
void IJob.Execute(IJobContext context, Operation operation)
{
using (MySqlConnection conn = CreateConnection())
{
conn.Open();
if (conn.State != System.Data.ConnectionState.Open)
{
Logger.Instance.LogFormat(LogType.Error, this, "Could not open SQL Connection!");
return;
}
// TODO: This string contains CustomData. When actually using this job this should be revised to NOT use any custom data (or make it extensible)!
StringBuilder queryText = new StringBuilder();
queryText.AppendFormat("INSERT INTO {0} ", TableName);
queryText.Append("(Einsatznr, Einsatzort, Einsatzplan, Hinweis, Kreuzung, Meldebild, Mitteiler, Objekt, Ort, Strasse, Fahrzeuge, Alarmtime, Faxtime, Einsatzstichwort, Stichwort) ");
queryText.Append("VALUES (");
queryText.AppendFormat("'{0}', ", operation.OperationNumber);
queryText.AppendFormat("'{0}', ", operation.Einsatzort.Location);
queryText.AppendFormat("'{0}', ", operation.OperationPlan);
queryText.AppendFormat("'{0}', ", operation.Comment);
queryText.AppendFormat("'{0}', ", operation.Einsatzort.Intersection);
queryText.AppendFormat("'{0}', ", operation.Picture);
queryText.AppendFormat("'{0}', ", operation.Messenger);
queryText.AppendFormat("'{0}', ", operation.Einsatzort.Property);
queryText.AppendFormat("'{0}', ", operation.Einsatzort.City);
queryText.AppendFormat("'{0}', ", operation.Einsatzort.Street + " " + operation.Einsatzort.StreetNumber);
queryText.AppendFormat("'{0}', ", operation.Resources.ToString("{FullName} {RequestedEquipment} | ", null));
queryText.AppendFormat("'{0}', ", operation.GetCustomData<string>("Alarmtime"));
queryText.AppendFormat("'{0}', ", operation.GetCustomData<string>("Faxtime"));
queryText.AppendFormat("'{0}', ", operation.Keywords.EmergencyKeyword);
queryText.AppendFormat("'{0}'", operation.Keywords.Keyword);
queryText.Append(")");
MySqlCommand cmd = new MySqlCommand(queryText.ToString(), conn);
cmd.ExecuteNonQuery();
}
}