Beispiel #1
0
 void ClearRecords()
 {
     FirstNameTextbox.Clear();
     LastNameTextbox.Clear();
     AccountNumberTextbox.Clear();
     BalanceTextbox.Clear();
 }
Beispiel #2
0
 void ClearFields()
 {
     FirstNameTextbox.Clear();
     LastNameTextbox.Clear();
     AccountNumberTextbox.Clear();
     BalanceTextbox.Clear();
     EmailTextbox.Clear();
     PhoneNumberTextbox.Clear();
     BalanceDateTextbox.Clear();
 }
Beispiel #3
0
        private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
        {
            // The undo / redo stack collections are not "Observable", so we
            // need to manually refresh the UI when they change.
            var root = UndoService.Current[this];

            root.UndoStackChanged += new EventHandler(OnUndoStackChanged);
            root.RedoStackChanged += new EventHandler(OnRedoStackChanged);
            FirstNameTextbox.Focus();
        }
Beispiel #4
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            if (!String.Equals(PasswordTextbox.Text, ConfirmTextbox.Text))
            {
                label13.Text    = "Passwords Must Match";
                label13.Visible = true;
            }
            else
            {
                string str = Properties.Settings.Default.DefaultConnection;

                SqlConnection con = new SqlConnection
                {
                    ConnectionString = str
                };
                con.Open();
                SqlCommand cmd = new SqlCommand("Insert into Employee(SSN, FirstName, LastName, City, State, " +
                                                "ZipCode, Email, Password, Telephone, StartDate, HourlyRate, Type) " +
                                                "Values(@SSN, @FirstName, @LastName, @City, @State, @ZipCode, @Email, @Password, @Telephone, @AccountCreationDate, " +
                                                "@HourlyRate, @AccountType)", con);
                cmd.Parameters.AddWithValue("@SSN", SSNTextbox.Text);
                cmd.Parameters.AddWithValue("@FirstName", FirstNameTextbox.Text);
                cmd.Parameters.AddWithValue("@LastName", LastNameTextbox.Text);
                cmd.Parameters.AddWithValue("@City", CityTextbox.Text);
                cmd.Parameters.AddWithValue("@State", StateTextbox.Text);
                cmd.Parameters.AddWithValue("@ZipCode", ZipTextbox.Text);
                cmd.Parameters.AddWithValue("@Email", EmailTextbox.Text);
                cmd.Parameters.AddWithValue("@Password", PasswordTextbox.Text);
                cmd.Parameters.AddWithValue("@Telephone", TelephoneTextbox.Text);
                cmd.Parameters.AddWithValue("@AccountCreationDate", DateTime.Now.Date);
                cmd.Parameters.AddWithValue("@HourlyRate", HourlyWageTextBox.Text);
                cmd.Parameters.AddWithValue("@AccountType", comboBox1.Text);

                cmd.ExecuteNonQuery();
                label13.Text    = "Successfully Added " + FirstNameTextbox.Text + " " + LastNameTextbox.Text;
                label13.Visible = true;

                //Clear the textboxes
                SSNTextbox.Clear();
                FirstNameTextbox.Clear();
                FirstNameTextbox.Clear();
                LastNameTextbox.Clear();
                CityTextbox.Clear();
                StateTextbox.Clear();
                ZipTextbox.Clear();
                EmailTextbox.Clear();
                PasswordTextbox.Clear();
                ConfirmTextbox.Clear();
                TelephoneTextbox.Clear();
                HourlyWageTextBox.Clear();
                comboBox1.SelectedIndex = -1;
            }
        }
Beispiel #5
0
 private void ResetTextBoxes()
 {
     FirstNameTextbox.ResetText();
     MiddleNameTextbox.ResetText();
     LastNameTextbox.ResetText();
     BirthDateTextbox.ResetText();
     GenderTextbox.ResetText();
     BloodTypeTextbox.ResetText();
     PresentAddressTextbox.ResetText();
     ReligionTextbox.ResetText();
     EmailAddressTextbox.ResetText();
     MobileNumberTextbox.ResetText();
 }
Beispiel #6
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            // Save record as it is.
            SaveRecord();

            // Clear the inputs
            FirstNameTextbox.Clear();
            LastNameTextbox.Clear();
            AccountNumberTextbox.Clear();
            BalanceTextbox.Clear();

            // Update the state of IsNewRecord
            IsNewRecord = true;
        }
 private void SetFirstName(string FirstName)
 {
     try
     {
         Console.WriteLine("Is First Name textbox displayed? {0}", FirstNameTextbox.Displayed);
         FirstNameTextbox.Clear();
         FirstNameTextbox.SendKeys(FirstName);
     }
     catch (Exception e)
     {
         Logger.Error("Error: ", e);
         throw (e);
     }
 }
        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();
        }
