コード例 #1
0
        private void ProcessPayment(Boolean IsCorrection)
        {
            // start transaction
            using (TransactionScope TS = new TransactionScope())
            {
                // process payment
                try
                {
                    ClassCustomBinding.BindToObject("ModelTMSContainer." + SetName + "Set", KeyID, Controls, DataItem, ControlObjectContext);

                    if (!IsCorrection)
                    {
                        (DataItem as RelationAdvancePayment).PayOut(ControlObjectContext, Common.CurrentClientDateTime(Session));
                    }
                    else
                    {
                        (DataItem as RelationAdvancePayment).PayBack(ControlObjectContext, Common.CurrentClientDateTime(Session));
                    }
                    ControlObjectContext.SaveChanges(SaveOptions.DetectChangesBeforeSave);

                    // commit transaction
                    TS.Complete();
                }
                catch (Exception ex)
                {
                    // rollback transaction
                    TS.Dispose();

                    // inform user
                    Common.InformUserOnTransactionFail(ex, Page);
                }
            }
        }
コード例 #2
0
ファイル: ClassTMSUserControl.cs プロジェクト: Quopt/TMS
 public void SaveDataIntoDataItemFromControls()
 {
     ClassCustomBinding.BindToObject("ModelTMSContainer." + SetName + "Set", KeyID, Controls, DataItem, ControlObjectContext);
 }