コード例 #1
0
ファイル: Contenido.aspx.cs プロジェクト: netxuz/InternetOEM
        protected void Page_Load(object sender, EventArgs e)
        {
            oWeb.ValidaSessionAdm();
            if (!IsPostBack)
            {
                CodContenido.Value = oWeb.GetData("CodContenido");
                CodNodo.Value      = oWeb.GetData("CodNodo");
                if (!string.IsNullOrEmpty(CodContenido.Value))
                {
                    DBConn oConn = new DBConn();
                    if (oConn.Open())
                    {
                        CmsContenidos oContenidos = new CmsContenidos(ref oConn);
                        oContenidos.CodContenido = CodContenido.Value;
                        DataTable dContenidos = oContenidos.Get();
                        if (dContenidos != null)
                        {
                            if (dContenidos.Rows.Count > 0)
                            {
                                txtTitulo.Text = dContenidos.Rows[0]["titulo_contenido"].ToString();
                                rdCmbEstado.FindItemByValue(dContenidos.Rows[0]["est_contenido"].ToString()).Selected = true;
                                rdDescripcion.Content = dContenidos.Rows[0]["texto_contenido"].ToString();
                                rdResumen.Content     = dContenidos.Rows[0]["resumen_contenido"].ToString();
                                chk_destacado.Checked = (dContenidos.Rows[0]["dest_contenido"].ToString() == "1" ? true : false);
                                chk_rss.Checked       = (dContenidos.Rows[0]["ind_rss"].ToString() == "1" ? true : false);
                                btnArchivos.Visible   = true;
                                idGridFile.Visible    = true;
                            }
                        }
                        dContenidos = null;

                        oConn.Close();
                    }
                }
            }
            else
            {
                if ((Session["ReloadImageCont"] != null) && (!string.IsNullOrEmpty(Session["ReloadImageCont"].ToString())))
                {
                    rdgArchivos.Rebind();
                }
            }
        }
コード例 #2
0
        void oBntDen_Click(object sender, EventArgs e)
        {
            DBConn oConn = new DBConn();

            try
            {
                if (oConn.Open())
                {
                    oConn.BeginTransaction();

                    CmsContenidos oContenidos = new CmsContenidos(ref oConn);
                    oContenidos.CodContenido = (sender as Button).Attributes["CodContenido"].ToString();
                    oContenidos.IndDenuncia  = "V";
                    oContenidos.Accion       = "EDITAR";
                    oContenidos.Put();

                    if (string.IsNullOrEmpty(oContenidos.Error))
                    {
                        oConn.Commit();

                        StringBuilder oFolder = new StringBuilder();
                        oFolder.Append(Server.MapPath(".")).Append(@"\binary\");
                        oContenidos.SerializaContenidos(ref oConn, oFolder.ToString(), "Contenidos.bin");
                    }
                    else
                    {
                        oConn.Rollback();
                    }
                    oConn.Close();
                }
            }
            catch (Exception Ex)
            {
                if (oConn.bIsOpen)
                {
                    oConn.Rollback();
                    oConn.Close();
                }
            }
            Response.Redirect(".");
        }
コード例 #3
0
ファイル: Contenidos.aspx.cs プロジェクト: netxuz/InternetOEM
        protected void rdContenido_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                CmsContenidos oContenidos = new CmsContenidos(ref oConn);
                oContenidos.CodNodo = CodNodo.Value;

                GridColumn oGridColumn;

                oGridColumn            = rdContenido.MasterTableView.Columns.FindByUniqueName("NomContenido");
                oGridColumn.HeaderText = oCulture.GetResource("Contenido", "NomContenido");

                oGridColumn            = rdContenido.MasterTableView.Columns.FindByUniqueName("EstContenido");
                oGridColumn.HeaderText = oCulture.GetResource("Contenido", "EstContenido");

                rdContenido.DataSource = oContenidos.Get();

                oConn.Close();
            }
        }
