Exemple #1
0
        public static ClientSession Login(QE_USER user)
        {
            try {
                //user.PASSWORD = AccountService.aesEncryptBase64(user.PASSWORD, "QEKey");
                QE_USER loginedUser = KennyORM.GetDBSource("QE_USER", "select * from QE_USER where USER_ID='" + user.USER_ID + "' and PASSWORD='******' and active=1").Cast <QE_USER>().First();
                if (loginedUser.ID != 0)
                {
                    if (loginedUser.FIRST_LOGIN.Date.Year == 1900 || loginedUser.FIRST_LOGIN.Date == null)
                    {
                        loginedUser.FIRST_LOGIN = DateTime.Now;
                    }
                    else
                    {
                        loginedUser.LAST_LOGIN = DateTime.Now;
                    }

                    KennyORM.UpdateRecord(loginedUser);
                }
                ClientSession session = new ClientSession();
                session.loginedUser = loginedUser;
                HttpContext.Current.Session["ClientSession"] = session;
                return(session);
            }
            catch { return(new ClientSession()); }
        }
Exemple #2
0
 public static TERM GetTerm(int id)
 {
     try { return(KennyORM.GetDBSource("TERM", "select * from TERM where ID='" + id + "' and active=1").Cast <TERM>().First()); }
     catch { return(new TERM()); }
 }
Exemple #3
0
 public static List <QE_USER> GetUsersList()
 {
     try { return(KennyORM.GetDBSource("QE_USER", "select ID,USER_ID,USER_NAME,USER_NAME_CHI from QE_USER where active=1").Cast <QE_USER>().ToList()); }
     catch { return(new List <QE_USER>()); }
 }
Exemple #4
0
 public static QE_USER GetUser(int id)
 {
     try { return(KennyORM.GetDBSource("QE_USER", "select * from QE_USER where ID=" + id + " and active=1").Cast <QE_USER>().First()); }
     catch { return(new QE_USER()); }
 }
Exemple #5
0
 public static List <QE_USER> GetUsers()
 {
     try { return(KennyORM.GetDBSource("QE_USER").Cast <QE_USER>().ToList()); }
     catch { return(new List <QE_USER>()); }
 }
Exemple #6
0
 public static List <STUDENT> GetStudentsByClass(int qe_class)
 {
     try { return(KennyORM.GetDBSource("STUDENT", "select * from STUDENT where ID in (select STUDENT from CLASS_STUDENT_LIST where QE_CLASS = " + qe_class + ") and active=1").Cast <STUDENT>().ToList()); }
     catch { return(new List <STUDENT>()); }
 }
Exemple #7
0
 public static List <QE_CLASS> GetClassesByForm(int form)
 {
     try { return(KennyORM.GetDBSource("QE_CLASS", "select * from QE_CLASS where TERM = '" + TermService.GetCurrentTerm().ID + "' and active=1 and FORM = " + form + " order by FORM, NAME").Cast <QE_CLASS>().ToList()); }
     catch { return(null); }
 }
Exemple #8
0
 public static TERM GetNextTerm()
 {
     try{ return(KennyORM.GetDBSource("TERM", "select top 1 * from TERM where TERM_START > CURRENT_TIMESTAMP and active=1").Cast <TERM>().First()); }
     catch { return(new TERM()); }
 }
Exemple #9
0
 public static List <HOMEWORK> GetHomeworksByGroupAndType(int student_group, int homework_type)
 {
     try { return(KennyORM.GetDBSource("HOMEWORK", "select * from HOMEWORK where STUDENT_GROUP='" + student_group + "' and HOMEWORK_TYPE=" + homework_type + " and active=1").Cast <HOMEWORK>().ToList()); }
     catch { return(null); }
 }
Exemple #10
0
 public static List <HOMEWORK> GetHomeworks(int student_group)
 {
     try { return(KennyORM.GetDBSource("HOMEWORK", "select * from HOMEWORK where STUDENT_GROUP='" + student_group + "' and active=1").Cast <HOMEWORK>().ToList()); }
     catch { return(null); }
 }
Exemple #11
0
 public static List <HOMEWORK> GetHomeworksByType(int homework_type)
 {
     try { return(KennyORM.GetDBSource("HOMEWORK", "select * from HOMEWORK where STUDENT_GROUP in (select ID from STUDENT_GROUP where TERM='" + TermService.GetCurrentTerm().ID + "' and active=1) and HOMEWORK_TYPE=" + homework_type + " and active=1").Cast <HOMEWORK>().ToList()); }
     catch { return(null); }
 }
Exemple #12
0
 public static HOMEWORK GetHomework(int id)
 {
     try { return(KennyORM.GetDBSource("HOMEWORK", "select * from HOMEWORK where ID=" + id + " and active=1").Cast <HOMEWORK>().First()); }
     catch { return(null); }
 }
Exemple #13
0
 public static List <STUDENT_GROUP> GetStudentGroups(int subject)
 {
     try { return(KennyORM.GetDBSource("STUDENT_GROUP", "select * from STUDENT_GROUP where TERM='" + TermService.GetCurrentTerm().ID + "' and SUBJECT=" + subject + " and active=1").Cast <STUDENT_GROUP>().ToList()); }
     catch { return(null); }
 }
Exemple #14
0
 public static STUDENT_GROUP GetStudentGroup(int id)
 {
     try { return(KennyORM.GetDBSource("STUDENT_GROUP", "select * from STUDENT_GROUP where ID=" + id + " and active=1").Cast <STUDENT_GROUP>().First()); }
     catch { return(null); }
 }
Exemple #15
0
 public static List <TERM> GetTerms()
 {
     try { return(KennyORM.GetDBSource("TERM").Cast <TERM>().ToList()); }
     catch { return(new List <TERM>()); }
 }
Exemple #16
0
 public static STUDENT GetStudent(int id)
 {
     try { return(KennyORM.GetDBSource("STUDENT", "select * from STUDENT where ID = " + id + " and active=1").Cast <STUDENT>().First()); }
     catch { return(new STUDENT()); }
 }
Exemple #17
0
 public static TERM GetTermByName(string name)
 {
     try { return(KennyORM.GetDBSource("TERM", "select * from TERM where TERM_NAME='" + name + "' and active=1").Cast <TERM>().First()); }
     catch { return(new TERM()); }
 }
Exemple #18
0
 public static List <STUDENT> GetStudents(int term) // get students by term
 {
     try { return(KennyORM.GetDBSource("STUDENT", "select * from STUDENT where ID in (select STUDENT from CLASS_STUDENT_LIST where ID in (select ID from QE_CLASS where TERM = " + TermService.GetCurrentTerm().ID + " and active=1 order by FORM, NAME) and active=1) and active=1").Cast <STUDENT>().ToList()); }
     catch { return(new List <STUDENT>()); }
 }
Exemple #19
0
 public static SSUBJECT GetSSubject(int id)
 {
     try { return(KennyORM.GetDBSource("SSUBJECT", "select * from SSUBJECT where ID=" + id + " and active=1").Cast <SSUBJECT>().First()); }
     catch { return(new SSUBJECT()); }
 }
Exemple #20
0
 public static QE_CLASS GetClass(int form, string name)
 {
     try { return(KennyORM.GetDBSource("QE_CLASS", "select * from QE_CLASS where TERM = '" + TermService.GetCurrentTerm().ID + "' and active=1 and FORM = " + form + " and NAME = '" + name + "'").Cast <QE_CLASS>().First()); }
     catch { return(null); }
 }