コード例 #1
0
        private void loadings(string station)
        {
            metList = new List<Synoptic>();
            try
            {
                string total = "";
                string[] lines = System.IO.File.ReadAllLines(Sending.directoryUrl + station + "-" + "synoptic" + ".json");
                foreach (string line in lines)
                {

                    total += line;
                }

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

                for (int d = 0; d < model.Count; d++)
                {
                    u = new Synoptic(null);
                    u.Station = model.ElementAt(d).Station;
                    u.Date = model.ElementAt(d).Date;
                    u.Time = model.ElementAt(d).Time;
                    u.Ir = model.ElementAt(d).Ir;
                    u.Ix = model.ElementAt(d).Ix;
                    u.H = model.ElementAt(d).H;
                    u.Www = model.ElementAt(d).Www;
                    u.Vv = model.ElementAt(d).Vv;
                    u.N = model.ElementAt(d).N;
                    u.Dd = model.ElementAt(d).Dd;
                    u.Ff = model.ElementAt(d).Ff;
                    u.T = model.ElementAt(d).T;
                    u.Td = model.ElementAt(d).Td;
                    u.Po = model.ElementAt(d).Po;
                    u.Gisis = model.ElementAt(d).Gisis;
                    u.Hhh = model.ElementAt(d).Hhh;
                    u.Rrr = model.ElementAt(d).Rrr;
                    u.Tr = model.ElementAt(d).Tr;
                    u.Present = model.ElementAt(d).Present;
                    u.Past = model.ElementAt(d).Past;
                    u.Nh = model.ElementAt(d).Nh;
                    u.Cl = model.ElementAt(d).Cl;
                    u.Cm = model.ElementAt(d).Cm;
                    u.Ch = model.ElementAt(d).Ch;
                    u.Tq = model.ElementAt(d).Tq;
                    u.Ro = model.ElementAt(d).Ro;
                    u.R1 = model.ElementAt(d).R1;
                    u.Tx = model.ElementAt(d).Tx;
                    u.Tm = model.ElementAt(d).Tm;
                    u.Ee = model.ElementAt(d).Ee;
                    u.E = model.ElementAt(d).E;
                    u.Sss = model.ElementAt(d).Sss;
                    u.Pchange = model.ElementAt(d).Pchange;
                    u.P24 = model.ElementAt(d).P24;
                    u.Rr = model.ElementAt(d).Rr;
                    u.Tr1 = model.ElementAt(d).Tr1;
                    u.Ns = model.ElementAt(d).Ns;
                    u.Ns1 = model.ElementAt(d).Ns1;
                    u.C = model.ElementAt(d).C;
                    u.Hs = model.ElementAt(d).Hs1;
                    u.Ns1 = model.ElementAt(d).N;
                    u.C1 = model.ElementAt(d).C1;
                    u.Hs1 = model.ElementAt(d).Hs1;
                    u.Ns2 = model.ElementAt(d).Ns2;
                    u.C2 = model.ElementAt(d).C2;
                    u.Hs2 = model.ElementAt(d).Hs2;
                    u.Supplementary = model.ElementAt(d).Supplementary;
                    u.Wb = model.ElementAt(d).Wb;
                    u.Rh = model.ElementAt(d).Rh;
                    u.Vap = model.ElementAt(d).Vap;
                    u.Users = model.ElementAt(d).User;
                    u.Submitted = model.ElementAt(d).Submitted; 
                    metList.Add(u);
                }


                List<Synoptic> metLists = new List<Synoptic>(metList.Where(c => Convert.ToDateTime(c.Date).Month.ToString() == (monthTxtCbx.SelectedIndex + 1).ToString() && Convert.ToDateTime(c.Date).Day.ToString() == dayTxtCbx.Text && Convert.ToDateTime(c.Date).Year.ToString() == yearTxtBx.Text));

                SynopticGrid.ItemsSource = null;
                SynopticGrid.ItemsSource = metLists;

            }
            catch (Exception ex)
            {

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

            }


        }
