Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                config = Application["Configuration"] as Configuration;

                try
                {
                    _defaultParams = new Dictionary<string, string>();
                    string p = Request.Params.Get("days");
                    _defaultParams.Add("days", (p == null) ? config.daysback.ToString() : p);
                    p = Request.Params.Get("cat");
                    _defaultParams.Add("cat", (p == null) ? "" : p);
                    timeline = new Timeline(Server.MapPath("~"), config.datadir, config.timeline);
                    buildCategoryPanels();
                }
                catch (Exception ex)
                {
                    Label l = new Label();
                    l.Text = "Error loading dataset: " + ex.Message;
                    phMain.Controls.Add(l);
                    l = new Label();
                    l.Text = "Stacktrace: " + ex.StackTrace;
                    phMain.Controls.Add(l);
                }
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                config = Application["Configuration"] as Configuration;

                string px = null, py = null;

                if (!IsPostBack)
                {
                    Timeline tl = new Timeline(Server.MapPath("~"), config.datadir, config.timeline);

                    string penultimate = tl.Lookup(tl.RowCount - 2, "ID").ToString();
                    string latest = tl.Lookup(tl.RowCount - 1, "ID").ToString();

                    lstTagX.Items.Add(new ListItem("Latest (" + latest + ")", latest));
                    lstTagX.Items.Add(new ListItem("Penultimate (" + penultimate + ")", penultimate));
                    lstTagY.Items.Add(new ListItem("Latest (" + latest + ")", latest));
                    lstTagY.Items.Add(new ListItem("Penultimate (" + penultimate + ")", penultimate));

                    foreach (KeyValuePair<string, uint> kvp in config.tags)
                    {
                        lstTagX.Items.Add(new ListItem(kvp.Key + " (" + kvp.Value.ToString() + ")", kvp.Value.ToString()));
                        lstTagY.Items.Add(new ListItem(kvp.Key + " (" + kvp.Value.ToString() + ")", kvp.Value.ToString()));
                    }

                    px = Request.Params.Get("jobX");
                    py = Request.Params.Get("jobY");
                    Prefix = Request.Params.Get("prefix");

                    if (px == null) rbnTagX.Checked = true; else { txtIDX.Text = px; rbnIDX.Checked = true; }
                    if (py == null) rbnTagY.Checked = true; else { txtIDY.Text = py; rbnIDY.Checked = true; }

                    if (px != null)
                    {
                        if (config.tags.HasID(px))
                        {
                            rbnTagX.Checked = true;
                            lstTagX.SelectedValue = px;
                        }
                        else
                            lstTagX.SelectedValue = penultimate;
                    }
                    else
                        lstTagX.SelectedValue = penultimate;

                    if (py != null)
                    {
                        if (config.tags.HasID(py))
                        {
                            rbnTagY.Checked = true;
                            lstTagY.Items.FindByText(py.ToString());
                            lstTagY.SelectedValue = py.ToString();
                        }
                        else
                            lstTagY.SelectedValue = latest;
                    }
                    else
                        lstTagY.SelectedValue = latest;
                }

                JX = px != null ? px : rbnTagX.Checked ? lstTagX.SelectedValue : txtIDX.Text;
                JY = py != null ? py : rbnTagY.Checked ? lstTagY.SelectedValue : txtIDY.Text;

                Job jX = null, jY = null;

                try
                {
                    jX = new Job(config.datadir, (uint)Convert.ToInt32(JX), true);
                    jY = new Job(config.datadir, (uint)Convert.ToInt32(JY), true);
                }
                catch (Exception)
                {
                }

                txtIDX.Text = JX;
                txtIDY.Text = JY;

                cmp = new Comparison(jX, jY, Prefix.Replace('|', '\\'), config.tags);

                phPre.Controls.Add(buildHeader("CHART_PRE", ""));
                phChart.Controls.Add(buildChart());
                phHisto.Controls.Add(buildHistogramm());
                phMain.Controls.Add(buildTabPanels());
                //phMain.Controls.Add(buildFooter());
            }
            catch (Exception ex)
            {
                Label l = new Label();
                l.Text = "Error loading dataset: " + ex.Message;
                phMain.Controls.Add(l);
                l = new Label();
                l.Text = "Stacktrace: " + ex.StackTrace;
                phMain.Controls.Add(l);
            }
        }