예제 #1
0
        void objetoGrid_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if ((e.ColumnIndex == 5 || e.ColumnIndex == 8) && e.RowIndex > -1)
                {
                    DataGridViewColumn campo = ((DataGridView)sender).Columns[((DataGridView)sender).Columns[e.ColumnIndex].Tag.ToString()] as DataGridViewTextBoxColumn;
                    if (campo == null)
                    {
                        campo = ((DataGridView)sender).Columns[((DataGridView)sender).Columns[e.ColumnIndex].Tag.ToString()] as DataGridViewImageColumn;
                    }

                    campo.DataGridView.CurrentCell = campo.DataGridView.CurrentRow.Cells[campo.Index];
                    if (campo.DataGridView.CurrentRow.Index == campo.DataGridView.NewRowIndex)
                    {
                        campo.DataGridView.EndEdit();
                    }
                    if (!campo.DataGridView.IsCurrentCellDirty)
                    {
                        campo.DataGridView.NotifyCurrentCellDirty(true);
                    }
                    else
                    {
                        campo.DataGridView.NotifyCurrentCellDirty(false);
                    }

                    object objeto = null;

                    if (e.ColumnIndex == 5)
                    {
                        objeto = BuscarListaPr.BuscarBarrio();
                        if (objeto != null)
                        {
                            objeto = BarrioPr.Instancia.RegistroPorId((int)objeto);
                        }
                    }
                    else if (e.ColumnIndex == 8)
                    {
                        objeto = BuscarListaPr.BuscarPersona();
                    }

                    if (objeto != null)
                    {
                        campo.DataGridView.NotifyCurrentCellDirty(false);
                        campo.DataGridView.BeginEdit(false);
                        campo.DataGridView.CurrentRow.Cells[campo.Name].Value = objeto;
                        campo.DataGridView.EndEdit();
                    }
                    else
                    {
                        campo.DataGridView.EndEdit();
                    }
                }
            }
            catch (Exception ex)
            {
                General.Mensaje(ex.Message.ToString());
            }
        }
예제 #2
0
        public static int BuscarCliente()
        {
            object unObjeto = BuscarListaPr.Buscar("Clientes", "personas", "id > 0 and (id = @codigo or identificacion like @nombre or upper(nombre) like @nombre or upper(apellido) like @nombre)", "id, identificacion as \"Identificación\", apellido || ' ' || nombre as \"Nombre\"", "order by 3");

            if (unObjeto == null)
            {
                unObjeto = -1;
            }
            return((int)unObjeto);
        }
예제 #3
0
        public void BuscarCliente(object unObjeto)
        {
            venta   objeto = (venta)unObjeto;
            cliente item   = (cliente)BuscarListaPr.BuscarObjeto(TipoConsulta.Clientes);

            if (item != null)
            {
                objeto.fkcliente = item;
                objeto.idcliente = item.id;
            }
        }
예제 #4
0
        public void BuscarBeneficiario(object unObjeto)
        {
            contable objeto = (contable)unObjeto;
            persona  item   = (persona)BuscarListaPr.BuscarObjeto(TipoConsulta.Personas);

            if (item != null)
            {
                objeto.fkpersona = item;
                objeto.idpersona = item.id;
            }
        }
예제 #5
0
파일: UsuarioPr.cs 프로젝트: ferbenor/moro
        void colIdentificacion_ButtonCustomClick(object sender, EventArgs e)
        {
            DataGridViewTextBoxColumn campo = (DataGridViewTextBoxColumn)sender;
            object objeto = BuscarListaPr.BuscarPersona();

            if (objeto != null)
            {
                campo.DataGridView.BeginEdit(true);
                campo.DataGridView.CurrentRow.Cells["colPersona"].Value = (persona)objeto;
                campo.DataGridView.EndEdit();
            }
        }