Beispiel #9
0
        private void UpdateButton_Click(object sender, EventArgs e)
        {
            if (UpdateButton.Text == "UPDATE INFORMATION")
            {
                UpdateButton.Text     = "SAVE ALL";
                UpdateButton.Size     = new Size(95, 30);
                UpdateButton.Location = new Point(901, 445);
                ResetButton.Visible   = true;

                EnableControls();
                FirstNameTextbox.Focus();
            }

            else if (UpdateButton.Text == "SAVE ALL")
            {
                //EXCEPTION 2
                try
                {
                    opacityform        = new OpacityForm();
                    cryptography       = new Cryptography();
                    darkeropacityform  = new DarkerOpacityForm();
                    notificationwindow = new NotificationWindow();

                    if (FirstNameTextbox.Text.Trim().Length < 1 || MiddleNameTextbox.Text.Trim().Length < 1 || LastNameTextbox.Text.Trim().Length < 1 ||
                        BirthDateTextbox.Text.Trim().Length < 1 || GenderTextbox.Text.Length < 1 || BloodTypeTextbox.Text.Trim().Length < 1 ||
                        PresentAddressTextbox.Text.Trim().Length < 1 || ReligionTextbox.Text.Trim().Length < 1 || EmailAddressTextbox.Text.Trim().Length < 1 ||
                        MobileNumberTextbox.Text.Trim().Length < 1)
                    {
                        notificationwindow.CaptionText    = "MESSAGE CONTENT";
                        notificationwindow.MsgImage.Image = Properties.Resources.warning;
                        notificationwindow.MessageText    = "PLEASE PROVIDE THE REQUIRED\nINFORMATIONS BEING ASK !";

                        darkeropacityform.Show();
                        notificationwindow.ShowDialog();
                        darkeropacityform.Hide();
                    }

                    else if (!EmailAddressTextbox.Text.Trim().Contains("@") || !EmailAddressTextbox.Text.Trim().Contains(".com"))
                    {
                        notificationwindow.CaptionText    = "MESSAGE CONTENT";
                        notificationwindow.MsgImage.Image = Properties.Resources.warning;
                        notificationwindow.MessageText    = "PLEASE PROVIDE A VALID EMAIL ADDRESS !";

                        darkeropacityform.Show();
                        notificationwindow.ShowDialog();
                        darkeropacityform.Hide();
                    }

                    else if (MobileNumberTextbox.Text.Trim().Length < 11 || MobileNumberTextbox.Text.Trim().Length > 11)
                    {
                        notificationwindow.CaptionText    = "MESSAGE CONTENT";
                        notificationwindow.MsgImage.Image = Properties.Resources.warning;
                        notificationwindow.MessageText    = "PHONE NUMBER MUST BE 11-DIGITS LONG !";

                        darkeropacityform.Show();
                        notificationwindow.ShowDialog();
                        darkeropacityform.Hide();
                    }

                    else if (isNumber(MobileNumberTextbox.Text.Trim()) == false)
                    {
                        notificationwindow.CaptionText    = "MESSAGE CONTENT";
                        notificationwindow.MsgImage.Image = Properties.Resources.warning;
                        notificationwindow.MessageText    = "PHONE NUMBER CONTAIN AN INVALID\nCHARACTERS !";

                        darkeropacityform.Show();
                        notificationwindow.ShowDialog();
                        darkeropacityform.Hide();
                    }

                    else
                    {
                        //INNER EXCEPTION 2
                        try
                        {
                            string alterquery = "UPDATE [Tbl.Teachers] SET [FIRST NAME] = @fname, [MIDDLE NAME] = @mname, [LAST NAME] = @lname," +
                                                "GENDER = @gender, [BIRTH DATE] = @bdate, [PRESENT ADDRESS] = @paddress, RELIGION = @religion, [BLOOD TYPE] = @btype," +
                                                "[EMAIL ADDRESS] = @eaddress, [MOBILE NUMBER] = @mnumber WHERE [USER ID] = '" + UserID + "'";
                            sqlcommand = new SqlCommand(alterquery, sqlconnection);

                            sqlcommand.Parameters.AddWithValue("@fname", FirstNameTextbox.Text.Trim());
                            sqlcommand.Parameters.AddWithValue("@mname", MiddleNameTextbox.Text.Trim());
                            sqlcommand.Parameters.AddWithValue("@lname", LastNameTextbox.Text.Trim());
                            sqlcommand.Parameters.AddWithValue("@gender", GenderTextbox.Text.Trim());

                            sqlcommand.Parameters.AddWithValue("@bdate", BirthDateTextbox.Text.Trim());
                            sqlcommand.Parameters.AddWithValue("@paddress", PresentAddressTextbox.Text.Trim());
                            sqlcommand.Parameters.AddWithValue("@religion", ReligionTextbox.Text.Trim());

                            sqlcommand.Parameters.AddWithValue("@btype", BloodTypeTextbox.Text.Trim());
                            sqlcommand.Parameters.AddWithValue("@eaddress", EmailAddressTextbox.Text.Trim());
                            sqlcommand.Parameters.AddWithValue("@mnumber", MobileNumberTextbox.Text.Trim());
                            sqlcommand.ExecuteNonQuery();

                            notificationwindow.CaptionText    = "MESSAGE CONTENT";
                            notificationwindow.MsgImage.Image = Properties.Resources.check;
                            notificationwindow.MessageText    = "SUCCESSFULLY UPDATED !";

                            darkeropacityform.Show();
                            notificationwindow.ShowDialog();
                            darkeropacityform.Hide();

                            UpdateButton.Text     = "UPDATE INFORMATION";
                            UpdateButton.Size     = new Size(170, 30);
                            UpdateButton.Location = new Point(826, 445);

                            ResetButton.Visible = false;
                            DisableControls();
                        }

                        catch (Exception exception)
                        {
                            opacityform.Show();
                            MessageBox.Show(exception.Message.ToString(), "Account Information Form Inner Exception 2",
                                            MessageBoxButtons.OK, MessageBoxIcon.Error);

                            opacityform.Hide();
                        }
                    }
                }

                catch (Exception exception)
                {
                    opacityform.Show();
                    MessageBox.Show(exception.Message.ToString(), "Account Information Form Exception 2",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                    opacityform.Hide();
                }
            }
        }