本文整理汇总了C#中Metadata.TableToXml方法的典型用法代码示例。如果您正苦于以下问题:C# Metadata.TableToXml方法的具体用法?C# Metadata.TableToXml怎么用?C# Metadata.TableToXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Metadata
的用法示例。
在下文中一共展示了Metadata.TableToXml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFullXml
/// <summary>
/// 获取填充xml
/// </summary>
/// <param name="obj">要填充的实体</param>
/// <param name="modelCode">实体名称</param>
/// <returns>返回xml</returns>
public XElement GetFullXml(IEntityBase obj, string modelCode, SubmitData submitData)
{
XElement element = null;
Metadata meta = new Metadata();
string modelType = string.Empty;
if (!string.IsNullOrEmpty(modelCode))
{
modelType = modelCode.ToUpper();
}
else
{
modelType = obj.GetType().Name;
}
List<AutoDictionary> listAutoDic = new List<AutoDictionary>();
string strMainKey = string.Empty;
string strMainValue = string.Empty;
CommonBLL bll = new CommonBLL("");
#region 处理元数据
#region " T_HR_EMPLOYEEOVERTIMERECORD "
if (modelType.ToUpper() == Constants.T_HR_EMPLOYEEOVERTIMERECORD)
{
strMainKey = "OVERTIMERECORDID";
strMainValue = string.Empty;
Type objtype = obj.GetType();
PropertyInfo[] propinfos = objtype.GetProperties();
foreach (PropertyInfo propinfo in propinfos)
{
string keyValue = propinfo.GetValue(obj, null) != null ? propinfo.GetValue(obj, null).ToString() : string.Empty;
if (propinfo.Name == strMainKey)
{
strMainValue = keyValue;
}
}
if (obj is T_HR_EMPLOYEEOVERTIMERECORD)
{
T_HR_EMPLOYEEOVERTIMERECORD entity = obj as T_HR_EMPLOYEEOVERTIMERECORD;
if (submitData.SubmitFlag != SubmitFlag.New && submitData.ApprovalResult == ApprovalResult.NoPass)
{
var overtimeDetail = bll.Query<T_HR_EMPLOYEEOVERTIMERECORD>().Where(w => w.OVERTIMERECORDID == strMainValue).ToList();
//Dictionary<object, object> detail = new Dictionary<object, object>();
//detail.Add(overtimeDetail, null);//normItemConfigList 是2级从表列表
Dictionary<object, object> detail = new Dictionary<object, object>();
detail.Add(entity.T_HR_EMPLOYEEOVERTIMEDETAILRD, null);
listAutoDic.Add(new AutoDictionary
{
TableName = modelType,
KeyValue = "CREATEUSERID",
DataValue = submitData.ApprovalUser.UserID,
DataText = submitData.ApprovalUser.UserName,
Name = "CREATEUSERID"
});
listAutoDic.Add(new AutoDictionary
{
TableName = modelType,
KeyValue = "CREATEPOSTID",
DataValue = submitData.ApprovalUser.PostID,
DataText = submitData.ApprovalUser.PostName,
Name = "CREATEPOSTID"
});
listAutoDic.Add(new AutoDictionary
{
TableName = modelType,
KeyValue = "CREATEDEPARTMENTID",
DataValue = submitData.ApprovalUser.DepartmentID,
DataText = submitData.ApprovalUser.DepartmentName,
Name = "CREATEDEPARTMENTID"
});
listAutoDic.Add(new AutoDictionary
{
TableName = modelType,
KeyValue = "CREATECOMPANYID",
DataValue = submitData.ApprovalUser.CompanyID,
DataText = submitData.ApprovalUser.CompanyName,
Name = "CREATECOMPANYID"
});
}
}
}
#endregion
#endregion
//auditInfo.ObjXml = metaData.TableToXml(yearNormDraft, null, auditInfo.SystemCode, auditInfo.ModelCode, listAutoDic);// 将Detail设置成了null
string xml = meta.TableToXml(obj, null, "HR", modelType, listAutoDic);
element = XElement.Parse(xml);
//SMT.Portal.Common.MetaData metaData = new MetaData();
return element;
//.........这里部分代码省略.........