private bool ValidateForm()
        {
            if (!Regex.Match(FirstNameTextBox.Text, @"^\D{1,30}$").Success)
            {
                MessageBox.Show("First name must consist of at least 1 character and not exceed 30 characters!");
                FirstNameTextBox.Focus();
                return(false);
            }

            if (!Regex.Match(LastNameTextBox.Text, @"^\D{1,30}$").Success)
            {
                MessageBox.Show("Last name must consist of at least 1 character and not exceed 30 characters!");
                LastNameTextBox.Focus();
                return(false);
            }

            if (!Regex.Match(AddressTextBox.Text, @"^(Вул\.\s\D{1,40}\,\s\d{1,3})$").Success)
            {
                MessageBox.Show("Address must consist of at least 1 character and not exceed 50 characters!");
                AddressTextBox.Focus();
                return(false);
            }

            if (!Regex.Match(PhoneNumberTextBox.Text, @"^\d{10}$").Success)
            {
                MessageBox.Show("Phone number must consist of 10 digits!");
                PhoneNumberTextBox.Focus();
                return(false);
            }

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

            try
            {
                us = DB.UsersList.Where(u => u.Login == LoginTextBox.Text).Single();
            }
            catch (Exception) { }
            if (us != null && uss.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();
            binding = AddressTextBox.GetBindingExpression(TextBox.TextProperty);
            binding.UpdateSource();
            MessageBox.Show("Aktualizacja danych powiodła się!");
        }
Esempio n. 3
0
        private void AddressButton_Click(object sender, EventArgs e)
        {
            AddressTextBox.Text = address;
            AddressTextBox.Show();

            FullNameTextBox.Text = String.Empty;
            ContactTextBox.Text  = String.Empty;
        }
Esempio n. 4
0
 private void ClearForm()
 {
     NameTextBox.Clear();
     EmailTextBox.Clear();
     PhoneTextBox.Clear();
     AddressTextBox.Clear();
     Products.Clear();
     TotalTextBox.Text = "0";
 }
Esempio n. 5
0
        private void ShowAllButton_Click(object sender, EventArgs e)
        {
            FullNameTextBox.Text = name;
            ContactTextBox.Text  = contact;
            AddressTextBox.Text  = address;

            FullNameTextBox.Show();
            ContactTextBox.Show();
            AddressTextBox.Show();
        }
Esempio n. 6
0
        private void AddCustomersButton_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection();

            //символен низ за връзка към базата данни – взема се от файл с име app.config
            con.ConnectionString = ConfigurationManager.ConnectionStrings["MassiveDynamic.Properties.Settings.MassiveDynamicConnectionString"].ConnectionString;
            //символен низ със заявката към базата данни
            string insertIntoId             = "'" + CustomerIdAddTextBox.Text + "'";
            string inserIntoCustomerName    = "'" + CompanyNameTextBox.Text + "'";
            string inserIntoCustomerAddress = "'" + AddressTextBox.Text + "'";
            string inserIntoCustomerPhone   = "'" + CustomerPhoneTextBox.Text + "'";

            //INSERT INTO table_name (column1,column2,column3,...)  VALUES(value1, value2, value3,...);  Insert into cheatSheet
            string insertCommand = string.Format("insert into Customers (CustomerID,CompanyName,Address,Phone) values({0},{1},{2},{3});", insertIntoId, inserIntoCustomerName, inserIntoCustomerAddress, inserIntoCustomerPhone);

            SqlCommand com = new SqlCommand(insertCommand, con);

            //определяне на типа на командата - в конкретния случай е текст
            com.CommandType = CommandType.Text;

            try
            {
                //отваряме връзката към базата данни
                con.Open();
                //изпълняваме командата / в този случай нямаме връщан резултат
                com.ExecuteNonQuery();

                //извеждаме съобщение, че всичко е преминало успешно
                MessageBox.Show("Данните за форма на обучение са добавени успешно!",
                                "Message/Съобщение");
                //изчистваме въведената стойност в текстовото поле
                CustomerIdAddTextBox.Clear();
                CompanyNameTextBox.Clear();
                AddressTextBox.Clear();
                CustomerPhoneTextBox.Clear();
            }
            //ако не е преминало всичко успешно, това означава, че е възникнало изключение
            catch (Exception exe)
            {
                //извеждаме съобщение с възникналото изключение
                MessageBox.Show(exe.ToString(), "Message/Съобщение:");
            }
            //затваря се връзката към базата данни
            con.Close();
            //затваря се отворената форма
            this.Close();
        }
