Beispiel #1
0
        //Insert All-Transactions House Price Index for Arizona
        public void InsertAZSTHPI(System.Web.UI.WebControls.ListBox ListBox1)
        {
            string a, b, c, d, e, f, g, h, i;

            FRED m = new FRED();

            a = m.getDate(); // date

            b = "Arizona"; // stateName

            c = m.AZSTHPI(); // all-transactions HPI

            d = "NULL"; // 20rsa

            e = "NULL"; // 20rnsa

            f = "NULL"; // 20rpsnsa

            g = "NULL"; // 10rsa

            h = "NULL"; // 10rnsa

            i = "NULL"; // 10rpsnsa

            if (c == "DNF")
            {
                ListBox1.Text += "AZSTHPI up to date! \n";
            }

            else
            {
                try
                {
                    String query = String.Format("INSERT INTO state_stats VALUES('{0}', '{1}', '{2}', {3}, {4}, {5}, {6}, {7}, {8})", a, b, c, d, e, f, g, h, i);

                    //create command and assign the query and connection from the constructor
                    MySqlCommand cmd = new MySqlCommand(query, connection);

                    //Execute command
                    cmd.ExecuteNonQuery();

                    ListBox1.Text += String.Format("{0} has been updated with AZSTHPI. \n", a);
                }
                catch { UpdateAZSTHPI(c, a, ListBox1); }
            }
        }
Beispiel #2
0
        //Insert PHOENIX CITY unemployment_NSA statement
        public void InsertPhoeURN(System.Web.UI.WebControls.ListBox ListBox1)
        {
            string a, b, c, d, e;

            FRED f = new FRED();

            b = "Phoenix"; // cityName

            c = "Maricopa"; // countyName

            d = "NULL"; // home_price_index

            a = f.getDate(); // date

            e = f.phoeURN(); // unemployment

            if (e == "DNF")
            {
                ListBox1.Text += "phoeURN up to date! \n";
            }

            else
            {

                try
                {
                    String query = String.Format("INSERT INTO city_stats VALUES('{0}', '{1}', '{2}', {3}, '{4}')", a, b, c, d, e);

                    //create command and assign the query and connection from the constructor
                    MySqlCommand cmd = new MySqlCommand(query, connection);

                    //Execute command
                    cmd.ExecuteNonQuery();

                    ListBox1.Text += String.Format("{0} has been updated with phoeURN. \n", a);

                }
                catch { UpdatePhoeURN(e, a, ListBox1); }
            }
        }
Beispiel #3
0
        //Insert PHOENIX CITY home_price_index statement
        public void InsertPHXrnsa(System.Web.UI.WebControls.ListBox ListBox1)
        {
            //open connection
            if (this.OpenConnection() == true)
            {
                string a, b, c, d, e;

                FRED f = new FRED();

                b = "Phoenix"; // cityName

                c = "Maricopa"; // countyName

                d = f.phxrnsa(); // home_price_index

                a = f.getDate(); // date

                e = "NULL"; // unemployment

                MessageBox.Show(a);

                if (d == "DNF")
                {
                    ListBox1.Text = "PHXrnsa up to date! \n";
                }

                else
                {

                    try
                    {

                        String query = String.Format("INSERT INTO city_stats VALUES('{0}', '{1}', '{2}', '{3}', {4})", a, b, c, d, e);

                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connection);

                        //Execute command
                        cmd.ExecuteNonQuery();

                        ListBox1.Text = String.Format("{0} has been updated with PHXrnsa. \n", a);

                    }

                    catch { UpdatePHXrnsa(d, a, ListBox1); }
                }
            }
        }
Beispiel #4
0
        //Insert MARICOPA COUNTY unemployment_NSA statement
        public void InsertMariURN(System.Web.UI.WebControls.ListBox ListBox1)
        {
            string a, b, c, d, e, f;

            FRED m = new FRED();

            a = m.getDate(); // date

            b = "Maricopa"; //countyName

            c = "Arizona"; // stateName

            d = m.AZMARIURN(); // unemployment_NSA

            e = "NULL"; // population_NSA

            f = "NULL"; // labor_force_NSA

            if (d == "DNF")
            {
                ListBox1.Text += "mariURN up to date! \n";
            }

            else
            {
                try
                {
                    String query = String.Format("INSERT INTO county_stats VALUES('{0}', '{1}', '{2}', '{3}', {4}, {5})", a, b, c, d, e, f);

                    //create command and assign the query and connection from the constructor
                    MySqlCommand cmd = new MySqlCommand(query, connection);

                    //Execute command
                    cmd.ExecuteNonQuery();

                    ListBox1.Text += String.Format("{0} has been updated with MariURN. \n", a);
                }
                catch { UpdateMariURN(d, a, ListBox1); }
            }
        }