コード例 #1
0
 public FormGrades(FormMainStudent m, string idStudent)
 {
     InitializeComponent();
     this.Icon      = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
     this.MdiParent = m;
     con            = new SQLiteConnector();
     this.idStudent = idStudent;
     parent         = m;
     dataGrabbed    = false;
     fillDataGrid();
 }
コード例 #2
0
 public FormCursos(FormMainStudent m, string idStudent, string idAccount)
 {
     InitializeComponent();
     this.Icon      = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
     this.MdiParent = m;
     con            = new SQLiteConnector();
     this.idStudent = idStudent;
     this.idAccount = idAccount;
     FillDataGridView();
     parent         = m;
     selectedCourse = "";
 }
コード例 #3
0
 //FormAssignments;
 public FormMainStudent(FormLogin l, string idAccount)
 {
     InitializeComponent();
     this.Icon      = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
     con            = new SQLiteConnector();
     login          = l;
     this.idAccount = idAccount;
     isCursosOpen   = false;
     isGradesOpen   = false;
     //IsAssignmentsOpen = false;
     setTitle();
     cursos = null;
     grades = null;
 }
コード例 #4
0
        private void Login()
        {
            SQLiteConnector con = new SQLiteConnector();

            string username = textUser.Text.ToUpper();
            string password = textPassword.Text;

            if (username == "" || password == "")
            {
                MessageBox.Show("Debe llenar ambos campos.", "Campos Vacios", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string sql       = @"select idAccount from Account where username='******' and password='******';";
            string idAccount = "";

            try
            {
                con.Open();
                idAccount = con.SelectSingle(sql);
                sql       = @"select idProfessor from account where idAccount=" + idAccount;
                if (con.SelectSingle(sql) == "")
                {
                    sql = @"select idStudent from account where idAccount=" + idAccount;
                    if (con.SelectSingle(sql) == "")
                    {
                        con.Close();
                        Admin.AdminMain main = new Admin.AdminMain(this); // TODO: implemenent admin screen
                        main.Show();
                    }
                    else
                    {
                        con.Close();
                        FormMainStudent main = new FormMainStudent(this, idAccount);
                        main.Show();
                    }
                }
                else
                {
                    con.Close();
                    FormsProfesor.FormProfessor main = new FormsProfesor.FormProfessor(this, idAccount); // TODO: implemenent teacher screen
                    main.Show();
                }
                con.Close();


                this.Hide();
            }
            catch (System.Data.SQLite.SQLiteException err)
            {
                //MessageBox.Show(err.Message.ToString());
                Console.WriteLine(err.Message);
            }
            catch (System.IndexOutOfRangeException)
            {
                MessageBox.Show("Usuario o contraseña incorrecta", "Credenciales Inválidas", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                con.Close();
            }
        }