Esempio n. 7
0
        private void StoreBtn_Click(object sender, EventArgs e)
        {
            //verifies data was entered
            if (string.IsNullOrEmpty(FirstNameTextbox.Text))
            {
                MessageBox.Show("Please enter your First Name.");
                return;
            }
            if (string.IsNullOrEmpty(LastNameTextbox.Text))
            {
                MessageBox.Show("Please enter your Last Name.");
                return;
            }
            if (string.IsNullOrEmpty(AddressTextBox.Text))
            {
                MessageBox.Show("Please enter your Address.");
                return;
            }
            if (string.IsNullOrEmpty(AddressTextBox.Text))
            {
                MessageBox.Show("Please enter your City/State/Zipcode.");
                return;
            }
            if (string.IsNullOrEmpty(PhoneNumberTextbox.Text))
            {
                MessageBox.Show("Please enter your Phone Number");
                return;
            }
            //calls method to add data
            addData(FirstNameTextbox.Text, LastNameTextbox.Text, AddressTextBox.Text, CityStateZipcodeTextboc.Text, PhoneNumberTextbox.Text);



            //clears all items
            FirstNameTextbox.Clear();
            LastNameTextbox.Clear();
            AddressTextBox.Clear();
            CityStateZipcodeTextboc.Clear();
            PhoneNumberTextbox.Clear();
        }
Esempio n. 8
0
 private void DebuggerInterruptCallback(uint lwpid, uint status, string tdname, reg64 regs, fpreg64 fpregs, dbreg64 dbregs)
 {
     _regs   = regs;
     _fpregs = fpregs;
     _lwpid  = lwpid;
     _status = status;
     _tdname = tdname;
     _dbregs = dbregs;
     if (AddressTextBox.InvokeRequired)
     {
         AddressTextBox.Invoke((EventHandler) delegate
         {
             //AddressTextBox.Text = "0x" + regs.r_rip.ToString("X");
         });
         _BP.Invoke((EventHandler) delegate
         {
             if (_wp.Checked)
             {
                 InstructionData data = new InstructionData(regs.r_rip);
                 _BP.Checked          = false;
                 _wp.Checked          = true;
                 Peek(data.bAddress);
                 AddressTextBox.Text = $"0x{data.bAddress.ToString("X")}";
             }
         });
     }
     else
     {
         if (_wp.Checked)
         {
             InstructionData data = new InstructionData(regs.r_rip);
             _BP.Checked = false;
             _wp.Checked = true;
             Peek(data.bAddress);
             AddressTextBox.Text = $"0x{data.bAddress.ToString("X")}";
         }
     }
 }
