private void Save_Click_Button(object sender, RoutedEventArgs e)
        {
            if (NameTextBox.Text == String.Empty || SurnameTextBox.Text == String.Empty || LoginTextBox.Text == String.Empty || PasswordTextBox.Text == String.Empty)
            {
                MessageBox.Show("Uzupełnij puste pola!");
                return;
            }
            Courier us = null;

            try
            {
                us = DB.CouriersList.Where(u => u.Login == LoginTextBox.Text).Single();
            }
            catch (Exception) { }
            if (us != null && css.Login != LoginTextBox.Text)
            {
                MessageBox.Show("Podany login jest zajety!");
                return;
            }
            BindingExpression binding = NameTextBox.GetBindingExpression(TextBox.TextProperty);

            binding.UpdateSource();
            binding = SurnameTextBox.GetBindingExpression(TextBox.TextProperty);
            binding.UpdateSource();
            binding = PasswordTextBox.GetBindingExpression(TextBox.TextProperty);
            binding.UpdateSource();
            binding = LoginTextBox.GetBindingExpression(TextBox.TextProperty);
            binding.UpdateSource();
            MessageBox.Show("Aktualizacja danych powiodła się!");
        }
Beispiel #2
0
        /// <summary>
        /// Deletes contact information in the list and ListBox.
        /// </summary>
        private void RemoveContact()
        {
            var selectedIndex = AllContactsListBox.SelectedIndex;

            if (selectedIndex == -1)
            {
                MessageBox.Show("Select a contact from the list", "Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
                //TODO: если после if-else нет никакой общей логики, тогда в if можно написать return, а else с лишней вложенностью убрать (+)
            }

            DialogResult result = MessageBox.Show("Do you really want to remove this contact?",
                                                  "Remove contact", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (result == DialogResult.OK)
            {
                var selectedContact = _contacts[selectedIndex];
                _project.Contacts.Remove(selectedContact);
                AllContactsListBox.Items.RemoveAt(selectedIndex);
                SurnameTextBox.Clear();
                NameTextBox.Clear();
                PhoneTextBox.Clear();
                EmailTextBox.Clear();
                VkIDTextBox.Clear();
                SaveToFile();
            }
            SortingFoundContacts();
        }
Beispiel #3
0
 /// <summary>
 /// Clears all Text boxes
 /// </summary>
 private void ClearTextBoxes()
 {
     SurnameTextBox.Clear();
     NameTextBox.Clear();
     BirthdayDateTimePicker.Value = BirthdayDateTimePicker.MinDate;
     PhoneMaskedTextBox.Clear();
     EmailTextBox.Clear();
     VkTextBox.Clear();
 }
Beispiel #4
0
 private void ClearAllInputs()
 {
     userNameTextBox.Clear();
     passwordTextBox.Clear();
     NameTextBox.Clear();
     SurnameTextBox.Clear();
     registerUserNameTextBox.Clear();
     registerPasswordTextBox.Clear();
     confirmTextBox.Clear();
 }
 private void Reset()
 {
     UserNameTextBox.Clear();
     PasswordTextBox.Clear();
     NameTextBox.Clear();
     SecondNameTextBox.Clear();
     SurnameTextBox.Clear();
     BirthDayDatePicker.ClearValue(DatePicker.SelectedDateProperty);
     SexComboBox.ClearValue(ComboBox.SelectedItemProperty);
     PositionComboBox.ClearValue(ComboBox.SelectedItemProperty);
 }
Beispiel #6
0
 internal void RefreshTabEmployee()
 {
     employeeBindingSource.Clear();
     for (int i = 0; i < manager.Employees.Count; i++)
     {
         employeeBindingSource.Add(manager.Employees[i]);
     }
     NameTextBox.Clear();
     SurnameTextBox.Clear();
     EmployeeDateTimePicker.Value = DateTime.Now;
     SalaryTextBox.Clear();
     EmployeeDataGridView.ClearSelection();
 }
Beispiel #7
0
        private void AddToQueueButton_Click(object sender, EventArgs e)
        {
            if (!FirstNameIsCorrect() || !LastNameIsCorrect() || !AgeIsCorrect())
            {
                return;
            }

            _eq.AddToElectronicQueue(new Person(NameTextBox.Text,
                                                SurnameTextBox.Text, int.Parse(AgeTextBox.Text)));

            NameTextBox.Clear();
            SurnameTextBox.Clear();
            AgeTextBox.Clear();
        }
Beispiel #8
0
 private void ResetAll()
 {
     NameTextBox.Clear();
     SurnameTextBox.Clear();
     foreach (RadioButton rb in AcademicGroupBox.Controls)
     {
         rb.Checked = false;
     }
     foreach (CheckBox cb in HobbiesGroupBox.Controls)
     {
         cb.Checked = false;
     }
     AcademicLevelsRichTextBox.Clear();
 }
        /// <summary>
        /// Метод проверки правильности вводимых полей контакта
        /// </summary>
        /// <returns>true, если все поля введены правильно</returns>
        public bool CheckCorrectInput()
        {
            //TryCatch Surname
            try
            {
                _contact.Surname = SurnameTextBox.Text;
            }
            catch (ArgumentNullException e)
            {
                MessageBox.Show(e.Message, "Add Contact Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                SurnameTextBox.Focus();
                return(false);
            }
            catch (ArgumentException e)
            {
                MessageBox.Show(e.Message, "Add Contact Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                SurnameTextBox.Focus();
                return(false);
            }

            //TryCatch Name
            try
            {
                _contact.Name = NameTextBox.Text;
            }
            catch (ArgumentNullException e)
            {
                MessageBox.Show(e.Message, "Add Contact Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                NameTextBox.Focus();
                return(false);
            }
            catch (ArgumentException e)
            {
                MessageBox.Show(e.Message, "Add Contact Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                NameTextBox.Focus();
                return(false);
            }


            //TryCatch Birhday
            try
            {
                _contact.Birhday = BirthdayDayTool.Value;
            }
            catch (ArgumentException e)
            {
                MessageBox.Show(e.Message, "Add Contact Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                BirthdayDayTool.Focus();
                return(false);
            }

            //TryCatch PhoneNumber
            try
            {
                _contact.Number.Number = Convert.ToInt64(PhoneTextBox.Text);
            }
            catch (ArgumentNullException e)
            {
                MessageBox.Show(e.Message, "Add Contact Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                PhoneTextBox.Focus();
                return(false);
            }
            catch (ArgumentException e)
            {
                MessageBox.Show(e.Message, "Add Contact Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                PhoneTextBox.Focus();
                return(false);
            }


            //TryCatch Email
            try
            {
                _contact.Email = EmailTextBox.Text;
            }

            catch (ArgumentNullException e)
            {
                MessageBox.Show(e.Message, "Add Contact Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                EmailTextBox.Focus();
                return(false);
            }
            catch (ArgumentException e)
            {
                MessageBox.Show(e.Message, "Add Contact Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                EmailTextBox.Focus();
                return(false);
            }

            //TryCatch Vk
            try
            {
                _contact.VK = VKTextBox.Text;
            }
            catch (ArgumentNullException e)
            {
                MessageBox.Show(e.Message, "Add Contact Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                VKTextBox.Focus();
                return(false);
            }
            catch (ArgumentException e)
            {
                MessageBox.Show(e.Message, "Add Contact Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                VKTextBox.Focus();
                return(false);
            }


            return(true);
        }