Пример #1
0
        public DataTable GetSource(IDictionary <IAttributeDefinition, object> criterias, PagingSetting pagingSetting)
        {
            int pageNum   = pagingSetting.PageNum;
            int pageCount = pagingSetting.PageCount;
            int itemCount = pagingSetting.ItemCount;

            IList <IApplication> items = ApplicationBLL.GetAllPaged(criterias, ref pageNum,
                                                                    ref pageCount, pagingSetting.PageSize, ref itemCount);

            pagingSetting.PageNum   = pageNum;
            pagingSetting.PageCount = pageCount;
            pagingSetting.ItemCount = itemCount;

            var od = AppCore.AppSingleton.FindObjDef <ApplicationObjDef>();

            DataTable source = new DataTable("ApplicaitonList");

            source.Columns.AddRange(new DataColumn[]
            {
                new DataColumn(od.ID.Name, typeof(System.String)),
                new DataColumn(od.Type.Name, typeof(System.String)),
                new DataColumn(od.SubType.Name, typeof(System.String)),
                new DataColumn(od.CustomerID.Name, typeof(System.String)),
                new DataColumn(od.CustomerName.Name, typeof(System.String)),
                new DataColumn(od.CustomerSex.Name, typeof(System.String)),
                new DataColumn(od.Region.Name, typeof(System.String)),
                new DataColumn(od.DateApplied.Name, typeof(System.String)),
                new DataColumn(AppCore.AppSingleton.FindObjDef <StatusObjDef>().Value.Name, typeof(System.String)),
            });

            foreach (IApplication item in items)
            {
                source.Rows.Add(new object[]
                {
                    item.ID,
                    item.Type,
                    item.SubType,
                    item.CustomerID,
                    item.CustomerName,
                    item.CustomerSex,
                    item.Region,
                    item.DateApplied,
                    item.Status == null?JobStatus.None.ToLabel():item.Status.Value
                });
            }

            return(source);
        }