public string iExportRewardLog(LinkedList <int> RewardList)
        {
            string strLog = "";

            SystemManager SysManage  = new SystemManager();
            PaperInstance Instance   = new PaperInstance();
            SqlConnection connection = SysManage.iConnectDB();

            try{ connection.Open(); } catch (Exception ex) { /*...*/ }

            try
            {
                //Get record list
                const string strCmd = "select [Account], [ActionName], Reward_AssignTable.[Credit], [Message], [TimeStamp] from" +
                                      "(Reward_RuleTable left join Reward_AssignTable on Reward_RuleTable.ID = Reward_AssignTable.Reward_ID)" +
                                      "left join Sys_AccountTable on Reward_AssignTable.Account_ID = Sys_AccountTable.ID" + "order by Sys_AccountTable.ID";

                SqlCommand    cmd        = new SqlCommand(strCmd, connection);
                SqlDataReader dataReader = cmd.ExecuteReader();

                while (dataReader.Read())
                {
                    string strRecord = "";

                    //Write record;
                    //...

                    strLog = strLog + strRecord + "\r\n";
                }

                dataReader.Close();
                cmd.Dispose();

                SysManage.WriteLog(0, 20, 0, "Export Reward Log");
            }
            catch (Exception ex)
            {
                //...
            }

            //Close DB
            try { connection.Close(); } catch (Exception ex) { /*...*/ }

            return(strLog);
        }
        public PaperInstance iGetInstance(int ID)
        {
            SystemManager SysManage  = new SystemManager();
            PaperInstance Instance   = new PaperInstance();
            SqlConnection connection = SysManage.iConnectDB();

            try{ connection.Open(); } catch (Exception ex) { /*...*/ }

            try
            {
                //Get instance info
                SqlCommand    cmd        = new SqlCommand("select * from  Exam_InstanceTable join Exam_PaperDescTable on (Exam_InstanceTable.Paper_ID = Exam_PaperDescTable.ID) where Exam_InstanceTable.ID =" + ID, connection);
                SqlDataReader dataReader = cmd.ExecuteReader();

                bool bSuccess = dataReader.Read();

                if (bSuccess)
                {
                    //File Instance.RegDesc and Instance.Desc
                    //...
                    SysManage.WriteLog(0, 10, 0, "Get exam instance, Successful");
                }
                else
                {
                    SysManage.WriteLog(0, 10, 1, "Get exam instance, failed");
                }

                dataReader.Close();
                cmd.Dispose();
            }
            catch (Exception ex)
            {
                //...
            }

            try
            {
                //Get question list
                const string strQuestionSQL = "select [Type], [Content], [Answer], [Score] from" +
                                              "(Exam_QuestionTable	left join Exam_PaperInfoTable on Exam_QuestionTable.ID = Exam_PaperInfoTable.Question_ID)"+
                                              "left join Exam_InstanceTable on Exam_PaperInfoTable.Paper_ID = Exam_InstanceTable.Paper_ID" + "where Exam_InstanceTable.ID";

                SqlCommand    cmd        = new SqlCommand(strQuestionSQL + ID, connection);
                SqlDataReader dataReader = cmd.ExecuteReader();

                while (dataReader.Read())
                {
                    KeyValuePair <QuestionDesc, string> QuestionPair = new KeyValuePair <QuestionDesc, string>();

                    //File Instance.QuestionList
                    //...

                    Instance.QuestionList.AddLast(QuestionPair);
                }

                dataReader.Close();
                cmd.Dispose();
            }
            catch (Exception ex)
            {
                //...
            }

            //Close DB
            try { connection.Close(); } catch (Exception ex) { /*...*/ }

            return(Instance);
        }