private void btnBuscaResponsiva_Click(object sender, EventArgs e)
        {
            try
            {
                frmBuscarResponsiva form = new frmBuscarResponsiva("B");

                var result = form.ShowDialog();

                if (result == DialogResult.OK)
                {
                    this.tbResponsable.Text = form._responsiva.responsable;
                    this.tbPuesto.Text      = form._responsiva.puesto;
                    this.tbSucursal.Text    = form._responsiva.sucursal;

                    this.tbFolio.Text = form._responsiva.idResponsiva.ToString();

                    this._responsiva = form._responsiva;

                    // llena el grid con los puestos disponibles
                    this.gcActivos.DataSource = form._activos;
                    this._activos             = form._activos;
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Responsivas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Beispiel #2
0
        private void gcResponsables_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (this.gridView1.GetSelectedRows().Count() == 0)
                {
                    throw new Exception("No a seleccionado una responsiva");
                }

                this._responsiva = new Modelos.Responsivas();

                foreach (int i in this.gridView1.GetSelectedRows())
                {
                    var dr1 = this.gridView1.GetRow(i);

                    this._responsiva = (Modelos.Responsivas)dr1;
                }

                this._activos = this._activosNegocio.getBuscaActivos(this._responsiva.idResponsiva);

                this.tbRespDe.Text = this._responsiva.responsable;

                this.gcActivos.DataSource = this._activos;
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Responsivas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Beispiel #3
0
        private void gcResponsables_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (this.gridView1.GetSelectedRows().Count() == 0)
                {
                    throw new Exception("No a seleccionado una responsiva");
                }

                this._responsiva = new Modelos.Responsivas();

                foreach (int i in this.gridView1.GetSelectedRows())
                {
                    var dr1 = this.gridView1.GetRow(i);

                    this._responsiva = (Modelos.Responsivas)dr1;
                }

                this._activos = this._activosNegocio.getBuscaActivosRepBaja(this._responsiva.idResponsiva);

                if (this.cbBajas.Checked)
                {
                    if (!this.cbReparaciones.Checked)
                    {
                        this._activos = this._activos.Where(w => w.status.Equals("BAJA") || w.status.Equals("ACTIVO")).ToList();
                    }
                }
                else
                {
                    if (this.cbReparaciones.Checked)
                    {
                        this._activos = this._activos.Where(w => w.status.Equals("REPARACION") || w.status.Equals("ACTIVO")).ToList();
                    }
                    else
                    {
                        this._activos = this._activos.Where(w => w.status.Equals("ACTIVO")).ToList();
                    }
                }

                this.tbRespDe.Text = this._responsiva.responsable;
                this.tbFolio.Text  = this._responsiva.idResponsiva.ToString();

                this.gcActivos.DataSource = this._activos;
                this.gridView2.BestFitColumns();
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Responsivas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private void btnBusFolio_Click(object sender, EventArgs e)
        {
            try
            {
                // validacion
                if (string.IsNullOrEmpty(this.tbFolio.Text))
                {
                    throw new Exception("Defina un folio");
                }

                int folio = Convert.ToInt16(this.tbFolio.Text);

                // obtiene responsables
                Modelos.RespPorFolio respFolio = this._responsivasNegocio.obtieneRespXFolio(folio);

                if (respFolio == null)
                {
                    this.gcActivos.DataSource = null;
                    this.ActiveControl        = this.tbFolio;
                    this.tbFolio.SelectAll();

                    this.tbResponsable.Text = string.Empty;
                    this.tbPuesto.Text      = string.Empty;
                    this.tbSucursal.Text    = string.Empty;

                    throw new Exception("Sin resultados");
                }

                this.gcActivos.DataSource = null;
                this.ActiveControl        = this.tbFolio;
                this.tbFolio.SelectAll();

                this.tbResponsable.Text = respFolio.responsiva.responsable;
                this.tbPuesto.Text      = respFolio.responsiva.puesto;
                this.tbSucursal.Text    = respFolio.responsiva.sucursal;

                this._responsiva = respFolio.responsiva;

                // llena el grid con los puestos disponibles
                this.gcActivos.DataSource = respFolio.activos;
                this._activos             = respFolio.activos;
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Responsivas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private void btnNuevaResp_Click(object sender, EventArgs e)
        {
            try
            {
                if (this._usuario == null)
                {
                    throw new Exception("Seleccione una persona");
                }

                this.DialogResult = System.Windows.Forms.DialogResult.OK;

                this._responsiva = new Modelos.Responsivas();
                this._nuevaResp  = true;

                this.Close();
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Traspasos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private void gcUsuarios_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                this._activos    = null;
                this._responsiva = null;

                if (this.gridView1.GetSelectedRows().Count() == 0)
                {
                    throw new Exception("No a seleccionado una persona");
                }

                this._usuario = new Modelos.PersonaResponsivas();

                foreach (int i in this.gridView1.GetSelectedRows())
                {
                    var dr1 = this.gridView1.GetRow(i);

                    this._usuario = (Modelos.PersonaResponsivas)dr1;
                }

                // busca responsivas segun un usuario
                List <Modelos.Responsivas> responsivas = this._responsivasNegocio.buscaResponsiva(this._usuario.idPersona);

                if (responsivas.Count == 0)
                {
                    this.gcResponsivas.DataSource = null;
                    this.gcActivos.DataSource     = null;
                    throw new Exception("El usuario no tiene responsivas");
                }
                this.tbUsuarioSeleccionado.Text = this._usuario.nombre;

                this.gcResponsivas.DataSource = responsivas;
                this.gcActivos.DataSource     = null;
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Traspasos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Beispiel #7
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.cmbSucursal.SelectedIndex == -1)
                {
                    throw new Exception("Seleccione una sucursal");
                }

                string responsable = this.tbResp.Text;
                int    idSuc       = (int)this.cmbSucursal.SelectedValue;

                List <Modelos.Responsivas> responsivas = this._responsivasNegocio.buscaResponsiva(responsable, idSuc, this._tipoCons);

                this._activos = null;

                this.tbRespDe.Text = string.Empty;

                this.gcActivos.DataSource = this._activos;

                this._responsiva = null;

                if (responsivas.Count == 0)
                {
                    this.gcResponsables.DataSource = null;

                    throw new Exception("Sin resultados");
                }

                this.gcResponsables.DataSource = responsivas;
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Responsivas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Beispiel #8
0
        private void btnVistaPrevia_Click(object sender, EventArgs e)
        {
            try
            {
                if (this._responsiva == null)
                {
                    throw new Exception("Seleccione una persona");
                }

                Modelos.Responsivas responsiva = new Modelos.Responsivas();

                DateTime thisDay = DateTime.Today;

                responsiva.fechaImpresion = thisDay.ToString("d");

                frmReporteActivosPersona form = new frmReporteActivosPersona();

                List <Modelos.Activos> activos = new List <Modelos.Activos>();

                // cambia activos
                foreach (Modelos.Activos ac in this._activos)
                {
                    string   descripcion = ac.descripcion.Replace("---", ";");
                    string[] array       = descripcion.Split(';');

                    descripcion = (!string.IsNullOrEmpty(array[0]) ? "Marca: " + array[0] + "; " : string.Empty) +
                                  (!string.IsNullOrEmpty(array[1]) ? "Modelo: " + array[1] + ";\n" : string.Empty) +
                                  (!string.IsNullOrEmpty(array[2]) ? "Núm. Serie: " + array[2] + ";\n" : string.Empty) +
                                  (!string.IsNullOrEmpty(array[3]) ? "Color: " + array[3] + "; " : string.Empty) +
                                  (!string.IsNullOrEmpty(array[4]) ? "Costo: " + array[4] + "; " : string.Empty) +
                                  (!string.IsNullOrEmpty(array[5]) ? "Factura: " + array[5] + ";\n" : string.Empty) +
                                  (!string.IsNullOrEmpty(array[6]) ? "Detalles: " + array[6] + ";\n" : string.Empty);

                    activos.Add(new Modelos.Activos
                    {
                        accion            = ac.accion,
                        area              = ac.area,
                        costo             = ac.costo,
                        claveActivo       = ac.claveActivo,
                        descripcion       = descripcion.Trim(),
                        fechaAlta         = ac.fechaAlta,
                        fechaModificacion = ac.fechaModificacion,
                        idActivo          = ac.idActivo,
                        idArea            = ac.idArea,
                        idTipo            = ac.idTipo,
                        idUsuarioAlta     = ac.idUsuarioAlta,
                        idUsuarioModifica = ac.idUsuarioModifica,
                        nombreCorto       = ac.nombreCorto,
                        numEtiqueta       = ac.numEtiqueta,
                        seleccionado      = ac.seleccionado,
                        status            = ac.status,
                        tipo              = ac.tipo
                    });
                }

                responsiva.puesto      = this._responsiva.puesto;
                responsiva.responsable = this._responsiva.nombre;
                responsiva.sucursal    = this._responsiva.sucursal;

                // obtiene logo
                Modelos.Logo logo = this._responsivasNegocio.obtieneLogo("reportes");

                form._logo        = logo;
                form._activos     = activos;
                form._responsivas = responsiva;

                form._empresa = Modelos.Login.empresa;

                // bitacora
                this._catalogosNegocio.generaBitacora(
                    "Genera Reporte 'Activos por Persona' con parametros:" +
                    " sucursal: " + responsiva.sucursal +
                    " responsable: " + responsiva.responsable +
                    (this.cbBajas.Checked ? " BAJAS ": string.Empty) +
                    (this.cbReparacion.Checked ? " REPARACIONES " : string.Empty), "CONSULTAS");

                form.Show();
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Responsivas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }