Ejemplo n.º 1
0
        private string Loading_allinstruments()
        {

            //try
            //{
            string total = "";
            string[] lines = System.IO.File.ReadAllLines(Sending.directoryUrl + "center-" + "instruments" + ".json");
            foreach (string line in lines)
            {

                total += line;
            }

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

            for (int d = 0; d < model.Count; d++)
            {
                i = new Instrument(null);
                i.Station = model.ElementAt(d).Station;
                i.Name = model.ElementAt(d).Name;
                i.Element = model.ElementAt(d).Element;
                i.DateRegister = model.ElementAt(d).DateRegister;
                i.DateExpire = model.ElementAt(d).DateExpire;
                i.Code = model.ElementAt(d).Code;
                i.Manufacturer = model.ElementAt(d).Manufacturer;
                i.Description = model.ElementAt(d).Description;
                i.Submitted = model.ElementAt(d).Submitted;
                i.Sync = "T";
                i.Save();

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

            //}
            //catch (Exception ex)
            //{

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

            //}


        }
Ejemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (MessageBox.Show("confirm this information ?" + name.Text + " " + stationTxtCbx.Text + " ", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    u = App.WimeaApp.Instruments.Add();
                    u.Station = stationTxtCbx.Text;
                    u.Name = name.Text;
                    u.Element = element.Text;
                    u.DateRegister = datesRegister.Text;
                    u.DateExpire = dateExpire.Text;
                    u.Code = code.Text;
                    u.Manufacturer = manufacturer.Text;
                    u.Description = description.Text;
                    u.Submitted = DateTime.Now.ToString();                            
                    u.Sync = "F";
                    u.Save();
                    RefreshUserList();
                    clear();

                }
                else
                {

                    return;
                }
            }
            catch (Exception ex)
            {

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

            }
        }