private void frmManAreaEquipoEdit_Load(object sender, EventArgs e)
        {
            BSUtils.LoaderLook(cboEmpresa, new EmpresaBL().ListaCombo(Parametros.intTECorporativo), "RazonSocial", "IdEmpresa", true);
            cboEmpresa.EditValue = IdEmpresa;
            BSUtils.LoaderLook(cboUnidadMinera, new UnidadMineraBL().ListaTodosActivo(Convert.ToInt32(cboEmpresa.EditValue)), "DescUnidadMinera", "IdUnidadMinera", true);
            cboUnidadMinera.EditValue = IdUnidadMinera;
            BSUtils.LoaderLook(cboArea, new AreaBL().ListaTodosActivo(IdEmpresa, IdUnidadMinera), "DescArea", "IdArea", true);
            cboArea.EditValue = IdArea;

            txtDias.EditValue = 0;

            if (pOperacion == Operacion.Nuevo)
            {
                this.Text = "AreaEquipo - Nuevo";
            }
            else if (pOperacion == Operacion.Modificar)
            {
                this.Text = "AreaEquipo - Modificar";
                AreaEquipoBE objE_AreaEquipo = null;
                objE_AreaEquipo = new AreaEquipoBL().Selecciona(IdAreaEquipo);
                if (objE_AreaEquipo != null)
                {
                    IdAreaEquipo              = objE_AreaEquipo.IdAreaEquipo;
                    cboEmpresa.EditValue      = objE_AreaEquipo.IdEmpresa;
                    cboUnidadMinera.EditValue = objE_AreaEquipo.IdUnidadMinera;
                    cboArea.EditValue         = objE_AreaEquipo.IdArea;
                    intIdEquipo        = objE_AreaEquipo.IdEquipo;
                    txtCodigo.Text     = objE_AreaEquipo.Codigo;
                    txtDescEquipo.Text = objE_AreaEquipo.DescEquipo;
                    txtDias.EditValue  = objE_AreaEquipo.Dias;
                }
            }

            txtCodigo.Select();
        }
        private void tlbMenu_DeleteClick()
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (XtraMessageBox.Show("Esta seguro de eliminar el registro?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (!ValidarIngreso())
                    {
                        AreaEquipoBE objE_AreaEquipo = new AreaEquipoBE();
                        objE_AreaEquipo.IdAreaEquipo = int.Parse(gvAreaEquipo.GetFocusedRowCellValue("IdAreaEquipo").ToString());
                        objE_AreaEquipo.Usuario      = Parametros.strUsuarioLogin;
                        objE_AreaEquipo.Maquina      = WindowsIdentity.GetCurrent().Name.ToString();
                        objE_AreaEquipo.IdEmpresa    = Parametros.intEmpresaId;

                        AreaEquipoBL objBL_Area = new AreaEquipoBL();
                        objBL_Area.Elimina(objE_AreaEquipo);
                        XtraMessageBox.Show("El registro se eliminó correctamente", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Cargar();
                    }
                }
                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                if (!ValidarIngreso())
                {
                    AreaEquipoBL objBL_AreaEquipo = new AreaEquipoBL();
                    AreaEquipoBE objAreaEquipo    = new AreaEquipoBE();

                    objAreaEquipo.IdAreaEquipo   = IdAreaEquipo;
                    objAreaEquipo.IdUnidadMinera = Convert.ToInt32(cboUnidadMinera.EditValue);
                    objAreaEquipo.IdArea         = Convert.ToInt32(cboArea.EditValue);
                    objAreaEquipo.IdEquipo       = intIdEquipo;
                    objAreaEquipo.Codigo         = txtCodigo.Text;
                    objAreaEquipo.DescEquipo     = txtDescEquipo.Text;
                    objAreaEquipo.Dias           = Convert.ToInt32(txtDias.EditValue);
                    objAreaEquipo.FlagEstado     = true;
                    objAreaEquipo.Usuario        = Parametros.strUsuarioLogin;
                    objAreaEquipo.Maquina        = WindowsIdentity.GetCurrent().Name.ToString();
                    objAreaEquipo.IdEmpresa      = Convert.ToInt32(cboEmpresa.EditValue);

                    if (pOperacion == Operacion.Nuevo)
                    {
                        objBL_AreaEquipo.Inserta(objAreaEquipo);
                    }
                    else
                    {
                        objBL_AreaEquipo.Actualiza(objAreaEquipo);
                    }

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void txtNumeroSolicitud_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    SolicitudEppBE objE_SolicitudEpp = null;
                    objE_SolicitudEpp = new SolicitudEppBL().SeleccionaNumero(Convert.ToInt32(txtNumeroSolicitud.EditValue));
                    if (objE_SolicitudEpp != null)
                    {
                        if (objE_SolicitudEpp.IdSituacion == Parametros.intSLCPendiente)
                        {
                            intIdSolicitudEpp               = objE_SolicitudEpp.IdSolicitudEpp;
                            txtNumeroSolicitud.Text         = objE_SolicitudEpp.Numero;
                            intIdPersona                    = objE_SolicitudEpp.IdPersona;
                            txtResponsable.Text             = objE_SolicitudEpp.Responsable;
                            intIdEmpresaResponsable         = objE_SolicitudEpp.IdEmpresaResponsable;
                            txtEmpresaResponsable.Text      = objE_SolicitudEpp.EmpresaResponsable;
                            intIdUnidadMineraResponsable    = objE_SolicitudEpp.IdUnidadMineraResponsable;
                            txtUnidadMineraResponsable.Text = objE_SolicitudEpp.UnidadMineraResponsable;
                            intIdAreaResponsable            = objE_SolicitudEpp.IdAreaResponsable;
                            txtAreaResponsable.Text         = objE_SolicitudEpp.AreaResponsable;
                            intIdSectorResponsable          = objE_SolicitudEpp.IdSectorResponsable;
                            txtSectorResponsable.Text       = objE_SolicitudEpp.SectorResponsable;
                            txtCargo.Text                   = objE_SolicitudEpp.Cargo;
                            txtDescNegocio.Text             = objE_SolicitudEpp.DescNegocio;

                            PersonaBE objE_Persona = null;
                            objE_Persona = new PersonaBL().Selecciona(0, 0, 0, objE_SolicitudEpp.IdJefe);

                            if (objE_Persona != null)
                            {
                                strEmail = objE_Persona.Email;
                            }

                            //LLENAMOS EL DETALLE

                            List <SolicitudEppDetalleBE> lstSolicitudDetalle = null;
                            lstSolicitudDetalle = new SolicitudEppDetalleBL().ListaTodosActivo(intIdSolicitudEpp);

                            mListaEppDetalleOrigen = new List <CEppDetalle>();


                            foreach (SolicitudEppDetalleBE item in lstSolicitudDetalle)
                            {
                                CEppDetalle objE_EppDetalle = new CEppDetalle();
                                objE_EppDetalle.IdEmpresa    = intIdEmpresa;
                                objE_EppDetalle.IdEpp        = 0;
                                objE_EppDetalle.IdEppDetalle = 0;
                                objE_EppDetalle.Item         = item.Item;
                                objE_EppDetalle.IdEquipo     = item.IdEquipo;
                                objE_EppDetalle.Codigo       = item.Codigo;
                                objE_EppDetalle.DescEquipo   = item.DescEquipo;

                                //Obtenemos la fecha de vencimiento
                                AreaEquipoBE objE_AreaEquipo = null;
                                objE_AreaEquipo = new AreaEquipoBL().SeleccionaEquipo(intIdEmpresaResponsable, intIdUnidadMineraResponsable, intIdAreaResponsable, 0);
                                if (objE_AreaEquipo == null)
                                {
                                    string strMensaje = "El Equipo de Protecciòn Personal, no esta asigando:\n";
                                    strMensaje = strMensaje + "Empresa : " + objE_SolicitudEpp.EmpresaResponsable + "\n";
                                    strMensaje = strMensaje + "Sede : " + objE_SolicitudEpp.UnidadMineraResponsable + "\n";
                                    strMensaje = strMensaje + "Area : " + objE_SolicitudEpp.AreaResponsable + "\n";
                                    strMensaje = strMensaje + "EPP : " + item.DescEquipo + "\n";

                                    XtraMessageBox.Show(strMensaje, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    return;
                                }
                                else
                                {
                                    objE_EppDetalle.FechaVencimiento = deFecha.DateTime.AddDays(objE_AreaEquipo.Dias);
                                }


                                objE_EppDetalle.Cantidad = item.Cantidad;

                                EquipoBE objE_Equipo = null;
                                objE_Equipo = new EquipoBL().Selecciona(Parametros.intEmpresaId, item.IdEquipo);
                                if (objE_Equipo != null)
                                {
                                    objE_EppDetalle.Precio = objE_Equipo.Precio;
                                    objE_EppDetalle.Total  = item.Cantidad * objE_Equipo.Precio;
                                }


                                objE_EppDetalle.IdTipoEntrega   = Parametros.intTENuevo;
                                objE_EppDetalle.DescTipoEntrega = "NUEVO";
                                objE_EppDetalle.IdKardex        = 0;
                                objE_EppDetalle.TipoOper        = 4;
                                mListaEppDetalleOrigen.Add(objE_EppDetalle);
                            }

                            bsListado.DataSource    = mListaEppDetalleOrigen;
                            gcEppDetalle.DataSource = bsListado;
                            gcEppDetalle.RefreshDataSource();
                        }
                        else
                        {
                            XtraMessageBox.Show("La Solicitud ya fue atendida o anulada. \nPor Favor Verifique", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }