예제 #1
0
 public FormCrearTrabajo(string idCourse, FormProfessor p)
 {
     InitializeComponent();
     this.Icon     = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
     this.idCourse = idCourse;
     con           = new SQLiteConnector();
     parent        = p;
 }
예제 #2
0
 public FormRevisar(string idAssignment, string AssName, FormProfessor parent)
 {
     InitializeComponent();
     this.Icon         = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
     this.idAssignment = idAssignment;
     AssignmentName    = AssName;
     setTitle();
     con = new SQLiteConnector();
     fillDataGridTrabajos();
     this.parent = parent;
 }
예제 #3
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();
            }
        }