Пример #1
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;
            }
        }
Пример #2
0
 private void SubjectTextBoxReply_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         NameTextBox.Focus();
     }
 }
 private void NewButton_Click(object sender, RoutedEventArgs e)
 {
     Settings.LogButtonClicked(sender as Button);
     ClearInputs();
     NameTextBox.Focus();
     _IsInNewMode = true;
 }
Пример #4
0
        private bool IsValid()
        {
            var valid = true;

            if (NameTextBox.IsNullOrEmpty())
            {
                NameTextBox.HintText.Foreground = ColorConstants.WarningRed;
                valid = false;
            }
            if (HeightTextBox.IsNullOrEmpty())
            {
                HeightTextBox.HintText.Foreground = ColorConstants.WarningRed;
                valid = false;
            }
            if (WeightTextBox.IsNullOrEmpty())
            {
                WeightTextBox.HintText.Foreground = ColorConstants.WarningRed;
                valid = false;
            }
            if (PositionComboBox.SelectedItem == null || RoleComboBox.SelectedItem == null)
            {
                valid = false;
            }

            return(valid);
        }
Пример #5
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();
        }
Пример #6
0
    public Task <bool> IsValid()
    {
        if (DataContext is not YandexPreset preset)
        {
            return(Task.FromResult(false));
        }

        if (string.IsNullOrWhiteSpace(preset.Title))
        {
            StatusBand.Warning(LocalizationHelper.Get("S.Options.Upload.Preset.Warning.Title"));
            NameTextBox.Focus();
            return(Task.FromResult(false));
        }

        if (UserSettings.All.UploadPresets.OfType <UploadPreset>().Any(a => a.Title != _originalTitle && a.Title == preset.Title.Trim()))
        {
            StatusBand.Warning(LocalizationHelper.Get("S.Options.Upload.Preset.Warning.Repeated"));
            NameTextBox.Focus();
            return(Task.FromResult(false));
        }

        if (string.IsNullOrWhiteSpace(preset.OAuthToken))
        {
            StatusBand.Warning(LocalizationHelper.Get("S.Options.Upload.Preset.Warning.Token"));
            TokenTextBox.Focus();
            return(Task.FromResult(false));
        }

        return(Task.FromResult(true));
    }
Пример #7
0
 void ClearTextBox()
 {
     NameTextBox.Clear();
     GenderTextBox.Clear();
     AgeTextBox.Clear();
     DepartmentTextBox.Clear();
 }
        private void AddButton_Click(object sender, EventArgs e)
        {
            string ProductName     = NameTextBox.Text;
            string ProductCategory = CategoryComboBox.Text;
            string ProductWeight   = WeightTextBox.Text;
            string ProductCost     = CostTextBox.Text;
            string ProductExpire   = ExpireTextBox.Text;

            Product Good = new Product(ProductName, ProductWeight, ProductCost, ProductExpire, ProductCategory);

            StoreSystem.AddToSystem(Good);
            // All products are stored in array StoreSystem.List.

            StockProductTextBox.Text = Convert.ToString(Product.ProdudctCount);
            MeatCatTextBox.Text      = Convert.ToString(Product.MeatCategoryID);
            SweetCatTextBox.Text     = Convert.ToString(Product.SweetCategoryID);
            VegetableCatTextBox.Text = Convert.ToString(Product.VegerableCategoryID);
            AlertLabel.Text          = Good.alert;

            NameTextBox.Text      = "";
            CategoryComboBox.Text = "";
            WeightTextBox.Text    = "";
            CostTextBox.Text      = "";
            ExpireTextBox.Text    = "";

            NameTextBox.Focus();
        }
 /// <summary>
 ///     修改
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ModItem_OnClick(object sender, RoutedEventArgs e)
 {
     if (ModButton.Content.ToString() == "修改")
     {
         if (IDTextBox.Text == "")
         {
             return;
         }
         NameTextBox.IsReadOnly     = false;
         PasswordTextBox.IsReadOnly = false;
         LevelComboBox.IsEnabled    = true;
         NameTextBox.Focus();
         ModButton.Content = "完成";
     }
     else
     {
         if (IDTextBox.Text == "")
         {
             ModButton.Content = "修改"; return;
         }
         NameTextBox.IsReadOnly     = true;
         PasswordTextBox.IsReadOnly = true;
         LevelComboBox.IsEnabled    = false;
         _users[int.Parse(IDTextBox.Text) - 1].Name     = NameTextBox.Text;
         _users[int.Parse(IDTextBox.Text) - 1].Password = PasswordTextBox.Text;
         _users[int.Parse(IDTextBox.Text) - 1].Level    = LevelComboBox.Text;
         UpdateGrid(_users[int.Parse(IDTextBox.Text) - 1]);
         ModButton.Content = "修改";
     }
 }
        public Login()
        {
            InitializeComponent();

            _vm = new ViewModels.LoginViewModel();
            this.DataContext = _vm;

            NameTextBox.Text     = "shuayb";
            PasswordBox.Password = "******";

            NameTextBox.Focus();

            //using (var db = new AlphaElectricEntitiesDB())
            //{
            //    //Adding New User
            //    AlphaElectric_DataAccessLayer.Login newUser = new AlphaElectric_DataAccessLayer.Login()
            //    {
            //        Username = "******",
            //        Name = "Shuayb Ashraf",
            //        Password = Hashing.HashPassword("12345")
            //    };
            //    db.Logins.Add(newUser);
            //    db.SaveChanges();
            //}
        }
