本文整理汇总了C#中EntityBase.Save方法的典型用法代码示例。如果您正苦于以下问题:C# EntityBase.Save方法的具体用法?C# EntityBase.Save怎么用?C# EntityBase.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityBase
的用法示例。
在下文中一共展示了EntityBase.Save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveNewEntity
//二次分发和追加分发调用
public static ReturnInfo SaveNewEntity(EntityBase EntityData, FormsUIBase info, String ActionName)
{
ReturnInfo RetInfo = new ReturnInfo();
ArrayList ErrList = new ArrayList();
EntityData.ReceiveDateTime = DateTime.Now;
EntityData.ProcessID = info.ProcessID;
EntityData.WorkItemID = info.WorkItemID;
EntityData.StepName = info.StepName;
EntityData.D_StepStatus = ProcessConstString.StepStatus.STATUS_COMPLETED;
EntityData.SubmitAction = ActionName;
EntityData.EnTrans.Begin();
if (!EntityData.Save())
{
ErrList.AddRange(EntityData.ErrMsgs);
}
else
{
info.IdentityID = EntityData.ID;
}
String strErr = String.Empty;
foreach (String str in ErrList)
{
strErr += str + "\\n";
}
if (String.IsNullOrEmpty(strErr.Trim()))
{
//提交事务
RetInfo.IsSucess = true;
EntityData.EnTrans.Commit();
}
else
{
//实体保存出错,回滚
RetInfo.IsSucess = false;
RetInfo.ErrMessage = strErr.Trim();
EntityData.EnTrans.Rollback();
}
return RetInfo;
}
示例2: SaveEntity
public static ReturnInfo SaveEntity(EntityBase entity, bool isSerialize)
{
ReturnInfo RetInfo = new ReturnInfo();
ArrayList ErrList = new ArrayList();
if (isSerialize)
{
String strformdada = XmlUtility.SerializeXml(entity);
entity.FormsData = strformdada;
}
entity.EnTrans.Begin();
if (!entity.Save())
{
ErrList.AddRange(entity.ErrMsgs);
}
String strErr = String.Empty;
foreach (String str in ErrList)
{
strErr += str + "\\n";
}
if (String.IsNullOrEmpty(strErr.Trim()))
{
//提交事务
RetInfo.IsSucess = true;
entity.EnTrans.Commit();
}
else
{
//实体保存出错,回滚
RetInfo.IsSucess = false;
RetInfo.ErrMessage = strErr.Trim();
entity.EnTrans.Rollback();
}
return RetInfo;
}