private bool IsFormValid()
 {
     if (NameTextBox.Text.Trim() == string.Empty)
     {
         Messages.ShowErrorMessage("Name is required");
         NameTextBox.Clear();
         NameTextBox.Focus();
         return(false);
     }
     if (EmailTextBox.Text.Trim() == string.Empty)
     {
         Messages.ShowErrorMessage("Email is required");
         EmailTextBox.Clear();
         EmailTextBox.Focus();
         return(false);
     }
     if (TelephoneTextBox.Text.Trim() == string.Empty)
     {
         Messages.ShowErrorMessage("Telephone is required");
         TelephoneTextBox.Clear();
         TelephoneTextBox.Focus();
         return(false);
     }
     return(true);
 }
Пример #2
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            SqlCeConnection Connection = DataBaseConnection.Instance.Connection;

            try
            {
                if (NameTextBox.Text == "")
                {
                    MessageBox.Show("Unesite ime para!");
                }
                else if (SportComboBox.Text == "")
                {
                    MessageBox.Show("Uzaberite vrstu sporta!");
                }



                else
                {
                    SqlCeCommand command = new SqlCeCommand("INSERT INTO Doubles (Name, Sports_Id) VALUES" + " ('" + NameTextBox.Text + "', '" + SportComboBox.Text + "'); ", Connection);

                    command.ExecuteNonQuery();

                    MessageBox.Show("Unos je uspio!");
                    NameTextBox.Clear();
                    NameTextBox.Focus();
                }
            }

            catch (Exception ee)
            {
                MessageBox.Show("Unos nije uspio! \r Greska: " + ee.Message);
                return;
            }
        }
Пример #3
0
 private void ClearTextFields()
 {
     NameTextBox.Clear();
     MailTextBox.Clear();
     MailUserLabel.Content  = $"Mail: ";
     MailAdminLabel.Content = $"Mail: ";
 }
Пример #4
0
 private void refresh()
 {
     NameTextBox.Clear();
     idTextBox.Clear();
     DscribeTextBox.Clear();
     bindingDateGridView(null);
 }
Пример #5
0
 private void OnUpdateUserListClicked(object sender, RoutedEventArgs e) //user values updated
 {
     if (usrListselected)                                               //if an item from user list is selected
     {
         currentItem = (Users)UserListListBox.SelectedItem;
         userList.Remove(currentItem);
         currentItem.Name   = NameTextBox.Text;
         currentItem.E_Mail = E_MailTextBox.Text;
         userList.Add(currentItem);
         UserListListBox.ItemsSource = userList;
         UserListListBox.Items.Refresh();
         RemoveEmptyEntries();
         NameTextBox.Clear();
         E_MailTextBox.Clear();
     }
     else if (adminListSelected)//if an item from admin list is selected
     {
         currentItem = (Users)AdminListListBox.SelectedItem;
         adminList.Remove(currentItem);
         currentItem.Name   = NameTextBox.Text;
         currentItem.E_Mail = E_MailTextBox.Text;
         adminList.Add(currentItem);
         AdminListListBox.ItemsSource = adminList;
         AdminListListBox.Items.Refresh();
         RemoveEmptyEntries();
         NameTextBox.Clear();
         E_MailTextBox.Clear();
     }
     if (NameTextBox.Text.Length == 0 || E_MailTextBox.Text.Length == 0)
     {
         UpdateUserListButton.IsEnabled = false;
         AddToUserListButton.IsEnabled  = false;
     }
 }
Пример #6
0
        private void EditProductButton_Clickk(object sender, EventArgs e)
        {
            if (edit == -1)
            {
                AddProductButton.Hide();
                DeleteProductButton.Hide();
            }
            else
            {
                AddProductButton.Show();
                DeleteProductButton.Show();
            }

            if (edit == 1)
            {
                try
                {
                    Products[ProductsGridView.CurrentCell.RowIndex].Size  = ToInt64(SizeTextBox.Text);
                    Products[ProductsGridView.CurrentCell.RowIndex].Name  = NameTextBox.Text;
                    Products[ProductsGridView.CurrentCell.RowIndex].Price = ToDouble(PriceTextBox.Text);
                    Products[ProductsGridView.CurrentCell.RowIndex].Date  = Convert.ToString(DateTimePickerOfProduct.Value);
                    ProductsGridView.CurrentRow.SetValues(Products[ProductsGridView.CurrentCell.RowIndex].Id, Products[ProductsGridView.CurrentCell.RowIndex].Size, Products[ProductsGridView.CurrentCell.RowIndex].Date, Products[ProductsGridView.CurrentCell.RowIndex].Name, Products[ProductsGridView.CurrentCell.RowIndex].Price);
                    SizeTextBox.Clear();
                    NameTextBox.Clear();
                    PriceTextBox.Clear();
                }
                catch (Exception)
                {
                    MessageBox.Show("Ошибка");
                }
            }
            edit *= -1;
        }