コード例 #2
0
ファイル: Login.xaml.cs プロジェクト: WereDouglas/wimea
        private string Loading_synoptic(string station)
        {
            string reply = "";
            try
            {
                string total = "";
                string[] lines = System.IO.File.ReadAllLines(Sending.directoryUrl + station + "-" + "synoptic" + ".json");
                foreach (string line in lines)
                {

                    total += line;
                }

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

                for (int d = 0; d < model.Count; d++)
                {
                    u = new Synoptic(null);
                    u.Station = model.ElementAt(d).Station;
                    u.Date = model.ElementAt(d).Date + " ";
                    u.Time = model.ElementAt(d).Time + " ";
                    u.Ir = model.ElementAt(d).Ir + " ";
                    u.Ix = model.ElementAt(d).Ix + " ";
                    u.H = model.ElementAt(d).H + " ";
                    u.Www = model.ElementAt(d).Www + " ";
                    u.Vv = model.ElementAt(d).Vv + " ";
                    u.N = model.ElementAt(d).N + " ";
                    u.Dd = model.ElementAt(d).Dd + " ";
                    u.Ff = model.ElementAt(d).Ff + " ";
                    u.T = model.ElementAt(d).T + " ";
                    u.Td = model.ElementAt(d).Td + " ";
                    u.Po = model.ElementAt(d).Po;
                    u.Gisis = model.ElementAt(d).Gisis;
                    u.Hhh = model.ElementAt(d).Hhh + " ";
                    u.Rrr = model.ElementAt(d).Rrr + " ";
                    u.Tr = model.ElementAt(d).Tr + " ";
                    u.Present = model.ElementAt(d).Present + " ";
                    u.Past = model.ElementAt(d).Past + " ";
                    u.Nh = model.ElementAt(d).Nh + " ";
                    u.Cl = model.ElementAt(d).Cl + " ";
                    u.Cm = model.ElementAt(d).Cm + " ";
                    u.Ch = model.ElementAt(d).Ch + " ";
                    u.Tq = model.ElementAt(d).Tq + " ";
                    u.Ro = model.ElementAt(d).Ro + " ";
                    u.R1 = model.ElementAt(d).R1 + " ";
                    u.Tx = model.ElementAt(d).Tx + " ";
                    u.Tm = model.ElementAt(d).Tm + " ";
                    u.Ee = model.ElementAt(d).Ee + " ";
                    u.E = model.ElementAt(d).E + " ";
                    u.Sss = model.ElementAt(d).Sss + " ";
                    u.Pchange = model.ElementAt(d).Pchange + " ";
                    u.P24 = model.ElementAt(d).P24 + " ";
                    u.Rr = model.ElementAt(d).Rr + " ";
                    u.Tr1 = model.ElementAt(d).Tr1 + " ";
                    u.Ns = model.ElementAt(d).Ns + " ";
                    u.Ns1 = model.ElementAt(d).Ns1 + " ";
                    u.C = model.ElementAt(d).C + " ";
                    u.Hs = model.ElementAt(d).Hs1 + " ";
                    u.Ns1 = model.ElementAt(d).N + " ";
                    u.C1 = model.ElementAt(d).C1 + " ";
                    u.Hs1 = model.ElementAt(d).Hs1 + " ";
                    u.Ns2 = model.ElementAt(d).Ns2 + " ";
                    u.C2 = model.ElementAt(d).C2 + " ";
                    u.Hs2 = model.ElementAt(d).Hs2 + " ";
                    u.Supplementary = model.ElementAt(d).Supplementary + " ";
                    u.Wb = model.ElementAt(d).Wb + " ";
                    u.Rh = model.ElementAt(d).Rh + " ";
                    u.Vap = model.ElementAt(d).Vap + " ";
                    u.Users = model.ElementAt(d).User + " ";
                    u.Submitted = model.ElementAt(d).Submitted + " ";
                    u.Sync = "T";
                    u.Save();

                }
                return "Loaded synoptic information into local database!";

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message.ToString());
                return "done loading synoptics";

            }


        }
コード例 #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (MessageBox.Show("confirm this information ?" + present.Text + " " + supplementary.Text + " " + ir.Text, "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {

                    u = App.WimeaApp.Synoptics.Add();
                    u.Station = stationTxtCbx.Text;
                    u.Date = DateTime.Now.ToString() ;
                    u.Time = time.Text;
                    u.Ir = ir.Text;
                    u.Ix = ix.Text;
                    u.H = h.Text;
                    u.Www = present.Text;
                    u.Vv = vv.Text;
                    u.N = n.Text;
                    u.Dd = dd.Text;
                    u.Ff = ff.Text;
                    u.T = t.Text;
                    u.Td = td.Text;
                    u.Po = po.Text;
                    u.Gisis = gisis.Text;
                    u.Hhh = hhh.Text;
                    u.Rrr = rrr.Text;
                    u.Tr = tr.Text;
                    u.Present = present.Text;
                    u.Past = past.Text;
                    u.Nh = nh.Text;
                    u.Cl = c.Text;
                    u.Cm = cm.Text;
                    u.Ch = ch.Text;
                    u.Tq = tq.Text;
                    u.Ro = ro.Text;
                    u.R1 = r1.Text;
                    u.Tx = tx.Text;
                    u.Tm = tm.Text;
                    u.Ee = ee.Text;
                    u.E = es.Text;
                    u.Sss = sss.Text;
                    u.Pchange = pchange.Text;
                    u.P24 = p24.Text;
                    u.Rr = rr.Text;
                    u.Tr1 = tr1.Text;
                    u.Ns = ns.Text;
                    u.Ns1 = ns1.Text;
                    u.C = c.Text;
                    u.Hs = hs.Text;
                    u.Ns1 = ns1.Text;
                    u.C1 = c.Text;
                    u.Hs1 = hs.Text;
                    u.Ns2 = ns.Text;
                    u.C2 = c2.Text;
                    u.Hs2 = hs2.Text;
                    u.Supplementary = supplementary.Text;
                    u.Wb = wb.Text;
                    u.Rh = rh.Text;
                    u.Vap = vap.Text;
                    u.Users = "test";
                    u.Submitted = DateTime.Now.ToString();
                    u.Sync = "F";

                    u.Save();
                    RefreshUserList();
                 

                }
                else
                {

                    return;
                }
            }
           catch (Exception ex)
            {

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

            }
        }