/// <summary> /// /// </summary> private void EliminarElemento() { try { ServiciosCD40.Top n = new ServiciosCD40.Top(); n.IdSistema = (string)Session["idsistema"]; n.IdTop = (string)Session["elemento"]; if (ServicioCD40.DeleteSQL(n) < 0) { logDebugView.Warn("(TOP-EliminarElemento): No se ha podido eliminar la TOP"); } cMsg.alert((string)GetGlobalResourceObject("Espaniol", "ElementoEliminado")); } catch (Exception ex) { logDebugView.Error(string.Format("TOP-EliminarElemento. Error al eliminar el terminal idTop={0} sistema={0} ", (string)Session["idsistema"], (string)Session["elemento"]), ex); } MuestraDatos(DameDatos()); }
/// <summary> /// /// </summary> /// <returns></returns> private ServiciosCD40.Tablas[] DameDatos() { try { ServiciosCD40.Top t = new ServiciosCD40.Top(); Configuration config = WebConfigurationManager.OpenWebConfiguration("~"); KeyValueConfigurationElement s = config.AppSettings.Settings["Sistema"]; t.IdSistema = s.Value; Session["idsistema"] = s.Value; ServiciosCD40.Tablas[] d = ServicioCD40.ListSelectSQL(t); datos = d; return(d); } catch (Exception ex) { logDebugView.Error("(TOP-DameDatos): ", ex); } return(null); }
protected void Page_Load(object sender, EventArgs e) { //Si no está autentificado se redirige a la pagina de login if (Context.Request.IsAuthenticated) { // retrieve user's identity from httpcontext user FormsIdentity ident = (FormsIdentity)Context.User.Identity; string perfil = ident.Ticket.UserData; //A esta pantalla tienen accesos todos los usuarios menos los operadores if (string.Compare(perfil, "0") == 0) { Response.Redirect("~/Login.aspx", false); return; } } else { Response.Redirect("~/Login.aspx", false); return; } if (!IsPostBack) { StringBuilder strConsulta = new StringBuilder(); string strIdSistema = string.Empty; strVersion = strNucleo = string.Empty; dtst = null; dtsPasarelas = null; dtsEquiposExternos = null; /* * CRViewerInf.DisplayToolbar = true; * CRViewerInf.EnableParameterPrompt = false; * CRViewerInf.EnableDatabaseLogonPrompt = false; * CRViewerInf.Visible = false; * CRViewerInf.HasToggleGroupTreeButton = false; * CRViewerInf.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None; * CRViewerInf.HasToggleParameterPanelButton = false; * CRViewerInf.HasDrilldownTabs = false; //Se oculta la pestaña pagina principal * CRViewerInf.HasExportButton = false; //Se ocultan las opciones de exportacion de la Toolbar * CRViewerInf.HasCrystalLogo = false; //Se oculta el logo de Crystal Reports * CRViewerInf.HasPrintButton = true; //Se oculta la opción de imprimir */ string strIdioma = System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName; ServiciosCD40.ServiciosCD40 Servicio = new ServiciosCD40.ServiciosCD40(); //Se obtiene el valor del parámetro Sistema, configurado en el fichero Web.config Configuration config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~"); KeyValueConfigurationElement objConf = config.AppSettings.Settings[CONF_KEY_SISTEMA]; strIdSistema = objConf.Value; bConSafta = false; //Se obtiene el parametro que indica si se debe o no visualizar la posición Sacta objConf = config.AppSettings.Settings[CONF_KEY_CON_SACTA]; if ((objConf != null) && (!string.IsNullOrEmpty(objConf.Value) && string.Compare(objConf.Value, "SI", true) == 0)) { //El sistema está configurado con el sistema SACTA bConSafta = true; } //Obtenemos el Núcleo, que se pasa como parámetro en todos los informes ServiciosCD40.Nucleos tabNucleo = new ServiciosCD40.Nucleos(); tabNucleo.IdSistema = strIdSistema; ServiciosCD40.Tablas[] dTabNucleos = Servicio.ListSelectSQL(tabNucleo); if (null != dTabNucleos && dTabNucleos.Length > 0) { //Nos quedamos con el primer registro, porque en el sistema sólo se puede definir un nucleo strNucleo = ((ServiciosCD40.Nucleos)dTabNucleos[0]).IdNucleo; dTabNucleos = null; //Liberamos la memoria } //Informe de configuración de elementos físicos //sFicheroReport = Server.MapPath(CR_INF_HW_ELEMENTS); sFicheroReport = Server.MapPath("~/Informes/" + CR_INF_HW_ELEMENTS); //Se obtienen los datos a visualizar en cada subinforme //Subinforme de puestos de operador ServiciosCD40.Top tabPuestosOp = new ServiciosCD40.Top(); tabPuestosOp.IdSistema = strIdSistema; dtst = Servicio.DataSetSelectSQL(tabPuestosOp); //Subinforme pasarelas strConsulta.Append("SELECT tifx.IdSistema, tifx.IdTIFX, tifx.ModoArranque, tifx.ModoSincronizacion, tifx.Master, "); strConsulta.Append("tifx.SNMPPortLocal, tifx.SNMPPortRemoto, tifx.SNMPTraps, tifx.SIPPortLocal, "); strConsulta.Append("tifx.TimeSupervision, tifx.IpRed1, tifx.IpRed2, tifx.Grabador1, tifx.Grabador2, "); strConsulta.Append("gwactivas.IpRed AS ipComunicaciones, recursos.IdRecurso, recursos.TipoRecurso, "); strConsulta.Append(" recursos.idEquipos, recursos.Tipo, recursos.Interface, recursos.SlotPasarela, "); strConsulta.Append("recursos.NumDispositivoSlot, recursos.ServidorSIP, recursos.Diffserv, tifx.iSupervLanGW, tifx.itmmaxSupervLanGW "); strConsulta.Append("FROM tifx LEFT OUTER JOIN recursos ON tifx.IdSistema = recursos.IdSistema "); strConsulta.Append("AND tifx.IdTIFX = recursos.IdTIFX LEFT OUTER JOIN "); strConsulta.Append("gwactivas ON tifx.IdSistema = gwactivas.IdSistema AND tifx.IdTIFX = gwactivas.IdTifx "); strConsulta.AppendFormat("AND tifx.IdSistema='{0}'", strIdSistema); dtsPasarelas = Servicio.ObtenerDataSet(strConsulta.ToString()); strConsulta.Clear(); //Subinforme Equipos externos strConsulta.Append("SELECT IdSistema, idEquipos, IpRed1, IpRed2, TipoEquipo, Interno, SipPort, IpRed3,"); strConsulta.Append("SrvPresenciaIpRed1, SrvPresenciaIpRed2, SrvPresenciaIpRed3 FROM equiposeu "); strConsulta.Append("WHERE (Min!=-1 AND MAX!=-1)"); dtsEquiposExternos = Servicio.ObtenerDataSet(strConsulta.ToString()); if (System.IO.File.Exists(sFicheroReport)) { CRSourceInf.Report.FileName = sFicheroReport; CRSourceInf.ReportDocument.Load(sFicheroReport); TraducirInforme(CRSourceInf.ReportDocument, strIdioma); //Asociamos el datasource if (null != dtst && dtst.Tables.Count > 0) { try { if (null != GetLocalResourceObject("LB_INFORME_ELEMENTOS_FISICOS_SUMMARY")) { CRSourceInf.ReportDocument.SummaryInfo.ReportTitle = GetLocalResourceObject("LB_INFORME_ELEMENTOS_FISICOS_SUMMARY").ToString(); } else { CRSourceInf.ReportDocument.SummaryInfo.ReportTitle = "Informe de Configuración de Elementos Físicos"; } //El informe principal tiene tres subreports //Le asignamos los datos if (CRSourceInf.ReportDocument.Subreports.Count > 0) { for (int i = 0; i < CRSourceInf.ReportDocument.Subreports.Count; i++) { if (CRSourceInf.ReportDocument.Subreports[i] != null) { switch (CRSourceInf.ReportDocument.Subreports[i].Name.ToString()) { case CR_INF_HW_ELEMENTS_SUBINF_TO: TraducirInforme(CRSourceInf.ReportDocument.Subreports[i], strIdioma); if (dtst != null && dtst.Tables.Count > 0) { CRSourceInf.ReportDocument.Subreports[i].SetDataSource(dtst.Tables[0]); } break; case CR_INF_HW_ELEMENTS_SUBINF_PASARELAS: TraducirInforme(CRSourceInf.ReportDocument.Subreports[i], strIdioma); if (dtsPasarelas != null && dtsPasarelas.Tables.Count > 0) { dtsPasarelas.Tables[0].TableName = "Pasarelas"; CRSourceInf.ReportDocument.Subreports[i].SetDataSource(dtsPasarelas.Tables[0]); } break; case CR_INF_HW_ELEMENTS_SUBINF_EQUIPOS_EXT: TraducirInforme(CRSourceInf.ReportDocument.Subreports[i], strIdioma); if (dtsEquiposExternos != null && dtsEquiposExternos.Tables.Count > 0) { dtsEquiposExternos.Tables[0].TableName = "equiposeu"; CRSourceInf.ReportDocument.Subreports[i].SetDataSource(dtsEquiposExternos.Tables[0]); } break; default: break; } } } } //Se leen el recurso Version LB_VERSION if (null != GetGlobalResourceObject("Espaniol", "LB_VERSION")) { strVersion = GetGlobalResourceObject("Espaniol", "LB_VERSION").ToString(); } //Se pasan los parámetros al informe. Los parámetros se deben pasar siempre después de configurar //los data Sources. Si no se hace así, la ejecución del report falla, indicando que le faltan parámetros CRSourceInf.ReportDocument.SetParameterValue("p_version", strVersion.ToString()); CRSourceInf.ReportDocument.SetParameterValue("p_idEmplazamiento", strNucleo.ToString()); CRSourceInf.ReportDocument.SetParameterValue("p_bSAFTA", bConSafta); //CRViewerInf.DataBind(); //CRViewerInf.Visible = true; VisualizaInformePdf(); } catch (System.Threading.ThreadAbortException) { //ThreadException can happen for internale Response implementation if (dtst != null) { dtst.Clear(); } if (dtsPasarelas != null) { dtsPasarelas.Clear(); } if (dtsEquiposExternos != null) { dtsEquiposExternos.Clear(); } } catch (Exception ex) { logDebugView.Error(string.Format("Error al ejecutar el informe {0}. Error:{1} ", sFicheroReport, ex.Message.ToString())); } } } else { logDebugView.Error(string.Format("Error al ejecutar el informe {0}: el fichero no existe ", sFicheroReport)); DeshabilitaBotonesExportar(); } } }
private bool bExistenRecursosAsignados(string strNombreEquipoExt, string strTipoEquipoExt) { //MVO 26/06/2017: se verifica si el equipo externo está asignado a algún recurso (radio o telefonía) o pasarela y terminal de operador (grabador), en función del tipo // Si el equipo es de tipo grabador, el grabador puede estar configurado en alguna pasarela o terminal de operador como grabador 1 o grabador 2 // Si el equipo es de tipo telefonía o radio, el equipo puede estar asignado a un recurso de telefónía o radio respectivamente. ServiciosCD40.Tablas[] t = null; bool bExiste = false; if (!string.IsNullOrEmpty(strNombreEquipoExt) && !string.IsNullOrEmpty(strTipoEquipoExt)) { switch (strTipoEquipoExt) { case TIPO_EQUIPO_GRABADOR: // Busca alguna pasarela que tenga este grabador configurado como Grabador1 o Grabador2 ServiciosCD40.TifX r = new ServiciosCD40.TifX(); r.IdSistema = (string)Session["idsistema"]; r.Grabador1 = strNombreEquipoExt; t = ServicioAccesoABaseDeDatos.ListSelectSQL(r); if (t != null && t.Length > 0) { // No se pueden borrar el equipo que está asignado a una pasarela bExiste = true; } else { // Busca alguna top (terminal de operador) que tenga este grabador configurado como Grabador1 o Grabador2 ServiciosCD40.Top tops = new ServiciosCD40.Top(); tops.IdSistema = (string)Session["idsistema"]; tops.Grabador1 = strNombreEquipoExt; t = ServicioAccesoABaseDeDatos.ListSelectSQL(tops); if (t != null && t.Length > 0) { // No se pueden borrar el equipo que está asignado a un terminal de operador bExiste = true; } } break; case TIPO_EQUIPO_RADIO: case TIPO_EQUIPO_TLF: //Se comprueba si el equipo radio está asociado a un recurso radio o de telefonía ServiciosCD40.Recursos objRec = new ServiciosCD40.Recursos(); objRec.IdSistema = (string)Session["idsistema"]; objRec.IdEquipo = strNombreEquipoExt; t = ServicioAccesoABaseDeDatos.ListSelectSQL(objRec); if (t != null && t.Length > 0) { // No se pueden borrar equipos externos de tipo radio o telefonía que están asignados a recursos bExiste = true; } break; default: bExiste = false; break; } } return(bExiste); }
/// <summary> /// /// </summary> private void GuardarCambios(string strSistema) { try { LblIp1Existente.Visible = LblIp2Existente.Visible = false; ServiciosCD40.Top n = new ServiciosCD40.Top(); n.IdSistema = strSistema; if (!Modificando) //TOP nueva { n.IdTop = TxtIdTop.Text; } else { n.IdTop = ListBox1.SelectedValue; } NewItem = n.IdTop; n.PosicionSacta = UInt16.Parse(DListPosicion.SelectedValue); n.IpRed1 = TxtIP1.Text; //Si la direccion IP2 no se informa (está oculta), se configura con el valor de la IP1, ya que la IP2 era requerida if (string.IsNullOrEmpty(TxtIP2.Text) || false == TxtIP2.Visible) { n.IpRed2 = TxtIP1.Text; //TxtIP2.Text=TxtIP1.Text; } else { n.IpRed2 = TxtIP2.Text; } n.ModoArranque = DListArranque.SelectedValue; // Comprobar que ninguna de las IPs existen en el sistema. if (ServicioCD40.ExisteIP(n.IdSistema, n.IpRed1, n.IdTop)) { LblIp1Existente.Visible = true; return; } else if (false == n.IpRed1.Equals(n.IpRed2)) { //Si las 2 direcciones IP no son iguales, se comprueba si la segunda dirección IP no está asignada a otro elemento if (ServicioCD40.ExisteIP(n.IdSistema, n.IpRed2, n.IdTop)) { LblIp2Existente.Visible = true; return; } } n.Grabador1 = DDLRecorder1.SelectedIndex != 0 ? DDLRecorder1.SelectedValue : null; n.Grabador2 = DDLRecorder2.SelectedIndex != 0 ? DDLRecorder2.SelectedValue : null; if (!Modificando) //TOP nueva { if (ServicioCD40.InsertSQL(n) < 0) { logDebugView.Warn("(TOP-GuardarCambios): No se ha podido guardar la TOP."); } ActualizaWebPadre(true); } else { if (ServicioCD40.UpdateSQL(n) < 0) { logDebugView.Warn("(TOP-GuardarCambios): No se ha podido actualizar la TOP."); } IndexListBox1 = ListBox1.SelectedIndex; } Modificando = false; } catch (Exception ex) { logDebugView.Error("(TOP-GuardarCambios): ", ex); } EsconderMenu(); ListBox1.Enabled = true; BtNuevo.Visible = PermisoSegunPerfil; BtEliminar.Visible = BtModificar.Visible = PermisoSegunPerfil && ListBox1.Items.Count > 0; MuestraDatos(DameDatos()); }