Exemple #1
0
        /// <summary>
        /// This saves the pass after verifying that the user has entered the same password twice
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SavePassBtn_Click(object sender, EventArgs e)
        {
            if (PassTxt.Text.Equals(DupePassTxt.Text))
            {
                List <UserClass> userList = _client.GetUsers().GetAwaiter().GetResult();
                UserClass        user     = new UserClass();
                foreach (var users in userList)
                {
                    if (users.user == _client.Username)
                    {
                        user = users;
                    }
                }

                if (user.user != null)
                {
                    user.pass = PassTxt.Text;
                    _client.UpdateRecord(user).GetAwaiter();
                    Close();
                }
                else
                {
                    MessageBox.Show(@"An error has occured");
                }
            }
            else
            {
                MessageBox.Show(@"The 2 passwords are not the same");
            }
        }
Exemple #2
0
        /// <summary>
        /// This verifies the selected item then refreshes the list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AcceptBtn_Click(object sender, EventArgs e)
        {
            if (ItemsList.SelectedIndex == -1)
            {
                MessageBox.Show(@"Please select an item to accept first");
                return;
            }

            if (ItemsList.SelectedIndex < _unverifiedBordersList.Count)
            {
                var border = _unverifiedBordersList[ItemsList.SelectedIndex];
                border.Verified = true;
                _client.UpdateRecord(border).GetAwaiter();
            }
            else
            {
                var button = _unverifiedButtonsList[ItemsList.SelectedIndex - _unverifiedBordersList.Count];
                button.verified = true;
                _client.UpdateRecord(button).GetAwaiter();
            }
            CreateFormInstance(true, true);
        }
Exemple #3
0
        public async Task InsertandUpdate_Button_AD()
        {
            var client = new HistoryMapWebClient(user, pass);
            var record = new GenericLabelForWorldMap(new LocalDate(Era.BeforeCommon, 50, 5, 5), new Point(5, 5),
                                                     "SomeType", new Dictionary <string, string>()
            {
                { "Key", "Value" }
            }, 50, 50, Guid.NewGuid().ToString());

            //create record
            var a = await client.CreateRecord(record);

            Assert.IsTrue(a.Success);

            //Find record
            var allRecords = await client.GetButtons();

            var inserted = allRecords.SingleOrDefault(p => p._id == record._id);

            Assert.IsNotNull(inserted);

            //Update record
            var newDate = new LocalDate(Era.Common, 1050, 05, 05);

            record.timeOf = newDate;
            var updateResult = await client.UpdateRecord(record);

            Assert.IsTrue(updateResult.Success);

            //Check update
            allRecords = await client.GetButtons();

            inserted = allRecords.SingleOrDefault(p => p._id == record._id);

            Assert.AreEqual(newDate, inserted.timeOf);
        }