Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.

Commit

Permalink
Añadidas calificaciones
Browse files Browse the repository at this point in the history
Se añadió un botón para consultar notas
Actualizado icono
App optimizada en tamaño y rendimiento
Ventanas centradas a la pantalla
Corregido error que no desactivaba notificaciones
  • Loading branch information
lxndr-rl committed Mar 12, 2021
1 parent 3fb8d11 commit e7fda3b
Show file tree
Hide file tree
Showing 67 changed files with 9,440 additions and 5,930 deletions.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
7 changes: 7 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\lxMeets.sln",
"PreviewInSolutionExplorer": false
}
Binary file modified .vs/lxMeets/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified .vs/lxMeets/v16/.suo
Binary file not shown.
Binary file added .vs/slnx.sqlite
Binary file not shown.
206 changes: 206 additions & 0 deletions GradeWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

115 changes: 115 additions & 0 deletions GradeWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
using Newtonsoft.Json;
using System;
using System.Drawing;
using System.Net;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace lxMeets
{
public partial class GradeWindow : Form
{
WebClient client = new WebClient();
string cedula = "";
public GradeWindow()
{
InitializeComponent();

if (Properties.Settings.Default.Cedula.Length > 2) { cedula = Properties.Settings.Default.Cedula; }

else
{
cedula = lxMessageInputBox.ShowDialog("Ingresar número de cédula", "Ingresar número de cédula");

while ((cedula.Length < 9 && cedula.Length > 0) || !Regex.IsMatch(cedula, @"^\d+$"))
{
if (cedula == "Cancel") break;
MessageBox.Show("Cédula Inválida"); cedula = lxMessageInputBox.ShowDialog("Ingresar número de cédula", "Ingresar número de cédula");
}
}
if (cedula != "Cancel") fetchAPI(cedula);


}

private async void fetchAPI(string cedula)
{
/*
TODO
Implementar selección de Año Lectivo
API ya lista para consultar con año lectivo
*/
try
{
string url = @"https://api.lxndr.dev/uae/notas/?ced=" + cedula + "&aLect";
if (cedula.Length == 0) this.Close();
var json = await client.DownloadStringTaskAsync(url);
dynamic stuff = JsonConvert.DeserializeObject(json);
cargandoPicture.Visible = false;
if ((bool)stuff.error) { MessageBox.Show(stuff.message.ToString()); this.Close(); }
otraCButton.Visible = true;
nombresLabel.Text = stuff.apellidos + " " + stuff.nombres;
carreraLabel.Text = stuff.carrera;
facultadLabel.Text = stuff.facultad;
GenerateTable(stuff.parciales.Count, stuff.parciales[0].Count, tablaParcial, stuff, "parciales");
GenerateTable(stuff.promedios.Count, stuff.promedios[0].Count, tablaPromedio, stuff, "promedios");
}
catch (Exception e) { }
}

private void GenerateTable(int rowCount, int columnCount, TableLayoutPanel tableController, dynamic stuff, string tipo)
{
tableController.Controls.Clear();
tableController.ColumnStyles.Clear();
tableController.RowStyles.Clear();
tableController.AutoScroll = true;
tableController.ColumnCount = columnCount;
tableController.RowCount = rowCount;

for (int x = 0; x < columnCount; x++)
{
tableController.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));

for (int y = 0; y < rowCount; y++)
{
string toWrite = stuff[tipo][y][x].ToString();
Console.WriteLine(toWrite);
if (x == 0)
{
tableController.RowStyles.Add(new RowStyle(SizeType.AutoSize));
}

Label cmd = new Label();
cmd.ForeColor = Color.White;
cmd.Text = toWrite;
tableController.Controls.Add(cmd, x, y);
}
}
}


private void button1_Click(object sender, EventArgs e)
{
this.Close();
}

private void otraCButton_Click(object sender, EventArgs e)
{
cedula = lxMessageInputBox.ShowDialog("Ingresar número de cédula", "Ingresar número de cédula");

while ((cedula.Length < 9 && cedula.Length > 0) || !Regex.IsMatch(cedula, @"^\d+$"))
{
if (cedula == "Cancel") break;
MessageBox.Show("Cédula Inválida"); cedula = lxMessageInputBox.ShowDialog("Ingresar número de cédula", "Ingresar número de cédula");
}

cargandoPicture.Visible = true;
if (cedula == "Cancel") this.Close();
}

private void GradeWindow_Shown(object sender, EventArgs e)
{
if (cedula == "Cancel") this.Close();
}
}
}
Loading

0 comments on commit e7fda3b

Please sign in to comment.