예제 #6
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            this.spvValidador.Validate();
            if (this.spvValidador.LastFailedValidationResults.Count == 0)
            {
                if (this.cadenaSql != null && this.parametros.Count > 0)
                {
                    BuscarListaPr.LlenaGrid(this.dgrLista, cadenaSql, parametros.Select(x => new DataParameter(x.Key, x.Value)).ToArray());
                }
                else if (this.FuncionBuscar != null)
                {
                    object lista   = null;
                    var    tipo    = typeof(BuscarListaPr);
                    var    funcion = tipo.GetMethod(this.FuncionBuscar, new Type[] { typeof(string) });
                    if (funcion == null)
                    {
                        funcion = tipo.GetMethod(this.FuncionBuscar, new Type[] { typeof(string), typeof(object[]) });
                        lista   = funcion.Invoke(null, new object[] { this.txtBuscar.Text, this.ParamsParametros });
                    }
                    else
                    {
                        lista = funcion.Invoke(null, new[] { this.txtBuscar.Text });
                    }
                    this.dgrLista.DataSource = null;
                    this.dgrLista.DataSource = lista;
                }
                else
                {
                    int i = 0;
                    lp.Add(new LinqToDB.Data.DataParameter("nombre", this.txtBuscar.Text.Trim() + "%"));
                    int.TryParse(this.txtBuscar.Text.Trim(), out i);
                    lp.Add(new LinqToDB.Data.DataParameter("codigo", i));

                    BuscarListaPr.LlenaGrid(this.dgrLista, this.Tabla, "where " + this.ValorWhere, this.Campos, this.Ordenar, lp.ToArray());
                }


                if (this.dgrLista.Rows.Count == 0)
                {
                    this.btnSeleccionar.Enabled = false;
                }
                else
                {
                    this.btnSeleccionar.Enabled = true;
                }
            }
            this.txtBuscar.Focus();
            this.txtBuscar.SelectAll();
        }
예제 #7
0
파일: BodegaPr.cs 프로젝트: ferbenor/moro
        public void BuscarBodega(object unObjeto, short unOrden)
        {
            inventario objeto = (inventario)unObjeto;
            bodega     item   = (bodega)BuscarListaPr.BuscarObjeto(TipoConsulta.Bodegas);

            if (item != null)
            {
                if (unOrden == 1)
                {
                    objeto.fkbodegas1 = item;
                }
                if (unOrden == 2)
                {
                    objeto.fkbodegas2 = item;
                }
            }
        }
예제 #8
0
파일: UsuarioPr.cs 프로젝트: ferbenor/moro
        void colIdentificacion_ButtonDropDownClick(object sender, System.ComponentModel.CancelEventArgs e)
        {
            DataGridViewTextBoxColumn campo = (DataGridViewTextBoxColumn)sender;

            campo.DataGridView.BeginEdit(false);
            if (!campo.DataGridView.IsCurrentCellDirty)
            {
                campo.DataGridView.NotifyCurrentCellDirty(true);
            }
            object objeto = BuscarListaPr.BuscarPersona();

            if (objeto != null)
            {
                campo.DataGridView.NotifyCurrentCellDirty(false);
                campo.DataGridView.CurrentRow.Cells["colPersona"].Value = (persona)objeto;
                campo.DataGridView.EndEdit();
            }
        }
예제 #9
0
파일: ProductoPr.cs 프로젝트: ferbenor/moro
 void objetoGrid_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == 2 && e.RowIndex > -1)
         {
             DataGridViewTextBoxColumn campo = (DataGridViewTextBoxColumn)((DataGridView)sender).Columns[((DataGridView)sender).Columns[2].Tag.ToString()];
             campo.DataGridView.CurrentCell = campo.DataGridView.CurrentRow.Cells[campo.Index];
             if (campo.DataGridView.CurrentRow.Index == campo.DataGridView.NewRowIndex)
             {
                 campo.DataGridView.EndEdit();
             }
             campo.DataGridView.BeginEdit(false);
             if (!campo.DataGridView.IsCurrentCellDirty)
             {
                 campo.DataGridView.NotifyCurrentCellDirty(true);
             }
             else
             {
                 campo.DataGridView.NotifyCurrentCellDirty(false);
             }
             object objeto = BuscarListaPr.Buscar("Marcas", "marcas", "activo = 't'", "id as \"ID\", descripcion as \"Descripcion\"");
             if (objeto != null)
             {
                 campo.DataGridView.NotifyCurrentCellDirty(false);
                 campo.DataGridView.CurrentRow.Cells["colMarca"].Value = (marca)objeto;
                 campo.DataGridView.EndEdit();
                 campo.DataGridView.InvalidateCell(campo.DataGridView.CurrentRow.Cells[2]);
                 campo.DataGridView.EndEdit();
             }
             else
             {
                 campo.DataGridView.EndEdit();
             }
         }
     }
     catch (Exception ex)
     {
         General.Mensaje(ex.Message.ToString());
     }
 }
