예제 #1
0
 public CPracticeData[] LoadPracData(string UserName)
 {
     try
     {
         string s = string.Format("UserName like '{0}'", UserName.Trim().Replace("'", "''"));
         DataRow[] arrRows = m_dtPracticeData.Select(s);
         if (arrRows != null && arrRows.Length > 0)
         {
             List<CPracticeData> lsRet = new List<CPracticeData>();
             foreach (DataRow dtRow in arrRows)
             {
                 CPracticeData data = new CPracticeData(dtRow[1].ToString());
                 data.PraticeTime = new DateTime(long.Parse(dtRow[2].ToString()));
                 data.ExerciseCount = long.Parse(dtRow[3].ToString());
                 data.KeyCount = long.Parse(dtRow[4].ToString());
                 data.FailKeyCount = long.Parse(dtRow[5].ToString());
                 data.UsingHelpCount = long.Parse(dtRow[6].ToString());
                 data.TotalTime = long.Parse(dtRow[7].ToString());
                 lsRet.Add(data);
             }
             return lsRet.ToArray();
         }
         return null;
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message, "Load Practice Data");
     }
     return null;
 }
예제 #2
0
 public bool UpdatePracData(CPracticeData data)
 {
     try
     {
         int iNewID;
         for (iNewID = 0; m_dtPracticeData.Rows.Contains(iNewID); ++iNewID) ;
         DataRow dtRowNew = m_dtPracticeData.NewRow();
         dtRowNew[0] = iNewID;
         dtRowNew[1] = data.UserName;
         dtRowNew[2] = data.PraticeTime.ToBinary();
         dtRowNew[3] = data.ExerciseCount;
         dtRowNew[4] = data.KeyCount;
         dtRowNew[0] = iNewID;
         dtRowNew[0] = iNewID;
         dtRowNew[0] = iNewID;
         m_dtPracticeData.Rows.Add(iNewID, data.UserName, data.PraticeTime.ToBinary(), data.ExerciseCount,
             data.KeyCount, data.FailKeyCount, data.UsingHelpCount, data.TotalTime);
         m_dtPracticeData.AcceptChanges();
         return true;
     }
     catch
     {
         return false;
     }
 }
예제 #3
0
 public bool AppendPracticeData(CPracticeData data)
 {
     return CPersistantData.Instance.UpdatePracData(data);
 }