Beispiel #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (tBlock_imienia.Text == "Imię zostało podane prawidłowo." && tBlock_nazwiska.Text == "Nazwisko zostało podane prawidłowo." &&
                tBlock_stanowiska.Text == "Stanowisko zostało podane prawidłowo." && tBlock_emailu.Text == "Email jest poprawny." &&
                tBlock_Loginu.Text == "Login jest poprawny." && tBlock_hasła.Text == "Hasło jest poprawne." &&
                tBlock_potwierdzenia_hasła.Text == "Hasło zostało zatwierdzone." && (ComboBox_Płeć.SelectedIndex == 0 || ComboBox_Płeć.SelectedIndex == 1) &&
                (ComboBox_Roli.SelectedIndex == 0 || ComboBox_Roli.SelectedIndex == 1))
            {
                c.Imię       = Tb_imienia.Text;
                c.Nazwisko   = Tb_nazwiska.Text;
                c.Stanowisko = Tb_stanowiska.Text;
                c.Płeć       = ComboBox_Płeć.Text;
                c.Email      = Tb_emaila.Text;
                c.Login      = Tb_Loginu.Text;
                c.Hasło      = Tb_hasła.Text;
                c.Rola       = ComboBox_Roli.Text;

                bool success = c.Insert(c);

                if (success == true)
                {
                    MessageBox.Show("Dane zostały poprawnie wprowadzone. Teraz możesz przejść do opcji logowania.");
                    emailSending(Tb_emaila.Text);
                }
                else
                {
                    MessageBox.Show("Coś poszło nie tak. Spróbuj ponownie.");
                }
            }
            else
            {
                MessageBox.Show("Pewne dany zostały błędnie uzupełnione. Aby zarejestrować użytkownika, należy wprowadzić wszystkie dane. Wprowadź ponownie dane.");
            }
        }
Beispiel #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            //get tge value from input fields
            contact.FirstName     = textBoxFirstName.Text;
            contact.LastName      = textBoxLastName.Text;
            contact.ContactNumber = textBoxContactNumber.Text;
            contact.Address       = textBoxAddress.Text;
            contact.Gender        = comboGender.Text;

            //Inserting data to database
            bool isSuccess = contact.Insert(contact);

            if (isSuccess == true)
            {
                //insert successfull
                MessageBox.Show("New Contact Successfully Inserted");
            }
            else
            {
                MessageBox.Show("Failed to add contact. error");
            }

            //Load data with new added record on Grid View
            DataTable dt = contact.Select();

            dgvConntactList.DataSource = dt;
            Clear(); //Clear after entering data
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //Get the value from the input fields
            c.FirstName = txtBoxFirstName.Text;
            c.LastName  = txtBoxLastName.Text;
            c.ContactNo = txtBoxContactNumber.Text;
            c.Address   = txtBoxAddress.Text;
            c.Gender    = cmbGender.Text;

            //Inserting Data into Database using the method we created in last stepp
            bool success = c.Insert(c);

            if (success == true)
            {
                //Successfully inserted
                MessageBox.Show("New Contact Successfully Inserted");

                //Call the clear methodhere
                Clear();
            }

            else
            {
                //Failed to add contact
            }
            //Load Data on Data Gridview
            DataTable dt = c.Select();

            dvgContactList.DataSource = dt;
        }
Beispiel #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            // Get the value from the input fields.

            c.FirstName     = txtboxFirstName.Text;
            c.LastName      = txtboxLastName.Text;
            c.contactNumber = textBoxContactNumber.Text;
            c.Address       = txtBoxAddress.Text;
            c.Gender        = cmbGender.Text;

            //Inserting data into datbase using the method created
            bool success = c.Insert(c);

            if (success == true)
            {
                MessageBox.Show("Success");
                DataTable dt = c.Select();
                dgvContactList.DataSource = dt;
                clear();
            }
            else
            {
                MessageBox.Show("Try again");
            }
        }
Beispiel #5
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            //get values from input fields
            c.FirstName     = FNtb.Text;
            c.LastName      = LNtb.Text;
            c.ContactNumber = CNtb.Text;
            c.Address       = Addresstb.Text;
            c.Gender        = Gendercb.Text;

            //inserting data into databasse
            bool success = c.Insert(c);

            if (success == true)
            {
                MessageBox.Show("New Contact has been successfully Inserted");
                Clear();
            }
            else
            {
                MessageBox.Show("Failed to add contact. Try Again.");
            }
            DataTable dt = c.Select();

            dgvContactList.DataSource = dt;
        }
