public static AccountInfo FindBackChecked(string account, string key)
        {
            string sql = string.Format("select * from UsersTable where Account ='{0}' and Key='{1}'", account,
                                       Encryption.EncryptBase64(key));

            using (SQLiteDataReader reader = SQLiteControl.ExecuteReader(sql))
            {
                if (reader == null)
                {
                    return(null);
                }

                int result = 0;
                while (reader.Read() && result < 1)
                {
                    result++;
                    _account.ID = string.IsNullOrEmpty(reader["ID"].ToString())
                        ? 0
                        : int.Parse(reader["ID"].ToString());
                    _account.Person   = reader["Person"].ToString();
                    _account.Account  = reader["Account"].ToString();
                    _account.Password = reader["Password"].ToString();
                    _account.Key      = reader["Key"].ToString();
                    _account.Power    = string.IsNullOrEmpty(reader["Power"].ToString())
                        ? 0
                        : int.Parse(reader["Power"].ToString());
                }

                if (result != 1)
                {
                    return(null);
                }
            }
            return(_account);
        }
        /// <summary>
        /// 账号密码完全验证
        /// </summary>
        /// <param name="Account"></param>
        /// <returns></returns>
        public static bool AccountFullChecked(string Account, string Password)
        {
            string sql = string.Format("select * from UsersTable where Account='{0}' and Password='******'", Account, Password);

            using (SQLiteDataReader reader = SQLiteControl.ExecuteReader(sql))
            {
                if (reader == null)
                {
                    return(false);
                }

                int result = 0;
                while (reader.Read())
                {
                    ++result;
                    _account.ID = string.IsNullOrEmpty(reader["ID"].ToString())
                        ? 0
                        : int.Parse(reader["ID"].ToString());
                    _account.Person   = reader["Person"].ToString();
                    _account.Account  = reader["Account"].ToString();
                    _account.Password = reader["Password"].ToString();
                    _account.Key      = reader["Key"].ToString();
                    _account.Power    = string.IsNullOrEmpty(reader["Power"].ToString())
                        ? 0
                        : int.Parse(reader["Power"].ToString());
                }
                if (result == 1)
                {
                    return(true);
                }
            }
            return(false);
        }
        public static List <AccountInfo> GetAll()
        {
            string sql = "select * from UsersTable where Power >= 0";

            using (SQLiteDataReader reader = SQLiteControl.ExecuteReader(sql))
            {
                List <AccountInfo> accounts = Looper(reader);
                return(accounts);
            }
        }
        public static List <PayRecordInfo> SimpleQuery(int pageIndex, int pageSize, string key, out int total)
        {
            string           sql    = string.Format("select * from PayRecordTable");
            SQLiteDataReader reader = SQLiteControl.ExecuteReader(sql);

            total = Looper(reader).Count;
            sql   = string.Format("select * from PayRecordTable where (StudentName like '%{0}%' " +
                                  "or OperationPerson like '%{0}%') " +
                                  "limit {1} offset {2}", key, pageSize, (pageIndex - 1) * pageSize);
            reader = SQLiteControl.ExecuteReader(sql);
            var result = Looper(reader);

            reader.Close();
            return(result);
        }
Example #5
0
        /// <summary>
        /// 查询被删除的学生信息
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="key"></param>
        /// <param name="total"></param>
        /// <returns></returns>

        public static List <StudentInfo> RealyQuerry(int pageIndex, int pageSize, string key, out int total)
        {
            string           sql    = string.Format("select * from StudentsTable where IsDelete = 1");
            SQLiteDataReader reader = SQLiteControl.ExecuteReader(sql);

            total = Looper(reader).Count;
            reader.Close();

            sql = string.Format(
                "select * from StudentsTable where (SerialNum like '%{0}%' " +
                "or Name like '%{0}%' or Parents like '%{0}%' " +
                "or Address like '%{0}%') " +
                "and IsDelete = 1 " +
                "limit {1} offset {2}",
                key, pageSize, (pageIndex - 1) * pageSize);
            reader = SQLiteControl.ExecuteReader(sql);
            return(Looper(reader));
        }
        /// <summary>
        /// 简单的查询
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static List <AccountInfo> SimpleQuery(int pageIndex, int pageSize, string key, out int total)
        {
            string             sql      = "select * from UsersTable where Power >= 0";
            SQLiteDataReader   reader   = SQLiteControl.ExecuteReader(sql);
            List <AccountInfo> accounts = Looper(reader);

            total = accounts == null ? 0 : accounts.Count;

            sql =
                string.Format(
                    "select * from UsersTable where (Person like '%{0}%' or Account like '%{0}%') and Power >= 0 limit {1} offset {2}",
                    key, pageSize, (pageIndex - 1) * pageSize);
            reader = SQLiteControl.ExecuteReader(sql);
            accounts.Clear();
            accounts = Looper(reader);
            reader.Dispose();
            return(accounts);
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="key"></param>
        /// <param name="total"></param>
        /// <returns></returns>
        public static List <GroupClassInfo> SimpleQuery(int pageIndex, int pageSize, string key, out int total)
        {
            string           sql    = string.Format("select * from GroupClassTable where IsDelete is NULL or IsDelete = 0");
            SQLiteDataReader reader = SQLiteControl.ExecuteReader(sql);

            total = Looper(reader).Count;

            sql = string.Format(
                "select * from GroupClassTable where (GroupName like '%{0}%' " +
                "or ClassTeacher like '%{0}%') " +
                "and (IsDelete is NULL or IsDelete = 0) " +
                "limit {1} offset {2}",
                key, pageSize, (pageIndex - 1) * pageSize);
            reader = SQLiteControl.ExecuteReader(sql);
            var result = Looper(reader);

            reader.Close();
            return(result);
        }
        /// <summary>
        /// 账号检查
        /// </summary>
        /// <param name="Account"></param>
        /// <returns></returns>
        public static bool AccountChecked(string Account)
        {
            string sql = string.Format("select * from UsersTable where Account='{0}'", Account);

            using (SQLiteDataReader reader = SQLiteControl.ExecuteReader(sql))
            {
                if (reader == null)
                {
                    return(false);
                }

                int result = 0;
                while (reader.Read())
                {
                    ++result;
                }

                if (result == 1)
                {
                    return(true);
                }
            }
            return(false);
        }
Example #9
0
        public static List <CheckinInfo> Query(int GroupID)
        {
            string sql = string.Format("select * from StudentsCheckinTable where GroupID = {0}", GroupID);

            return(Looper(SQLiteControl.ExecuteReader(sql)));
        }