private void CargaDDLGrabadores() { Configuration config = WebConfigurationManager.OpenWebConfiguration("~"); KeyValueConfigurationElement s = config.AppSettings.Settings["Sistema"]; Session["idsistema"] = s.Value; ServiciosCD40.EquiposEU tifx = new ServiciosCD40.EquiposEU(); string strFirstItemRecorder = string.Empty; strFirstItemRecorder = GetLocalResourceObject("DDLRecorderItem1").ToString(); tifx.IdSistema = s.Value; tifx.TipoEquipo = (uint)ServiciosCD40.Tipo_Elemento_HW.TEH_GRABADOR; DDLRecorder1.Items.Clear(); //Se añade el item 0 que indica que no se selecciona ningún grabador. //DDLRecorder1.Items.Add("< Ninguno >"); DDLRecorder1.Items.Add(strFirstItemRecorder); DDLRecorder1.SelectedIndex = 0; DDLRecorder1.DataSource = ServicioCD40.DataSetSelectSQL(tifx); DDLRecorder1.DataTextField = "IdEquipos"; DDLRecorder1.DataValueField = "IdEquipos"; DDLRecorder1.DataBind(); DDLRecorder2.Items.Clear(); //Se añade en el item 0, DDLRecorder2.Items.Add("< Ninguno >"); DDLRecorder2.Items.Add(strFirstItemRecorder); DDLRecorder2.SelectedIndex = 0; DDLRecorder2.DataSource = ServicioCD40.DataSetSelectSQL(tifx); DDLRecorder2.DataTextField = "IdEquipos"; DDLRecorder2.DataValueField = "IdEquipos"; DDLRecorder2.DataBind(); }
private ServiciosCD40.Tablas[] DameDatos() { try { ServiciosCD40.EquiposEU t = new ServiciosCD40.EquiposEU(); Configuration config = WebConfigurationManager.OpenWebConfiguration("~"); KeyValueConfigurationElement s = config.AppSettings.Settings["Sistema"]; t.IdSistema = s.Value; Session["idsistema"] = s.Value; ServiciosCD40.Tablas[] d = ServicioAccesoABaseDeDatos.ListSelectSQL(t); datos = d; return(d); } catch (Exception ex) { logDebugView.Error("(EQUIPOSEU-DameDatos): ", ex); } return(null); }
private void EliminarElemento() { try { ServiciosCD40.EquiposEU n = new ServiciosCD40.EquiposEU(); n.IdSistema = (string)Session["idsistema"]; n.IdEquipos = (string)Session["elemento"]; if (ServicioAccesoABaseDeDatos.DeleteSQL(n) < 0) { logDebugView.Warn("(EQUIPOSEU-EliminarElemento): No se ha podido eliminar la EQUIPOSEU."); } else { cMsg.alert((string)GetGlobalResourceObject("Espaniol", "ElementoEliminado")); } } catch (Exception ex) { logDebugView.Error("Error al eliminar equipo externo(EQUIPOSEU-EliminarElemento): ", ex); } MuestraDatos(DameDatos()); }
private void GuardarCambios() { try { string strSistema = (string)Session["idsistema"]; //MVO: el número de grabadores se comprueba al guardar los cambios, tanto si es un alta como una modificación if (DDLTipoEquipo.SelectedValue == TIPO_EQUIPO_GRABADOR /* 5- Grabador*/ && (NumGrabadores > MAX_GRABADORES || bNumGrabadoresExcedido)) { cMsg.alert((string)GetGlobalResourceObject("Espaniol", "MaximoNumeroGrabadores")); return; } ServiciosCD40.EquiposEU n = new ServiciosCD40.EquiposEU(); n.IdSistema = strSistema; if (!TBIdEquipo.ReadOnly) //Nuevo Equipo Externo { //Se comprueba que no exista otro equipo EU con el mismos identificador o Central ATS en la tabla de encaminamientos //Porque en la tabla equiposEu, se almacenan los equipos externos y los identificadores de la central ATS //que tienen configurada una Central IP if (!bExisteEquipoExterno(n.IdSistema, TBIdEquipo.Text)) { n.IdEquipos = TBIdEquipo.Text; } else { //Ya existe otro equipo externo o Central ATS con el mismo identificador cMsg.alert((string)GetGlobalResourceObject("Espaniol", "ErrorEU_Existente")); return; } } else { n.IdEquipos = ListBox1.SelectedValue; } //Si el equipo externo es de tipo grabador, se comprueba que no exista otro equipo externo grabador con la misma dirección IP if (DDLTipoEquipo.SelectedValue == TIPO_EQUIPO_GRABADOR) { if (ServicioAccesoABaseDeDatos.ExisteGrabadorMismaIP(strSistema, TxtIP1.Text, n.IdEquipos)) { cMsg.alert(string.Format((string)GetGlobalResourceObject("Espaniol", "AvisoConfGrabadorMismaIp"), TxtIP1.Text)); return; } else if ((string.Compare(TxtIP1.Text, TxtIP2.Text) != 0) && ServicioAccesoABaseDeDatos.ExisteGrabadorMismaIP(strSistema, TxtIP2.Text, n.IdEquipos)) { cMsg.alert(string.Format((string)GetGlobalResourceObject("Espaniol", "AvisoConfGrabadorMismaIp"), TxtIP2.Text)); return; } } NewItem = n.IdEquipos; n.IpRed1 = TxtIP1.Text; n.IpRed2 = TxtIP2.Text; n.TipoEquipo = Convert.ToUInt32(DDLTipoEquipo.SelectedValue); n.Interno = false; // Siempre es false, excepto para el caso del equipo externo asociado a la Central ATS propia n.SipPort = DDLTipoEquipo.SelectedValue == TIPO_EQUIPO_GRABADOR /* Grabador */ ? RTSP_PORT : Convert.ToInt32(TBSipPort.Text); // Comprobar que ninguna de las IPs existen ya dadas de alta en el sistema. /* SE ELIMINA ESTA RESTRICCIÓN PARA PODER CONFIGURAR EQUIPOS VINCULADOS A UN PROXY */ /* * if (ServicioAccesoABaseDeDatos.ExisteIP(n.IdSistema, n.IpRed1, n.IdEquipos)) * { * LblIp1Existente.Visible = true; * return; * } * else if (ServicioAccesoABaseDeDatos.ExisteIP(n.IdSistema, n.IpRed2, n.IdEquipos)) * { * LblIp2Existente.Visible = true; * return; * } */ if (!TBIdEquipo.ReadOnly) //Equipo nuevo { if (ServicioAccesoABaseDeDatos.InsertSQL(n) < 0) { logDebugView.Warn("(EQUIPOSEU-GuardarCambios): No se ha podido guardar la EQUIPOSEU"); } } else { if (ServicioAccesoABaseDeDatos.UpdateSQL(n) < 0) { logDebugView.Warn("(EQUIPOSEU-GuardarCambios): No se ha podido actualizar la EQUIPOSEU"); } } } catch (Exception ex) { logDebugView.Error("(EQUIPOSEU-GuardarCambios): ", ex); } EsconderMenu(); ListBox1.Enabled = true; BtNuevo.Visible = PermisoSegunPerfil; BtEliminar.Visible = BtModificar.Visible = false; EsconderValidacion(); MuestraDatos(DameDatos()); }