Beispiel #6
0
        public void btnAdd_Click(object sender, EventArgs e)
        {
            //Get the value from the input fields
            c.FirstName = txtFirstName.Text;
            c.LastName  = txtLastName.Text;
            c.ContactNo = txtContactNo.Text;
            c.Adress    = txtAdress.Text;
            c.Gender    = cmbGender.Text;

            //Inserting data into Database

            bool sucess = c.Insert(c);

            if (sucess == true)
            {
                MessageBox.Show("New Contact Sucessfully Inserted");
                Clear();
            }
            else
            {
                MessageBox.Show("Failed to add New Contact. Try Again.");
            }
            DataTable dt = c.Select();

            dgvContactList.DataSource = dt;
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //Get values from input fields
            c.FirstName = textBoxFirstName.Text;
            c.LastName  = textBoxLastName.Text;
            c.ContactNo = textBoxContactNo.Text;
            c.Address   = textBoxAddress.Text;
            c.Gender    = comboBoxGender.Text;

            //Inseting data into database using the method we created
            bool success = c.Insert(c);

            if (success == true)
            {
                //Successfully inserted
                MessageBox.Show("New contact Inserted Successfully!");
                //call the method for clearing the fields
                Clear();
            }
            else
            {
                //Failed to add contact
                MessageBox.Show("Failed to insert record. Try Again!");
            }

            //Load data on Grid View
            System.Data.DataTable dt = c.Select(); //selects data from database
            dgvContactList.DataSource = dt;
        }
Beispiel #8
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //Get the value from the input fields
            c.FirstName = txtBoxFirstName.Text;
            c.LastName  = txtBoxLastName.Text;
            c.ContactNo = txtBoxContactNumber.Text;
            c.Address   = txtBoxAddress.Text;
            c.Gender    = cmbGender.Text;

            //Inserting Data into DAtabase uing the method we created in previous episode
            bool success = c.Insert(c);

            if (success == true)
            {
                //Successfully Inserted
                MessageBox.Show("New Contact Successfully Inserted");
                Clear();
                //Call the Clear Method Here
                //Clear();
            }
            else
            {
                //FAiled to Add Contact
                MessageBox.Show("Failed to add New Contact. Try Again.");
            }
            //load data on grid
            DataTable dt = c.Select();

            dgv.DataSource = dt;
        }
Beispiel #9
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //get the value from the input fields
            c.FirstName = textBoxFirstName.Text;
            c.LastName  = textBoxLastName.Text;
            c.ContactNo = textBoxContactNo.Text;
            c.Address   = textBoxAddress.Text;
            c.Gender    = comboBoxGender.Text;

            //inserting data into db using the created method
            bool success = c.Insert(c);

            if (success == true)
            {
                //successfully inserted
                MessageBox.Show("New contact has been inserted");
                //call the clear method
                Clear();
            }
            else
            {
                //failed to add contact
                MessageBox.Show("Failed to add new contact. Try again.");
            }
            //load data in the box
            DataTable dt = c.Select();

            dgvContactList.DataSource = dt;
        }
Beispiel #10
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            //Get the value from the input fields
            c.Title       = Title.Text;
            c.Description = Description.Text;
            c.Label       = Label.Text;

            //Inserting Data into Database
            bool success = c.Insert(c);

            if (success == true)
            {
                //Successfully Inserted
                MessageBox.Show("New Task Successfully Inserted");
                //Call the Clear Method Here
                //Clear();
            }
            else
            {
                //Failed to Add Contact
                MessageBox.Show("Failed to add New task. Try Again.");
            }
            //Load Data on Data Gridview
            DataTable dt = c.Select();
            // dgvContactList.DataSource = dt;
        }
Beispiel #11
0
        //Додавання даних
        private void btnInsert_Click(object sender, EventArgs e)
        {
            if (txtFirstName.Text == "" || txtLastName.Text == "" || txtPhoneNumber.Text == "" || txtAddress.Text == "" || cmbOther.Text == "")
            {
                MessageBox.Show("Поля порожні! Заповніть всі поля!", "TellPhoneBook");
            }
            else
            {
                c.FirstName   = txtFirstName.Text;
                c.LastName    = txtLastName.Text;
                c.PhoneNumber = txtPhoneNumber.Text;
                c.Address     = txtAddress.Text;
                c.Other       = cmbOther.Text;

                bool success = c.Insert(c);
                if (success == true)
                {
                    MessageBox.Show("Контакт доданий!", "TellPhoneBook");
                    Clear();
                }
                else
                {
                    MessageBox.Show("Контакт не доданий!", "TellPhoneBook");
                }
                //Load
                DataTable dt = c.Select();
                dgvContactList.DataSource = dt;
            }
        }
Beispiel #12
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            // Get the Value from the input fields
            c.FirstName     = txtboxFirstName.Text;
            c.LastName      = txtboxLastName.Text;
            c.ContactNumber = txtboxContactNumber.Text;
            c.Address       = txtboxAddress.Text;
            c.Gender        = cmbGender.Text;

            // Insert Data into Database using the methods we created in contactClass.cs

            bool success = c.Insert(c);

            if (success == true)
            {
                // Successfully Inserted
                MessageBox.Show("New Contact Successfully Inserted");
                // Call the clear() method here:
                Clear();
            }
            else
            {
                // Failed to add contact
                MessageBox.Show("Failed to add contact, please try again.");
            }

            // Load Data on Data Grid View
            DataTable dt = c.Select();

            dgvContactList.DataSource = dt;
        }