예제 #10
0
파일: VentaPr.cs 프로젝트: ferbenor/moro
 void objetoGrid_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == 1 && e.RowIndex > -1)
         {
             DataGridViewTextBoxColumn campo = (DataGridViewTextBoxColumn)((DataGridView)sender).Columns[((DataGridView)sender).Columns[e.ColumnIndex].Tag.ToString()];
             campo.DataGridView.CurrentCell = campo.DataGridView.CurrentRow.Cells[campo.Index];
             if (campo.DataGridView.CurrentRow.Index == campo.DataGridView.NewRowIndex)
             {
                 campo.DataGridView.EndEdit();
             }
             if (!campo.DataGridView.IsCurrentCellDirty)
             {
                 campo.DataGridView.NotifyCurrentCellDirty(true);
             }
             else
             {
                 campo.DataGridView.NotifyCurrentCellDirty(false);
             }
             object objeto = BuscarListaPr.BuscarProducto();
             if (objeto != null)
             {
                 campo.DataGridView.NotifyCurrentCellDirty(false);
                 campo.DataGridView.BeginEdit(false);
                 campo.DataGridView.CurrentRow.Cells["colProducto"].Value = objeto;
                 campo.DataGridView.EndEdit();
             }
             else
             {
                 campo.DataGridView.EndEdit();
             }
         }
     }
     catch (Exception ex)
     {
         General.Mensaje(ex.Message.ToString());
     }
 }
예제 #11
0
 private object BuscarCuenta()
 {
     return(BuscarListaPr.Buscar("CuentasGrupo", "cuentascontables", "esgrupo = 't' and periodo = " + General.periodoActual + " and (codigo like @nombre or upper(nombre) like @nombre )", "id as \"ID\", codigo as \"Codigo\", nombre as \"Nombre\""));
 }
