public void modificarNoticia()
        {
            int tipoNoticia = 1;

            if (this.rdbTipoNoticia.Text.Trim() != "General")
            {
                tipoNoticia = 0;
            }
            PNegocio.Administrador.Noticia objInstancia = new PNegocio.Administrador.Noticia();
            codeHtmlContenido = hidContenido.Value;
            codeHtmlContenido = codeHtmlContenido.Replace("[", "<");
            codeHtmlContenido = codeHtmlContenido.Replace("]", ">");
            string res = "";

            res = objInstancia.modificarNoticia(this.hidIdAnt.Value, this.txtTitulo.Text.Trim(), codeHtmlContenido.Trim(), Gen.Util.CS.Gen.convertirFecha(this.datepicker.Text.Trim()), Gen.Util.CS.Gen.convertirFecha(this.datepicker2.Text.Trim()), this.txtURLImagen.Text, tipoNoticia);
            if (res == "correcto")
            {
                Session["textoDialogo"] = "Modificado correctamente";
                Response.Redirect("Noticia.aspx");
            }
            else
            {
                this.lblDialog.Text = "No fue posible realizar el cambio, intente nuevamente";
            }
        }
        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);
        }
        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());
        }
Beispiel #4
0
 public void cargarNoticiasNoseleccionadas(string idGrupo)
 {
     PNegocio.Administrador.Noticia instancia = new PNegocio.Administrador.Noticia();
     this.lblTablaNoticias.Text = instancia.consultarNoticiasUlNoSeleccionados(idGrupo, "");
     if (this.lblTablaNoticias.Text != "<strong>No se encontraron resultados para mostrar en la tabla</strong>")
     {
         this.lblTablaFiltro.Text = PNegocio.Administrador.TextoFiltro.textoTablaFiltroSortMostrarNoticias();
     }
 }
Beispiel #5
0
        public void llenarDatosProveedor(string toSee)
        {
            List <string[]> lista = new PNegocio.Administrador.Noticia().consultarGrupoNoticiaPorId(toSee);

            this.lblDescribeNombre.Text = "Nombre del grupo: ";
            this.lblNombreGrupo.Text    = lista[1][1];

            this.lblTextoExplicacion.Text = "<strong>Los siguientes proveedores estan ligados al grupo de noticia seeccionado:</strong>";
        }
        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));
        }
        public void insertar()
        {
            int tipoNoticia = 1;

            if (this.rdbTipoNoticia.Text.Trim() != "General")
            {
                tipoNoticia = 0;
            }
            codeHtmlContenido = hidContenido.Value;
            codeHtmlContenido = codeHtmlContenido.Replace("[", "<");
            codeHtmlContenido = codeHtmlContenido.Replace("]", ">");
            string res =
                new PNegocio.Administrador.Noticia().insertarNoticia(
                    this.txtTitulo.Text, codeHtmlContenido,
                    Gen.Util.CS.Gen.convertirFecha(this.datepicker.Text), Gen.Util.CS.Gen.convertirFecha(this.datepicker2.Text),
                    this.txtURLImagen.Text.Trim(), tipoNoticia
                    );

            if (res == "correcto")
            {
                if (tipoNoticia == 0)
                {
                    enviarCorreoGeneral();
                }
                Session["textoDialogo"] = "Insertado correctamente";
                Response.Redirect("Noticia.aspx");
            }
            else
            {
                this.lblDialog.Text = res;
            }

            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "mostrarDialog()", true);

            mostrarTablarNoticias();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool permiso = false;

            try
            {
                //INICIO Permiso de ver esta pantalla
                string[]         resLog      = (string[])Session["resLog"];
                PNegocio.Usuario nUsuario    = new PNegocio.Usuario();
                int[]            idPantallas = nUsuario.getIdPantallasByIdRol(int.Parse(resLog[2]));
                Session["Pantallas"] = idPantallas;
                //int[] idPantallas = (int[])Session["Pantallas"];
                for (int i = 0; i < idPantallas.Length; i++)
                {
                    if (idPantallas[i] == 1 ||
                        idPantallas[i] == 2 ||
                        idPantallas[i] == 4 ||
                        idPantallas[i] == 8 ||
                        idPantallas[i] == 16 ||
                        idPantallas[i] == 32
                        )
                    {
                        permiso = true;
                        break;
                    }
                }
                if (permiso == false)
                {
                    cerrarSesion();
                }
            }
            catch (Exception)
            {
                cerrarSesion();
            }
            ////FIN Permiso de ver esta pantalla
            Session["fecha1"]          = ""; // fechas usadas en pantalla PAGOS
            Session["fecha2"]          = "";
            Session["FVfec1"]          = ""; //mgv fechas de busqueda en la FV60
            Session["FVfec2"]          = "";
            Session["M7fec1"]          = ""; //mgv fechas de busqueda en la MIR7
            Session["M7fec2"]          = "";
            Session["PantallaUsuario"] = "";

            try
            {
                string   idProveedor = Session["ProveedorLoged"].ToString();
                string[] resultado   = null;

                resultado             = new PNegocio.Administrador.Noticia().consultarNoticiaPorIdProveedor(idProveedor);
                this.lblTitulo.Text   = resultado[0];
                this.lblArticulo.Text = resultado[1];
                //if (resultado != null)
                //{
                if (resultado[2].ToString().Trim() != "" && resultado[2].ToString().Trim() != null)
                {
                    this.lblBanner.Text = "<img src='" + resultado[2] + "'/>";
                }
                else
                {
                    this.lblBanner.Text = "";
                }
                //}
                //else
                //{
                //    this.lblArticulo.Text = "No existen noticias por el momento, este al pendiente";
                //    //this.lblBanner.Text = "<img src='../images/adn_logo.png' />";
                //}
            }
            catch (Exception)
            {
                this.lblArticulo.Text = "No existen noticias por el momento, este al pendiente";
            }
            try
            {
                DatoMaestro dm       = new DatoMaestro();
                string      userName = HttpContext.Current.User.Identity.Name;
                // mgv. Crear lista para WS y lista para CN
                List <string[]> informacionImportante     = new PNegocio.Usuario().getSociedadesByUsuario(userName); // sociedad_bukrs as bukrs, RFC, lifnr, instancia WS
                List <string[]> listaDiferentesInstancias = Gen.Util.CS.Gen.sintetizaInfoConexiones(informacionImportante);
                Session["listaDiferentesInstancias"] = listaDiferentesInstancias;
                //List<string[]> informacionImportanteCN = new PNegocio.Usuario().getSociedadesByUsuarioCN(userName); // sociedad_bukrs as bukrs, RFC, lifnr, CN
                //List<string[]> listaInstanciasCN = Gen.Util.CS.Gen.sintetizaInfoCN(informacionImportanteCN);
                //Session["listaInstanciasCN"] = listaInstanciasCN;
                /// FIN
            }
            catch (Exception)
            {
                //throw;
            }
        }