Пример #11
0
 public PersonPage(Logic l, Patient p = null)
 {
     InitializeComponent();
     EnableTextBoxes(false);
     AppLogic = l;
     if (p == null)
     {
         p = new Patient();
         AppointmentsGrid.Visibility      = Visibility.Hidden;
         PatientDataStackPanel.Visibility = Visibility.Hidden;
         NewPatientStackPanel.Visibility  = Visibility.Visible;
         i.Visibility = Visibility.Visible;
         EnableTextBoxes(true);
         PeselTextBox.IsEnabled = true;
         NameTextBox.Focus();
     }
     else if (!DEBUG)
     {
         try
         {
             list = new ObservableCollection <Visit>(AppLogic.ShowPatientVisits(p));
             VisitsList.ItemsSource = list;
         }
         catch (Exception ex)
         {
             MessageBoxes.ShowUnknownError(ex);
         }
     }
     CurrentPatient = p;
 }
 private void RefreshTextBoxes()
 {
     CustomerIdTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
     NameTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
     ContactInfoTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
     NicTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
 }
Пример #13
0
 private void DiscardButton_Click(object sender, RoutedEventArgs e)
 {
     // revert to original employee information
     NameTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
     EmployeeIdTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
     ContactInfoTextBox.GetBindingExpression(TextBox.TextProperty)?.UpdateTarget();
 }
Пример #14
0
 private void ClearTextFields()
 {
     NameTextBox.Clear();
     MailTextBox.Clear();
     MailUserLabel.Content  = $"Mail: ";
     MailAdminLabel.Content = $"Mail: ";
 }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //启动线程登录
            //验证输入
            if (string.IsNullOrEmpty(NameTextBox.Text))
            {
                SetInformationString("请输入用户名");
                NameTextBox.Focus();
                return;
            }

            if (string.IsNullOrEmpty(PasswordBox.Password))
            {
                SetInformationString("请输入密码");
                PasswordBox.Focus();
                return;
            }

            SetInformationString("正在验证维护状态...");
            UISettings(false);

            UserName     = NameTextBox.Text;
            UserPassword = PasswordBox.Password;
            IsChecked    = (bool)Remember.IsChecked;

            ThreadAccountLogin = new Thread(ThreadCheckAccount);
            ThreadAccountLogin.IsBackground = true;
            ThreadAccountLogin.Start();
        }
Пример #16
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;
        }
Пример #17
0
        private void UpdateFormFieldsFromRepositoryView(int itemIndex)
        {
            var item = TeaRepositoryView.Items[itemIndex];

            if (item is IEntry <TeaTimerDefinition> )
            {
                var entry = (IEntry <TeaTimerDefinition>)item;
                NameTextBox.Text              = entry.Value.Name;
                MinuteUpDown.Value            = entry.Value.Time.Minute;
                SecondUpDown.Value            = entry.Value.Time.Second;
                TeaEditGroup.Text             = entry.Value.Name;
                CancelBtn.Enabled             = true;
                SaveBtn.Text                  = "Save";
                SaveBtn.Enabled               = !_setup.Handles.ContainsKey(entry);
                TeaRepositoryView.ContextMenu = _contextMenu;
            }
            else
            {
                NameTextBox.Text   = string.Empty;
                MinuteUpDown.Value = 4;
                SecondUpDown.Value = 0;
                TeaEditGroup.Text  = item.ToString();
                CancelBtn.Enabled  = false;
                SaveBtn.Enabled    = true;
                SaveBtn.Text       = "Create";
            }
            NameTextBox.Focus();
        }
        private void SaveButton_Click_1(object sender, EventArgs e)
        {
            if (NameTextBox.Text == "" || DescriptionTextBox.Text == "")
            {
                WarningLabel.DissapearAfterSeconds(2);
                NameTextBox.FlickerIfEmpty();
                DescriptionTextBox.FlickerIfEmpty();
            }
            else
            {
                //DAL.Instance.CreatePlace(NameTextBox.Text, LuxeCheckBox.Checked, DescriptionTextBox.Text, image);
                Place place = (Place)PlacesComboBox.SelectedItem;
                if (NameTextBox.Text != place.Name)
                {
                    place.Name = NameTextBox.Text;
                }
                if (LuxeCheckBox.Checked != place.Luxe)
                {
                    place.Luxe = LuxeCheckBox.Checked;
                }
                if (DescriptionTextBox.Text != place.Description)
                {
                    place.Description = DescriptionTextBox.Text;
                }
                if (ImagePictureBox.BackgroundImage != place.Image)
                {
                    place.Image = ImagePictureBox.BackgroundImage;
                }


                this.Close();
            }
        }
