コード例 #1
0
ファイル: AddUser.xaml.cs プロジェクト: WereDouglas/wimea
                private void btnDialogOk_Click(object sender, RoutedEventArgs e)
                {
                    try
                    {
                        _user = App.WimeaApp.Users.Add();
                        _user.Name = nameTxtBx.Text;
                        _user.Email = emailTxtBx.Text;
                        _user.Contact = contactTxtBx.Text;
                        _user.Role = roleTxtBx.Text;
                        _user.Station = stationTxtCbx.Text;
                        _user.Save();
                        this.DialogResult = true;
                    }
                    catch (Exception ex) {

                        MessageBox.Show(ex.Message.ToString());
                        return;
                    
                    }
                    
                   
                }
コード例 #2
0
ファイル: Login.xaml.cs プロジェクト: WereDouglas/wimea
        private string Loading_users()
        {
            try
            {
                string total = "";
                string[] lines = System.IO.File.ReadAllLines(Sending.directoryUrl + "center-" + "users" + ".json");
                foreach (string line in lines)
                {
                    total += line;
                }

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

                for (int d = 0; d < model.Count; d++)
                {
                    r = App.WimeaApp.Users.Add();
                    r.Station = model.ElementAt(d).Station;
                    r.Name = model.ElementAt(d).Name;
                    r.Email = model.ElementAt(d).Email;
                    r.Contact = model.ElementAt(d).Contact;
                    r.Role = model.ElementAt(d).Role;
                    r.Password = Encryption.SimpleEncrypt(model.ElementAt(d).Password);
                    r.Sync = "T";
                    r.Save();

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

            }
            catch (Exception ex)
            {

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

            }


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

                total += line;
            }

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

            for (int d = 0; d < model.Count; d++)
            {
                try
                {
                    string usernames = _UsersList.Where(l => l.Email == model.ElementAt(d).Email).Select(l => l.Name).SingleOrDefault().ToString();

                    if (usernames == "")
                    {
                        r = new User(null);
                        r.Station = "Data center";
                        r.Name = model.ElementAt(d).Name;
                        r.Email = model.ElementAt(d).Email;
                        r.Contact = model.ElementAt(d).Contact;
                        r.Role = model.ElementAt(d).Role;
                        r.Save();
                    }
                }
                catch (Exception)
                {
                    r = new User(null);
                    r.Station = "Data center";
                    r.Name = model.ElementAt(d).Name;
                    r.Email = model.ElementAt(d).Email;
                    r.Contact = model.ElementAt(d).Contact;
                    r.Role = model.ElementAt(d).Role;
                    r.Save();

                }

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

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

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

            //}


        }