private void addbutton_Click(object sender, EventArgs e)
        {
            DireccionGestor.setorigen("buscador");
            EmployeeForm studentaddobject = new EmployeeForm();

            studentaddobject.WindowState = FormWindowState.Maximized;
            studentaddobject.Show();
            this.Close();
        }
Esempio n. 2
0
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            LoginClass create = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());

            create.CreateEmployeeTable(UserAccessForm.getusername());
            origen = "inicio";
            EmployeeForm employeeaddobject = new EmployeeForm();

            employeeaddobject.WindowState = FormWindowState.Maximized;
            employeeaddobject.Show();
            this.Close();
        }
        private void editbutton_Click(object sender, EventArgs e)
        {
            DireccionGestor.setorigen("editor");

            DireccionGestor.setsombrestatic(namelabel.Text);
            DireccionGestor.setotrostatic(joblabel.Text);
            string        userDataName = UserAccessForm.getusername() + "_employee_table";
            EmployeeClass student      = new EmployeeClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
            string        orden        = "SELECT * FROM " + userDataName + " WHERE `NOMBRE COMPLETO`= '" + namelabel.Text + "' and EDAD = '" + agelabel.Text + "';";

            DireccionGestor.setorigen("editor");
            DireccionGestor.setordensql(orden);
            EmployeeForm studentaddobject = new EmployeeForm();

            studentaddobject.WindowState = FormWindowState.Maximized;
            studentaddobject.Show();
            this.Close();
        }
        private void editbutton_Click(object sender, EventArgs e)
        {
            if (cargobox.Text == "" || edadbox.Text == "" || comboname.Text == "")
            {
                MessageBox.Show("Hay datos importantes faltantes.");

                if (cargobox.Text == "")
                {
                    cargobox.BackColor = Color.Red;
                }
                if (edadbox.Text == "")
                {
                    edadbox.BackColor = Color.Red;
                }
                if (comboname.Text == "")
                {
                    comboname.BackColor = Color.Red;
                }
            }
            else
            {
                DireccionGestor.setsombrestatic(comboname.Text);
                DireccionGestor.setedadstatic(int.Parse(edadbox.Text));
                DireccionGestor.setotrostatic(cargobox.Text);
                string        userDataName = UserAccessForm.getusername() + "_employee_table";
                EmployeeClass student      = new EmployeeClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                string        orden        = "SELECT * FROM " + userDataName + " WHERE `NOMBRE COMPLETO`= '" + comboname.Text + "' and EDAD = '" + edadbox.Text + "' and ID='" + EmployeeClass.getids() + "';";

                DireccionGestor.setorigen("editor");
                DireccionGestor.setordensql(orden);


                if (student.fillcombos(comboname, edadbox, cargobox, orden) == true)
                {
                    EmployeeForm studentaddobject = new EmployeeForm();
                    studentaddobject.WindowState = FormWindowState.Maximized;
                    studentaddobject.Show();
                    this.Close();
                }
            }
        }
