Beispiel #1
0
        private void SaveChangeList()
        {
            using (ChangeList change = new ChangeList(true))
            {
                change.FromDate = FromDate;
                change.Todate   = ToDate;

                if (ChangeListID == 0)
                {
                    ChangeListID = change.Add();
                }

                change.Clear(ChangeListID);

                foreach (ChangeListToolstriptItem RmenuItem in contextMenuStrip1.Items)
                {
                    if (RmenuItem.asapuChangeListItem != null)
                    {
                        foreach (ChangeListItemBhikku bhikku in RmenuItem.asapuChangeListItem.bhikkuList)
                        {
                            change.AddBhikkuAsapuwa(ChangeListID, RmenuItem.asapuChangeListItem.asapuwaID, bhikku.bInfo.ID, bhikku.bInfo.Post, bhikku.bInfo.ChangeType);
                        }
                    }
                }
            }
        }
Beispiel #2
0
 //------------------------------ batch handling (to avoid event firing for every operation). 
 /// <summary>
 /// Executes a batch operation.
 /// During batch operation events firing will be suppressed, and event will be fired only after TransactionCommit is invoked.
 /// it is for event handling only .
 /// </summary>
 public void Transaction(Action action)
 {
     FireBeforeChange("Changes in transaction");
     transactionLevel++;
     if (UseEventsArgs && transactionLevel == 1) ChangeList.Clear();
     try
     {
         action();
     }
     finally
     {
         transactionLevel--;
         if (transactionLevel == 0)
         {
             FireChange(UseEventsArgs ? new BGCurveChangedArgs(this, ChangeList.ToArray()) : null);
             if (UseEventsArgs) ChangeList.Clear();
         }
     }
 }