コード例 #4
0
ファイル: Parametros.aspx.cs プロジェクト: netxuz/InternetOEM
        protected void btnRSS_Click(object sender, EventArgs e)
        {
            string sUrlSite         = "http://" + Application["URLSite"].ToString();
            string sNameSite        = string.Empty;
            string sTitleHeaderNodo = string.Empty;
            string sMessage         = oCulture.GetResource("Mensajes", "sMessage11");
            DBConn oConn            = new DBConn();

            if (oConn.Open())
            {
                CmsNodos oNodos = new CmsNodos(ref oConn);
                oNodos.IniNodo = "V";
                DataTable dNodo = oNodos.Get();
                if (dNodo != null)
                {
                    if (dNodo.Rows.Count > 0)
                    {
                        sTitleHeaderNodo = dNodo.Rows[0]["titleheader_nodo"].ToString();
                    }
                }
                dNodo = null;


                CmsContenidos oContenidos = new CmsContenidos(ref oConn);
                oContenidos.IndRss = "1";
                DataTable dContenidos = oContenidos.Get();
                if (dContenidos != null)
                {
                    if (dContenidos.Rows.Count > 0)
                    {
                        var articlesEntries = from p in dContenidos.AsEnumerable()
                                              orderby p["date_contenido"]
                                              select new XElement("item",
                                                                  new XElement("title", p["titulo_contenido"]),
                                                                                                                 //new XElement("link", string.Format(sUrlSite + "/Default.aspx?CodContenido={0}", p["cod_contenido"])),
                                                                  new XElement("link", string.Format(sUrlSite)), // + "/Default.aspx?CodContenido={0}", p["cod_contenido"])),
                                                                  new XElement("pubDate", p["date_contenido"]),
                                                                  new XElement("description", p["resumen_contenido"]));

                        XDocument doc = new XDocument(
                            new XDeclaration("1.0", "utf-8", "yes"),
                            new XElement("rss",
                                         new XAttribute("version", "2.0"),
                                         new XElement("channel",
                                                      new XElement("title", Application["SiteName"].ToString()),
                                                      new XElement("description", sTitleHeaderNodo),
                                                      new XElement("lastBuildDate", DateTime.UtcNow.ToUniversalTime()),
                                                      new XElement("link", sUrlSite),
                                                      articlesEntries
                                                      )
                                         )
                            );
                        StringBuilder cPath = new StringBuilder();
                        cPath.Append(Server.MapPath(".")).Append(@"\rss.xml");
                        doc.Save(cPath.ToString());
                        sMessage = oCulture.GetResource("Mensajes", "sMessage10");
                    }
                }
                dContenidos = null;
                oConn.Close();

                StringBuilder js = new StringBuilder();
                js.Append("function LgRespuesta() {");
                js.Append(" window.radalert('").Append(sMessage).Append("', 400, 100,'" + oCulture.GetResource("Global", "MnsAtencion") + "'); ");
                js.Append(" Sys.Application.remove_load(LgRespuesta); ");
                js.Append("};");
                js.Append("Sys.Application.add_load(LgRespuesta);");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "LgRespuesta", js.ToString(), true);
            }
        }
