Ejemplo n.º 1
0
        private void timer_Tick(object sender, EventArgs e)
        {
            TimeClass timeobject = new TimeClass();

            hourlabelstrip.Text = timeobject.clockshape();
            datelabelstrip.Text = timeobject.dateshape();

            AgendaClass ev = new AgendaClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());

            string hora       = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();
            string fechal     = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString();;
            string fechashort = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString();



            string orden = "SELECT DESCRIPCION, HORA, PRIORIDAD FROM " + UserAccessForm.getusername() + "_events_table WHERE (HORA='" + hora + "' AND ( FECHA='" + fechal + "' or `FECHA DE RECORDATORIO`='" + fechashort + "'))AND ACTIVO='SI';";

            if (ev.getnametarea(orden))
            {
                DireccionGestor.setsombrestatic(ev.getname());
                DireccionGestor.setotrostatic(ev.gettime());
                DireccionGestor.setprioridadstatic(ev.getprioridad());
                DireccionGestor.setestadostatic(true);


                SystemSounds.Hand.Play();
                MessageBox.Show("SON LAS " + ev.gettime() + " ES HORA DE " + ev.getname());

                MessageBox.Show(DireccionGestor.getnombrestatic().ToString());
            }

            cuenta++;
            if (cuenta == 4000)
            {
                cuenta = 0;
                backbuttonstrip.PerformClick();
            }
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
        private void agendaAdd_Load(object sender, EventArgs e)
        {
            //SystemSounds.Hand.Play();
            playmusic.Hide();
            stopmusic.Hide();

            activobox.Hide();
            labelactivo.Hide();
            AgendaClass add   = new AgendaClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
            string      orden = "SELECT distinct `SONIDO` FROM " + UserAccessForm.getusername() + "_events_table;";

            add.Fillcombo(melodybox, orden);

            if (DireccionGestor.getorigen() == "modificar")
            {
                activobox.Show();
                labelactivo.Show();
                titlelabel.Text = "EDITAR TAREAS";
                motivoBox.Text  = DireccionGestor.getnombrestatic();
                fecha           = DireccionGestor.getotrostatic();

                if (fecha != "00/00/0000")
                {
                    datebox.Text = fecha;
                }
                else
                {
                    datebox.Enabled = false;
                }


                AgendaClass mod = new AgendaClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
                orden = "SELECT * FROM " + UserAccessForm.getusername() + "_events_table WHERE DESCRIPCION= '" + DireccionGestor.getnombrestatic() + "' and FECHA = '" + DireccionGestor.getotrostatic() + "';";
                mod.filleverything(activobox, priority, shortdate, hora, lunescheck, martescheckBox, miercolescheckBox, juevescheckBox, viernescheckbox, sabadocheckBox, domingocheckBox, comborepeticion, melodybox, orden);

                if (hora != "00:00:00")
                {
                    timeBox.Text = hora;
                }
                else
                {
                    timeBox.Enabled = false;
                }

                //MessageBox.Show("LUNES "+lunes+", MARTES "+martes+", MIERCOLES "+miercoles+", JUEVES "+jueves+", VIERNES "+viernes+", SABADO "+sabado+", DOMINGO "+domingo)



                if (lunescheck.Checked == false && martescheckBox.Checked == false && miercolescheckBox.Checked == false && juevescheckBox.Checked == false && viernescheckbox.Checked == false && sabadocheckBox.Checked == false && domingocheckBox.Checked == false)
                {
                    //comborepeticion.Text = "NO";
                    paneldias.Hide();
                    datebox.Enabled = true;
                }
                else if (lunescheck.Checked == false && martescheckBox.Checked == false && miercolescheckBox.Checked == false && juevescheckBox.Checked == false && viernescheckbox.Checked == false && sabadocheckBox.Checked == false && domingocheckBox.Checked == false)
                {
                    //comborepeticion.Text = "ELEGIR";
                    paneldias.Show();

                    datebox.Enabled = false;
                    fecha           = "00/00/0000";
                }
                else if (lunescheck.Checked == true && martescheckBox.Checked == true && miercolescheckBox.Checked == true && juevescheckBox.Checked == true && viernescheckbox.Checked == true && sabadocheckBox.Checked == false && domingocheckBox.Checked == false)
                {
                    //comborepeticion.Text = "DIARIO";
                    paneldias.Show();

                    datebox.Enabled = false;
                    fecha           = "00/00/0000";
                }
                else if (lunescheck.Checked == true && martescheckBox.Checked == true && miercolescheckBox.Checked == true && juevescheckBox.Checked == true && viernescheckbox.Checked == true && sabadocheckBox.Checked == true && domingocheckBox.Checked == true)
                {
                    //comborepeticion.Text = "TODOS LOS DIAS";
                    paneldias.Show();
                    fecha           = "00/00/0000";
                    datebox.Enabled = false;
                }
            }
            else
            {
                priority.Text        = "NORMAL";
                comborepeticion.Text = "NO";
            }


            OKbutton.BackColor        = Color.Green;
            cancelbutton.BackColor    = Color.Red;
            tareasverbutton.BackColor = Color.Blue;
        }
Ejemplo n.º 4
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(); }
            }
        }
