Beispiel #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (MessageBox.Show("confirm this information ?" + dates.Text + " " + stationTxtCbx.Text + " ", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    u = App.WimeaApp.Dailys.Add();
                    u.Station = stationTxtCbx.Text;
                    u.Maxs = maxTemp.Text;
                    u.Mins = minTemp.Text;
                    u.Actual = Rainfall.Text;
                    u.Anemometer = AnemometerHeight.Text;
                    u.Wind = WindRun.Text;
                    u.Maxi = maxTemp.Text;

                    if (RainfallChk.IsChecked == true)
                        u.Rain = "true";
                    else u.Rain = "false";

                    if (ThunderstormChk.IsChecked == true)
                        u.Thunder = "true";
                    else u.Thunder = "false";
                    if (FogChk.IsChecked == true)
                        u.Fog = "true";
                    else u.Fog = "false";

                    if (HazeChk.IsChecked == true)
                        u.Haze = "true";
                    else u.Haze = "false";

                    if (ThunderstormChk.IsChecked == true)
                        u.Thunder = "true";
                    else u.Thunder = "false";

                    if (HailChk.IsChecked == true)
                        u.Storm = "true";
                    else u.Storm = "false";
                    if (QuakeChk.IsChecked == true)
                        u.Quake = "true";
                    else u.Quake = "false";

                    u.Height = AnemometerHeight.Text;
                    u.Duration = RainDuration.Text;
                    u.Sunshine = Sunshine.Text;
                    u.Radiationtype = Radtype.Text;
                    u.Radiation = Radiation.Text;
                    u.Evaptype1 = EvapType.Text;
                    u.Evap1 = Evap.Text;
                    u.Evaptype2 = Evaptype2.Text;
                    u.Evap2 = Evap2.Text;
                    u.Users = "user";
                    u.Dates = (Convert.ToDateTime(dates.Text).ToString("yyyy-MM-dd"));
                    u.Sync = "F";
                    u.Save();
                    RefreshUserList();
                    clear();

                }
                else
                {

                    return;
                }
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message.ToString());
                return;

            }
        }
Beispiel #2
0
        private string Loading_daily(string station)
        {
            string reply = "";
            try
            {
                string total = "";
                string[] lines = System.IO.File.ReadAllLines(Sending.directoryUrl + station + "-" + "daily" + ".json");
                foreach (string line in lines)
                {

                    total += line;
                }

                List<DailyOnline> model = JsonConvert.DeserializeObject<List<DailyOnline>>(total);

                for (int p = 0; p < model.Count; p++)
                {
                    d = new Daily(null);
                    d.Station = model.ElementAt(p).Station;
                    d.Id = model.ElementAt(p).Id;
                    d.Maxs = model.ElementAt(p).Max;
                    d.Mins = model.ElementAt(p).Min;
                    d.Actual = model.ElementAt(p).Actual;
                    d.Anemometer = model.ElementAt(p).Anemometer;
                    d.Wind = model.ElementAt(p).Wind;
                    d.Maxi = model.ElementAt(p).Maxi;
                    d.Rain = model.ElementAt(p).Rain;
                    d.Thunder = model.ElementAt(p).Thunder;
                    d.Fog = model.ElementAt(p).Fog;
                    d.Haze = model.ElementAt(p).Haze;
                    d.Storm = model.ElementAt(p).Storm;
                    d.Quake = model.ElementAt(p).Quake;
                    d.Height = model.ElementAt(p).Height;
                    d.Duration = model.ElementAt(p).Duration;
                    d.Sunshine = model.ElementAt(p).Sunshine;
                    d.Radiationtype = model.ElementAt(p).Radiationtype;
                    d.Radiation = model.ElementAt(p).Radiation;
                    d.Evaptype1 = model.ElementAt(p).Evaptype1;
                    d.Evap1 = model.ElementAt(p).Evap1;
                    d.Evaptype2 = model.ElementAt(p).Evaptype2;
                    d.Evap2 = model.ElementAt(p).Evap2;
                    d.Users = model.ElementAt(p).User;
                    d.Dates = model.ElementAt(p).Date;
                    d.Sync = "T";
                    d.Save();

                }
                return "Loaded daily information into local database!";
            }
            catch (Exception ex)
            {

                return (ex.Message.ToString());
            }

        }
Beispiel #3
0
        private void loadings(string station)
        {
            metList = new List<Daily>();
            try
            {
                string total = "";
                string[] lines = System.IO.File.ReadAllLines(Sending.directoryUrl + station + "-" + "daily" + ".json");
                foreach (string line in lines)
                {

                    total += line;
                }

                List<DailyOnline> model = JsonConvert.DeserializeObject<List<DailyOnline>>(total);

                for (int d = 0; d < model.Count; d++)
                {
                    u = new Daily(null);
                    u.Station = model.ElementAt(d).Station;
                    u.Id =  model.ElementAt(d).Id;                  
                    u.Maxs =  model.ElementAt(d).Max;
                    u.Mins =  model.ElementAt(d).Min;
                    u.Actual = model.ElementAt(d).Actual;
                    u.Anemometer =  model.ElementAt(d).Anemometer;
                    u.Wind =  model.ElementAt(d).Wind;
                    u.Maxi =  model.ElementAt(d).Maxi;
                    u.Rain =  model.ElementAt(d).Rain;
                    u.Thunder =  model.ElementAt(d).Thunder;
                    u.Fog =  model.ElementAt(d).Fog;
                    u.Haze =  model.ElementAt(d).Haze;
                    u.Storm =  model.ElementAt(d).Storm;
                    u.Quake =  model.ElementAt(d).Quake;
                    u.Height =  model.ElementAt(d).Height;
                    u.Duration =  model.ElementAt(d).Duration;
                    u.Sunshine =  model.ElementAt(d).Sunshine;
                    u.Radiationtype =  model.ElementAt(d).Radiationtype;
                    u.Radiation =  model.ElementAt(d).Radiation;
                    u.Evaptype1 =  model.ElementAt(d).Evaptype1;
                    u.Evap1 =  model.ElementAt(d).Evap1;
                    u.Evaptype2 =  model.ElementAt(d).Evaptype2;
                    u.Evap2 =  model.ElementAt(d).Evap2;
                    u.Users =  model.ElementAt(d).User;                    
                    u.Dates = model.ElementAt(d).Date;
                    metList.Add(u);
                }


                List<Daily> metLists = new List<Daily>(metList.Where(c => Convert.ToDateTime(c.Dates).Month.ToString() == (monthTxtCbx.SelectedIndex + 1).ToString()  && Convert.ToDateTime(c.Dates).Year.ToString() == yearTxtBx.Text).OrderBy(c=>c.Dates));

                MetarGrid.ItemsSource = null;
                MetarGrid.ItemsSource = metLists;




            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message.ToString());
                return;

            }

        }