Esempio n. 1
0
        private void UserOption_Load(object sender, EventArgs e)
        {
            ConexionTask Conexion = new ConexionTask();
            DataSet      ds;

            lblnombre.Text = Task_Login.usuario;
            string comando;

            comando                     = "exec CargarUsuario " + Convert.ToInt32(Task_Login.IDus) + "";
            ds                          = Conexion.ExecuteDS(comando);
            txtNombre.Text              = ds.Tables[0].Rows[0]["nombre"].ToString();
            txtApellido.Text            = ds.Tables[0].Rows[0]["apellido"].ToString();
            txtCedula.Text              = ds.Tables[0].Rows[0]["cedula"].ToString();
            txtEmail.Text               = ds.Tables[0].Rows[0]["Email"].ToString();
            txtUsuario.Text             = ds.Tables[0].Rows[0]["nombreusuario"].ToString();
            richTextBoxDescripcion.Text = ds.Tables[0].Rows[0]["descripcion"].ToString();
            richTextBoxDireccion.Text   = ds.Tables[0].Rows[0]["direccion"].ToString();
            dateTimePicker1.Value       = Convert.ToDateTime(ds.Tables[0].Rows[0]["fechanacimiento"].ToString());
            if (ds.Tables[0].Rows[0]["sexo"].ToString().ToString() == "M")
            {
                radioButtonM.Checked = true;
            }
            else if (ds.Tables[0].Rows[0]["sexo"].ToString().ToString() == "F")
            {
                radioButtonF.Checked = true;
            }
        }