Пример #19
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();
         }
     }
Пример #20
0
 private void ClearButton_Click(object sender, EventArgs e)
 {
     NameTextBox.Text   = "";
     InputTextBox1.Text = "";
     InputTextBox2.Text = "";
     NameTextBox.Focus();
 }
 private void MarkAllValid()
 {
     NameTextBox.ClearValue(Control.StyleProperty);
     LogoTextBox.ClearValue(Control.StyleProperty);
     StateComboBox.ClearValue(Control.StyleProperty);
     StadiumComboBox.ClearValue(Control.StyleProperty);
 }
Пример #22
0
        private void NameChangeButton_Click(object sender, RoutedEventArgs e)
        {
            if (!ChangingName)
            {
                NameTextBox.Text             = SettingsData.Name;
                NameTextBox.Visibility       = Visibility.Visible;
                NameTextBox.IsHitTestVisible = true;
                NameTextBox.SelectAll();
                NameTextBox.Focus();
                NameTextBox.CaretIndex = NameTextBox.Text.Length;
            }
            else
            {
                if (nameValid)
                {
                    SettingsData.Name = NameTextBox.Text;
                }


                NameTextBox.Visibility       = Visibility.Hidden;
                NameTextBox.IsHitTestVisible = false;
                NameTextBox.Text             = "";
                NameChangeButton.Content     = "Change name";
            }
        }
 public LocationSettingWindow(string name = "")
 {
     InitializeComponent();
     NameTextBox.Text = name;
     if (name != string.Empty)
     {
         this.name = name;
         Location location;
         location = WorkingSets.local.getLocation(name);
         if (!WorkingSets.local.LocalSQLClient.Connected)
         {
             ErrorReporter.ErrorReport(30002, "位置管理器", WorkingSets.local.LocalSQLClient.ErrorText);
         }
         if (location.id > -1)
         {
             TitleTextBlock.Text  = "修改位置";
             Changingconfirm      = true;
             originName           = name;
             CompanyTextBox.Text  = location.company;
             AddressTextBox.Text  = location.address;
             OperatorTextBox.Text = location.operatorName;
             textChanged          = false;
         }
         else
         {
             TitleTextBlock.Text = "新位置";
         }
     }
     else
     {
         TitleTextBlock.Text = "新位置";
     }
     NameTextBox.Focus();
 }
Пример #24
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();
        }
Пример #25
0
 // focus when criterion is added
 private void NameTextBoxTextChanged(object sender, TextChangedEventArgs e)
 {
     if (((TextBox)sender).Text == "")
     {
         NameTextBox.Focus();
     }
 }
        public RenameDictionaryWindow()
        {
            InitializeComponent();
            MainGrid.DataContext = this;

            NameTextBox.Focus();
        }
Пример #27
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();
        }
Пример #28
0
        private void CommandBinding_SaveAsVariant_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            var diagnosis = GetCurrent();

            if (diagnosis == null)
            {
                return;
            }
            var diagnosisGroup = diagnosis.DiagnosisGroup;
            var name           = TextBoxController.TextGet(NameTextBox);

            if (string.IsNullOrEmpty(name) ||
                DiagnosisCollection.Any(d => d.Name == TextBoxController.TextGet(NameTextBox)))
            {
                TextBoxController.AppendText("Please enter variant name", NameTextBox);
                return;
            }

            var text = PreviewBox.Text;

            if (string.IsNullOrEmpty(text))
            {
                PreviewBox.Text = "Please enter report text";
                return;
            }

            NameTextBox.Focus();
            NameTextBox.SelectAll();
            DiagnosisCollection.Add(new Diagnosis(name, text, diagnosisGroup));
            Repository.SaveCollection(DiagnosisCollection);
        }
        private void SiteDetailsDialogControl_Loaded(object sender, RoutedEventArgs e)
        {
            // Initialize site name textbox
            if (BuilderApplication.Instance.CurrentSite != null &&
                !string.IsNullOrEmpty(BuilderApplication.Instance.CurrentSite.Name))
            {
                NameTextBox.Text = BuilderApplication.Instance.CurrentSite.Name;
            }
            else if (ViewerApplicationControl.Instance != null &&
                     ViewerApplicationControl.Instance.ViewerApplication != null &&
                     !string.IsNullOrEmpty(ViewerApplicationControl.Instance.ViewerApplication.TitleText))
            {
                NameTextBox.Text = ViewerApplicationControl.Instance.ViewerApplication.TitleText;
            }

            // Initialize description textbox
            if (BuilderApplication.Instance.CurrentSite != null &&
                !string.IsNullOrEmpty(BuilderApplication.Instance.CurrentSite.Description))
            {
                DescriptionTextBox.Text = BuilderApplication.Instance.CurrentSite.Description;
            }
            else
            {
                DescriptionTextBox.Text = "";
            }

            NameTextBox.Focus();
            NameTextBox.SelectAll();
        }
        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ę!");
        }