public List<EntidadUdc> Error(EntidadUdc parError) { List<EntidadUdc> listaError = new List<EntidadUdc>(); listaError.Add(parError); return listaError; }
public TablaUdcs(EntidadUdc parUdc) { this.managerOracle = new ManagerOracle("JDE"); this.comando = new OracleCommand(); this.log = string.Empty; if (parUdc != null) { this.udc = parUdc; } else { this.udc = new EntidadUdc(); } }
public List<EntidadUdc> ContratosTodos() { EntidadUdc udc = new EntidadUdc(); udc.Producto = "00"; udc.Definicion = "01"; udc.Tipo = "P"; TablaUdcs tabla = new TablaUdcs(udc); List<EntidadUdc> lista = tabla.Obtener(); if (lista != null) { return lista; } else { udc.Log = tabla.Log; return this.Error(udc); } }
public List<EntidadUdc> Obtener() { // Contenedor de datos DataTable datos; // Sentencia SQL this.comando.CommandText = "select " + "COD.DRSY as PRODUCTO " + ",COD.DRRT as DEFINICION " + ",trim(COD.DRKY) as CODIGO " + ",TRIM(COD.DRDL01 || COD.DRDL02) as DESCRIPCION " + ",TRIM(COD.DRKY) || ' : ' || TRIM(COD.DRDL01) as COMPLETA " + ",COD.DRSPHD as TIPO " + "from PRODCTL.F0005 COD " + "where 1=1 " + "and trim(COD.DRSY) like :parProducto " + "and COD.DRRT like :parDefinicion " + "and trim(COD.DRSPHD) like :parTipo " ; // Configurar parametros this.comando.Parameters.Clear(); if (this.udc.Producto == string.Empty) { this.comando.Parameters.Add(":parProducto", OracleType.VarChar).Value = "%"; } else { this.comando.Parameters.Add(":parProducto", OracleType.VarChar).Value = this.udc.Producto; } if (this.udc.Definicion == string.Empty) { this.comando.Parameters.Add(":parDefinicion", OracleType.VarChar).Value = "%"; } else { this.comando.Parameters.Add(":parDefinicion", OracleType.VarChar).Value = this.udc.Definicion; } if (this.udc.Tipo == string.Empty) { this.comando.Parameters.Add(":parTipo", OracleType.VarChar).Value = "%"; } else { this.comando.Parameters.Add(":parTipo", OracleType.VarChar).Value = this.udc.Tipo; } // Obtener datos datos = this.managerOracle.Consultar(this.comando); // Crear lista de objetos if (datos != null) { if (datos.Rows.Count != 0) { List<EntidadUdc> listaCodigos = new List<EntidadUdc>(); foreach (DataRow fila in datos.Rows) { EntidadUdc auxUdc = new EntidadUdc(); auxUdc.Producto = fila["PRODUCTO"].ToString(); auxUdc.Definicion = fila["DEFINICION"].ToString(); auxUdc.Codigo = fila["CODIGO"].ToString(); auxUdc.Descripcion = fila["DESCRIPCION"].ToString(); auxUdc.Completa = fila["COMPLETA"].ToString(); auxUdc.Tipo = fila["TIPO"].ToString(); listaCodigos.Add(auxUdc); } this.log = listaCodigos.Count.ToString(); return listaCodigos; } else { this.log = "VACIO"; return null; } } else { this.log = this.managerOracle.Log; return null; } }