コード例 #5
0
        void oButton_Click(object sender, EventArgs e)
        {
            string        sNomApeUsrOrigen = string.Empty;
            string        sEmailDestino    = string.Empty;
            string        pCodContenido    = string.Empty;
            BinaryUsuario dUser;
            StringBuilder sFile = new StringBuilder();
            DBConn        oConn = new DBConn();

            try
            {
                if (oConn.Open())
                {
                    oConn.BeginTransaction();

                    StringBuilder oFolder = new StringBuilder();
                    oFolder.Append(Server.MapPath(".")).Append(@"\binary\");

                    CmsContenidos oContenidos = new CmsContenidos(ref oConn);
                    if (!string.IsNullOrEmpty((sender as Button).Attributes["CodContenidoRel"].ToString()))
                    {
                        oContenidos.CodContenidoRel = (sender as Button).Attributes["CodContenidoRel"].ToString();
                    }
                    oContenidos.CodUsuario     = oIsUsuario.CodUsuario;
                    oContenidos.CodUsuarioRel  = HttpContext.Current.Session["CodUsuarioPerfil"].ToString();
                    oContenidos.TextoContenido = (string.IsNullOrEmpty((sender as Button).Attributes["CodContenidoRel"].ToString()) ? (this.FindControl("txtComent_" + oIsUsuario.CodUsuario) as TextBox).Text : (this.FindControl("txt_" + (sender as Button).Attributes["CodContenidoRel"].ToString()) as TextBox).Text);
                    oContenidos.EstContenido   = "P";
                    oContenidos.CodNodo        = pCodNodo;
                    oContenidos.DateContenido  = DateTime.Now.ToString();
                    oContenidos.PrvContendio   = "4";
                    oContenidos.IpUsuario      = Request.ServerVariables["REMOTE_ADDR"].ToString();
                    oContenidos.Accion         = "CREAR";
                    oContenidos.Put();
                    pCodContenido = oContenidos.CodContenido;

                    if (string.IsNullOrEmpty(oContenidos.Error))
                    {
                        oConn.Commit();

                        /*sFile.Append("ContenidoUsuario_").Append(oIsUsuario.CodUsuario).Append(".bin");
                         * oContenidos.CodUsuarioRel = oIsUsuario.CodUsuario;
                         * oContenidos.SerializaTblContenidoByUser(ref oConn, oFolder.ToString(), sFile.ToString());
                         *
                         * sFile.Length = 0;
                         * sFile.Append("ContenidoUsuario_").Append(HttpContext.Current.Session["CodUsuarioPerfil"].ToString()).Append(".bin");
                         * oContenidos.CodUsuario = HttpContext.Current.Session["CodUsuarioPerfil"].ToString();
                         * oContenidos.CodUsuarioRel = HttpContext.Current.Session["CodUsuarioPerfil"].ToString();
                         * oContenidos.SerializaTblContenidoByUser(ref oConn, oFolder.ToString(), sFile.ToString());*/

                        //sFile.Length = 0;
                        //sFile.Append("Contenidos.bin");
                        oContenidos.SerializaContenidos(ref oConn, oFolder.ToString(), "Contenidos.bin");

                        oLog.CodEvtLog = "002";
                        oLog.IdUsuario = oLog.IdUsuario = (!string.IsNullOrEmpty(oIsUsuario.CodUsuario) ? oIsUsuario.CodUsuario : "-1");
                        oLog.ObsLog    = "<COMENTARIOA>" + Session["CodUsuarioPerfil"].ToString();
                        //oLog.putLog();

                        SysUsuario oUsuario = new SysUsuario();
                        oUsuario.Path       = Server.MapPath(".");
                        oUsuario.CodUsuario = oIsUsuario.CodUsuario;
                        dUser = oUsuario.ClassGet();
                        if (dUser != null)
                        {
                            sNomApeUsrOrigen = dUser.NomUsuario + " " + dUser.ApeUsuario;
                        }
                        dUser = null;

                        oUsuario.CodUsuario = HttpContext.Current.Session["CodUsuarioPerfil"].ToString();
                        dUser = oUsuario.ClassGet();
                        if (dUser != null)
                        {
                            sEmailDestino = dUser.EmlUsuario;
                        }
                        dUser = null;

                        StringBuilder sAsunto     = new StringBuilder();
                        StringBuilder oHtml       = new StringBuilder();
                        DataTable     dParamEmail = oWeb.DeserializarTbl(Server.MapPath("."), "ParamEmail.bin");
                        if (dParamEmail != null)
                        {
                            if (dParamEmail.Rows.Count > 0)
                            {
                                DataRow[] oRows = dParamEmail.Select(" tipo_email = 'N' ");
                                if (oRows != null)
                                {
                                    if (oRows.Count() > 0)
                                    {
                                        sAsunto.Append(oRows[0]["asunto_email"].ToString());
                                        sAsunto.Replace("[NOMBRESITIO]", Application["SiteName"].ToString());
                                        sAsunto.Replace("[USUARIO]", sNomApeUsrOrigen);
                                        oHtml.Append(oRows[0]["cuerpo_email"].ToString());
                                        oHtml.Replace("[NOMBRE]", sNomApeUsrOrigen);
                                        oHtml.Replace("[CUERPO]", (string.IsNullOrEmpty((sender as Button).Attributes["CodContenidoRel"].ToString()) ? (this.FindControl("txtComent_" + oIsUsuario.CodUsuario) as TextBox).Text : (this.FindControl("txt_" + (sender as Button).Attributes["CodContenidoRel"].ToString()) as TextBox).Text));
                                        oHtml.Replace("[SITIO]", "http://" + Request.ServerVariables["HTTP_HOST"].ToString());
                                        oHtml.Replace("[NOMBRESITIO]", Application["SiteName"].ToString());

                                        Emailing oEmailing = new Emailing();
                                        oEmailing.FromName = Application["NameSender"].ToString();
                                        oEmailing.From     = Application["EmailSender"].ToString();
                                        oEmailing.Address  = sEmailDestino;
                                        oEmailing.Subject  = (!string.IsNullOrEmpty(sAsunto.ToString()) ? sAsunto.ToString() : sNomApeUsrOrigen + oCulture.GetResource("Mensajes", "sMessage01") + Application["SiteName"].ToString());
                                        oEmailing.Body     = oHtml;
                                        oEmailing.EmailSend();
                                    }
                                }
                                oRows = null;
                            }
                        }
                        dParamEmail = null;
                    }
                    else
                    {
                        oConn.Rollback();
                    }
                    oConn.Close();
                }
            }
            catch (Exception Ex)
            {
                if (oConn.bIsOpen)
                {
                    oConn.Rollback();
                    oConn.Close();
                }
            }
            Response.Redirect(".");
        }
コード例 #6
0
ファイル: Contenidos.aspx.cs プロジェクト: netxuz/InternetOEM
        protected void rdContenido_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "cmdEdit":
                string[] cParam = new string[2];
                cParam[0] = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["cod_contenido"].ToString();
                cParam[1] = CodNodo.Value;
                Response.Redirect(String.Format("Contenido.aspx?CodContenido={0}&CodNodo={1}", cParam));
                break;

            case "cmdDelete":
                string pCodContenido = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["cod_contenido"].ToString();
                DBConn oConn         = new DBConn();
                if (oConn.Open())
                {
                    StringBuilder sPath;
                    CmsArchivos   oArchivos = new CmsArchivos(ref oConn);
                    oArchivos.CodContenido = pCodContenido;
                    DataTable dArchivos = oArchivos.Get();
                    if (dArchivos != null)
                    {
                        if (dArchivos.Rows.Count > 0)
                        {
                            foreach (DataRow oRow in dArchivos.Rows)
                            {
                                sPath = new StringBuilder();
                                sPath.Append(Server.MapPath("."));
                                sPath.Append(@"\rps_onlineservice\");
                                sPath.Append(@"\contenido\");
                                sPath.Append(@"\contenido_");
                                sPath.Append(pCodContenido);
                                sPath.Append(@"\");
                                sPath.Append(oRow["nom_archivo"].ToString());
                                if (File.Exists(sPath.ToString()))
                                {
                                    File.Delete(sPath.ToString());
                                    oArchivos            = new CmsArchivos(ref oConn);
                                    oArchivos.CodArchivo = oRow["cod_archivo"].ToString();
                                    oArchivos.Accion     = "ELIMINAR";
                                    oArchivos.Put();
                                }
                            }
                        }
                    }
                    dArchivos = null;

                    sPath = new StringBuilder();
                    sPath.Append(Server.MapPath("."));
                    sPath.Append(@"\binary\Contenido_");
                    sPath.Append(pCodContenido);
                    sPath.Append(".bin");
                    File.Delete(sPath.ToString());

                    CmsContenidos oContenidos = new CmsContenidos(ref oConn);
                    oContenidos.CodContenido = pCodContenido;
                    oContenidos.Accion       = "ELIMINAR";
                    oContenidos.Put();
                    oConn.Close();
                }
                rdContenido.Rebind();
                break;
            }
        }
コード例 #7
0
ファイル: Contenido.aspx.cs プロジェクト: netxuz/InternetOEM
        protected void btnGrabar_Click(object sender, EventArgs e)
        {
            oIsUsuario = oWeb.GetObjUsuario();
            string        sFile;
            string        cAccion = "CREAR";
            StringBuilder sPath;
            DBConn        oConn = new DBConn();

            try
            {
                if (oConn.Open())
                {
                    oConn.BeginTransaction();

                    if (string.IsNullOrEmpty(CodContenido.Value))
                    {
                        ObjectModel oObjectModel = new ObjectModel(ref oConn);
                        CodContenido.Value = oObjectModel.getCodeKey("CMS_CONTENIDOS");
                    }
                    else
                    {
                        cAccion = "EDITAR";
                    }

                    CmsContenidos oContenidos = new CmsContenidos(ref oConn);
                    oContenidos.CodContenido     = CodContenido.Value;
                    oContenidos.CodNodo          = CodNodo.Value;
                    oContenidos.CodUsuario       = oIsUsuario.CodUsuario;
                    oContenidos.TituloContenido  = txtTitulo.Text;
                    oContenidos.TextoContenido   = rdDescripcion.Content;
                    oContenidos.DateContenido    = DateTime.Now.ToString();
                    oContenidos.EstContenido     = rdCmbEstado.SelectedValue;
                    oContenidos.DestContenido    = (chk_destacado.Checked ? "1" : "0");
                    oContenidos.IndRss           = (chk_rss.Checked ? "1" : "0");
                    oContenidos.ResumenContenido = rdResumen.Content;
                    oContenidos.IpUsuario        = oWeb.GetIpUsuario();
                    oContenidos.Accion           = cAccion;
                    oContenidos.Put();
                    CodContenido.Value = oContenidos.CodContenido;
                    if (string.IsNullOrEmpty(oContenidos.Error))
                    {
                        oConn.Commit();

                        sPath = new StringBuilder();
                        sPath.Append(Server.MapPath("."));
                        sPath.Append(@"\binary\");
                        sFile = "Contenido_" + oContenidos.CodContenido + ".bin";
                        oContenidos.SerializaContenido(ref oConn, sPath.ToString(), sFile);

                        sFile = "Contenidos.bin";
                        oContenidos.SerializaContenidos(ref oConn, sPath.ToString(), sFile);

                        sFile = "Contenido_n" + CodNodo.Value + ".bin";
                        oContenidos.SerializaTblContenidoByNodo(ref oConn, sPath.ToString(), sFile);

                        sPath = new StringBuilder();
                        sPath.Append(Server.MapPath("."));
                        sPath.Append(@"\rps_onlineservice\");
                        sPath.Append(@"\contenido\");
                        sPath.Append(@"\contenido_");
                        sPath.Append(CodContenido.Value);
                        sPath.Append(@"\");
                        if (!Directory.Exists(sPath.ToString()))
                        {
                            Directory.CreateDirectory(sPath.ToString());
                        }

                        oLog.CodEvtLog = "003";
                        oLog.IdUsuario = (!string.IsNullOrEmpty(oIsUsuario.CodUsuario)? oIsUsuario.CodUsuario : "-1");
                        oLog.ObsLog    = "<CONTENIDO>" + Session["CodUsuarioPerfil"].ToString();
                        //oLog.putLog();
                    }
                    else
                    {
                        oConn.Rollback();
                    }
                    oConn.Close();
                    btnArchivos.Visible = true;
                    idGridFile.Visible  = true;
                    rdgArchivos.Rebind();
                }
            }
            catch (Exception Ex)
            {
                if (oConn.bIsOpen)
                {
                    oConn.Rollback();
                    oConn.Close();
                }
            }
        }