Exemplo n.º 1
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();
            }
        }
Exemplo 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);
            }
        }
Exemplo n.º 3
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);
     }
 }
Exemplo n.º 4
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);
                }
            }
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
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);
                }
            }
        }