Esempio n. 9
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            SqlCeConnection Connection = DataBaseConnection.Instance.Connection;


            try
            {
                if (NameTextBox.Text == "")
                {
                    MessageBox.Show("Unesite naziv grada!");
                }
                else if (AddressTextBox.Text == "")
                {
                    MessageBox.Show("Unesite adresu!");
                }


                else
                {
                    SqlCeCommand command = new SqlCeCommand("INSERT INTO Code_betting_shop (Name, Address) VALUES" + " ('" + NameTextBox.Text + "', '" + AddressTextBox.Text + "'); ", Connection);

                    command.ExecuteNonQuery();

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

            catch (Exception ee)
            {
                MessageBox.Show("Unos nije uspio! \r Greska: " + ee.Message);
                return;
            }
        }
Esempio n. 10
0
        private void FindCompetitor()                                                                  //Set up to find the competitors by their number.
        {
            DetailsTextBox.Clear();                                                                    //Clears the details textbox.
            Competitor editSkier;                                                                      //Makes aninstance of the Competitor class.

            if (SearchTextBox.Text.Trim() != "" && NumberTextBox.Text.Trim() != "")                    //You can only use on search method so if there is text in both it will be rejected.
            {
                MessageBox.Show("Please use only one search method!");                                 //The error message.
            }
            else if (SearchByName.Text.Trim() == "" && NumberTextBox.Text.Trim() == "")                //If there is no text in either search methods then the search will fail.
            {
                editSkier = null;                                                                      //There's no competitor.
                MessageBox.Show("There is no competitor with that number or name! Please try again."); //The error message.
                NameTextBox.Clear();                                                                   //Clears the name text box.
                AddressTextBox.Clear();                                                                //Clears the address text box.
                ScoreTextBox.Clear();                                                                  //Clears the score text box.
                NumberTextBox.Clear();                                                                 //Clears number text box.
                TagTextBox.Clear();                                                                    //Clears the tag text box.
            }

            //***NOTE*** - This is a very inefficient way to seach. I have the same code twice for each search method because I didn't know how to differentiate between the two.

            else if (SearchByName.Text.Trim() != "")                          //If search by name has some text in it then it will make a competitor.
            {
                editSkier = SkiRun.FindSkierByName(SearchByName.Text.Trim()); //Calls the find competitor by name in the SkiRun class.
                try
                {
                    NameTextBox.Text    = editSkier.GetName().Trim();                                                                                                                                                                                                                                    //Sets the competitor name.
                    AddressTextBox.Text = editSkier.GetAddress().Trim();                                                                                                                                                                                                                                 //Sets the competitor address.
                    ScoreTextBox.Text   = editSkier.GetScore().Trim();                                                                                                                                                                                                                                   //Sets the competitor score.

                    if (editSkier.GetSponsor() == null && editSkier.GetBlood() == null && editSkier.GetNoK() == null)                                                                                                                                                                                    //If there's no sponsor, no blood type and no next of kin then it must be an amateur.
                    {
                        DetailsTextBox.Text = "Class: Amatuer" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £100";                                                                                                                                   //Information show in details text box.
                        TagTextBox.Text     = "Amateur";                                                                                                                                                                                                                                                 //Displays the tag in the tag text box.
                    }
                    else if (editSkier.GetSponsor() != null)                                                                                                                                                                                                                                             //If the sponsor does no equal null then it must be a professional.
                    {
                        DetailsTextBox.Text = "Class: Professional" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £200" + Environment.NewLine + "Sponsor: " + editSkier.GetSponsor();                                                                 //Information show in details text box.
                        TagTextBox.Text     = "Professional";                                                                                                                                                                                                                                            //Displays the tag in the tag text box.
                    }
                    else if (editSkier.GetBlood() != null)                                                                                                                                                                                                                                               //If blood type does not equal null then is must be a celebrity.
                    {
                        DetailsTextBox.Text = "Class: Celebrity" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You do not have to pay." + Environment.NewLine + "Blood Type: " + editSkier.GetBlood() + Environment.NewLine + "Next of Kin: " + editSkier.GetNoK(); //Information show in details text box.
                        TagTextBox.Text     = "Celebrity";                                                                                                                                                                                                                                               //Displays the tag in the tag text box.
                    }
                }
                catch
                {
                    MessageBox.Show("Could not find competitor!");  //If the user types a name it cannot find then it will display this.
                }
            }
            else if (NumberTextBox.Text.Trim() != "")                    //If the number text box has something in it then it will use this method.
            {
                editSkier = SkiRun.FindSkier(NumberTextBox.Text.Trim()); //Calls the find competitor in the SkiRun class.
                try
                {
                    NameTextBox.Text    = editSkier.GetName();                                                                                                                                                                                                                                           //Sets the competitor name.
                    AddressTextBox.Text = editSkier.GetAddress();                                                                                                                                                                                                                                        //Sets the competitor address.
                    ScoreTextBox.Text   = editSkier.GetScore();                                                                                                                                                                                                                                          //Sets the competitor score.

                    if (editSkier.GetSponsor() == null && editSkier.GetBlood() == null && editSkier.GetNoK() == null)                                                                                                                                                                                    //If there's no sponsor, no blood type and no next of kin then it must be an amateur.
                    {
                        DetailsTextBox.Text = "Class: Amatuer" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £100";                                                                                                                                   //Information show in details text box.
                        TagTextBox.Text     = "Amateur";                                                                                                                                                                                                                                                 //Displays the tag in the tag text box.
                    }
                    else if (editSkier.GetSponsor() != null)                                                                                                                                                                                                                                             //If the sponsor does no equal null then it must be a professional.
                    {
                        DetailsTextBox.Text = "Class: Professional" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You have paid £200" + Environment.NewLine + "Sponsor: " + editSkier.GetSponsor();                                                                 //Information show in details text box.
                        TagTextBox.Text     = "Professional";                                                                                                                                                                                                                                            //Displays the tag in the tag text box.
                    }
                    else if (editSkier.GetBlood() != null)                                                                                                                                                                                                                                               //If blood type does not equal null then is must be a celebrity.
                    {
                        DetailsTextBox.Text = "Class: Celebrity" + Environment.NewLine + "Your age: " + editSkier.GetAge() + Environment.NewLine + "You do not have to pay." + Environment.NewLine + "Blood Type: " + editSkier.GetBlood() + Environment.NewLine + "Next of Kin: " + editSkier.GetNoK(); //Information show in details text box.
                        TagTextBox.Text     = "Celebrity";                                                                                                                                                                                                                                               //Displays the tag in the tag text box.
                    }
                }
                catch
                {
                    MessageBox.Show("Could not find competitor!");  //If the user types a name it cannot find then it will display this.
                }
            }
            //NumberTextBox.Clear();
            //SearchByName.Items.Clear();
            //SearchTextBox.Clear();
        }
Esempio n. 11
0
        public FtpDialog()
        {
            InitializeComponent();

            AddressTextBox.Focus();
        }
Esempio n. 12
0
 private void AddressTextBox_GotFocus(object sender, RoutedEventArgs e)
 {
     AddressTextBox.SelectAll();
     ErrorAddressTextBlock.Visibility = Visibility.Collapsed;
     //SetTextBlockVisibilityCollapsed();
 }