Exemplo n.º 1
0
        private void contactsverbutton_Click(object sender, EventArgs e)
        {
            cuenta = 0;
            ShowContacts show = new ShowContacts();

            show.WindowState = FormWindowState.Normal;
            show.Show();
            this.Close();
        }
Exemplo n.º 2
0
        private void cONTACTOSToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LoginClass create = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());

            create.CreateContactsTable(UserAccessForm.getusername());
            origen = "inicio";
            ShowContacts agendaobjectl = new ShowContacts();

            agendaobjectl.WindowState = FormWindowState.Normal;
            agendaobjectl.Show();
        }
Exemplo n.º 3
0
 private void cancelbutton_Click(object sender, EventArgs e)
 {
     if (DireccionGestor.getorigen() == "editor" || DireccionGestor.getorigen() == "buscador")
     {
         ShowContacts pop = new ShowContacts();
         pop.WindowState = FormWindowState.Normal;
         pop.Show();
         this.Close();
     }
     else
     {
         this.Close();
     }
 }
Exemplo n.º 4
0
        private void OKbutton_Click(object sender, EventArgs e)
        {
            cuenta = 0;
            carga ca = new carga();

            ca.WindowState = FormWindowState.Normal;
            ca.Show();
            if (DireccionGestor.getorigen() == "inicio")
            {
                if (nombrebox.Text == "" || telefonobox.Text == "")
                {
                    if (nombrebox.Text == "")
                    {
                        nombrebox.BackColor = Color.Red;
                    }
                    else
                    {
                        nombrebox.BackColor = Color.Green;
                    }
                    if (telefonobox.Text == "")
                    {
                        telefonobox.BackColor = Color.Red;
                    }
                    else
                    {
                        telefonobox.BackColor = Color.Green;
                    }
                    MessageBox.Show("HAY CAMPOS CLAVES VACIOS");
                }
                else
                {
                    if (direccionbox.Text == "")
                    {
                        direccionbox.Text = "NINGUNA";
                    }
                    if (emailbox.Text == "")
                    {
                        emailbox.Text = "NINGUNA";
                    }

                    try
                    {
                        LoginClass add = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                        add.AddContact(nombrebox.Text, telefonobox.Text, direccionbox.Text, emailbox.Text, UserAccessForm.getusername().ToString());
                        MessageBox.Show("NUEVO CONTACTO " + nombrebox.Text + " AGREGADO");

                        if (MessageBox.Show("Agregar a otro empleado?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                        {
                            add = new LoginClass();


                            this.Close();
                        }
                        else
                        {
                            add = new LoginClass();

                            addContact menu = new addContact();
                            menu.WindowState = FormWindowState.Normal;
                            menu.Show();
                            this.Close();
                        }
                    }
                    catch (FormatException datethis) { datethis.ToString(); }
                }
            }
            else if (DireccionGestor.getorigen() == "editor")
            {
                try
                {
                    LoginClass add = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                    add.ordensql("UPDATE " + UserAccessForm.getusername() + "_contacts_table SET NOMBRE='" + nombrebox.Text + "', TELEFONO='" + telefonobox.Text + "', DIRECCION='" + direccionbox.Text + "', EMAIL='" + emailbox.Text + "' WHERE ID='" + ShowContacts.getdataout()[4] + "';");
                    MessageBox.Show("CONTACTO " + DireccionGestor.getnombrestatic() + " EDITADO");

                    ShowContacts show = new ShowContacts();
                    show.WindowState = FormWindowState.Normal;
                    show.Show();
                    this.Close();
                }
                catch (FormatException datethis) { datethis.ToString(); }
                catch (IndexOutOfRangeException oper) { oper.ToString(); }
            }
            else if (DireccionGestor.getorigen() == "buscador")
            {
                if (nombrebox.Text == "" || telefonobox.Text == "")
                {
                    if (nombrebox.Text == "")
                    {
                        nombrebox.BackColor = Color.Red;
                    }
                    else
                    {
                        nombrebox.BackColor = Color.Green;
                    }
                    if (telefonobox.Text == "")
                    {
                        telefonobox.BackColor = Color.Red;
                    }
                    else
                    {
                        telefonobox.BackColor = Color.Green;
                    }
                    MessageBox.Show("HAY CAMPOS CLAVES VACIOS");
                }
                else
                {
                    if (direccionbox.Text == "")
                    {
                        direccionbox.Text = "NINGUNA";
                    }
                    if (emailbox.Text == "")
                    {
                        emailbox.Text = "NINGUNA";
                    }

                    try
                    {
                        LoginClass add = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                        add.AddContact(nombrebox.Text, telefonobox.Text, direccionbox.Text, emailbox.Text, UserAccessForm.getusername().ToString());
                        MessageBox.Show("NUEVO CONTACTO " + nombrebox.Text + " AGREGADO");

                        if (MessageBox.Show("Agregar a otro empleado?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                        {
                            add = new LoginClass();

                            ShowContacts ad = new ShowContacts();
                            ad.WindowState = FormWindowState.Normal;
                            ad.Show();
                            this.Close();
                        }
                        else
                        {
                            add = new LoginClass();

                            addContact menu = new addContact();
                            menu.WindowState = FormWindowState.Normal;
                            menu.Show();
                            this.Close();
                        }
                    }
                    catch (FormatException datethis) { datethis.ToString(); }
                }
            }


            ca.Close();
        }