Пример #7
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();
        }
Пример #8
0
        private async void CreateFoodButton_Click(object sender, EventArgs e)
        {
            if (_isHubConnectionStarted is false)
            {
                await _hubConnection.StartAsync();

                _isHubConnectionStarted = true;
            }

            CreateFoodDto createFoodDto = new CreateFoodDto
            {
                Name        = NameTextBox.Text,
                Description = DescriptionTextBox.Text,
                Ingredients = IngredientsTextBox.Text,
            };

            await _hubConnection.SendAsync("CreateFood", createFoodDto);

            _hubConnection.On <bool>("CreateFoodResult", handler =>
            {
                if (handler)
                {
                    MessageBox.Show("Created.");

                    NameTextBox.Clear();
                    DescriptionTextBox.Clear();
                    IngredientsTextBox.Clear();
                }
                else
                {
                    MessageBox.Show("Faild to create.");
                }
            });
        }
Пример #9
0
 private void RegisterButton_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(PhoneTextBox.Text) && !string.IsNullOrEmpty(NameTextBox.Text) && !string.IsNullOrEmpty(PasswordBox.Password) && !string.IsNullOrEmpty(ConfirmPasswordBox.Password))
     {
         if (PasswordBox.Password == ConfirmPasswordBox.Password)
         {
             if (!service.SignUpEmployee(NameTextBox.Text, PhoneTextBox.Text, PasswordBox.Password, "default", out string message, out Employee user))
             {
                 Close();
             }
             else
             {
                 PhoneTextBox.Clear();
                 NameTextBox.Clear();
                 PasswordBox.Clear();
                 ConfirmPasswordBox.Clear();
             }
         }
         else
         {
             MessageBox.Show("Passwords in to fields should be equal");
             PasswordBox.Clear();
             ConfirmPasswordBox.Clear();
             PasswordBox.Focus();
         }
     }
Пример #10
0
 void ClearTextBox()
 {
     NameTextBox.Clear();
     GenderTextBox.Clear();
     AgeTextBox.Clear();
     DepartmentTextBox.Clear();
 }
Пример #11
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (NameTextBox.Text == "")
            {
                MessageBox.Show("Employee name not entered.");
                NameTextBox.Focus();
                return;
            }

            int IDNumber;

            try {
                IDNumber = int.Parse(IDTextBox.Text);
            } catch {
                MessageBox.Show("Invalid Employee ID.");
                IDTextBox.Focus();
                return;
            }

            myEmployee.NewEmployee(NameTextBox.Text, IDNumber, DepartmentTextBox.Text, PositionTextBox.Text);

            NameTextBox.Clear();
            IDTextBox.Clear();
            DepartmentTextBox.Clear();
            PositionTextBox.Clear();

            ListBox.Items.Add("Employee: " + IDNumber + " added!");

            NameTextBox.Focus();
        }
Пример #12
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // clear form and re-create all obj
            newTest = true;

            NameTextBox.Clear();
            AgeNumericUpDown1.Value = 0;
            MaxHRTextBox.Clear();
            HR85textBox.Clear();
            MaleRadioButton.Checked          = false;
            FemaleRadioButton.Checked        = false;
            readynessCheckBox.Checked        = false;
            contraIndicationCheckBox.Checked = false;
            lifestyleCheckBox.Checked        = false;
            aerobicTextBox.Clear();
            fitnessTextBox.Clear();
            RemarksRichTextBox.Clear();
            HR1NumericUpDown.Value = 0;
            HR2NumericUpDown.Value = 0;
            HR3NumericUpDown.Value = 0;
            HR4NumericUpDown.Value = 0;
            HR5NumericUpDown.Value = 0;

            foreach (var series in chart1.Series)
            {
                series.Points.Clear();
            }
            checkAllForm();

            currentTested = new Tested();
        }
Пример #13
0
 private void CancelButton_Click(object sender, EventArgs e)
 {
     CancelButton.Visible = false;
     NameTextBox.Clear();
     selectedCompanyId   = -1;
     selectedCompanyName = null;
     SaveButton.Text     = "Save";
 }
Пример #14
0
 private void SaveContent_Click(object sender, RoutedEventArgs e)
 {
     SetInnitialWalletValue(PlayerName);
     CreditLabel.Content = person.wallet.GetCredit();
     CreditTextBox.Clear();
     NameLabel.Content = PlayerName + "'s Game";
     NameTextBox.Clear();
 }