Esempio n. 2
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtNombre.Text == "" || txtApellido.Text == "" || txtCedula.Text == "" || sexo == "" || richTextBoxDireccion.Text == "" || txtEmail.Text == "" || richTextBoxDescripcion.Text == "" || txtUsuario.Text == "" || txtContraseña.Text == "")
                {
                    MessageBox.Show("Debe llenar todos los campos requeridos", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    string Comando;
                    Comando = "insert into usuarios (nombre, apellido, cedula, sexo, direccion, email, fechanacimiento, Descripcion, nombreusuario, contraseña) values ('" + txtNombre.Text + "', '" + txtApellido.Text + "', '" + txtCedula.Text.Trim() + "', " +
                              "'" + sexo + "', '" + richTextBoxDireccion.Text + "', '" + txtEmail.Text.Trim() + "', Convert(varchar(19), '" + dateTimePicker1.Value.ToShortDateString() + "'), '" + richTextBoxDescripcion.Text + "', '" + txtUsuario.Text.Trim() + "', '" + txtContraseña.Text.Trim() + "') ";

                    ConexionTask con = new ConexionTask();
                    con.ExecuteSP(Comando);
                    MessageBox.Show("Se ha Registrado un Nuevo Usuario", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Limpiar();
                }
            }
            catch (Exception Error)
            {
                MessageBox.Show("Ocurrio un error en la transaccion" + Error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
        private void btnguardar_Click(object sender, EventArgs e)
        {
            ConexionTask Conexion = new ConexionTask();
            string       sexo     = string.Empty;
            string       cmd;

            if (radioButtonF.Checked == true)
            {
                sexo = "F";
            }
            else if (radioButtonM.Checked == true)
            {
                sexo = "M";
            }

            if (txtNombre.Text == string.Empty || txtApellido.Text == string.Empty || txtCedula.Text == string.Empty || txtEmail.Text == string.Empty || txtUsuario.Text == string.Empty || richTextBoxDescripcion.Text == string.Empty || richTextBoxDireccion.Text == string.Empty)
            {
                MessageBox.Show("Debe completar todos los campos para guardar la información", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                try
                {
                    cmd = string.Format("exec UpdateUsuario " + Convert.ToInt32(Task_Login.IDus) + ", '" + txtNombre.Text + "', '" + txtApellido.Text + "', '" + txtCedula.Text + "', '" + sexo + "', '" + richTextBoxDireccion.Text + "', '" + txtEmail.Text + "', '" + dateTimePicker1.Value.ToShortDateString() + "', '" + richTextBoxDescripcion.Text + "', '" + txtUsuario.Text + "'");
                    Conexion.ExecuteSP(cmd);
                    MessageBox.Show("Los datos han sido guardados correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception Error)
                {
                    MessageBox.Show("Ha ocurrido un error en la transaccion" + Error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                Desactivar();
            }
        }
Esempio n. 4
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                ConexionTask ConTask = new ConexionTask();

                DataSet ds = ConTask.ExecuteDS("Select * from usuarios where nombreusuario = '" + textBox1.Text.Trim() + "'and contraseña ='" + textBox2.Text.Trim() + "'");
                if (textBox1.Text.Trim() == ds.Tables[0].Rows[0]["NombreUsuario"].ToString().Trim() && textBox2.Text.Trim() == ds.Tables[0].Rows[0]["contraseña"].ToString().Trim())
                {
                    usuario = ds.Tables[0].Rows[0]["nombre"].ToString().Trim();
                    IDus    = ds.Tables[0].Rows[0]["idusuario"].ToString().Trim();
                    Task_Menu abre = new Task_Menu();
                    this.Hide();
                    abre.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Nombre de usuario o constraseña incorrectos, intentelo de nuevo", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch
            {
                MessageBox.Show("Nombre de usuario o constraseña incorrectos, intentelo de nuevo", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 5
0
        private void Task_TareaView2_Load(object sender, EventArgs e)
        {
            string cmd;
            int    valor;

            valor = Convert.ToInt32(Task_Menu.id);
            ConexionTask abre = new ConexionTask();

            cmd = string.Format("select tarea.titulotarea, tarea.descripciontarea, urgencia.nonurgencia, tipo.tipo, tarea.fechacreada, tarea.fecharecordatorio  from tarea join urgencia on tarea.idurgencia = urgencia.idurgencia join tipo on tarea.idtipo = tipo.idtipo where tarea.idtarea =" + valor + "");
            DataSet DataS;

            try
            {
                DataS          = abre.ExecuteDS(cmd);
                txtTitulo.Text = DataS.Tables[0].Rows[0]["titulotarea"].ToString();
                richTextBoxDescripcion.Text = DataS.Tables[0].Rows[0]["descripciontarea"].ToString();
                comboBox1.Text        = DataS.Tables[0].Rows[0]["nonurgencia"].ToString();
                comboBox2.Text        = DataS.Tables[0].Rows[0]["tipo"].ToString();
                dateTimePicker1.Value = Convert.ToDateTime(DataS.Tables[0].Rows[0]["fecharecordatorio"].ToString());
            }
            catch (Exception error)
            {
                MessageBox.Show("Ha ocurrido un error " + error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 6
0
 private void Task_CompletarTarea_Load(object sender, EventArgs e)
 {
     try
     {
         ConexionTask con = new ConexionTask();
         string       cmd = "exec tareaspendientes_completar " + Task_Login.IDus + "";
         con.ExecuteDGV(cmd, dataGridCompletarTarea);
     }
     catch (Exception error)
     {
         MessageBox.Show("Ha ocurrido un error " + error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 7
0
 private void Task_EditarTarea_Load(object sender, EventArgs e)
 {
     try
     {
         ConexionTask con = new ConexionTask();
         string       cmd = "exec MostrarTareasEditar " + Convert.ToInt32(Task_Login.IDus) + "";
         con.ExecuteDGV(cmd, dataGridEditarTarea);
     }
     catch (Exception error)
     {
         MessageBox.Show("Ha ocurrido un error " + error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 8
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (comboEstado.Text == "Todas")
            {
                try
                {
                    ConexionTask con = new ConexionTask();
                    con.ExecuteDGV("Select idtarea as 'iD', titulotarea as 'Titulo', fechacreada as 'Emision', fecharecordatorio as 'Recordatorio', estado as 'Estado' from tarea where idusuario = " + Convert.ToInt32(Task_Login.IDus) + " and estado != 'Completa'", dataGridCompletarTarea);
                }
                catch (Exception error)
                {
                    MessageBox.Show("Ha ocurrido un error " + error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }


            if (comboEstado.Text == "Atrasada")
            {
                try
                {
                    ConexionTask con = new ConexionTask();
                    string       cmd = "exec tareasatrasada_completar " + Task_Login.IDus + "";
                    con.ExecuteDGV(cmd, dataGridCompletarTarea);
                }
                catch (Exception error)
                {
                    MessageBox.Show("Ha ocurrido un error " + error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (comboEstado.Text == "Pendiente")
            {
                try
                {
                    ConexionTask con = new ConexionTask();
                    string       cmd = "exec tareaspendientes_completar " + Task_Login.IDus + "";
                    con.ExecuteDGV(cmd, dataGridCompletarTarea);
                }
                catch (Exception error)
                {
                    MessageBox.Show("Ha ocurrido un error " + error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 9
0
        private void button2_Click(object sender, EventArgs e)
        {
            ConexionTask ConTask = new ConexionTask();

            try
            {
                if (comboEstado.Text == "Todas")
                {
                    ConTask.ExecuteDGV("Select idtarea as 'iD', titulotarea as 'Titulo', fechacreada as 'Emision', fecharecordatorio as 'Recordatorio', estado as 'Estado' from tarea where idusuario = " + Convert.ToInt32(Task_Login.IDus) + " and estado != 'Completa'", dataGridEditarTarea);
                }
                else
                {
                    ConTask.ExecuteDGV("Select idtarea as 'iD', titulotarea as 'Titulo', fechacreada as 'Emision', fecharecordatorio as 'Recordatorio', estado as 'Estado' from tarea where idusuario = " + Convert.ToInt32(Task_Login.IDus) + " and estado = '" + comboEstado.Text + "'", dataGridEditarTarea);
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("Ha ocurrido un error " + error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 10
0
 private void btnguardar_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtantpass.Text == string.Empty || txtcommitpass.Text == string.Empty || txtnewpass.Text == string.Empty)
         {
             MessageBox.Show("Debe llenar todos los campos requeridos", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             ConexionTask Con = new ConexionTask();
             DataSet      dt;
             dt = Con.ExecuteDS("Select contraseña from usuarios where idusuario = " + Convert.ToInt32(Task_Login.IDus) + "");
             if (txtantpass.Text == dt.Tables[0].Rows[0]["contraseña"].ToString())
             {
                 if (txtnewpass.Text == txtcommitpass.Text)
                 {
                     Con.ExecuteSP("update usuarios set contraseña = " + txtcommitpass.Text + " where idusuario = " + Convert.ToInt32(Task_Login.IDus) + "");
                     txtantpass.Clear();
                     txtcommitpass.Clear();
                     txtnewpass.Clear();
                 }
                 else
                 {
                     MessageBox.Show("El campo 'Nueva Contraseña' no coincide con el campo 'Confirmar Contraseña'", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show("La contraseña a modificar no coincide con el campo 'Antigua Contraseña'", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     catch (Exception Error)
     {
         MessageBox.Show("Ha ocurrido un error en la trasnsacción: " + Error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 11
0
        private void dataGridCompletarTarea_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Task_Menu.id = dataGridCompletarTarea.CurrentRow.Cells["ID"].Value.ToString();
            string       cmd;
            ConexionTask con = new ConexionTask();

            if (MessageBox.Show("¿Desea completar esta tarea?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                cmd = "exec completartarea " + Task_Menu.id + "";
                con.ExecuteSP(cmd);
                MessageBox.Show("Se ha completado la tarea", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                comboEstado.Text = "Pendiente";
                try
                {
                    cmd = "exec tareaspendientes_completar " + Task_Login.IDus + "";
                    con.ExecuteDGV(cmd, dataGridCompletarTarea);
                }
                catch (Exception error)
                {
                    MessageBox.Show("Ha ocurrido un error " + error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 12
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            int    tipo = 0, urgencia = 0;
            string estado;

            if (comboBox2.Text == "Personal")
            {
                tipo = 1;
            }
            else if (comboBox2.Text == "Estudiantil")
            {
                tipo = 2;
            }
            else if (comboBox2.Text == "Deportiva")
            {
                tipo = 3;
            }
            else if (comboBox2.Text == "Laboral")
            {
                tipo = 4;
            }
            else if (comboBox2.Text == "Espiritual")
            {
                tipo = 5;
            }
            else if (comboBox2.Text == "Emocional")
            {
                tipo = 6;
            }

            if (comboBox1.Text == "Urgente")
            {
                urgencia = 1;
            }
            else if (comboBox1.Text == "Muy Urgente")
            {
                urgencia = 2;
            }
            else if (comboBox1.Text == "Normal")
            {
                urgencia = 3;
            }
            else if (comboBox1.Text == "No Urgente")
            {
                urgencia = 4;
            }

            if (dateTimePicker1.Value > dateTimePicker2.Value)
            {
                estado = "Pendiente";
            }
            else
            {
                estado = "Atrasada";
            }
            try
            {
                string cmd = string.Format("UpdateTarea " + Convert.ToInt32(Task_Menu.id) + ", " + tipo + ", " + urgencia + ", '" + txtTitulo.Text + "', '" + richTextBoxDescripcion.Text + "', " +
                                           "'" + estado + "', '" + dateTimePicker2.Value.ToShortDateString() + "', '" + dateTimePicker1.Value.ToShortDateString() + "'");
                ConexionTask abre = new ConexionTask();
                abre.ExecuteSP(cmd);
                MessageBox.Show("Se ha actualizado correctamente", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtTitulo.Enabled = false;
                richTextBoxDescripcion.Enabled = false;
                dateTimePicker1.Enabled        = false;
                comboBox1.Enabled  = false;
                comboBox2.Enabled  = false;
                btnEditar.Enabled  = true;
                btnGuardar.Visible = false;
            }
            catch (Exception Error)
            {
                MessageBox.Show("Ha ocurrido un error" + Error, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 13
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (comboBox2.Text == "Personal")
            {
                tipo = 1;
            }
            else if (comboBox2.Text == "Estudiantil")
            {
                tipo = 2;
            }
            else if (comboBox2.Text == "Deportiva")
            {
                tipo = 3;
            }
            else if (comboBox2.Text == "Laboral")
            {
                tipo = 4;
            }
            else if (comboBox2.Text == "Espiritual")
            {
                tipo = 5;
            }
            else if (comboBox2.Text == "Emocional")
            {
                tipo = 6;
            }

            if (comboBox1.Text == "Urgente")
            {
                urgencia = 1;
            }
            else if (comboBox1.Text == "Muy Urgente")
            {
                urgencia = 2;
            }
            else if (comboBox1.Text == "Normal")
            {
                urgencia = 3;
            }
            else if (comboBox1.Text == "No Urgente")
            {
                urgencia = 4;
            }

            if (txtTitulo.Text == "" || richTextBoxDescripcion.Text == "" || urgencia == 0 || tipo == 0)
            {
                MessageBox.Show("Debe completar todos los campos", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                try
                {
                    usu = Convert.ToInt32(Task_Login.IDus);
                    ConexionTask Connect = new ConexionTask();
                    string       cmd     = "Exec InsertarTarea " + tipo + ", " + usu + ", " + urgencia + ", '" + txtTitulo.Text + "', '" + richTextBoxDescripcion.Text + "', 'Pendiente', '" + dateTimePicker1.Value.ToShortDateString() + "', '" + dateTimePicker2.Value.ToShortDateString() + "'";
                    Connect.ExecuteSP(cmd);
                    MessageBox.Show("Se ha guardado correctamente", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception error)
                {
                    MessageBox.Show("Ha ocurrido un error enla transacción" + error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }