当前位置: 首页>>代码示例>>C#>>正文


C# Metadata.TableToXml方法代码示例

本文整理汇总了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;
//.........这里部分代码省略.........
开发者ID:JuRogn,项目名称:OA,代码行数:101,代码来源:AuditBLL.cs


注:本文中的Metadata.TableToXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。