Esempio n. 5
0
        private void savebuttonstrip_Click(object sender, EventArgs e)
        {
            carga man = new carga();

            if (savebuttonstrip.Text == "GUARDAR")
            {
                man.WindowState = FormWindowState.Normal;

                if (gottendegree.Text == "" || nameEmployeeBox.Text == "" || idBox.Text == "" || telephoneNumberBox.Text == "" || schedule.Text == "" || cargobox.Text == "" || comboNacionalidad.Text == "" || ageBox.Text == "" || mensualitybox.Text == "" || personalReferenceBox.Text == "" || telephoneReferenceBox.Text == "" || relationReferenceBox.Text == "" || AlergyNmaeBox.Text == "" || DolenciaNameBox.Text == "" || nameMedicineBox.Text == "" || MotivoMedicineBox.Text == "")
                {
                    MessageBox.Show("Hay datos importantes vacios, termine el formulario.");



                    if (gottendegree.Text == "")
                    {
                        gottendegree.BackColor = Color.Red;
                    }
                    else
                    {
                        gottendegree.BackColor = Color.Green;
                    }

                    if (nameEmployeeBox.Text == "")
                    {
                        nameEmployeeBox.BackColor = Color.Red;
                    }
                    else
                    {
                        nameEmployeeBox.BackColor = Color.Green;
                    }

                    if (idBox.Text == "")
                    {
                        idBox.BackColor = Color.Red;
                    }
                    else
                    {
                        idBox.BackColor = Color.Green;
                    }

                    if (telephoneNumberBox.Text == "")
                    {
                        telephoneNumberBox.BackColor = Color.Red;
                    }
                    else
                    {
                        telephoneNumberBox.BackColor = Color.Green;
                    }

                    if (schedule.Text == "")
                    {
                        schedule.BackColor = Color.Red;
                    }
                    else
                    {
                        schedule.BackColor = Color.Green;
                    }

                    if (cargobox.Text == "")
                    {
                        cargobox.BackColor = Color.Red;
                    }
                    else
                    {
                        cargobox.BackColor = Color.Green;
                    }

                    if (comboNacionalidad.Text == "")
                    {
                        comboNacionalidad.BackColor = Color.Red;
                    }
                    else
                    {
                        comboNacionalidad.BackColor = Color.Green;
                    }

                    if (ageBox.Text == "")
                    {
                        ageBox.BackColor = Color.Red;
                    }
                    else
                    {
                        ageBox.BackColor = Color.Green;
                    }

                    if (mensualitybox.Text == "")
                    {
                        mensualitybox.BackColor = Color.Red;
                    }
                    else
                    {
                        mensualitybox.BackColor = Color.Green;
                    }

                    if (personalReferenceBox.Text == "")
                    {
                        personalReferenceBox.BackColor = Color.Red;
                    }
                    else
                    {
                        personalReferenceBox.BackColor = Color.Green;
                    }

                    if (telephoneReferenceBox.Text == "")
                    {
                        telephoneReferenceBox.BackColor = Color.Red;
                    }
                    else
                    {
                        telephoneReferenceBox.BackColor = Color.Green;
                    }

                    if (relationReferenceBox.Text == "")
                    {
                        relationReferenceBox.BackColor = Color.Red;
                    }
                    else
                    {
                        relationReferenceBox.BackColor = Color.Green;
                    }

                    if (AlergyNmaeBox.Text == "")
                    {
                        AlergyNmaeBox.BackColor = Color.Red;
                    }
                    else
                    {
                        AlergyNmaeBox.BackColor = Color.Green;
                    }

                    if (DolenciaNameBox.Text == "")
                    {
                        DolenciaNameBox.BackColor = Color.Red;
                    }
                    else
                    {
                        DolenciaNameBox.BackColor = Color.Green;
                    }

                    if (nameMedicineBox.Text == "")
                    {
                        nameMedicineBox.BackColor = Color.Red;
                    }
                    else
                    {
                        nameMedicineBox.BackColor = Color.Green;
                    }

                    if (MotivoMedicineBox.Text == "")
                    {
                        MotivoMedicineBox.BackColor = Color.Red;
                    }
                    else
                    {
                        MotivoMedicineBox.BackColor = Color.Green;
                    }
                }
                else
                {
                    try
                    {
                        string        userDataName = UserAccessForm.getusername() + "_employee_table";
                        EmployeeClass employee     = new EmployeeClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                        employee.NameNoCopied(nameEmployeeBox.Text, userDataName);
                        int      age        = int.Parse(ageBox.Text);
                        double   mensuality = double.Parse(mensualitybox.Text);
                        DateTime birthdate  = Convert.ToDateTime(birthDateBox.Value.Date);
                        DateTime timegetin  = Convert.ToDateTime(dategetin.Value.ToShortTimeString());
                        string   access     = userDataName;

                        if (mensualitybox.BackColor == Color.Red)
                        {
                            MessageBox.Show("Arregle el campo no valido");
                        }
                        else
                        {
                            if (employee.NameNoCopied(nameEmployeeBox.Text, userDataName) == true)
                            {
                                man.Close();
                                MessageBox.Show("El Empleado " + nameEmployeeBox.Text + " ya existe.");
                                if (MessageBox.Show("Agregar a otro empleado?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                                {
                                    employee = new EmployeeClass();

                                    DireccionGestor menu = new DireccionGestor();
                                    menu.WindowState = FormWindowState.Normal;
                                    menu.Show();
                                    this.Close();
                                }
                                else
                                {
                                    employee = new EmployeeClass();

                                    EmployeeForm menu = new EmployeeForm();
                                    menu.WindowState = FormWindowState.Normal;
                                    menu.Show();
                                    this.Close();
                                }
                            }
                            else if (employee.NameNoCopied(nameEmployeeBox.Text, userDataName) == false)
                            {
                                if (gottendegree.Text == "" || nameEmployeeBox.Text == "" || idBox.Text == "" || telephoneNumberBox.Text == "" || schedule.Text == "" || cargobox.Text == "" || comboNacionalidad.Text == "" || ageBox.Text == "" || mensualitybox.Text == "" || personalReferenceBox.Text == "" || telephoneReferenceBox.Text == "" || relationReferenceBox.Text == "" || AlergyNmaeBox.Text == "" || DolenciaNameBox.Text == "" || nameMedicineBox.Text == "" || MotivoMedicineBox.Text == "")
                                {
                                    MessageBox.Show("Hay datos importantes vacios, termine el formulario.");
                                }
                                else
                                {
                                    string date       = birthDateBox.Value.Day.ToString() + "/" + birthDateBox.Value.Month.ToString() + "/" + birthDateBox.Value.Year.ToString();
                                    string evento     = birthDateBox.Value.Day.ToString() + "/" + birthDateBox.Value.Month.ToString();
                                    string eventoname = "CUMPLEAÑOS DE " + nameEmployeeBox.Text;

                                    AgendaClass addevent = new AgendaClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                                    addevent.saveData(UserAccessForm.getusername(), eventoname, 1, date, "7:20:0", "NO", "NO", "NO", "NO", "NO", "NO", "NO", evento, "SI", "");

                                    LoginClass add = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                                    add.AddContact(nameEmployeeBox.Text, telephoneNumberBox.Text, direccionbox.Text, emailcombo.Text, UserAccessForm.getusername().ToString());

                                    if (employee.SaveData(userDataName, dategetin, gottendegree.Text, nameEmployeeBox.Text, idBox.Text, birthDateBox, telephoneNumberBox.Text, schedule.Text, cargobox.Text, comboNacionalidad.Text, age, mensuality, personalReferenceBox.Text, telephoneReferenceBox.Text, relationReferenceBox.Text, AlergyNmaeBox.Text, DolenciaNameBox.Text, nameMedicineBox.Text, MotivoMedicineBox.Text, picturetextbox.Text, monedatipo.Text, sexobox.Text, direccionbox.Text, emailcombo.Text))
                                    {
                                        man.Close();
                                        employee.NameNoCopied(nameEmployeeBox.Text, userDataName);
                                        employee.OrderID(userDataName);
                                        MessageBox.Show("NUEVO EMPLEADO " + nameEmployeeBox.Text + " HA SIDO AGREGADO.");

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

                                            DireccionGestor menu = new DireccionGestor();
                                            menu.WindowState = FormWindowState.Normal;
                                            menu.Show();
                                            this.Close();
                                        }
                                        else
                                        {
                                            employee = new EmployeeClass();

                                            EmployeeForm menu = new EmployeeForm();
                                            menu.WindowState = FormWindowState.Normal;
                                            menu.Show();
                                            this.Close();
                                        }
                                    }

                                    else
                                    {
                                        man.Close();

                                        MessageBox.Show("NUEVO EMPLEADO " + nameEmployeeBox.Text + "HA SIDO AGREGADO.");
                                        if (MessageBox.Show("Agregar a otro empleado?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                                        {
                                            employee = new EmployeeClass();

                                            DireccionGestor menu = new DireccionGestor();
                                            menu.WindowState = FormWindowState.Normal;
                                            menu.Show();
                                            this.Close();
                                        }
                                        else
                                        {
                                            employee = new EmployeeClass();

                                            EmployeeForm menu = new EmployeeForm();
                                            menu.WindowState = FormWindowState.Normal;
                                            menu.Show();
                                            this.Close();
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch (FormatException datethis) { datethis.ToString(); }
                }
            }
            else if (savebuttonstrip.Text == "MODIFICAR")
            {
                man.WindowState = FormWindowState.Normal;

                if (referenciaopcionbox.Text == "NO")
                {
                    man.Close();
                    telephoneNumberBox.Text   = "NINGUNA";
                    relationReferenceBox.Text = "NINGUNA";
                    personalReferenceBox.Text = "NINGUNA";
                }

                try
                {
                    man.Close();
                    string        userDataName = UserAccessForm.getusername() + "_employee_table";
                    EmployeeClass save         = new EmployeeClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                    AgendaClass   addevent     = new AgendaClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());


                    double mensuality = double.Parse(mensualitybox.Text);

                    string nameevent  = "CUMPLEAÑOS DE " + nameEmployeeBox.Text;
                    string date       = birthDateBox.Value.Day.ToString() + "/" + birthDateBox.Value.Month.ToString() + "/" + birthDateBox.Value.Year.ToString();
                    string momentdate = birthDateBox.Value.Day.ToString() + "/" + birthDateBox.Value.Month.ToString();

                    save.ModifyData(DireccionGestor.getnombrestatic(), trabajando.Text, userDataName, dategetin, salidapicker, gottendegree.Text, nameEmployeeBox.Text, idBox.Text, birthDateBox,
                                    telephoneNumberBox.Text, schedule.Text, cargobox.Text, comboNacionalidad.Text, int.Parse(ageBox.Text), mensuality, personalReferenceBox.Text, telephoneNumberBox.Text,
                                    relationReferenceBox.Text, AlergyNmaeBox.Text, DolenciaNameBox.Text, nameMedicineBox.Text, MotivoMedicineBox.Text, picturetextbox.Text, monedatipo.Text,
                                    sexobox.Text, direccionbox.Text, emailcombo.Text, EmployeeClass.getids());
                    addevent.modifydata(UserAccessForm.getusername(), DireccionGestor.getnombrestatic(), nameevent, 1, date, "7:20:0", "NO", "NO", "NO", "NO", "NO", "NO", "NO", momentdate, "SI");
                    LoginClass add = new LoginClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                    add.editContact(nameEmployeeBox.Text, telephoneNumberBox.Text, direccionbox.Text, emailcombo.Text, DireccionGestor.getnombrestatic(), UserAccessForm.getusername().ToString());

                    MessageBox.Show("EL EMPLEADO " + nameEmployeeBox.Text + " HA SIDO MODIFICADO");



                    EmployeeClass      studentobject = new EmployeeClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                    EmployeeFormSearch buscar        = new EmployeeFormSearch();
                    buscar.WindowState = FormWindowState.Maximized;
                    buscar.Show();
                    this.Close();
                }
                catch (FormatException datethis) { datethis.ToString(); }
            }
        }