public List<Select.Combo> selectByMarca_Modelo(int id) { try { List<Select.Combo> parametros = new List<Select.Combo>(); Select.Combo p; DataTable dt = new DataTable(); SqlDataAdapter sda = new SqlDataAdapter(); string ConnString = ConfigurationManager.ConnectionStrings["barabaresConnectionString"].ConnectionString; using (SqlConnection SqlConn = new SqlConnection(ConnString)) { try { SqlConn.Open(); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); return parametros; } SqlCommand sqlCmd = new SqlCommand("VEHICULO_MODELO_SELECT_BY_MARCA", SqlConn); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.Add("@ipnCodigoPadre", SqlDbType.Int).Value = id; sda.SelectCommand = sqlCmd; sda.Fill(dt); SqlConn.Close(); sqlCmd.Dispose(); sda.Dispose(); } DataRow[] rows = dt.Select(); for (int i = 0; i < rows.Length; i++) { p = Utils.combo_parametro_parse(rows[i]); parametros.Add(p); } return parametros; } catch (Exception ex) { Select.Combo v = new Select.Combo(); LogBarabares b = new LogBarabares() { Accion = Constantes.LOG_LISTAR, Servicio = Constantes.SelectByMarca_Modelo, Input = JsonSerializer.selectById(id), Descripcion = ex.ToString(), Clase = v.GetType().Name, Aplicacion = Constantes.ENTORNO_SERVICIOS, Estado = Constantes.FALLA, Ip = "", IdUsuario = 1 //TODO: obtener usuario de la sesión }; Utils.add_LogBarabares(b); return new List<Select.Combo>(); } }
public static Select.Combo combo_provincia_parse(DataRow r) { Select.Combo p = new Select.Combo(); p.id= Int32.Parse(r["idProvincia"].ToString()); p.value = r["nombre"].ToString(); return p; }
public static Select.Combo combo_parametro_parse(DataRow r) { Select.Combo p = new Select.Combo(); p.id = Int32.Parse(r["idParametros"].ToString()); p.value = r["valor"].ToString(); return p; }
public static Select.Combo combo_distrito_parse(DataRow r) { Select.Combo p = new Select.Combo(); p.id = Int32.Parse(r["idDistrito"].ToString()); p.value = r["nombre"].ToString(); return p; }
public List<Select.Combo> selectAll_Departamento() { try { List<Select.Combo> departamentos = new List<Select.Combo>(); Select.Combo d; DataTable dt = new DataTable(); SqlDataAdapter sda = new SqlDataAdapter(); string ConnString = ConfigurationManager.ConnectionStrings["barabaresConnectionString"].ConnectionString; using (SqlConnection SqlConn = new SqlConnection(ConnString)) { try { SqlConn.Open(); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); return departamentos; } SqlCommand sqlCmd = new SqlCommand("DIRECCION_DEPARTAMENTO_SELECT_ALL", SqlConn); sqlCmd.CommandType = CommandType.StoredProcedure; sda.SelectCommand = sqlCmd; sda.Fill(dt); SqlConn.Close(); sqlCmd.Dispose(); sda.Dispose(); } DataRow[] rows = dt.Select(); for (int i = 0; i < rows.Length; i++) { d = Utils.combo_departamento_parse(rows[i]); departamentos.Add(d); } return departamentos; } catch (Exception ex) { Select.Combo d = new Select.Combo(); LogBarabares b = new LogBarabares() { Accion = Constantes.LOG_LISTAR, Servicio = Constantes.SelectAll_Departamento, Input = "", Descripcion = ex.ToString(), Clase = d.GetType().Name, Aplicacion = Constantes.ENTORNO_SERVICIOS, Estado = Constantes.FALLA, Ip = "", IdUsuario = 1 //TODO: obtener usuario de la sesión }; Utils.add_LogBarabares(b); return new List<Select.Combo>(); } }
public List<Select.Combo> selectByDepartamento_Provincia(int id) { try { List<Select.Combo> provincias = new List<Select.Combo>(); Select.Combo p; DataTable dt = new DataTable(); SqlDataAdapter sda = new SqlDataAdapter(); string ConnString = ConfigurationManager.ConnectionStrings["barabaresConnectionString"].ConnectionString; using (SqlConnection SqlConn = new SqlConnection(ConnString)) { try { SqlConn.Open(); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); return provincias; } SqlCommand sqlCmd = new SqlCommand("DIRECCION_PROVINCIA_SELECT_BY_DEPARTAMENTO", SqlConn); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.Add("@ipnIdDepartamento", SqlDbType.VarChar).Value = id; sda.SelectCommand = sqlCmd; sda.Fill(dt); SqlConn.Close(); sqlCmd.Dispose(); sda.Dispose(); } DataRow[] rows = dt.Select(); for (int i = 0; i < rows.Length; i++) { p = Utils.combo_provincia_parse(rows[i]); provincias.Add(p); } return provincias; } catch (Exception ex) { Select.Combo d = new Select.Combo(); LogBarabares b = new LogBarabares() { Accion = Constantes.LOG_LISTAR, Servicio = Constantes.SelectByDepartamento_Provincia, Input = JsonSerializer.selectById(id), Descripcion = ex.ToString(), Clase = d.GetType().Name, Aplicacion = Constantes.ENTORNO_SERVICIOS, Estado = Constantes.FALLA, Ip = "", IdUsuario = 1 //TODO: obtener usuario de la sesión }; Utils.add_LogBarabares(b); return new List<Select.Combo>(); } }