protected void BtProf_Click(object sender, EventArgs e) { AutenticacionTableAdapter autenticacion = new AutenticacionTableAdapter(); ProfesoresTableAdapter profesores = new ProfesoresTableAdapter(); RadioButtonList1.Items.Clear(); foreach (AutenticacionRow datos in autenticacion.GetData().Rows) { if (DropDownList1.SelectedValue == "Inhabilitar") { LblTipoDato.Text = "Profesores disponibles para Inhabilitar:"; if (datos["Role"].ToString() == "profesor") { RadioButtonList1.Items.Add(new ListItem(datos["Id"].ToString() + " - " + profesores.GetProfName(datos["Id"].ToString()).ToString(), datos["Id"].ToString())); } } else if (DropDownList1.SelectedValue == "Habilitar") { LblTipoDato.Text = "Profesores disponibles para Habilitar:"; if (datos["Role"].ToString() == "profesor$") { RadioButtonList1.Items.Add(new ListItem(datos["Id"].ToString() + " - " + profesores.GetProfName(datos["Id"].ToString()).ToString(), datos["Id"].ToString())); } } } wcOpciones.Visible = false; wcLista.Visible = true; }
protected void BtGenerar_Click(object sender, EventArgs e) { string path = ""; if (DropDownList1.SelectedItem.Value == "") { return; } else if (DropDownList1.SelectedValue == TiposReporte.ListadoEst.ToString()) { path = Server.MapPath("~/ListadoEstRep.rdlc"); ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = path; EstudiantesTableAdapter estudiantesTable = new EstudiantesTableAdapter(); ReportDataSource data = new ReportDataSource("DataSet1", (DataTable)estudiantesTable.GetData()); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(data); } else if (DropDownList1.SelectedValue == TiposReporte.ListadoProf.ToString()) { path = Server.MapPath("~/ListadoProfRep.rdlc"); ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = path; ProfesoresTableAdapter profesoresTable = new ProfesoresTableAdapter(); ReportDataSource data = new ReportDataSource("DataSet1", (DataTable)profesoresTable.GetData()); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(data); } else if (DropDownList1.SelectedValue == TiposReporte.ListadoAsig.ToString()) { path = Server.MapPath("~/ListadoAsigRep.rdlc"); ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = path; AsignaturasTableAdapter asignaturasTable = new AsignaturasTableAdapter(); ReportDataSource data = new ReportDataSource("DataSet1", (DataTable)asignaturasTable.GetData()); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(data); } else if (DropDownList1.SelectedValue == TiposReporte.ListadoCal.ToString()) { path = Server.MapPath("~/ListadoCalRep.rdlc"); ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = path; ListCalEstTableAdapter listCalTblA = new ListCalEstTableAdapter(); ReportDataSource datasource = new ReportDataSource("EstRepDS", (DataTable)listCalTblA.GetData()); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource); } wcOpciones.Visible = false; wcReporte.Visible = true; }
protected void btnConfirmarProf_Click(object sender, EventArgs e) { this.lblWarnProf.Visible = false; this.lblWarnradp.Visible = false; this.lblWarnTxt1.Visible = false; ProfesoresTableAdapter profesoresTableAdapter = new ProfesoresTableAdapter(); if ((bool)ViewState["nombreprof"]) { profesoresTableAdapter.ChangeProfName(txtNombreProfesor.Text.ToString().ToUpper(), ViewState["IdEditarProf"].ToString()); } this.lblEdicionProf.Visible = true; this.btnCancelarProf.Visible = false; this.btnVolverMenuPrincipalProf.Visible = true; }
protected void Login_Authenticate(object sender, AuthenticateEventArgs e) { AutenticacionTableAdapter authTBLA = new AutenticacionTableAdapter(); AutenticacionDataTable datosAuth = authTBLA.GetDataById(this.Login1.UserName); //var entity = new Database1Entities(); //var a = entity.DatosAutenticacion(this.Login1.UserName).ToArray(); if (datosAuth.Rows.Count == 0) { //Usuario no existe } else if (datosAuth.Rows.Count == 1) { var datosUsuario = (AutenticacionRow)datosAuth.Rows[0]; if (datosUsuario["Role"].ToString() == "profesor" && datosUsuario["Clave"].ToString() == this.Login1.Password) { this.Login1.Visible = false; this.webcontentLogin.Visible = false; Session["IdProf"] = datosUsuario["Id"].ToString(); Session["Role"] = "profesor"; ProfesoresTableAdapter profesoresTableAdapter = new ProfesoresTableAdapter(); Session["NomProf"] = profesoresTableAdapter.GetProfName(Session["IdProf"].ToString()).ToString(); this.idProf.Text = Session["IdProf"].ToString(); this.nomProf.Text = Session["NomProf"].ToString(); //this.SqlDataSource1.SelectParameters["Id"].DefaultValue = datosUsuario["Id"].ToString(); //this.SqlDataSource2.SelectParameters["IdEst"].DefaultValue = Id; this.webcontentProfesor.Visible = true; } else { //Negar acceso } } else { //Negar acceso } }
public static void UpdateEnUsoEntities(string idEst, string idProf, string clave) { var estudiantes = new EstudiantesTableAdapter(); var profesores = new ProfesoresTableAdapter(); var asignaturas = new AsignaturasTableAdapter(); if (estudiantes.GetStudentsNotInUses(idEst).ToString() == "no") { estudiantes.UpdateEnUsoEst("si", idEst); } if (profesores.GetUse(idProf).ToString() == "no") { profesores.UpdateEnUsoProf("si", idProf); } if (asignaturas.GetUse(clave).ToString() == "no") { asignaturas.UpdateEnUsoAsig("si", clave); } }
protected void btnEditarProfesor_Click(object sender, EventArgs e) { this.lblWarnProf.Visible = false; this.lblWarnradp.Visible = false; this.lblWarnTxt1.Visible = false; ProfesoresTableAdapter profesoresTableAdapter = new ProfesoresTableAdapter(); if (this.radbtnProfesores.SelectedValue != "") { ViewState["IdEditarProf"] = this.radbtnProfesores.SelectedValue.Substring(0, 7); this.lblElegirDatosp.Text = $"Elija que desea cambiar del profesor {profesoresTableAdapter.GetProfName(ViewState["IdEditarProf"].ToString())}"; this.radbtnElegirDatosProf.Items.Add("Cambiar nombre"); this.profesor.Visible = false; this.ElegirCambioProf.Visible = true; } else { this.lblWarnProf.Visible = true; } }
protected void btnContinuarProf_Click(object sender, EventArgs e) { ViewState["nombreprof"] = false; ViewState["IDprof"] = false; this.lblWarnProf.Visible = false; this.lblWarnradp.Visible = false; this.lblWarnTxt1.Visible = false; ProfesoresTableAdapter profesoresTableAdapter = new ProfesoresTableAdapter(); if (this.radbtnElegirDatosProf.SelectedValue == "Cambiar nombre") { this.lblProfesor.Text = $"Cambiar profesor {profesoresTableAdapter.GetProfName(ViewState["IdEditarProf"].ToString())}"; this.ElegirCambioProf.Visible = false; this.CambiarProfesor.Visible = true; this.nombreprof.Visible = true; ViewState["nombreprof"] = true; } else { this.lblWarnradp.Visible = true; } }
protected void btnEditar_Click(object sender, EventArgs e) { this.lblWarn.Visible = false; this.lblWarnEst.Visible = false; this.lblWarnrad.Visible = false; this.lblWarnTxt0.Visible = false; if (this.radbtnEntidades.SelectedValue == "Estudiante") { this.wcEditarEntidad.Visible = false; this.estudiante.Visible = true; EstudiantesTableAdapter estudiantesTableAdapter = new EstudiantesTableAdapter(); foreach (EstudiantesRow row in estudiantesTableAdapter.GetData()) { radbtnEstudiantes.Items.Add(new ListItem(row["IdEst"].ToString() + " - " + row["NombreEst"].ToString(), row["IdEst"].ToString())); } } else if (this.radbtnEntidades.SelectedValue == "Profesor") { this.wcEditarEntidad.Visible = false; this.profesor.Visible = true; ProfesoresTableAdapter profesoresTableAdapter = new ProfesoresTableAdapter(); foreach (ProfesoresRow row in profesoresTableAdapter.GetData()) { radbtnProfesores.Items.Add(new ListItem(row["IdProf"].ToString() + " - " + row["NombreProf"].ToString(), row["IdProf"].ToString())); } } else if (this.radbtnEntidades.SelectedValue == "Asignatura") { this.wcEditarEntidad.Visible = false; this.asignatura.Visible = true; AsignaturasTableAdapter asignaturasTableAdapter = new AsignaturasTableAdapter(); foreach (AsignaturasRow row in asignaturasTableAdapter.GetData()) { radbtnAsignaturas.Items.Add(new ListItem(row["Clave"].ToString() + " - " + row["NombreAsig"].ToString(), row["Clave"].ToString())); } } else if (this.radbtnEntidades.SelectedValue == "Calificacion") { ListCalEstTableAdapter calEstTableAdapter = new ListCalEstTableAdapter(); foreach (ListCalEstRow row in calEstTableAdapter.GetData().Rows) { RBLcalif.Items.Add(new ListItem( "Estudiante: " + row["IdEst"].ToString() + " - " + row["NombreEst"].ToString() + " / Asignatura: " + row["Clave"].ToString() + " - " + row["NombreAsig"].ToString() + " / Profesor: " + row["IdProf"].ToString() + " - " + row["NombreProf"].ToString() + " / Calificacion: " + row["Valor"].ToString() + " - " + row["Alpha"].ToString(), row["IdCal"].ToString())); } this.wcEditarEntidad.Visible = false; this.Calificacion.Visible = true; } else { this.lblWarn.Visible = true; } }
protected void btnSeguroAgregar_Click(object sender, EventArgs e) { this.btnVolverEditar.Visible = false; this.btnSeguroAgregar.Visible = false; this.btnVolverMenuPrincipal.Visible = true; this.lblEntidadAgregada.Visible = true; if ((bool)ViewState["agrEst"] == true) { //this.btnAgregar.Visible = true; estudiantes = new EstudiantesTableAdapter(); autenticacion = new AutenticacionTableAdapter(); if (nombreEst != null && contraEst != null) { string id = dataUpdate.GetID(); //this.btnAgregar.Visible = true; estudiantes.Insert(id, nombreEst.Text.ToUpper(), ListCarreras.SelectedValue, "0.00", 0, "Sin Honor", 0); autenticacion.Insert(id, contraEst.Text, null, "estudiante"); lblEntidadAgregada.Text = "Estudiante agregado"; } else { lblEntidadAgregada.Text = "No se ha podido agregar el estudiante"; } //divEst.Visible = false; //div1.Visible = true; } else if ((bool)ViewState["agrProf"] == true) { profesores = new ProfesoresTableAdapter(); autenticacion = new AutenticacionTableAdapter(); if (nombreProf != null && contraProf != null) { string id = dataUpdate.GetID(); //this.btnAgregar.Visible = true; profesores.Insert(id, nombreProf.Text.ToUpper()); autenticacion.Insert(id, contraProf.Text, null, "profesor"); } else { lblEntidadAgregada.Text = "No se ha podido agregar el profesor"; } //divProf.Visible = false; //div1.Visible = true; } else if ((bool)ViewState["agrAsig"] == true) { asignaturas = new AsignaturasTableAdapter(); if (claveAsig != null && nombreAsig != null && creditosAsig != null && Regex.IsMatch(creditosAsig.Text, @"^\d+$")) { //this.btnAgregar.Visible = true; asignaturas.Insert(claveAsig.Text.ToUpper(), nombreAsig.Text.ToUpper(), int.Parse(creditosAsig.Text)); } else { lblEntidadAgregada.Text = "No se ha podido agregar la asignatura"; } //lblError.Text = "No se ha podido agregar la asignatura"; //lblError.Visible = true; //btnVolverEditar.Visible = true; //divAsig.Visible = false; //div1.Visible = true; } }