本文整理汇总了C#中System.Data.DataRow.LogContentInfo方法的典型用法代码示例。如果您正苦于以下问题:C# DataRow.LogContentInfo方法的具体用法?C# DataRow.LogContentInfo怎么用?C# DataRow.LogContentInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.DataRow
的用法示例。
在下文中一共展示了DataRow.LogContentInfo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateItemMetadata
private void UpdateItemMetadata(ContentData item, DataRow row)
{
foreach (DataColumn column in MetadataColumns)
{
ContentMetaData metaData = item.MetaData.SingleOrDefault(cmd => cmd.Name == column.ColumnName);
if (metaData == null)
{
row.LogContentWarn(
"metadata named '{0}' not found",
column.ColumnName);
continue;
}
row.LogContentInfo("setting metadata field '{0}' to '{1}'", metaData.Name, row[column]);
metaData.Text = row[column].ToString();
}
DoContentUpdate(row, item);
}
示例2: DoUpdate
private void DoUpdate(
TaxonomyItemData data, DataRow row, ContentData existingItem, short timeouts = 0, bool failOnFault = false)
{
try
{
if (HasAuthentication)
{
TaxItemManager.Add(data);
row.LogContentInfo("updated successfully with id {0}.", existingItem.Id);
}
else
{
row.LogContentWarn("does not have authentication.");
}
}
catch (TimeoutException te)
{
if (timeouts < 10)
{
row.LogContentInfo("update timed out. Trying again.");
Thread.Sleep(TimeoutWait);
DoUpdate(data, row, existingItem, ++timeouts);
}
else
{
LogUpdateError(row, te);
}
}
catch (FaultException fe)
{
if (!failOnFault
&& fe.Message.Contains("The current user does not have permission to carry out this request"))
{
row.LogContentWarn("had authentication error. Re-authenticating then retrying.");
Authenticate();
DoUpdate(data, row, existingItem, failOnFault: true);
}
else
{
LogUpdateError(row, fe);
}
}
catch (CommunicationException ce)
{
if (!failOnFault)
{
row.LogContentWarn("had communication error. Waiting and then retrying.");
Thread.Sleep(TimeoutWait);
DoUpdate(data, row, existingItem, failOnFault: true);
}
else
{
LogUpdateError(row, ce);
}
}
catch (Exception ex)
{
LogUpdateError(row, ex);
}
}
示例3: UpdateItemTaxonomies
private void UpdateItemTaxonomies(ContentData item, DataRow row)
{
List<TaxonomyItemData> existingDataItems = FindExistingTaxonomyItemsForContent(item);
foreach (DataColumn column in TaxonomyColumns)
{
string[] taxPaths = row[column].ToString()
.Split(
new[] { TaxonomySeparator }, StringSplitOptions.RemoveEmptyEntries);
foreach (string taxPath in taxPaths)
{
row.LogContentInfo("setting taxonomy '{0}'", taxPath);
TaxonomyData tax = GetTaxonomy(taxPath);
if (tax == null || tax.Id <= 0)
{
Log.WarnFormat("Could not find taxonomy with path '{0}'", taxPath);
continue;
}
Log.InfoFormat("Found taxonomy '{0}' with id {1}", taxPath, tax.Id);
TaxonomyItemData data = CheckForExistingTaxonomyDataItem(existingDataItems, tax, row);
data.TaxonomyId = tax.Id;
data.ItemId = item.Id;
data.ItemType = EkEnumeration.TaxonomyItemType.Content;
DoUpdate(data, row, item);
}
}
row.LogContentInfo("updated successfully with taxonomies.");
}
示例4: CheckForExistingTaxonomyDataItem
private static TaxonomyItemData CheckForExistingTaxonomyDataItem(
IEnumerable<TaxonomyItemData> existingDataItems, TaxonomyData tax, DataRow row)
{
TaxonomyItemData data = existingDataItems.FirstOrDefault(d => d.TaxonomyId == tax.Id);
if (data != null)
{
row.LogContentInfo(
"Found an existing taxonomy data item for taxonomy '{0}'",
tax.Name);
}
else
{
data = new TaxonomyItemData();
row.LogContentInfo(
"Did not find an existing taxonomy data item for taxonomy '{0}'", tax.Name);
}
return data;
}
示例5: DoContentAdd
protected void DoContentAdd(DataRow row, ContentData content, short timeouts = 0, bool failOnFault = false)
{
try
{
if (HasAuthentication)
{
DoAPIAddCall(content);
row.LogContentInfo("saved successfully with id {0}.", content.Id);
}
else
{
row.LogContentWarn("does not have authentication.");
}
}
catch (TimeoutException te)
{
if (timeouts < 10)
{
row.LogContentInfo("save timed out. Trying again.");
Thread.Sleep(TimeoutWait);
DoContentAdd(row, content, ++timeouts);
}
else
{
row.LogContentError("failed to save.", te);
}
}
catch (FaultException fe)
{
if (!failOnFault
&& fe.Message.Contains("The current user does not have permission to carry out this request"))
{
row.LogContentWarn("had authentication error. Re-authenticating then retrying.");
Authenticate();
DoContentAdd(row, content, failOnFault: true);
}
else
{
row.LogContentError("failed to save.", fe);
}
}
catch (CommunicationException ce)
{
if (!failOnFault)
{
row.LogContentWarn("had communication error. Waiting and then retrying.");
Thread.Sleep(TimeoutWait);
DoContentAdd(row, content, failOnFault: true);
}
else
{
LogUpdateError(row, ce);
}
}
catch (Exception ex)
{
row.LogContentError("failed to save.", ex);
}
}
示例6: CheckForExistingItem
protected static ContentData CheckForExistingItem(DataRow row, IEnumerable<ContentData> existingItems)
{
row.LogContentInfo("checking for existence in ektron.");
ContentData item;
if (row.IsNew())
{
row.LogContentInfo("no contentId found, checking by title and folder path.");
string title = DestinationHelper.EncodeTitle(row["title"].ToString());
string folderPath = row["folderPath"].ToString();
item = existingItems.FirstOrDefault(ei => ei.Title == title && ei.Path == folderPath);
}
else
{
long id = (long)row["contentId"];
item = existingItems.FirstOrDefault(ei => ei.Id == id);
}
if (item != null)
{
row.LogContentInfo("found existing item.");
}
else
{
row.LogContentInfo("did not find existing item.");
}
return item;
}
示例7: UpdateContent
/// <summary>
/// Updates the existing content item as opposed to adding a new one. The
/// 'title' and 'html' fields are updated.
/// </summary>
/// <param name="row">Row containing data to update in existing content item.</param>
/// <param name="existingItem">Existing content item to update.</param>
protected virtual void UpdateContent(DataRow row, ContentData existingItem)
{
row.LogContentInfo("updating content with id {0}", row["contentId"]);
SetContentFields(row, existingItem);
DoContentUpdate(row, existingItem);
}
示例8: SaveContent
/// <summary>
/// Saves a new content item with the values from the data row.
/// The 'title' and 'html' fields are saved. The item is placed
/// in the folder found using the 'folderPath' column value in the data row.
/// </summary>
/// <param name="row">Row with content data.</param>
protected virtual void SaveContent(DataRow row)
{
row.LogContentInfo("saving in folder '{0}'", row["folderPath"]);
long folderId = _folderUtil.GetFolderId(row);
if (folderId <= 0)
{
row.LogContentWarn("can't save item because no folder was found for it.");
return;
}
ContentData content = GetNewContentDataObject();
SetContentFields(row, content);
content.FolderId = folderId;
DoContentAdd(row, content);
}