Пример #1
0
 public void CommitPalavras()
 {
     this.RemoveAllData <PALAVRAS>();
     System.Data.Common.DbTransaction transaction = this.DbBase.BeginTransaction();
     try
     {
         foreach (var item in Palavras)
         {
             this.Save(item, transaction);
         }
         transaction.Commit();
     }
     catch { transaction.Rollback(); }
     finally
     {
         DbBase.Close();
     }
 }
Пример #2
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "application/json";
     try
     {
         db.Open();
         var data    = context.Request;
         var stream  = new StreamReader(data.InputStream).ReadToEnd();
         var msgData = new JavaScriptSerializer().Deserialize <tb_Question>(stream);
         //保存到服务器
         db.InsertNewSession
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         db.Close();
     }
 }