Beispiel #13
0
        private void btnAdd_onclk_Click(object sender, EventArgs e)
        {
            //get the value from the input fields
            c.firstName = IFirstName.Text;
            c.lastName  = ILastName.Text;
            c.contactNo = IContactNo.Text;
            c.address   = IAddress.Text;
            c.gender    = SGender.Text;

            //inserting data into DB using the method we created
            bool success = c.Insert(c);

            if (success == true)
            {
                //successfully inserted
                MessageBox.Show("New Contact Successfully Inserted");
                // Call the method clear
                Clear();
            }
            else
            {
                //failed to add contact
                MessageBox.Show("Failed to Add New Contact. Try Again !!!");
            }
            // Load data on data grid view
            DataTable dt = c.Select();

            dgvContactList.DataSource = dt;
        }
Beispiel #14
0
        private void BtnTambah_Click(object sender, EventArgs e)
        {
            //dapatkan nilai dari kolom input
            c.Nama   = txtNama.Text;
            c.Ponsel = txtPonsel.Text;
            c.Jekel  = cmbJekel.Text;
            c.Alamat = txtAlamat.Text;

            //enter data into the database using this method
            bool success = c.Insert(c);

            if (success == true)
            {
                //Success Inserted
                MessageBox.Show("Kontak Baru berhasil ditambahkan");
                Clear();
            }
            else
            {
                //Gagal Ditambahkan
                MessageBox.Show("Gagal Menambahkan Kontak, Coba Lagi.");
            }
            DataTable dt = c.Select();

            dgvContact.DataSource = dt;
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            // get value from input field
            c.FirstName     = txtFirstName.Text;
            c.LastName      = txtLastName.Text;
            c.ContactNumber = txtContactNumber.Text;
            c.Address       = txtAddress.Text;
            c.Gender        = cmbGender.SelectedItem.ToString();

            // insert in data

            bool success = c.Insert(c);

            if (success == true)
            {
                MessageBox.Show("New Contact successfully Inserted");
                clear();
            }
            else
            {
                MessageBox.Show("Desole something went wrong");
            }
            // load data on grid view
            DataTable dt = c.Select();

            dvgLoader.DataSource = dt;
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //Get the value from the input fields
            c.FirstName = txtboxFirstName.Text;
            c.LastName  = txtboxLastName.Text;
            c.ContactNo = txtboxContactNo.Text;
            c.Address   = txtboxAddress.Text;
            c.Gender    = cmbGender.Text;

            //Insert Data into database
            bool success = c.Insert(c);

            if (success == true)
            {
                //Sussessfully Inserted
                MessageBox.Show("New Contact Successfully Inserted");
                Clear();
            }
            else
            {
                //Failed to Add Contact
                MessageBox.Show("Failed to add New Contact. Try Again.");
            }
            //Load Data on Data GRidview
            DataTable dt = c.Select();

            dgvContactList.DataSource = dt;
        }
        //add
        private void button1_Click(object sender, EventArgs e)
        {
            //get the value from input field
            c.firstName = textBox5.Text;
            c.lastName  = textBox4.Text;
            c.contactNo = textBox3.Text;
            c.address   = textBox2.Text;
            c.gender    = comboBox1.Text;

            bool success = c.Insert(c);

            if (success == true)
            {
                MessageBox.Show("New Contact Successfully Inserted");
                //clear method
                clear();
            }
            else
            {
                MessageBox.Show("Failed");
            }

            //Load data on grid
            DataTable dt = c.Select();

            dataGridView1.DataSource = dt;
        }
Beispiel #18
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            c.ContactName   = textBoxName.Text;
            c.ContactNumber = textBoxContactNumber.Text;
            c.Address       = textBoxaddress.Text;
            c.Gender        = comboBox1.Text;

            bool success = c.Insert(c);

            if (success)
            {
                MessageBox.Show("New Contact Inserted");
                Clear();
            }
            else
            {
                MessageBox.Show("New Contact Failed");
            }

            DataTable dt = c.Select();

            dgvcontact.DataSource = dt;
        }
Beispiel #19
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (textBoxFirstName.Text != String.Empty && textBoxLastName.Text != String.Empty && textBoxContactNumber.Text != String.Empty &&
                textBoxAddress.Text != String.Empty && cmbGender.Text != String.Empty)
            {
                //Get the value from the input fields
                c.FirstName = textBoxFirstName.Text;
                c.LastName  = textBoxLastName.Text;
                c.ContactNo = textBoxContactNumber.Text;
                c.Address   = textBoxAddress.Text;
                c.Gender    = cmbGender.Text;

                //Inserting Data into Database using the method we created in contactClass.cs

                bool success = c.Insert(c);
                if (success == true)
                {
                    //Successfully inserted
                    MessageBox.Show("New contact successfully inserted");
                    //Call the clear method here
                    Clear();
                }
                else
                {
                    //Failed to add contact
                    MessageBox.Show("Failed to add new contact. Try again.");
                }
                //Load Data on DataGridView
                DataTable dt = c.Select();
                dgvContactList.DataSource = dt;
            }
            else
            {
                MessageBox.Show("Complete the fields");
            }
        }