示例#1
0
        public List <FBDataGrid.FBGridItem> GetBorrowItems()
        {
            string   xmlDoc = @"<?xml version=""1.0"" encoding=""utf-8"" ?><GridItems>
                <GridItem PropertyDisplayName=""借款项目"" PropertyName=""REPAYTYPE"" Width=""100"" IsReadOnly=""true"" ReferenceType=""RepayType""/>
                <GridItem PropertyDisplayName=""借款余额"" PropertyName=""BORROWMONEY"" Width=""75"" IsReadOnly=""true"" />
                <GridItem PropertyDisplayName=""摘要"" PropertyName=""REMARK"" Width=""200"" IsReadOnly=""flase""/>
                <GridItem PropertyDisplayName=""还款金额"" PropertyName=""REPAYMONEY"" Width=""75"" IsReadOnly=""flase""/>
            </GridItems>";
            XElement xml    = XElement.Parse(xmlDoc);

            XElement xElement = xml;
            List <FBDataGrid.FBGridItem> list = new List <FBDataGrid.FBGridItem>();

            foreach (XElement xeItem in xElement.Elements("GridItem"))
            {
                FBDataGrid.FBGridItem gridItem = new FBDataGrid.FBGridItem();
                Type type = typeof(FBDataGrid.FBGridItem);
                xeItem.Attributes().ForEach(item =>
                {
                    PropertyInfo p = type.GetProperty(item.Name.LocalName);
                    if (p != null)
                    {
                        object v = item.Value.ConvertOrNull(p.PropertyType, null, null, DateTimeStyles.None, null);
                        p.SetValue(gridItem, v, null);
                    }
                });
                list.Add(gridItem);
            }
            return(list);
        }
示例#2
0
        public List <FBDataGrid.FBGridItem> GetItems()
        {
            string   xmlDoc = @"<?xml version=""1.0"" encoding=""utf-8"" ?><GridItems>
                <GridItem PropertyDisplayName=""科目名称"" PropertyName=""Entity.T_FB_SUBJECT.SUBJECTNAME"" Width=""150"" IsReadOnly=""true""/>
                <GridItem PropertyDisplayName=""可用结余"" PropertyName=""Entity.USABLEMONEY"" Width=""75"" IsReadOnly=""true""/>
                <GridItem PropertyDisplayName=""摘要"" PropertyName=""Entity.REMARK"" Width=""175"" MaxLength=""200""/>
                <GridItem PropertyDisplayName=""报销金额"" PropertyName=""Entity.APPLIEDMONEY"" Width=""75""/>

            </GridItems>";
            XElement xml    = XElement.Parse(xmlDoc);

            XElement xElement = xml;
            List <FBDataGrid.FBGridItem> list = new List <FBDataGrid.FBGridItem>();

            foreach (XElement xeItem in xElement.Elements("GridItem"))
            {
                FBDataGrid.FBGridItem gridItem = new FBDataGrid.FBGridItem();
                Type type = typeof(FBDataGrid.FBGridItem);
                xeItem.Attributes().ForEach(item =>
                {
                    PropertyInfo p = type.GetProperty(item.Name.LocalName);
                    if (p != null)
                    {
                        object v = item.Value.ConvertOrNull(p.PropertyType, null, null, DateTimeStyles.None, null);
                        p.SetValue(gridItem, v, null);
                    }
                });
                list.Add(gridItem);
            }
            return(list);
        }