Example #1
0
        /// <summary>
        /// データを登録する。同時にイベント駆動でトランザクションを張る
        /// </summary>
        /// <param name="InsertData">登録データ</param>
        public void Insert(BookList Listdata)
        {
            BookWriteContext.Connection.Open();

            try
            {
                InsertRecord(Listdata);
            }
            catch (SqlException)
            {
                BookListException BookEx = new BookListException();
                BookEx.ApendMessage = "データの登録に失敗しました。";
                throw BookEx;
            }
            finally
            {
                BookWriteContext.Connection.Close();
            }
        }
Example #2
0
 /// <summary>
 /// トランザクション(更新)
 /// </summary>
 /// <param name="SendResultList"></param>
 private void DeleteRecord(string RecordKey)
 {
     BookWriteContext.Transaction = BookWriteContext.Connection.BeginTransaction();
     try
     {
         SetUpdateRecordData(RecordKey);
         BookWriteContext.Transaction.Commit();
     }
     catch (SqlException)
     {
         BookWriteContext.Transaction.Rollback();
         throw;
     }
     catch (InvalidCastException)
     {
         BookListException ex = new BookListException("削除エラー");
         throw ex;
     }
     finally
     {
         BookWriteContext.Transaction = null;
     }
 }