Ejemplo n.º 1
0
        private void comboBoxRiverSystems_OnDropDown(object sender, EventArgs e)
        {
            toolStripStatusLabel1.Text = "Requesting River Systems API Data...";
            statusStrip1.Refresh();
            this.comboBoxRiverSystems.DataSource = null;
            this.comboBoxRiverSystems.SelectedValue = null;
            this.comboBoxRiverSystems.Items.Clear();
            var dTab = IDWRDailySeries.GetIdwrRiverSystems();
            this.comboBoxRiverSystems.DataSource = dTab;
            this.comboBoxRiverSystems.ValueMember = "River";
            this.comboBoxRiverSystems.DisplayMember = "Name";

            ComboBox senderComboBox = this.comboBoxRiverSystems;
            int width = senderComboBox.DropDownWidth;
            Graphics g = senderComboBox.CreateGraphics();
            Font font = senderComboBox.Font;
            int vertScrollBarWidth =
                (senderComboBox.Items.Count > senderComboBox.MaxDropDownItems)
                ? SystemInformation.VerticalScrollBarWidth : 0;

            int newWidth, maxWidth = 156;
            for (int i = 0; i < dTab.Rows.Count; i++)
            {
                string s = dTab.Rows[i]["Name"].ToString();
                newWidth = (int)g.MeasureString(s, font).Width
                    + vertScrollBarWidth;
                if (maxWidth < newWidth)
                { maxWidth = newWidth; }
            }
            senderComboBox.DropDownWidth = maxWidth;
            toolStripStatusLabel1.Text = "Done!";
        }
Ejemplo n.º 2
0
 private void comboBoxRiverSystems_SelectedIndexChanged(object sender, EventArgs e)
 {
     toolStripStatusLabel1.Text = "Requesting River Sites API Data...";
     statusStrip1.Refresh();
     if (comboBoxRiverSystems.SelectedValue is string)
     {
         this.comboBoxRiverSites.DataSource = null;
         this.comboBoxRiverSites.Items.Clear();
         var dTab = IDWRDailySeries.GetIdwrRiverSites(this.comboBoxRiverSystems.SelectedValue.ToString());
         riverSitesTable = dTab;
         FilterSites();
     }
 }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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();
            }
        }