Exemplo n.º 1
0
 private void cmbTipo_SelectionChangeCommitted(object sender, EventArgs e)
 {
     try
     {
         this._tipos = this._catalogosNegocio.getTipo((int)this.cmbTipo.SelectedValue);
     }
     catch (Exception Ex)
     {
         MessageBox.Show(Ex.Message, "Activos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
        private void gcTipos_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                // PERMISOS
                if (!Modelos.Login.permisos.Contains(56))
                {
                    return;
                }

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

                Modelos.Tipos ent = new Modelos.Tipos();

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

                    ent = (Modelos.Tipos)dr1;
                }

                frmModiftipos form = new frmModiftipos(ent.idTipo, ent.nombre,
                                                       ent.marca.Equals("NO") ? false : true,
                                                       ent.modelo.Equals("NO") ? false : true,
                                                       ent.serie.Equals("NO") ? false : true,
                                                       ent.color.Equals("NO") ? false : true,
                                                       ent.costo.Equals("NO") ? false : true,
                                                       ent.factura.Equals("NO") ? false : true,
                                                       ent.fechaCompra.Equals("NO") ? false : true
                                                       );

                var result = form.ShowDialog();

                if (result == DialogResult.OK)
                {
                    // llena el grid con los puestos disponibles
                    this.gcTipos.DataSource = this._catalogosNegocio.getTipos("A");
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Tipos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 3
0
        private void btnBusqAct_Click(object sender, EventArgs e)
        {
            try
            {
                frmBuscActivos form = new frmBuscActivos("MODIFICACION");

                var result = form.ShowDialog();

                if (result == DialogResult.OK)
                {
                    this.inicializaValores();

                    // trae permisos de tipos
                    this._tipos = this._catalogosNegocio.getTipo(form._idTipo);

                    // muestra los datos del activo
                    this._activoAntes = form._activoSelecc;

                    string[] array = this._activoAntes.descripcion.Split('&');

                    this.tbNombre.Text = this._activoAntes.nombreCorto;

                    this.tbMarca.Text       = array[0];
                    this.tbModelo.Text      = array[1];
                    this.tbNumSerie.Text    = array[2];
                    this.tbColor.Text       = array[3];
                    this.tbCosto.Text       = array[4];
                    this.tbFactura.Text     = array[5];
                    this.dtpFecha.Text      = array[6];
                    this.tbDescripcion.Text = array[7];
                    this.tbUsuario.Text     = this._activoAntes.usuario;

                    this.lbNumetiqueta.Text = this._activoAntes.numEtiqueta;
                    this.lbCveActivo.Text   = this._activoAntes.claveActivo;

                    this._idActivo = this._activoAntes.idActivo;

                    this.cmbTipo.SelectedValue     = this._activoAntes.idTipo;
                    this.cmbSucursal.SelectedValue = this._activoAntes.idSucursal;
                    this.cargaAreas(this._activoAntes.idSucursal);
                    this.cmbArea.SelectedValue = this._activoAntes.idArea;

                    this._idTipoAnt = this._activoAntes.idTipo;
                    this._idAreaAnt = this._activoAntes.idArea;

                    if (!string.IsNullOrEmpty(this._activoAntes.usuario))
                    {
                        MessageBox.Show(
                            "No es permitido cambiar la Sucursal\n" +
                            "El Activo pertenece a una responsiva\n" +
                            "Para realizar el cambio debe ser por medio de un traspaso", "Activos",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);

                        // this.cmbArea.Enabled = false;
                        this.cmbSucursal.Enabled = false;
                    }
                }

                if (result == DialogResult.Cancel)
                {
                    if (string.IsNullOrEmpty(this.tbNombre.Text))
                    {
                        this.tbNombre.ReadOnly      = true;
                        this.tbMarca.ReadOnly       = true;
                        this.tbModelo.ReadOnly      = true;
                        this.tbNumSerie.ReadOnly    = true;
                        this.tbColor.ReadOnly       = true;
                        this.tbCosto.ReadOnly       = true;
                        this.tbFactura.ReadOnly     = true;
                        this.tbDescripcion.ReadOnly = true;
                        this.dtpFecha.Enabled       = false;
                    }

                    MessageBox.Show("Operación Cancelada", "Activos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Activos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }