Free cookie consent management tool by TermsFeed Policy Generator

source: branches/WebApplication/MVC2/HLWebOKBQueryPlugin/Views/Query/RunCollectionDetail.ascx.cs @ 5977

Last change on this file since 5977 was 5977, checked in by msammer, 13 years ago

#1446 added user-controls RunCollectionDetail, RunCollectionTable and class RunCollectionData for showing the run-results

File size: 1.9 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Web;
5using System.Web.UI;
6using System.Web.UI.WebControls;
7
8using System.Reflection;
9
10namespace HLWebOKBQueryPlugin.Views.Query {
11    public partial class RunCollectionDetail : System.Web.UI.UserControl {
12        private object currentObject = null;
13        public object detailObject {
14            get { return currentObject; }
15            set {
16                currentObject = value;
17                FillDetails();
18            }
19        }
20
21        protected void Page_Load(object sender, EventArgs e) {
22            currentObject = getTest();
23
24            FillDetails();
25        }
26
27        protected void FillDetails() {
28            if (currentObject != null) {
29                Type rcd = currentObject.GetType();
30
31                foreach (PropertyInfo pi in rcd.GetProperties()) {
32                    TableRow tr = new TableRow();
33                    TableCell tc = new TableCell();
34                    tc.Text = pi.Name;
35                    tr.Cells.Add(tc);
36                    tc = new TableCell();
37                    try {
38                        tc.Text = pi.GetValue(currentObject, null).ToString();
39                    } catch (Exception ex) {
40                        tc.Text = ex.Message;
41                    }
42                    tr.Cells.Add(tc);
43                    TableRunDetail.Rows.Add(tr);
44                }
45            }
46        }
47
48        private RunCollectionData getTest() {
49            OKBQueryService.Run testrun = new OKBQueryService.Run();
50
51            testrun.Id = 34;
52            testrun.Algorithm = new OKBQueryService.Algorithm();
53            testrun.Algorithm.Name = "TestAlgo";
54            testrun.Algorithm.AlgorithmClass = "TestAlgoClass";
55
56            RunCollectionData run = new RunCollectionData(testrun);
57           
58            return run;
59        }
60    }
61}
Note: See TracBrowser for help on using the repository browser.