protected void Button_Eliminar_Click(object sender, EventArgs e) { if (itemSeleccionado == null) { MessageBox("Seleccione un puesto para poder eliminarlo."); } else { ServicioRef_WebService_BD.WS_Base_DatosSoapClient WS = new ServicioRef_WebService_BD.WS_Base_DatosSoapClient(); DataSet ds = WS.verificarPuesto(itemSeleccionado.Value.ToString()); if (!ds.Tables[0].Rows[0][0].ToString().Equals("puesto en uso")) { ds = WS.EliminarPuesto(itemSeleccionado.Value.ToString()); if (!ds.Tables[0].Rows[0][0].Equals("error")) { MessageBox("Se ha eliminado el puesto correctamente."); CargarPuestos(); } else { MessageBox("Error al eliminar"); } } else { MessageBox("El puesto seleccionado está en uso por los colaboradores."); } } }
protected void Button_CambiarContraseña_Click(object sender, EventArgs e) { if (!TextBox_Contrasenia_1.Text.Equals("") && !TextBox_Contrasenia_2.Text.Equals("") && CheckBox_EstasSeguro.Checked) { if (TextBox_Contrasenia_1.Text.Equals(TextBox_Contrasenia_2.Text)) { ServicioRef_WebService_BD.WS_Base_DatosSoapClient WS = new ServicioRef_WebService_BD.WS_Base_DatosSoapClient(); DataSet ds = WS.ActualizarContrasenia(IniciarSesion.usuarioActual[0].ToString(), TextBox_Contrasenia_1.Text); DataTable tablaResultado = ds.Tables[0]; DataRow row = tablaResultado.Rows[0]; if (row[0].ToString().Equals("exito")) { MessageBox_2("Contraseña cambiada satisfactoriamente", "MainAdministrador.aspx"); } else { MessageBox("Error"); } } else { MessageBox("Las contraseñas ingresadas no coinciden, intente nuevamente."); } } else { MessageBox("Por favor, rellene los campos y marque la casilla de confirmación."); } }
protected void Button_Agregar_Click(object sender, EventArgs e) { if (!TextBox_Puesto.Text.Equals("")) { try { ServicioRef_WebService_BD.WS_Base_DatosSoapClient WS = new ServicioRef_WebService_BD.WS_Base_DatosSoapClient(); DataSet ds = WS.CrearPuesto(TextBox_Puesto.Text); if (!ds.Tables[0].Rows[0].ToString().Equals("error")) { MessageBox("Se ha creado el Puesto correctamente"); CargarPuestos(); } else { MessageBox("Error al crear el Puesto."); } } catch { MessageBox("Error inesperado."); } } else { MessageBox("Ingrese el nombre del puesto!."); } }
private void CargarPuestos() { ServicioRef_WebService_BD.WS_Base_DatosSoapClient asd = new ServicioRef_WebService_BD.WS_Base_DatosSoapClient(); DataSet ds = asd.ObtenerPuesto(); DataTable tablaPuestos = ds.Tables[0]; ListBox_Puestos.DataMember = ds.Tables[0].Columns[1].ColumnName; ListBox_Puestos.DataValueField = ds.Tables[0].Columns[1].ColumnName; ListBox_Puestos.DataSource = ds.Tables[0]; ListBox_Puestos.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) // Borrar { if (itemSeleccionado == null) { MessageBox("Seleccione una hora para poder eliminarla."); } else { ServicioRef_WebService_BD.WS_Base_DatosSoapClient WS = new ServicioRef_WebService_BD.WS_Base_DatosSoapClient(); valores = itemSeleccionado.Value.Split(new[] { " -> " }, StringSplitOptions.None); DataSet ds = WS.BuscarIdHoraNoLaboral(valores[0], valores[1]); DataSet ds_2 = WS.BorrarHorasNoLaborables(Int32.Parse(ds.Tables[0].Rows[0][0].ToString())); ActualizarLista(); MessageBox("Se ha borrado la hora correctamente!."); } }
private void ActualizarLista() { ListBox_HorasLibresDefinidas.Items.Clear(); ServicioRef_WebService_BD.WS_Base_DatosSoapClient asd = new ServicioRef_WebService_BD.WS_Base_DatosSoapClient(); DataSet ds = new DataSet(); ds = asd.BuscarHorasNoLaborables(); DataTable tablaHorasNoLaborales = ds.Tables[0]; foreach (DataRow row in tablaHorasNoLaborales.Rows) { ListItem item = new ListItem(); item.Value = row["HoraInicio"].ToString() + " -> " + row["HoraFinal"].ToString(); item.Text = row["HoraInicio"].ToString() + " -> " + row["HoraFinal"].ToString(); ListBox_HorasLibresDefinidas.Items.Add(item); } }
protected void Button_AgregarHoraLibre_Click(object sender, EventArgs e) { if ((TextBox_HoraInicial.Text == "" || TextBox_HoraFinal.Text == "")) { MessageBox("Complete las casillas de Hora Inicial y Hora Final para poder agregar la hora"); } else { ServicioRef_WebService_BD.WS_Base_DatosSoapClient asd = new ServicioRef_WebService_BD.WS_Base_DatosSoapClient(); DataSet ds = new DataSet(); ds = asd.BuscarUltimoMuestreo(); DataSet ds_2 = new DataSet(); ds_2 = asd.AniadirHoraNoLaboral(Int32.Parse(ds.Tables[0].Rows[0][0].ToString()), TextBox_HoraInicial.Text, TextBox_HoraFinal.Text); ActualizarLista(); MessageBox("Se ha añadido la hora correctamente!."); } }