Ejemplo n.º 1
0
        private void btnupdate_Click(object sender, EventArgs e)
        {
            try
            {
                cMovimiento = new clsMovimiento();

                cMovimiento.Codigomovimiento = Int32.Parse(txtcodigo.Text);
                cMovimiento.Monto            = Double.Parse(txtmonto.Text.Trim());
                cMovimiento.Movimiento       = comboTipo.SelectedItem.ToString();
                cMovimiento.Descripcion      = txtdescripcion.Text.ToUpper();

                if (MessageBox.Show("¿ ESTA SEGURO DE MODIFICAR MOVIMIENTO ? ", "CONFIRMAR ACTUALIZACIÓN", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (AdmMovimiento.update(cMovimiento))
                    {
                        MessageBox.Show("MOVIMIENTO MODIFICADO CORRECTAMENTE ", "CONFIRMAR ACTUALIZACIÓN", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                        ListarMovimientos();
                        LimpiarCajas("");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error del sistema : " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void Do_Save(object sender, EventArgs e)
        {
            try
            {
                if (lvMovimientos.SelectedItems.Count > 0)
                {
                    movement = new clsMovimiento();
                    var fecha = new DateTime();
                    ControllerRHSGMT001 access = new ControllerRHSGMT001();
                    foreach (ListViewItem item in lvMovimientos.SelectedItems)
                    {
                        fecha = Convert.ToDateTime(item.SubItems[1].Text);
                    }
                    var movimient = access.GetMovimiento(listaMov[0].personKey, fecha, conection);

                    movement     = movimient;
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("Debe seleccionar un movimiento.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error al seleccionar el movimiento del trabajador.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 3
0
        private void btnsave_Click(object sender, EventArgs e)
        {
            try
            {
                if (isValidate())
                {
                    cMovimiento = new clsMovimiento();

                    cMovimiento.Monto       = Double.Parse(txtmonto.Text.Trim());
                    cMovimiento.Movimiento  = comboTipo.SelectedItem.ToString();
                    cMovimiento.Descripcion = txtdescripcion.Text.ToUpper();

                    if (AdmMovimiento.insert(cMovimiento))
                    {
                        MessageBox.Show("MOVIMIENTO REGISTRADO CORRECTAMENTE", "CONFIRMAR REGISTRO", MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                        ListarMovimientos();
                        LimpiarCajas("");
                        errorProvider1.Clear();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error del sistema : " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 4
0
        public List <clsMovimiento> ConsultarMovimientos(string strServicio)
        {
            List <clsMovimiento>      lstMovimiento             = new List <clsMovimiento>();
            DataTable                 dtRespuesta               = null;
            clsPersistenciaMovimiento objPersistenciaMovimiento = new clsPersistenciaMovimiento();

            try
            {
                dtRespuesta = objPersistenciaMovimiento.ConsultarMovimientos(strServicio);
                if (dtRespuesta != null)
                {
                    foreach (DataRow dr in dtRespuesta.Rows)
                    {
                        clsMovimiento objMovimiento   = new clsMovimiento();
                        DateTime      fechaMovimiento = DateTime.Parse(dr[0].ToString());
                        objMovimiento.fechaMovimiento          = fechaMovimiento.ToString("yyyy-MM-dd");
                        objMovimiento.numeroCuentaBeneficiario = dr[1].ToString();
                        objMovimiento.motivoMovimiento         = dr[2].ToString();
                        objMovimiento.entidadBeneficiario      = dr[3].ToString();
                        objMovimiento.Tipo            = dr[4].ToString();
                        objMovimiento.montoMovimiento = double.Parse(dr[5].ToString());
                        objMovimiento.saldoDisponible = double.Parse(dr[6].ToString());
                        objMovimiento.lugarMovimiento = dr[7].ToString();
                        lstMovimiento.Add(objMovimiento);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(lstMovimiento);
        }
Ejemplo n.º 5
0
        //modificar movimiento
        public bool Update(clsMovimiento update)
        {
            try
            {
                con.conectarBD();

                cmd             = new MySqlCommand("update_movimiento", con.conector);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("id", update.Codigomovimiento);
                cmd.Parameters.AddWithValue("monto", update.Monto);
                cmd.Parameters.AddWithValue("movimiento", update.Movimiento);
                cmd.Parameters.AddWithValue("descripcion", update.Descripcion);

                int resultado = cmd.ExecuteNonQuery();

                if (resultado != 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            catch (MySqlException ex) { throw ex; }

            finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); }
        }
Ejemplo n.º 6
0
 private bool Do_Delete(object sender, EventArgs e)
 {
     try
     {
         bool resultadoFinal = false;
         if (cmbmovimiento.Text == "Traslado")
         {
             var movement = new clsMovimiento();
             movement.fechaMovement = Convert.ToDateTime(dtpFechaMovimiento.Text);
             movement.movementkey   = Convert.ToInt32(cmbmovimiento.SelectedValue);
             movement.personKey     = person.PersonKey;
             movement.periodo       = periodo.Periodkey;
             resultadoFinal         = controler.EliminarMovimiento(movement, conection);
         }
         if (cmbmovimiento.Text == "Reubicación")
         {
             var movement = new clsMovimiento();
             movement.fechaMovement = Convert.ToDateTime(dtFechaMoviminetoReubicacion.Text);
             movement.movementkey   = Convert.ToInt32(cmbmovimiento.SelectedValue);
             movement.personKey     = person.PersonKey;
             movement.periodo       = periodo.Periodkey;
             resultadoFinal         = controler.EliminarMovimiento(movement, conection);
         }
         if (cmbmovimiento.Text == "Alta")
         {
             var movement = new clsMovimiento();
             movement.fechaMovement = Convert.ToDateTime(dtpfechaAlta.Text);
             movement.movementkey   = Convert.ToInt32(cmbmovimiento.SelectedValue);
             movement.personKey     = person.PersonKey;
             movement.periodo       = periodo.Periodkey;
             resultadoFinal         = controler.EliminarMovimiento(movement, conection);
         }
         if (cmbmovimiento.Text == "Baja")
         {
             var movement = new clsMovimiento();
             movement.fechaMovement = Convert.ToDateTime(dtpFechaBaja.Text);
             movement.movementkey   = Convert.ToInt32(cmbmovimiento.SelectedValue);
             movement.personKey     = person.PersonKey;
             movement.periodo       = periodo.Periodkey;
             resultadoFinal         = controler.EliminarMovimiento(movement, conection);
         }
         if (resultadoFinal)
         {
             MessageBox.Show("Registro de movimiento del trabajador eliminado satisfactoriamente.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("Verifique, el registro que desea eliminar no existe.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         return(resultadoFinal);
     }
     catch (Exception)
     {
         MessageBox.Show("Error al eliminar el registro requerido.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
         throw;
     }
 }
Ejemplo n.º 7
0
 public Boolean update(clsMovimiento update)
 {
     try
     {
         return(iMovimiento.Update(update));
     }
     catch (Exception ex)
     {
         MessageBox.Show("Se encontro el siguiente problema  : " + ex.Message, " ADVERTENCIA !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
 }
Ejemplo n.º 8
0
        private void LvMovimientos_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            try
            {
                movement = new clsMovimiento();
                var fecha = new DateTime();
                ControllerRHSGMT001 access = new ControllerRHSGMT001();
                foreach (ListViewItem item in lvMovimientos.SelectedItems)
                {
                    fecha = Convert.ToDateTime(item.SubItems[1].Text);
                }
                var movimient = access.GetMovimiento(listaMov[0].personKey, fecha, conection);

                movement     = movimient;
                DialogResult = DialogResult.OK;
            }
            catch (Exception)
            {
                MessageBox.Show("Error al seleccionar los datos de la ausencia.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 9
0
        private void Do_Save(object sender, EventArgs e)
        {
            clsMovimiento movement;

            if (cmbmovimiento.Text == "Traslado")
            {
                if (txtEstado.Text == "Alta")
                {
                    if (dtpFechaMovimiento.Value >= periodo.PeriodFechaInicio && dtpFechaMovimiento.Value <= periodo.PeriodFechaFin)
                    {
                        if (txtCausa.Text != "")
                        {
                            if ((cmbUnidadOrganizativas.Text != txtUnidadOrganizativa.Text) || (cmbCargo.Text != txtCargo.Text))
                            {
                                movement = new clsMovimiento();
                                movement.fechaMovement       = Convert.ToDateTime(dtpFechaMovimiento.Text);
                                movement.movementkey         = Convert.ToInt32(cmbmovimiento.SelectedValue);
                                movement.personKey           = person.PersonKey;
                                movement.unidadOrgKey        = person.OrgUnitKey;
                                movement.positionKey         = person.PositionKey;
                                movement.causa               = txtCausa.Text;
                                movement.unidadOrgKeyDestino = Convert.ToInt32(cmbUnidadOrganizativas.SelectedValue);
                                movement.positionKeyDestino  = Convert.ToInt32(cmbCargo.SelectedValue);
                                movement.periodo             = periodo.Periodkey;
                                controler.AddMovementTrasladoReubicacion(movement, conection);
                                CargarMovimientosTrabajador();
                            }
                            else
                            {
                                MessageBox.Show("Verifique, el traslado continen datos erróneos.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Verifique, el campo Causa es obligatorio.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Verifique, la fecha de movimiento seleccionada no se encuentra dentro del período activo.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Verifique, el estado actual de la persona no permite realizar ese Tipo de Movimiento.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (cmbmovimiento.Text == "Alta")
            {
                if ((txtEstado.Text == "Baja") || (txtEstado.Text == "Solicitud"))
                {
                    if (dtpfechaAlta.Value >= periodo.PeriodFechaInicio && dtpfechaAlta.Value <= periodo.PeriodFechaFin)
                    {
                        movement = new clsMovimiento();
                        movement.fechaMovement = Convert.ToDateTime(dtpfechaAlta.Text);
                        movement.movementkey   = Convert.ToInt32(cmbmovimiento.SelectedValue);
                        movement.personKey     = person.PersonKey;
                        movement.unidadOrgKey  = person.OrgUnitKey;
                        movement.positionKey   = person.PositionKey;
                        movement.periodo       = periodo.Periodkey;
                        controler.AddMovementAltaBaja(movement, conection);
                        CargarMovimientosTrabajador();
                    }
                    else
                    {
                        MessageBox.Show("Verifique, la fecha de movimiento seleccionada no se encuentra dentro del período activo.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Verifique, el estado actual de la persona no permite realizar ese Tipo de Movimiento.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (cmbmovimiento.Text == "Baja")
            {
                if (txtEstado.Text == "Alta")
                {
                    if (dtpFechaBaja.Value >= periodo.PeriodFechaInicio && dtpFechaBaja.Value <= periodo.PeriodFechaFin)
                    {
                        movement = new clsMovimiento();
                        movement.fechaMovement = Convert.ToDateTime(dtpFechaBaja.Text);
                        movement.movementkey   = Convert.ToInt32(cmbmovimiento.SelectedValue);
                        movement.personKey     = person.PersonKey;
                        movement.unidadOrgKey  = person.OrgUnitKey;
                        movement.positionKey   = person.PositionKey;
                        movement.periodo       = periodo.Periodkey;
                        controler.AddMovementAltaBaja(movement, conection);
                        CargarMovimientosTrabajador();
                    }
                    else
                    {
                        MessageBox.Show("Verifique, la fecha de movimiento seleccionada no se encuentra dentro del período activo.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Verifique, el estado actual de la persona no permite realizar ese Tipo de Movimiento.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (cmbmovimiento.Text == "Reubicación")
            {
                if (txtEstado.Text == "Alta")
                {
                    if (dtFechaMoviminetoReubicacion.Value >= periodo.PeriodFechaInicio && dtFechaMoviminetoReubicacion.Value <= periodo.PeriodFechaFin)
                    {
                        if (txtCausaReubicacion.Text != "")
                        {
                            if ((cmbUnidadReubicacion.Text != txtUnidadOrgReubicacion.Text) || (cmbCargoReubicacion.Text != txtCargoReubicacion.Text))
                            {
                                movement = new clsMovimiento();
                                movement.fechaMovement       = Convert.ToDateTime(dtFechaMoviminetoReubicacion.Text);
                                movement.movementkey         = Convert.ToInt32(cmbmovimiento.SelectedValue);
                                movement.personKey           = person.PersonKey;
                                movement.unidadOrgKey        = person.OrgUnitKey;
                                movement.positionKey         = person.PositionKey;
                                movement.causa               = txtCausaReubicacion.Text;
                                movement.unidadOrgKeyDestino = Convert.ToInt32(cmbUnidadReubicacion.SelectedValue);
                                movement.positionKeyDestino  = Convert.ToInt32(cmbCargoReubicacion.SelectedValue);
                                movement.periodo             = periodo.Periodkey;
                                controler.AddMovementTrasladoReubicacion(movement, conection);
                                CargarMovimientosTrabajador();
                            }
                            else
                            {
                                MessageBox.Show("Verifique, el traslado continen datos erróneos.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Verifique, el campo Causa es obligatorio.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Verifique, el estado actual de la persona no permite realizar ese Tipo de Movimiento.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Verifique, la fecha de movimiento seleccionada no se encuentra dentro del período activo.", "Sage MAS 500", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            UpdateLookup();
        }
Ejemplo n.º 10
0
 public void CargarDatosMovimiento(clsMovimiento movimiento)
 {
     if (movimiento != null)
     {
         if (movimiento.movementkey == 3)
         {
             //alta
             chkcrearMovimiento.Checked = true;
             grbDatosMovimiento.Enabled = true;
             grbBaja.Visible            = false;
             grbtraslado.Visible        = false;
             grbAlta.Visible            = true;
             dtpfechaAlta.Text          = movimiento.fechaMovement.ToString();
             cmbmovimiento.Text         = "Alta";
         }
         if (movimiento.movementkey == 4)
         { // baja
             chkcrearMovimiento.Checked = true;
             grbDatosMovimiento.Enabled = true;
             grbBaja.Visible            = true;
             grbtraslado.Visible        = false;
             grbAlta.Visible            = false;
             dtpFechaBaja.Text          = movimiento.fechaMovement.ToString();
             cmbmovimiento.Text         = "Baja";
         }
         if (movimiento.movementkey == 5)
         {
             //TRaslado
             chkcrearMovimiento.Checked = true;
             grbDatosMovimiento.Enabled = true;
             grbBaja.Visible            = false;
             grbtraslado.Visible        = true;
             grbAlta.Visible            = false;
             ControllerRHSMC001 control = new ControllerRHSMC001();
             var position = control.GetCargoXKey(movimiento.positionKey, conection);
             txtCargo.Text = position.PositionID;
             ControllerRHSMUO001 access = new ControllerRHSMUO001();
             var unidad = access.GetUnidadOrganizativaKey(movimiento.unidadOrgKey, conection);
             txtUnidadOrganizativa.Text = unidad.Name;
             dtpFechaMovimiento.Text    = movimiento.fechaMovement.ToString();
             txtCausa.Text = movimiento.causa;
             var positionNext = control.GetCargoXKey(movimiento.positionKeyDestino, conection);
             cmbCargo.Text = positionNext.PositionID;
             var unidadNext = access.GetUnidadOrganizativaKey(movimiento.unidadOrgKeyDestino, conection);
             cmbUnidadOrganizativas.Text = unidadNext.Name;
             cmbmovimiento.Text          = "Traslado";
         }
         if (movimiento.movementkey == 6)
         {
             chkcrearMovimiento.Checked = true;
             grbDatosMovimiento.Enabled = true;
             grbBaja.Visible            = false;
             grbtraslado.Visible        = true;
             grbAlta.Visible            = false;
             ControllerRHSMC001 control = new ControllerRHSMC001();
             var position = control.GetCargoXKey(movimiento.positionKey, conection);
             txtCargoReubicacion.Text = position.PositionID;
             ControllerRHSMUO001 access = new ControllerRHSMUO001();
             var unidad = access.GetUnidadOrganizativaKey(movimiento.unidadOrgKey, conection);
             txtUnidadOrgReubicacion.Text      = unidad.Name;
             dtFechaMoviminetoReubicacion.Text = movimiento.fechaMovement.ToString();
             txtCausaReubicacion.Text          = movimiento.causa;
             var positionNext = control.GetCargoXKey(movimiento.positionKeyDestino, conection);
             cmbCargoReubicacion.Text = positionNext.PositionID;
             var unidadNext = access.GetUnidadOrganizativaKey(movimiento.unidadOrgKeyDestino, conection);
             cmbUnidadReubicacion.Text = unidadNext.Name;
             cmbmovimiento.Text        = "Reubicación";
         }
         starBar.SetFormStatus(FormBindingStatus.Editing);
     }
 }