예제 #1
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            WeatherBug wb = new WeatherBug();
            WeatherInfo wi = wb.checkWeather("0", "70577");
            Label1.Text = wi.humidity;
            var provider = new PusherProvider("18353", "272a4f27cd993f2801a9", "c846a22521b7ed4c7f83");

            ObjectPusherRequest request = new ObjectPusherRequest("my-channel", "my-event", wi);
            provider.Trigger(request);
        }
예제 #2
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            using (SqlConnection myConnection = new SqlConnection())
            {
                myConnection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["WeatherDBConnectionString"].ConnectionString;
                SqlCommand myCommand = new SqlCommand();
                myCommand.Connection = myConnection;
                myCommand.CommandText = "dbo.uspGetAllClients";
                myCommand.CommandType = CommandType.StoredProcedure;

                DataSet ds = new DataSet();
                SqlDataAdapter daAdapter = new SqlDataAdapter();
                daAdapter.SelectCommand = myCommand;
                daAdapter.Fill(ds);
                var provider = new PusherProvider("18353", "272a4f27cd993f2801a9", "c846a22521b7ed4c7f83");
                foreach (DataRow DR in ds.Tables[0].Rows)
                {
                    string value1;
                    string value2;
                    value1 = DR[0].ToString().Trim();
                    value2 = DR[1].ToString().Trim();
                    WeatherBug wb = new WeatherBug();
                    WeatherInfo wi = wb.checkWeather(value1, value2);
                    Label1.Text = wi.humidity;
                    ObjectPusherRequest request = null;
                    String channel;
                    if (value1 == "0")
                    {
                        channel = "CITY" + value2;
                        request = new ObjectPusherRequest(channel, "my-event", wi);
                    }
                    else if (value1 == "1")
                    {
                        channel = "ZIP" + value2;
                        request = new ObjectPusherRequest(channel, "my-event", wi);

                    }
                    provider.Trigger(request);
                    Literal1.Text += value1 + value2 + "<br />";

                }

                GridView1.DataSource = ds;
                GridView1.DataBind();

            }
        }
예제 #3
0
        public void DoWork()
        {
            using (SqlConnection myConnection = new SqlConnection())
            {
                myConnection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["WeatherDBConnectionString"].ConnectionString;
                SqlCommand myCommand = new SqlCommand();
                myCommand.Connection = myConnection;
                myCommand.CommandText = "dbo.uspGetAllClients";
                myCommand.CommandType = CommandType.StoredProcedure;

                DataSet ds = new DataSet();
                SqlDataAdapter daAdapter = new SqlDataAdapter();
                daAdapter.SelectCommand = myCommand;
                daAdapter.Fill(ds);

                foreach (DataRow DR in ds.Tables[0].Rows)
                {
                    string value1;
                    string value2;
                    value1 = DR[0].ToString().Trim();
                    value2 = DR[1].ToString().Trim();
                    WeatherBug wb = new WeatherBug();
                    WeatherInfo wi = wb.checkWeather(value1, value2);
                    ObjectPusherRequest request = null;
                    String channel;
                    var provider = new PusherProvider("18353", "272a4f27cd993f2801a9", "c846a22521b7ed4c7f83");
                    if (value1 == "0")
                    {
                        channel = "CITY" + value2;
                        request = new ObjectPusherRequest(channel, "my-event", wi);
                    }
                    else if (value1 == "1")
                    {
                        channel = "ZIP" + value2;
                        request = new ObjectPusherRequest(channel, "my-event", wi);

                    }
                    provider.Trigger(request);
                }

            }
        }