Ejemplo n.º 5
0
        private void OKbutton_Click(object sender, EventArgs e)
        {
            string fecharecordatorio = "00/00";

            fecha = datebox.Value.Day.ToString() + "/" + datebox.Value.Month.ToString() + "/" + datebox.Value.Year.ToString();
            string hora = timeBox.Value.Hour.ToString() + ":" + timeBox.Value.Minute.ToString() + ":" + timeBox.Value.Second.ToString();

            AgendaClass agenda = new AgendaClass(UserAccessForm.getdbserver(), UserAccessForm.getdbname(), UserAccessForm.getdbuser(), UserAccessForm.getdbpassword(), UserAccessForm.getdbport());
            string      user   = UserAccessForm.getusername();

            if (lunescheck.Checked == true)
            {
                dias[0] = "SI";
            }
            else
            {
                dias[0] = "NO";
            }
            if (martescheckBox.Checked == true)
            {
                dias[1] = "SI";
            }
            else
            {
                dias[1] = "NO";
            }
            if (miercolescheckBox.Checked == true)
            {
                dias[2] = "SI";
            }
            else
            {
                dias[2] = "NO";
            }
            if (juevescheckBox.Checked == true)
            {
                dias[3] = "SI";
            }
            else
            {
                dias[3] = "NO";
            }
            if (viernescheckbox.Checked == true)
            {
                dias[4] = "SI";
            }
            else
            {
                dias[4] = "NO";
            }
            if (sabadocheckBox.Checked == true)
            {
                dias[5] = "SI";
            }
            else
            {
                dias[5] = "NO";
            }
            if (domingocheckBox.Checked == true)
            {
                dias[6] = "SI";
            }
            else
            {
                dias[6] = "NO";
            }



            int prioridad = 1;

            if (priority.Text == "MUY IMPORTANTE")
            {
                prioridad = 0;
            }
            else if (priority.Text == "NORMAL")
            {
                prioridad = 1;
            }
            else
            {
                prioridad = 2;
            }



            if (comborepeticion.Text == "NO")
            {
                fecharecordatorio = datebox.Value.Day.ToString() + "/" + datebox.Value.Month.ToString();
            }
            else
            {
                fecharecordatorio = "00/00";
            }

            // 0 - MUY IMPORTANTE
            // 1 - NORMAL
            // 2 - POCO IMPORTANTE

            if (DireccionGestor.getorigen() == "inicio" || DireccionGestor.getorigen() == "buscador")
            {
                string activo = "SI";

                if (motivoBox.Text == "" || priority.Text == "")
                {
                    MessageBox.Show("COMPLETE EL FORMULARIO");
                    if (motivoBox.Text == "")
                    {
                        motivoBox.BackColor = Color.Red;
                    }
                    else
                    {
                        motivoBox.BackColor = Color.Green;
                    }

                    if (priority.Text == "")
                    {
                        priority.BackColor = Color.Red;
                    }
                    else
                    {
                        motivoBox.BackColor = Color.Green;
                    }
                }
                else
                {
                    if (agenda.saveData(user, motivoBox.Text, prioridad, fecha, hora, dias[0], dias[1], dias[2], dias[3], dias[4], dias[5], dias[6], fecharecordatorio, activo, melodybox.Text))
                    {
                        MessageBox.Show("TAREA GUARDADA");
                        if (MessageBox.Show("Agregar otra tarea?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                        {
                            agenda = new AgendaClass();
                            this.Close();
                        }
                        else
                        {
                            agenda = new AgendaClass();
                            this.Close();
                            agendaAdd menu = new agendaAdd();
                        }
                    }
                    else
                    {
                        MessageBox.Show("TAREA GUARDADA" + " " + agenda.getmessageshow());
                        if (MessageBox.Show("Agregar otra tarea?", "Agregar", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                        {
                            agenda = new AgendaClass();
                            this.Close();
                        }
                        else
                        {
                            agenda = new AgendaClass();
                            this.Close();
                            agendaAdd menu = new agendaAdd();
                            menu.WindowState = FormWindowState.Normal;
                            menu.Show();
                        }
                    }
                }
            }
            else if (DireccionGestor.getorigen() == "modificar")
            {
                agenda.ordensql("UPDATE " + UserAccessForm.getusername() + "_events_table SET `DESCRIPCION`= '" + motivoBox.Text + "',  `FECHA` ='" + fecha + "',  `HORA` ='" + hora + "',  `PRIORIDAD` = '" + prioridad + "',  `LUNES`='" + dias[0] + "',  `MARTES` ='" + dias[1] + "', `MIERCOLES` ='" + dias[2] + "',  `JUEVES` ='" + dias[3] + "',  `VIERNES` ='" + dias[4] + "',  `SABADO` ='" + dias[5] + "',  `DOMINGO` ='" + dias[6] + "', `FECHA DE RECORDATORIO` ='" + fecharecordatorio + "', `ACTIVO` ='" + activobox.Text + "',`SONIDO`='" + melodybox.Text + "' WHERE  `DESCRIPCION`= '" + DireccionGestor.getnombrestatic() + "' AND FECHA ='" + DireccionGestor.getotrostatic() + "';");
                MessageBox.Show("TAREA MODIFICADA");

                AgendaEvents agendaobject = new AgendaEvents();
                agendaobject.WindowState = FormWindowState.Normal;
                agendaobject.Show();
                this.Close();
            }
        }