Пример #1
0
        public List <QRecUser> AcquireUserRecords()
        {
            List <QRecUser> retval = new List <QRecUser>();

            mDBOperator.Open();

            String SQL =
                "SELECT * FROM USER_TABLE";

            if (mVersion == VERSION.MANAGER)
            {
                MySqlDataReader reader = (MySqlDataReader)mDBOperator.Query(SQL);

                while (reader.Read())
                {
                    QRecUser rec = new QRecUser();

                    rec.ID        = reader.GetString(0);
                    rec.GroupMark = reader.GetString(1);
                    rec.Time      = reader.GetString(2);
                    rec.Name      = reader.GetString(3);
                    rec.Gender    = reader.GetString(4);
                    rec.Age       = reader.GetString(5);
                    rec.Health    = reader.GetString(6);
                    rec.Qualif    = reader.GetString(7);
                    rec.Job       = reader.GetString(8);
                    rec.Other     = reader.GetString(9);

                    retval.Add(rec);
                }
            }
            else if (mVersion == VERSION.STANDALONE)
            {
                SQLiteDataReader readerLite = (SQLiteDataReader)mDBOperator.Query(SQL);

                while (readerLite.Read())
                {
                    QRecUser rec = new QRecUser();

                    rec.ID        = readerLite["ID"].ToString();
                    rec.GroupMark = (String)readerLite["GROUP_MARK"];
                    rec.Time      = (String)readerLite["TIME"];
                    rec.Name      = (String)readerLite["NAME"];
                    rec.Gender    = (String)readerLite["GENDER"];
                    rec.Age       = readerLite["AGE"].ToString();
                    rec.Health    = (String)readerLite["HEALTH"];
                    rec.Qualif    = (String)readerLite["QUALIF"];
                    rec.Job       = (String)readerLite["JOB"];
                    rec.Other     = (String)readerLite["OTHER"];

                    retval.Add(rec);
                }
            }

            mDBOperator.Close();

            return(retval);
        }
Пример #2
0
        public QRecUser QueryUserTable(long id)
        {
            QRecUser retval = new QRecUser();

            mDBOperator.Open();
            String SQL = "SELECT * FROM USER_TABLE WHERE ID = " + id;

            //object result = ;

            if (mVersion != VERSION.STANDALONE)
            {
                MySqlDataReader reader = (MySqlDataReader)mDBOperator.Query(SQL);
                while (reader.Read())
                {
                    retval.ID        = reader.GetInt64(0).ToString();
                    retval.GroupMark = reader.GetString(1);
                    retval.Time      = reader.GetString(2);
                    retval.Name      = reader.GetString(3);
                    retval.Gender    = reader.GetString(4);
                    retval.Age       = reader.GetInt16(5).ToString();
                    retval.Health    = reader.GetString(6);
                    retval.Qualif    = reader.GetString(7);
                    retval.Job       = reader.GetString(8);
                    retval.Other     = reader.GetString(9);
                }
            }
            else
            {
                SQLiteDataReader readerLite = (SQLiteDataReader)mDBOperator.Query(SQL);
                while (readerLite.Read())
                {
                    retval.ID        = ((long)readerLite["ID"]).ToString();
                    retval.GroupMark = (String)readerLite["GROUP_MARK"];
                    retval.Time      = (String)readerLite["TIME"];
                    retval.Name      = (String)readerLite["NAME"];
                    retval.Gender    = (String)readerLite["GENDER"];
                    retval.Age       = ((int)readerLite["AGE"]).ToString();
                    retval.Health    = (String)readerLite["HEALTH"];
                    retval.Qualif    = (String)readerLite["QUALIF"];
                    retval.Job       = (String)readerLite["JOB"];
                    retval.Other     = (String)readerLite["OTHER"];
                }
            }

            mDBOperator.Close();
            return(retval);
        }
Пример #3
0
        public void UpdateUserTable(QRecUser user)
        {
            mDBOperator.Open();
            String SQL = "UPDATE " + Names.USER_TABLE_NAME + " SET " +
                         "GROUP_MARK = " + toolAppendSQ2Str(user.GroupMark) + ", " +
                         "TIME = " + toolAppendSQ2Str(user.Time) + ", " +
                         "NAME = " + toolAppendSQ2Str(user.Name) + ", " +
                         "GENDER = " + toolAppendSQ2Str(user.Gender) + ", " +
                         "AGE = " + user.Age + ", " +
                         "HEALTH = " + toolAppendSQ2Str(user.Health) + ", " +
                         "QUALIF = " + toolAppendSQ2Str(user.Qualif) + ", " +
                         "JOB = " + toolAppendSQ2Str(user.Job) + ", " +
                         "OTHER = " + toolAppendSQ2Str(user.Other) + " " +
                         "WHERE ID = " + user.ID + ";";

            mDBOperator.ExecuteX(SQL);
            mDBOperator.Close();
        }