protected void Page_Load(object sender, EventArgs e) { btnAceptar.Attributes["onclick"] = "return Confirmacion();"; Label11.Text = Session["Uni"].ToString(); Label12.Text = Session["Cedula"].ToString(); Label16.Text = DateTime.Now.ToShortDateString(); GridView2.Visible = false; LinkButton1.Visible = false; try { DataSet1TableAdapters.ClasesTableAdapter adapter = new DataSet1TableAdapters.ClasesTableAdapter(); DataSet1TableAdapters.Clientes1TableAdapter adapter2 = new DataSet1TableAdapters.Clientes1TableAdapter(); Label13.Text = cbxClase.SelectedValue; DataRow row1 = adapter.ObtenerDatos(Label11.Text, Convert.ToInt32(cbxClase.SelectedValue)).Rows[0]; Label15.Text = row1["Dia"].ToString(); Label20.Text = cbxClase.SelectedItem.ToString(); Label24.Text = row1["Hora"].ToString(); DataRow row2 = adapter2.GetData(cbxAlumna.SelectedValue).Rows[0]; Label18.Text = row1["Nivel"].ToString(); } catch(Exception ex) { } }
protected void Button1_Click(object sender, EventArgs e) { DataSet1TableAdapters.ClasesTableAdapter adapter = new DataSet1TableAdapters.ClasesTableAdapter(); if (!fecha.Equals("")) { try { string[] fechas = new string[100]; fechas = Lab.Split(','); foreach (string f in fechas) if (!f.Equals("")) adapter.Insert(txtNombre.Text, txtCupos.Text, f, cbxHora.SelectedValue.ToString(), "Habilitada", Session["Uni"].ToString(),0); GridView1.DataBind(); } catch (System.Data.SqlClient.SqlException ex) { lblEstado.Text = "Ya existe una clase este dia a la misma hora"; lblEstado.ForeColor = System.Drawing.Color.Red; } txtCupos.Text = ""; txtNombre.Text = ""; cbxHora.ClearSelection(); calendario.SelectedDates.Clear(); } else { lblEstado.Text = "No ha selecionado una fecha en el calendario"; lblEstado.ForeColor = System.Drawing.Color.Red; } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { Label13.Text = cbxClase.SelectedValue; DataSet1TableAdapters.ClasesTableAdapter adapter = new DataSet1TableAdapters.ClasesTableAdapter(); DataRow row1 = adapter.ObtenerDatos(Label11.Text, Convert.ToInt32(cbxClase.SelectedValue)).Rows[0]; Label15.Text = row1["Dia"].ToString(); Label20.Text = cbxClase.SelectedItem.ToString(); Label24.Text = row1["Hora"].ToString(); }
protected void Button1_Click(object sender, EventArgs e) { DataSet1TableAdapters.ClasesTableAdapter adapter = new DataSet1TableAdapters.ClasesTableAdapter(); DataSet1TableAdapters.Clases_InscritasTableAdapter adapter2 = new DataSet1TableAdapters.Clases_InscritasTableAdapter(); for (int i = 0; i < nombre.Length; i++) { if (nombre[i] != null) { adapter.ActualizarDocente("",0, nombre[i], dia[i], hora[i]); adapter2.ActualizarDocentes("", nombre[i], dia[i], hora[i]); } } ScriptManager.RegisterStartupScript(this, this.GetType(), "alertIns", "alert('Proceso terminado exitosamente');", true); GridView1.DataBind(); //Response.Redirect("Desasociar.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { DataSet1TableAdapters.ClasesTableAdapter adapter = new DataSet1TableAdapters.ClasesTableAdapter(); DataSet1TableAdapters.Clases_InscritasTableAdapter adapter2 = new DataSet1TableAdapters.Clases_InscritasTableAdapter(); DataSet1TableAdapters.DocentesTableAdapter adapter3 = new DataSet1TableAdapters.DocentesTableAdapter(); for (int i = 0; i < nombre.Length; i++) { if (nombre[i] != null) { DataRow row1 = adapter3.ObtenerUnidad(cbxDocente.SelectedValue).Rows[0]; string uni = row1["Unidad"].ToString(); if ((uni.Equals("DocenL") && unidad[i].Equals("Licsu")) || (uni.Equals("DocenS") && unidad[i].Equals("Sura")) || uni.Equals("DocenP") && unidad[i].Equals("Proteccion")) { adapter.ActualizarDocente(cbxDocente.SelectedValue, 1, nombre[i], dia[i], hora[i]); adapter2.ActualizarDocentes(cbxDocente.SelectedValue, nombre[i], dia[i], hora[i]); } else { if (!uni.Equals("")) ScriptManager.RegisterStartupScript(this, this.GetType(), "alertIns", "alert('No puede asociar un profesor de una unidad diferente a la unidad de la clase');", true); } } } ScriptManager.RegisterStartupScript(this, this.GetType(), "alertIns", "alert('Proceso terminado exitosamente');", true); for (int i = 0; i < nombre.Length; i++) { nombre[i] = ""; dia[i] = ""; hora[i] = ""; unidad[i] = ""; } GridView1.DataBind(); //Response.Redirect("Asociar.aspx"); }
protected void Boton1_Click(object sender, EventArgs e) { DataSet1TableAdapters.RolesTableAdapter adapter = new DataSet1TableAdapters.RolesTableAdapter(); DataSet1TableAdapters.Clientes1TableAdapter adapter2 = new DataSet1TableAdapters.Clientes1TableAdapter(); DataSet1TableAdapters.Clases_InscritasTableAdapter adapter3 = new DataSet1TableAdapters.Clases_InscritasTableAdapter(); DataSet1TableAdapters.ClasesTableAdapter adapter4 = new DataSet1TableAdapters.ClasesTableAdapter(); DataSet1TableAdapters.Clientes1TableAdapter adapter12 = new DataSet1TableAdapters.Clientes1TableAdapter(); try { DataRow row = adapter.GetPerfil(TextBox1.Text, TextBox2.Text).Rows[0]; //string perfil = row["perfil"].ToString(); Session["Perfil"] = row["perfil"].ToString(); try { DataRow row1 = adapter.GetPerfil(TextBox1.Text, TextBox2.Text).Rows[0]; //RegistroDatos.Tienda.cedula = row1["usuario"].ToString(); Session["Cedula"] = row1["usuario"].ToString(); DataRow row2 = adapter12.GetData(TextBox1.Text).Rows[0]; //RegistroDatos.Tienda.usuario = row2["Nombre"].ToString(); Session["Nombre"] = row2["Nombre"].ToString(); //RegistroDatos.Tienda.unidad = row2["UnidadDeNegocio"].ToString(); Session["Unidad"] = row2["UnidadDeNegocio"].ToString(); //clases = row2["ClasesActivas"].ToString(); Session["ClasesActivas"] = row2["ClasesActivas"].ToString(); }catch(Exception ex) { } if (Session["Perfil"].Equals("Admin")) { //Tienda.administrador = "Admin"; Session["Administrador"] = "Admin"; //Tienda.panel = true; Session["Panel"] = true; //Tienda.grid1 = true; Session["Grid1"] = true; //Tienda.grid2 = false; Session["Grid2"] = false; //Tienda.grid3 = true; Session["Grid3"] = true; //Tienda.hip1 = true; Session["Hip1"] = true; //Tienda.hip2 = false; Session["Hip2"] = false; Response.Redirect("Administrador.aspx"); } else { if (Session["Perfil"].Equals("user")) { DataTable table = adapter3.ObtenerTodo(); string fecha = ""; DateTime fech; string nombre; string fechaClase; string hora; string nombreI; string fechaClaseI; string horaI; string docente; string docenteExiste = ""; foreach (DataRow row3 in table.Rows) { fecha = row3["Fecha"].ToString(); fech = Convert.ToDateTime(fecha); nombre = row3["Nombre"].ToString(); hora = row3["Hora"].ToString(); if (fech.Year <= DateTime.Now.Year) { if (fech.Month < DateTime.Now.Month) { adapter3.ActualizarClase(1, TextBox1.Text, fecha, hora); } else { if (fech.Day < DateTime.Now.Day) { adapter3.ActualizarClase(1, TextBox1.Text, fecha, hora); } } } } Response.Redirect("Alumnas.aspx"); } else { if (Session["Perfil"].Equals("DocenL") || Session["Perfil"].Equals("DocenS") || Session["Perfil"].Equals("DocenP")) { if (Session["Perfil"].Equals("DocenL")) //Tienda.uni = "Licsu"; Session["Uni"] = "Licsu"; if (Session["Perfil"].Equals("DocenS")) //Tienda.uni = "Sura"; Session["Uni"] = "Sura"; if (Session["Perfil"].Equals("DocenP")) //Tienda.uni = "Proteccion"; Session["Uni"] = "Proteccion"; Response.Redirect("Docentes.aspx"); } if (Session["Perfil"].Equals("AdminL")) { //Tienda.panel = false; Session["Panel"] = false; //Tienda.uni = "Licsu"; Session["Uni"] = "Licsu"; //Tienda.administrador = "AdminL"; Session["Administrador"] = "AdminL"; //Tienda.docente = "DocenL"; Session["Docente"] = "DocenL"; //Tienda.grid2 = true; Session["Grid2"] = true; //Tienda.grid1 = false; Session["Grid1"] = false; //Tienda.grid3 = false; Session["Grid3"] = false; //Tienda.hip1 = false; Session["Hip1"] = false; //Tienda.hip2 = true; Session["Hip2"] = true; Response.Redirect("Administradores.aspx"); } if (Session["Perfil"].Equals("AdminS")) { //Tienda.panel = false; Session["Panel"] = false; //Tienda.uni = "Sura"; Session["Uni"] = "Sura"; //Tienda.administrador = "AdmiS"; Session["Administrador"] = "AdminS"; //Tienda.docente = "DocenS"; Session["Docente"] = "DocenS"; //Tienda.grid2 = true; Session["Grid2"] = true; //Tienda.grid1 = false; Session["Grid1"] = false; //Tienda.grid3 = false; Session["Grid3"] = false; Session["Hip1"] = false; //Tienda.hip2 = true; Session["Hip2"] = true; Response.Redirect("Administradores.aspx"); } if (Session["Perfil"].Equals("AdminP")) { //Tienda.panel = false; Session["Panel"] = false; //Tienda.uni = "Proteccion"; Session["Uni"] = "Proteccion"; //Tienda.administrador = "Adminp"; Session["Administrador"] = "AdminP"; //Tienda.docente = "DocenP"; Session["Docente"] = "DocenP"; //Tienda.grid2 = true; Session["Grid2"] = true; //Tienda.grid1 = false; Session["Grid1"] = false; //Tienda.grid3 = false; Session["Grid3"] = false; Session["Hip1"] = false; //Tienda.hip2 = true; Session["Hip2"] = true; Response.Redirect("Administradores.aspx"); } } } } catch (System.IndexOutOfRangeException ex) { lblValidado.Text = "Usuario y/o contraseƱa invalidos"; lblValidado.ForeColor = System.Drawing.Color.Red; lblValidado.Visible = true; TextBox1.Text = ""; TextBox2.Text = ""; } }