Пример #15
0
 private void FindButton_Click(object sender, RoutedEventArgs e) //Finds the competitor in the SkiRun class.
 {
     NameTextBox.Clear();                                        //Clears the name text box.
     AddressTextBox.Clear();                                     //Clears the address text box.
     ScoreTextBox.Clear();                                       //Clears the score text box.
     TagTextBox.Clear();                                         //Clears the tag text box.
     FindCompetitor();                                           //Calls the FindCompetitor method above.
 }
Пример #16
0
 private void ClearForm()
 {
     // option A
     NameTextBox.Clear();
     AgeTextBox.Clear();
     SubmitButton.Enabled = false;
     // option B - NameTextBox.Text = string.Empty; // or ""
 }
Пример #17
0
 public void TbClear()
 {
     ShTextBox.Clear();
     ArtTextBox.Clear();
     NameTextBox.Clear();
     CountTextBox.Clear();
     comboBox1.SelectedIndex = -1;
 }
Пример #18
0
 private void ClearForm()
 {
     NameTextBox.Clear();
     AgeTextBox.Clear();
     //other way:
     //NameTextBox.Text = string.Empty;
     SubmitButton.Enabled = false;
 }
Пример #19
0
 void ClearMethod()
 {
     NameTextBox.Clear();
     AgeTextBox.Clear();
     AddressTextBox.Clear();
     PhoneTextBox.Clear();
     HistoryTextBox.Clear();
 }
Пример #20
0
 /// <summary>
 /// Clears all Text boxes
 /// </summary>
 private void ClearTextBoxes()
 {
     SurnameTextBox.Clear();
     NameTextBox.Clear();
     BirthdayDateTimePicker.Value = BirthdayDateTimePicker.MinDate;
     PhoneMaskedTextBox.Clear();
     EmailTextBox.Clear();
     VkTextBox.Clear();
 }
Пример #21
0
        private void ClearInputs()
        {
            MarkAllValid();

            DebugIDLabel.ClearValue(Label.ContentProperty);
            NameTextBox.Clear();
            FlagTextBox.Clear();
            ContinentComboBox.ClearValue(ComboBox.SelectedValueProperty);
        }
Пример #22
0
 //This method clears all textboxes and reset drop downs to default values
 private void ClearAllFields()
 {
     NameTextBox.Clear();
     AgeComboBox.SelectedItem    = 18;
     GenderComboBox.SelectedItem = "Select";
     EmailTextBox.Clear();
     CustomerStatusComboBox.SelectedItem       = "Select";
     CommunicationChannelComboBox.SelectedItem = "Select";
 }
Пример #23
0
 private void ClearForm()
 {
     NameTextBox.Clear();
     EmailTextBox.Clear();
     PhoneTextBox.Clear();
     AddressTextBox.Clear();
     Products.Clear();
     TotalTextBox.Text = "0";
 }
Пример #24
0
 private void reset()
 {
     bindingDateGridView();
     idTextBox.Clear();
     NameTextBox.Clear();
     PriceTextBox.Clear();
     comboBoxOrderStatus.SelectedIndex = 0;
     comboBoxType.SelectedIndex        = 0;
 }
Пример #25
0
        private void resetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //When user wants to reset form, they will click on Reset

            NameTextBox.Clear();
            FeelTextBox.Clear();
            YearTextBox.Clear();
            ProfileTextBox.Clear();
        }
Пример #26
0
        //更新反序列信息
        public void ShowAllBook()
        {
            Thread thread = new Thread(threadStart);

            thread.Start();
            IDTextBox.Clear();
            NameTextBox.Clear();
            thread.Abort();
        }
Пример #27
0
 private void ClearAllInputs()
 {
     userNameTextBox.Clear();
     passwordTextBox.Clear();
     NameTextBox.Clear();
     SurnameTextBox.Clear();
     registerUserNameTextBox.Clear();
     registerPasswordTextBox.Clear();
     confirmTextBox.Clear();
 }
Пример #28
0
        public void Clear()
        {
            if (!(DataContext is EnterDataViewModel enterDataViewModel))
            {
                return;
            }

            enterDataViewModel.Name = string.Empty;
            NameTextBox.Clear();
        }
Пример #29
0
 private void ClearText()
 {
     NameTextBox.Clear();
     AddressTextBox.Clear();
     PostalCodeTextBox.Clear();
     CityTextBox.Clear();
     TelephoneTextBox.Clear();
     EmailTextBox.Clear();
     ContactTypeComboBox.SelectedIndex = -1;
 }
Пример #30
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (NameTextBox.Text.Length < 1)
            {
                return;
            }

            AdminUsersManagement.Add(NameTextBox.Text);
            NameTextBox.Clear();
        }