Beispiel #10
0
 private string crearTablaNoticiasNoSeleccionadas(string numeros)
 {
     string[] split = numeros.Split(new Char[] { ',' });
     PNegocio.Administrador.Noticia instancia = new PNegocio.Administrador.Noticia();
     return(instancia.consultarNoticiasSeleccionadasMotrarEnSortTable(split, "fuera", "sort"));
 }
 private string crearTablaNoticiasSeleccionadas(string numeros)
 {
     string[] split = numeros.Split(new Char[] { ',' });
     PNegocio.Administrador.Noticia instancia = new PNegocio.Administrador.Noticia();
     return(instancia.consultarNoticiasSeleccionadas(split, "dentro", "tabla"));
 }
        private void crearGrupo(string mode)
        {
            proveedoresSeleccionados = this.hidIdSelected.Value;
            nameGroup = this.txtNombreGrupoN.Text;
            string idGrupoNoticiaModificar = this.hidIDX.Value.ToString().Trim();

            string[] tablaNumeros   = this.hidIdsNoticiasSeleciondas.Value.ToString().Trim().Split(new Char[] { ',' });
            char[]   delimiterChars = { ',' };
            if (proveedoresSeleccionados != "" && nameGroup != "" && tablaNumeros.Length > 0 &&
                proveedoresSeleccionados != null && nameGroup != null)
            {
                idProveedores                    = proveedoresSeleccionados.Split(delimiterChars);
                idProveedores                    = identificar(idProveedores);
                this.lblIdNoticia.Text           = "";
                this.lblNoticiaSeleccionada.Text = "";

                if (mode == "insertar")
                {
                    new PNegocio.Administrador.Noticia().insertarGrupoNoticia(nameGroup, n_noticia, idProveedores, tablaNumeros);
                    nameGroup = n_noticia = "";
                    Session["textoDialogo"] = "El grupo de noticia se insertó correctamente";
                    Response.Redirect("GrupoNoticia.aspx");
                }
                if (mode == "modificar")
                {
                    List <string> listaString = new List <string>();
                    if (idProveedores.Length > 0)
                    {
                        listaString.Add(idProveedores[0]);
                    }
                    for (int i = 0; i < idProveedores.Length; i++)
                    {
                        bool existe = false;
                        for (int j = 0; j < listaString.Count; j++)
                        {
                            if (idProveedores[i] == listaString[j])
                            {
                                existe = true;
                                break;
                            }
                        }
                        if (!existe)
                        {
                            listaString.Add(idProveedores[i]);
                        }
                    }

                    string res = new PNegocio.Administrador.Noticia().modificarGrupoNoticia(idGrupoNoticiaModificar, nameGroup, n_noticia, listaString, tablaNumeros);
                    nameGroup = n_noticia = "";
                    Session["textoDialogo"] = res;
                    Response.Redirect("GrupoNoticia.aspx");
                }
            }
            else
            {
                this.lblDialog.Text = "debe de llenar todos los campos necesarios";
                if (n_noticia != "" && titulo != "" && n_noticia != null && titulo != null)
                {
                    this.lblIdNoticia.Text           = n_noticia;
                    this.lblNoticiaSeleccionada.Text = " Titulo: " + titulo;
                }
            }
            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "mostrarDialog()", true);
        }