protected void btnGrabar_Click(object sender, EventArgs e) { int iCount = 0; string cPath = Server.MapPath(".") + @"\binary\"; DBConn oConn = new DBConn(); if (oConn.Open()) { CmsNodos oNodos = new CmsNodos(ref oConn); foreach (RadListBoxItem oItem in rdListNodos.Items) { iCount = oItem.Index; iCount++; oNodos.CodNodo = oItem.Value.ToString(); oNodos.OrdNodo = iCount.ToString(); oNodos.Accion = "EDITAR"; oNodos.Put(); if (string.IsNullOrEmpty(oNodos.Error)) { oNodos.SerializaNodo(ref oConn, cPath, "Nodo_" + oNodos.CodNodo + ".bin"); oNodos.SerializaTblNodo(ref oConn, cPath, "Nodos.bin"); } } oConn.Close(); } }
protected void rdTree_ContextMenuItemClick(object sender, Telerik.Web.UI.RadTreeViewContextMenuEventArgs e) { StringBuilder cPath; StringBuilder cUrl = new StringBuilder(); switch (e.MenuItem.Value) { case "CREAR": cUrl.Append("Nodo.aspx?CodNodoRel="); cUrl.Append(e.Node.Value); rpnNavigate.ContentUrl = cUrl.ToString(); break; case "EDITAR": cUrl.Append("Nodo.aspx?CodNodo="); cUrl.Append(e.Node.Value); rpnNavigate.ContentUrl = cUrl.ToString(); break; case "ORDENAR": cUrl.Append("NodoOrden.aspx?CodNodo="); cUrl.Append(e.Node.Value); rpnNavigate.ContentUrl = cUrl.ToString(); break; case "ELIMINAR": DBConn oConn = new DBConn(); if (oConn.Open()) { cPath = new StringBuilder(); cPath.Append(Server.MapPath(".")).Append(@"\binary\Nodo_").Append(e.Node.Value).Append(".bin"); if (File.Exists(cPath.ToString())) { File.Delete(cPath.ToString()); } CmsNodos oNodos = new CmsNodos(ref oConn); oNodos.Accion = "ELIMINAR"; oNodos.CodNodo = e.Node.Value; oNodos.Put(); cPath.Length = 0; cPath.Append(Server.MapPath(".")).Append(@"\binary\"); oNodos.SerializaTblNodo(ref oConn, cPath.ToString(), "Nodos.bin"); e.Node.Remove(); } break; case "CONTENIDOS": cUrl.Append("Contenidos.aspx?CodNodo="); cUrl.Append(e.Node.Value); rpnNavigate.ContentUrl = cUrl.ToString(); break; case "CREARCONTENIDO": cUrl.Append("Contenido.aspx?CodNodo="); cUrl.Append(e.Node.Value); rpnNavigate.ContentUrl = cUrl.ToString(); break; } }
protected void btnGrabar_Click(object sender, EventArgs e) { oIsUsuario = oWeb.GetObjUsuario(); DBConn oConn = new DBConn(); if (oConn.Open()) { int iCount = int.Parse((string.IsNullOrEmpty(OrdNodo.Value) ? "0" : OrdNodo.Value)); CmsNodos oNodos = new CmsNodos(ref oConn); if (string.IsNullOrEmpty(OrdNodo.Value)) { DataTable dNodo = oNodos.Get(); iCount = (dNodo == null ? 0 : dNodo.Rows.Count); iCount++; } oConn.BeginTransaction(); oNodos.CodNodo = CodNodo.Value; oNodos.CodNodoRel = (string.IsNullOrEmpty(CodNodoRel.Value)? null : CodNodoRel.Value); oNodos.CodUsuario = oIsUsuario.CodUsuario; oNodos.CodTemplate = rdCmbTemplate.SelectedValue; oNodos.TituloNodo = txtTitulo.Text; oNodos.TextoNodo = textDescripcion.Text; oNodos.DateNodo = DateTime.Now.ToString(); oNodos.EstNodo = rdCmbEstado.SelectedValue; oNodos.PrvNodo = (chk_privado.Checked ? "1" : "0"); oNodos.IniNodo = (chk_inicio.Checked ? "V" : "N"); oNodos.PfNodo = (chk_perfil.Checked ? "V" : "N"); oNodos.ContNodo = (chk_contenido.Checked ? "V" : "N"); oNodos.TitleHeaderNodo = txtTitHeader.Text; oNodos.KeywordsNodo = txtKeyWords.Text; oNodos.OrdNodo = iCount.ToString(); oNodos.IniAsocUsrNodo = (chk_asocusrperfil.Checked ? "V" : "N"); oNodos.IndDesplUsrClient = (chk_PrivUsrClient.Checked ? "V" : "N"); oNodos.IndOlvClaveNodo = (chk_olvclave.Checked ? "V" : "N"); oNodos.IndRstClaveNodo = (chk_rstclave.Checked ? "V" : "N"); oNodos.IndLoginNodo = (chk_login.Checked ? "V" : "N"); oNodos.IndDesplUsrSite = (chk_PrivUsrSite.Checked ? "V" : "N"); oNodos.IndPoltSecureNodo = (chk_poltsecure.Checked ? "V" : "N"); oNodos.IndTermUseNodo = (chk_termuse.Checked ? "V" : "N"); oNodos.IndRegistrateNodo = (chk_registrate.Checked ? "V" : "N"); oNodos.IndPagExitoNodo = (chk_pagexito.Checked ? "V" : "N"); oNodos.IndPhotoNodo = (chk_pagefotos.Checked ? "V" : "N"); oNodos.IndIniNodoPhone = (chk_ini_nod_phone.Checked ? "V" : "N"); oNodos.IndPfNodoPhone = (chk_prf_nod_phone.Checked ? "V" : "N"); oNodos.IndContNodoPhone = (chk_cont_nod_phone.Checked ? "V" : "N"); oNodos.Accion = (string.IsNullOrEmpty(CodNodo.Value) ? "CREAR" : "EDITAR"); oNodos.Put(); CodNodo.Value = oNodos.CodNodo; if (string.IsNullOrEmpty(oNodos.Error)) { oConn.Commit(); string cPath = Server.MapPath(".") + @"\binary\"; oNodos.SerializaNodo(ref oConn, cPath, "Nodo_" + oNodos.CodNodo + ".bin"); oNodos.SerializaTblNodo(ref oConn, cPath, "Nodos.bin"); StringBuilder Script = new StringBuilder(); if (string.IsNullOrEmpty(sAccion.Value)) { if (!Page.ClientScript.IsClientScriptBlockRegistered("jsNewNodo")) { Script.Append("window.top.AddNode('"); Script.Append((CodNodoRel.Value == string.Empty ? "0" : CodNodoRel.Value)); Script.Append("', '"); Script.Append(CodNodo.Value); Script.Append("', '"); Script.Append(txtTitulo.Text); Script.Append("');"); Page.ClientScript.RegisterStartupScript(this.GetType(), "jsNewNodo", Script.ToString(), true); } } else { if (!Page.ClientScript.IsClientScriptBlockRegistered("jsChangeName")) { Script.Append("window.top.ChangeName('"); Script.Append(CodNodo.Value); Script.Append("', '"); Script.Append(txtTitulo.Text); Script.Append("');"); Page.ClientScript.RegisterStartupScript(this.GetType(), "jsChangeName", Script.ToString(), true); } } } else { oConn.Rollback(); } oConn.Close(); } }