private string selectNombreGrupo(string idGrupo) { PNegocio.Administrador.Noticia instancia = new PNegocio.Administrador.Noticia(); string sqlString = "select nombre from gruponoticia where idgrupoNoticia = " + idGrupo; return(instancia.consultarNoticiaPorId(sqlString)[1][0].ToString().Trim()); }
private string[] identificar(string[] idproveedores) { PNegocio.Administrador.Noticia instancia = new PNegocio.Administrador.Noticia(); List <string[]> idpro = new List <string[]>(); if (drlbTipoGrupo.SelectedValue.Equals("grupo")) { foreach (string idprove in idproveedores) { string sqlString = "select idOriginal from detProveedor where proveedor_idProveedor = " + idprove; idpro = instancia.consultarNoticiaPorId(sqlString); idpro.RemoveAt(0); int indice = idproveedores.Length; Array.Resize(ref idproveedores, idproveedores.Length + idpro.Count); foreach (string[] item in idpro) { idproveedores[indice] = item[0]; indice++; } } HashSet <string> set = new HashSet <string>(idproveedores); string[] result = new string[set.Count]; set.CopyTo(result); idproveedores = result; } return(idproveedores); }
public void cargarEdit() { try { if (Request.QueryString["toEdit"] != "" && Request.QueryString["toEdit"] != null) { PNegocio.Administrador.Noticia objInstancia = new PNegocio.Administrador.Noticia(); string sqlString = "select idnoticia as Nº_noticia, Titulo, cuerpo,fechaInicio, fechaFin,urlImagen, tipoNoticia from noticia where idNoticia = " + Request.QueryString["toEdit"] + ";"; List <string[]> lista = objInstancia.consultarNoticiaPorId(sqlString); if (lista.Count > 1) { this.txtTitulo.Text = lista[1][1]; this.hidContenido.Value = lista[1][2]; this.datepicker.Text = Gen.Util.CS.Gen.convertirFechaBDaFormatoJq(lista[1][3].ToString()); this.datepicker2.Text = Gen.Util.CS.Gen.convertirFechaBDaFormatoJq(lista[1][4].ToString()); this.txtURLImagen.Text = lista[1][5]; this.hidIdAnt.Value = lista[1][0]; if (lista[1][6] == "False") { this.rdbTipoNoticia.Items.FindByText("General").Selected = false; this.rdbTipoNoticia.Items.FindByText("Asignable").Selected = true; } this.btnGuardar.Visible = false; this.btnCancelar.Visible = true; } } else { this.btnModificar.Visible = false; } } catch (Exception) { this.btnModificar.Visible = false; } }
private string getTablaNoticiasGruposSelect(string idGrupo) { PNegocio.Administrador.Noticia instancia = new PNegocio.Administrador.Noticia(); string sqlString = "select * from noticia as n, GrupoNoticia_Noticia as gn " + "where n.idNoticia = gn.Noticia_idNoticia and GrupoNoticia_idGrupoNoticia = " + idGrupo; List <string[]> resultado = instancia.consultarNoticiaPorId(sqlString); string noticias = ""; if (resultado.Count > 1) { noticias += resultado[1][0]; for (int i = 2; i < resultado.Count; i++) { if (i != resultado.Count) { noticias += ","; } noticias += resultado[i][0]; } } this.hidIdsNoticiasSeleciondas.Value = noticias; return(instancia.consultarNoticiasGrupoEditar(resultado)); }