Exemplo n.º 1
0
        private void comboBoxRiverSites_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxRiverSites.SelectedValue is string)
            {
                toolStripStatusLabel1.Text = "Requesting Site Information API Data...";
                statusStrip1.Refresh();
                var dTab = IDWRDailySeries.GetIdwrSiteInfo(this.comboBoxRiverSites.SelectedValue.ToString());

                switch (dTab.Rows[0]["SiteType"].ToString())
                {
                case "F":
                case "Y":
                case "E":
                case "W":
                case "P":
                {
                    this.radioButtonGH.Enabled = false;
                    this.radioButtonFB.Enabled = false;
                    this.radioButtonAF.Enabled = false;
                    this.radioButtonQD.Enabled = true;
                    this.radioButtonQD.Checked = true;
                    this.buttonOK.Enabled      = true;
                    break;
                }

                case "D":
                {
                    this.radioButtonGH.Enabled = true;
                    this.radioButtonFB.Enabled = false;
                    this.radioButtonAF.Enabled = false;
                    this.radioButtonQD.Enabled = true;
                    this.radioButtonQD.Checked = true;
                    this.buttonOK.Enabled      = true;
                    break;
                }

                case "R":
                {
                    this.radioButtonGH.Enabled = false;
                    this.radioButtonFB.Enabled = true;
                    this.radioButtonAF.Enabled = true;
                    this.radioButtonQD.Enabled = false;
                    this.radioButtonFB.Checked = true;
                    this.buttonOK.Enabled      = true;
                    break;
                }

                default:
                {
                    this.radioButtonGH.Enabled = false;
                    this.radioButtonFB.Enabled = false;
                    this.radioButtonAF.Enabled = false;
                    this.radioButtonQD.Enabled = false;
                    this.radioButtonFB.Checked = false;
                    this.buttonOK.Enabled      = false;
                    break;
                }
                }
                this.labelName.Text = "Name: " + dTab.Rows[0]["FullName"].ToString();
                //this.labelSID.Text = "Site ID: " + dTab.Rows[0]["SiteID"].ToString();
                this.textBoxSID.Text       = dTab.Rows[0]["SiteID"].ToString();
                this.labelYears.Text       = "Years Available: " + dTab.Rows[0]["Years"].ToString();
                this.labelSType.Text       = "Site Type: " + dTab.Rows[0]["SiteType"].ToString();
                toolStripStatusLabel1.Text = "Done!";
                statusStrip1.Refresh();
                ValidateDates(sender, e);
            }
        }
Exemplo n.º 2
0
        private void comboBoxRiverSites_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxRiverSites.SelectedValue is string)
            {
                toolStripStatusLabel1.Text = "Requesting Site Information API Data...";
                statusStrip1.Refresh();

                var dType = Reclamation.TimeSeries.IDWR.DataType.HST;
                if (this.radioButtonAccounting.Checked)
                {
                    dType = Reclamation.TimeSeries.IDWR.DataType.ALC;
                }

                var dTab = IDWRDailySeries.GetIdwrSiteInfo(this.comboBoxRiverSites.SelectedValue.ToString(), dType);
                var dRow = riverSitesTable.Select("SiteID = '" + this.comboBoxRiverSites.SelectedValue.ToString() + "'");                
                if (dRow.Length > 0)
                {
                    this.radioButtonHistorical.Text = "Historical (" + dRow[0]["HSTCount"].ToString() + " years)";
                    this.radioButtonAccounting.Text = "Accounting (" + dRow[0]["ALCCount"].ToString() + " years)";
                }
                selectedSiteType = dTab.Rows[0]["SiteType"].ToString();

                if (this.radioButtonHistorical.Checked)
                {
                    this.tabControl1.Enabled = false;
                    switch (selectedSiteType)
                    {
                        case "F":
                        case "Y":
                        case "E":
                        case "W":
                        case "P":
                            {
                                this.radioButtonGH.Enabled = false;
                                this.radioButtonFB.Enabled = false;
                                this.radioButtonAF.Enabled = false;
                                this.radioButtonQD.Enabled = true;
                                this.radioButtonQD.Checked = true;
                                this.buttonOK.Enabled = true;
                                break;
                            }
                        case "D":
                            {
                                this.radioButtonGH.Enabled = true;
                                this.radioButtonFB.Enabled = false;
                                this.radioButtonAF.Enabled = false;
                                this.radioButtonQD.Enabled = true;
                                this.radioButtonQD.Checked = true;
                                this.buttonOK.Enabled = true;
                                break;
                            }
                        case "R":
                            {
                                this.radioButtonGH.Enabled = false;
                                this.radioButtonFB.Enabled = true;
                                this.radioButtonAF.Enabled = true;
                                this.radioButtonQD.Enabled = false;
                                this.radioButtonFB.Checked = true;
                                this.buttonOK.Enabled = true;
                                break;
                            }
                        default:
                            {
                                this.radioButtonGH.Enabled = false;
                                this.radioButtonFB.Enabled = false;
                                this.radioButtonAF.Enabled = false;
                                this.radioButtonQD.Enabled = false;
                                this.radioButtonFB.Checked = false;
                                this.buttonOK.Enabled = false;
                                break;
                            }
                    }
                }
                else //this.radioButtonAccounting.Checked
                {
                    this.radioButtonQD.Enabled = false;
                    this.radioButtonGH.Enabled = false;
                    this.radioButtonFB.Enabled = false;
                    this.radioButtonAF.Enabled = false;
                    this.radioButtonQD.Checked = false;
                    this.radioButtonGH.Checked = false;
                    this.radioButtonFB.Checked = false;
                    this.radioButtonAF.Checked = false;
                    this.tabControl1.Enabled = true;

                    switch (selectedSiteType)
                    {
                        case "F":
                            {
                                this.tabControl1.SelectedTab = tabControl1.TabPages["tabPageStream"];
                                this.radioButtonNatQ.Checked = true;
                                this.buttonOK.Enabled = true;
                                break;
                            }
                        case "R":
                            {
                                this.tabControl1.SelectedTab = tabControl1.TabPages["tabPageReservoir"];
                                this.radioButtonTotAcc.Checked = true;
                                this.buttonOK.Enabled = true;
                                break;
                            }
                        case "D":
                        case "P":
                            {
                                this.tabControl1.SelectedTab = tabControl1.TabPages["tabPageDiversion"];
                                this.radioButtonStorDiv2Date.Checked = true;
                                this.buttonOK.Enabled = true;
                                break;
                            }
                        default:
                            {
                                this.tabControl1.TabPages["tabPageStream"].Select();
                                this.radioButtonNatQ.Checked = true;
                                this.buttonOK.Enabled = false;
                                break;
                            }
                    }
                }
                this.labelName.Text = "Name: " + dTab.Rows[0]["FullName"].ToString();
                //this.labelSID.Text = "Site ID: " + dTab.Rows[0]["SiteID"].ToString();
                this.textBoxSID.Text = dTab.Rows[0]["SiteID"].ToString();
                this.labelYears.Text = "Years Available: " + dTab.Rows[0]["Years"].ToString();
                this.labelSType.Text = "Site Type: " + dTab.Rows[0]["SiteType"].ToString();
                toolStripStatusLabel1.Text = "Done!";
                statusStrip1.Refresh();
                ValidateDates();
            }
        }