예제 #12
0
        void DgvPlus_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (PermitirEventosInternos && e.ColumnIndex > -1 && e.RowIndex > -1)
            {
                DataGridViewColumn campo = this.Columns[e.ColumnIndex];
                try
                {
                    object             objeto  = null;
                    DataGridViewColumn columna = this.Columns[e.ColumnIndex];
                    if (this.Columns[e.ColumnIndex].GetType().Name == "DataGridViewButtonXColumn")
                    {
                        if (columna.Name.Contains("BEliminar"))
                        {
                            this.Rows.RemoveAt(e.RowIndex);
                        }
                        else
                        {
                            object nombreColumna = campo.Tag;
                            AntesBuscarCellEventArgs argumentos = new AntesBuscarCellEventArgs(e.ColumnIndex, e.RowIndex);
                            OnAntesBuscarCell(argumentos);
                            if (argumentos.TipoConsulta == TipoConsulta._NoSet)
                            {
                                columnasgrid registro = this.ColumnasGrid.Find(x => x.nombre.ToUpper() == columna.Name.Substring(3));
                                if (registro != null)
                                {
                                    TipoConsulta tipo;
                                    Enum.TryParse(registro.busqueda, out tipo);
                                    argumentos.TipoConsulta = tipo;
                                }
                            }
                            if (argumentos.TipoConsulta != TipoConsulta._NoSet)
                            {
                                if (!argumentos.Cancel)
                                {
                                    if (campo.DataGridView.CurrentRow.Index == campo.DataGridView.NewRowIndex)
                                    {
                                        campo.DataGridView.EndEdit();
                                    }
                                    if (!campo.DataGridView.IsCurrentCellDirty)
                                    {
                                        campo.DataGridView.NotifyCurrentCellDirty(true);
                                    }
                                    else
                                    {
                                        campo.DataGridView.NotifyCurrentCellDirty(false);
                                    }
                                    if (e.RowIndex > -1)
                                    {
                                        if (columna.Name.Contains("BCliente"))
                                        {
                                            if (campo.Tag == null)
                                            {
                                                nombreColumna = "colCliente";
                                            }
                                            objeto = BuscarListaPr.BuscarObjeto(TipoConsulta.Clientes);
                                        }
                                        else
                                        {
                                            objeto = BuscarListaPr.BuscarObjeto(argumentos.TipoConsulta, false, true, argumentos.GetValoresAdicionales());
                                            if (argumentos.ColumnaObjeto != null)
                                            {
                                                nombreColumna = argumentos.ColumnaObjeto;
                                            }
                                        }
                                    }

                                    if (objeto != null)
                                    {
                                        OnValidarGrid(new ValidacionGridEventArgs(e.ColumnIndex, e.RowIndex)
                                        {
                                            EsBoton = true, Objeto = objeto
                                        });
                                        campo.DataGridView.NotifyCurrentCellDirty(false);
                                        campo.DataGridView.BeginEdit(false);
                                        campo.DataGridView.CurrentRow.Cells[nombreColumna.ToString()].Value = objeto;
                                        campo.DataGridView.InvalidateRow(e.RowIndex);
                                    }
                                }
                                campo.DataGridView.EndEdit();
                            }
                            else
                            {
                                ModeloDB.General.Mensaje("Tipo de consulta no definida");
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    ModeloDB.General.Mensaje(ex.Message.ToString());
                }
            }
        }
예제 #13
0
 void DgvPlus_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
 {
     if (PermitirEventosInternos)
     {
         try
         {
             if (this.CurrentRow.Cells[e.ColumnIndex].IsInEditMode)
             {
                 AntesBuscarCellEventArgs argumentos = new AntesBuscarCellEventArgs(e.ColumnIndex, e.RowIndex);
                 OnAntesBuscarCell(argumentos);
                 if (argumentos.TipoConsulta == TipoConsulta._NoSet)
                 {
                     columnasgrid registro = this.ColumnasGrid.Find(x => x.nombre.ToUpper() == this.Columns[e.ColumnIndex].Name.Substring(3) && !string.IsNullOrEmpty(x.busqueda));
                     if (registro != null)
                     {
                         TipoConsulta tipo;
                         Enum.TryParse(registro.busqueda, out tipo);
                         argumentos.TipoConsulta = tipo;
                     }
                     else
                     {
                         return;
                     }
                 }
                 if (argumentos.TipoConsulta != TipoConsulta._NoSet)
                 {
                     if (!argumentos.Cancel)
                     {
                         object nombreColumna = this.Columns[e.ColumnIndex].Tag;
                         ValidacionGridEventArgs argumento = new ValidacionGridEventArgs(e.ColumnIndex, e.RowIndex)
                         {
                             Cancel = e.Cancel, EsBoton = false
                         };
                         OnValidarGrid(argumento);
                         e.Cancel = argumento.Cancel;
                         if (!e.Cancel)
                         {
                             object objeto = null;
                             if (argumentos.ColumnaObjeto != null)
                             {
                                 nombreColumna = argumentos.ColumnaObjeto;
                             }
                             if (!this.Columns.Contains((nombreColumna ?? "").ToString()))
                             {
                                 e.Cancel = true;
                                 //this.CancelEdit();
                                 ModeloDB.General.Mensaje("Columna destino de objeto encontrado no definida");
                             }
                             else
                             {
                                 objeto = BuscarListaPr.BuscarRegistro(argumentos.TipoConsulta, this.EditingControl.Text);
                                 if (objeto != null)
                                 {
                                     this.CurrentRow.Cells[nombreColumna.ToString()].Value = objeto;
                                     ((Instrumental1)this.CurrentRow.DataBoundItem).IntegrarAsociados();
                                 }
                                 else
                                 {
                                     e.Cancel = true;
                                     //this.CancelEdit();
                                     ModeloDB.General.Mensaje("Objeto no encontrado.");
                                 }
                             }
                         }
                     }
                 }
                 else
                 {
                     e.Cancel = true;
                     //this.CancelEdit();
                     ModeloDB.General.Mensaje("Tipo de consulta no definida");
                 }
             }
         }
         catch (Exception ex)
         {
             e.Cancel = true;
             //this.CancelEdit();
             ModeloDB.General.Mensaje(ex.Message);
         }
     }
 }
예제 #14
0
 public static object BuscarProducto()
 {
     return(BuscarListaPr.Buscar("Productos", "productos p inner join marcas m on p.idmarca = m.id", "p.id = @codigo or upper(m.descripcion) like @nombre or upper(p.descripcion) like @nombre ", "p.id as \"Id\", m.descripcion as \"Marca\", p.descripcion as \"Descripción\", p.precio1 as \"Precio\"", "order by 3"));
 }
예제 #15
0
 public static object BuscarItemInventario()
 {
     return(BuscarListaPr.Buscar("ItemsInventario", "itemsinventario i ", "i.id = @codigo or upper(descripcion) like @nombre or (case tipo when 'M' then 'MATERIALES' when 'S' then 'SERVICIOS' end) like @nombre", "i.id as \"Id\", descripcion as \"Descripcion\", (case tipo when 'M' then 'MATERIALES' when 'S' then 'SERVICIOS' end) as \"Tipo\", precio as \"Precio\", grabaiva as \"GrabaIva\"", "order by 2"));
 }
예제 #16
0
 public static object BuscarOrdenesServicio()
 {
     return(BuscarListaPr.Buscar("OrdenesServicio", "tiposservicio tp inner join ordenesservicio c on tp.id = c.idtiposervicio inner join contratos d on c.idcontrato = d.id inner join personas p on d.idpersona = p.id", "c.id = @codigo or p.identificacion like @nombre or upper(p.nombre) like @nombre or upper(p.apellido) like @nombre", "c.id as \"Orden\", c.fecha as \"Fecha\", p.identificacion as \"Identificación\", p.apellido || ' ' || p.nombre as \"Cliente\", tp.descripcion as \"Tipo\", case c.estado when 'R' then 'REGISTRADA' when 'P' then 'PROCESADA' else 'ANULADA' end as \"Estado\"", "order by 3"));
 }
예제 #17
0
 public static object BuscarContratos()
 {
     return(BuscarListaPr.Buscar("Contratos", "contratos c inner join personas p on c.idpersona = p.id", "c.id = @codigo or identificacion like @nombre or upper(nombre) like @nombre or upper(apellido) like @nombre", "c.id as \"Contrato\", identificacion as \"Identificación\", apellido || ' ' || nombre as \"Cliente\"", "order by 3"));
 }
예제 #18
0
 public static object BuscarBeneficiarios()
 {
     return(BuscarListaPr.Buscar("Beneficiarios", "personas", "id > 0 and (id = @codigo or identificacion like @nombre or upper(nombre) like @nombre or upper(apellido) like @nombre)", "id, identificacion as \"Identificación\", apellido || ' ' || nombre as \"Descripción\"", "order by 3"));
 }
예제 #19
0
 public static object BuscarBarrio()
 {
     return(BuscarListaPr.Buscar("Barrios", "barrios b inner join parroquias p on b.idparroquia = p.id inner join cantones c on p.idcanton = c.id inner join provincias pv on c.idprovincia = pv.id", "b.id = @codigo or upper(b.nombre) like @nombre or upper(p.nombre) like @nombre or upper(c.nombre) like @nombre or upper(pv.nombre) like @nombre", "b.id, b.nombre as \"Barrio\", p.nombre as \"Parroquia\", c.nombre as \"Canton\", pv.nombre as \"Provincia\"", "order by p.nombre"));
 }