Ejemplo n.º 1
0
        private void btmAdd_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;

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

            if (success == true)
            {
                //succussfully 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 in the grid view
            DataTable dt = c.Select();

            dgvContactList.DataSource = dt;
        }
Ejemplo n.º 2
0
        // Button click event
        private void btnAdd_Click(object sender, EventArgs e)
        {
            // Get value from input field
            c.FirstName = textBoxFirstName.Text;
            c.LastName  = textBoxLastName.Text;
            c.ContactNo = textBoxContactNumber.Text;
            c.Address   = textBoxAddress.Text;
            c.Gender    = cmbGender.Text;

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

            if (success == true)
            {
                // Successfully Inserted!
                MessageBox.Show("New Contact Successfully Inserted!");
                // Clear fields
                Clear();
            }
            else
            {
                // Failed to add
                MessageBox.Show("Failed to add new contact. Try again!");
            }

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

            dgvContactList.DataSource = dt;
        }
Ejemplo n.º 3
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            model.Firstname = txtName.Text;
            model.Lastname  = txtLastname.Text;
            model.Phone     = txtNumber.Text;
            model.Address   = txtAddress.Text;
            model.Gender    = cboGender.Text;

            bool success = model.Insert(model);

            if (success == true)
            {
                MessageBox.Show("New contact successfully Inserted.", "Create Success", MessageBoxButtons.OK, MessageBoxIcon.Information);

                Clear();
            }
            else
            {
                MessageBox.Show("Failed to create new Contact", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }

            // Load data on Data GridView
            DataTable dataTable = model.Select();

            dataGridView.DataSource = dataTable;
        }
Ejemplo n.º 4
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            // Get the value from the input fields
            c.FirstName = tbFirstName.Text;
            c.LastName  = tbLastName.Text;
            c.Phone     = maskedTextBox1.Text;
            c.Email     = tbEmail.Text;
            c.Note      = tbNote.Text;
            c.Status    = cmbStatus.Text;

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

            if (success == true)
            {
                // succesfully Inserted
                MessageBox.Show("New contact succesfully inserted");
                // Call the Clear method here
                eEmail.Clear();
                Clear();
            }
            else
            {
                // Faild to add contact
                MessageBox.Show("Failed to add new contact. Try again.");
            }

            // load data on Gridview
            DataTable dt = c.Select();

            dgvContactList.DataSource = dt;
        }
Ejemplo n.º 5
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                //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", "EContact", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //Call the Clear Method Here
                    Clear();
                }
                else
                {
                    //FAiled to Add Contact
                    MessageBox.Show("Failed to add New Contact. Duplicated Contact Value.", "EContact", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    Clear();
                }
                //Load Data on Data GRidview
                DataTable dt = c.Select();
                dgvContactList.DataSource = dt;
            }
        }
Ejemplo n.º 6
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;

            //insert the Data into Database using the method we created when we write the insertion code in contactClass
            bool success = c.Insert(c);

            if (success == true)
            {
                //inserted successfully
                MessageBox.Show("new Contact inserted successfuly");
                //the clear method will be Called here
                Clear();
            }
            else
            {
                //failed to add Contact
                MessageBox.Show("Failed to add Contact, try again. ");
            }
            //load Data on Data GRidview
            DataTable dt = c.Select();

            dgvContactList.DataSource = dt;
        }
Ejemplo n.º 7
0
        private void frmContactHub_Load(object sender, EventArgs e)
        {
            //Load Data in data grid view
            DataTable Dt = cc.Select();

            dgvContactList.DataSource = Dt;
        }
Ejemplo n.º 8
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            //get values from INPUT fields
            c.Cod_Tipologie = cmbCategorie.Text;
            c.Nume          = txtNume.Text;
            c.Prenume       = txtPrenume.Text;
            c.Tel           = txtTel.Text;
            c.Email         = txtEmail.Text;

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

            if (success == true)
            {
                //succesfully inserted
                MessageBox.Show("Ati introdus cu succes un abonat nou!");
            }
            else
            {
                //failed insertion
                MessageBox.Show("Nu ati reusit sa adaugati un nou abonat! Incercati din nou.");
                //metoda clear apelata aici
                Clear();
            }


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

            tbtSearch.DataContext = 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 = txtboxContactNumber.Text;
            c.Address   = txtboxAddress.Text;
            c.Gender    = cmbGender.Text;

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

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

                //calling clear method here
                clear();
            }
            else
            {
                MessageBox.Show("Failed to add New Contact. Try Again !");
            }

            //load data on DataGridView
            DataTable dt = c.Select();

            dgvContactList.DataSource = dt;
        }
Ejemplo n.º 10
0
 private void EContact_Load(object sender, EventArgs e)
 {
     //conn = new NpgsqlConnection("Server=\"localhost\";Port=5432;Database=test;User Id=postgres;Password=progStuff;");
     //conn = new NpgsqlConnection(myconnstrng);
     dt = c.Select();
     dgv1.DataSource = null;
     dgv1.DataSource = dt;
 }
Ejemplo n.º 11
0
        public void LoadData()
        {
            DataTable dt = c.Select();

            dataGridView1.DataSource = dt;

            this.dataGridView1.Columns["ContactID"].Visible = false;
        }
Ejemplo n.º 12
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            c.FirstName  = textBoxFirstName.Text;
            c.LastName   = textBoxLastName.Text;
            c.ConstactNo = textBoxContactNo.Text;
            c.Address    = textBoxAddress.Text;
            c.Gender     = comboBoxGender.Text;

            bool success = c.Insert(c);

            if (success == true)
            {
                MessageBox.Show("New Contact Successfully Inserted.");
                DataTable dt = c.Select();
                dataGridViewContactList.DataSource = dt;
                Clear();
            }
            else
            {
                MessageBox.Show("Failed to add New Contact. Try Again.");
            }
        }
Ejemplo n.º 13
0
        private void ContactBook_Load(object sender, EventArgs e)
        {
            DataTable dt = c.Select();

            contactList.DataSource = dt;
        }
Ejemplo n.º 14
0
        private void EContact_Load(object sender, EventArgs e)
        {
            DataTable dt = cc.Select();

            dgvContactlist.DataSource = dt;
        }