Пример #1
0
        private void Child_Update()
        {
            if (!IsDirty)
            {
                return;
            }

            using (var dalManager = DalFactoryActionExtenderSample.GetManager())
            {
                var args = new DataPortalHookArgs();
                OnUpdatePre(args);
                var dal = dalManager.GetProvider <IOrderDetailDal>();
                using (BypassPropertyChecks)
                {
                    dal.Update(
                        OrderDetailID,
                        ProductID,
                        PurchaseUnitPrice,
                        Quantity
                        );
                }

                OnUpdatePost(args);
            }
        }
Пример #2
0
 protected override void DataPortal_Update()
 {
     using (var dalManager = DalFactoryActionExtenderSample.GetManager())
     {
         var args = new DataPortalHookArgs();
         OnUpdatePre(args);
         var dal = dalManager.GetProvider <IOrderDal>();
         using (BypassPropertyChecks)
         {
             dal.Update(
                 OrderID,
                 UserName,
                 OrderNumber,
                 ReadProperty(OrderDateProperty),
                 CardType,
                 CardHolder,
                 CreditCard,
                 ExpDate
                 );
         }
         OnUpdatePost(args);
         // flushes all pending data operations
         FieldManager.UpdateChildren(this);
     }
 }
Пример #3
0
 private void Child_DeleteSelf()
 {
     using (var dalManager = DalFactoryActionExtenderSample.GetManager())
     {
         var args = new DataPortalHookArgs();
         OnDeletePre(args);
         var dal = dalManager.GetProvider <IOrderDetailDal>();
         using (BypassPropertyChecks)
         {
             dal.Delete(ReadProperty(OrderDetailIDProperty));
         }
         OnDeletePost(args);
     }
 }
Пример #4
0
        /// <summary>
        /// Loads a <see cref="Order"/> object from the database, based on given criteria.
        /// </summary>
        /// <param name="orderID">The Order ID.</param>
        protected void DataPortal_Fetch(Guid orderID)
        {
            var args = new DataPortalHookArgs(orderID);

            OnFetchPre(args);
            using (var dalManager = DalFactoryActionExtenderSample.GetManager())
            {
                var dal  = dalManager.GetProvider <IOrderDal>();
                var data = dal.Fetch(orderID);
                Fetch(data);
            }
            OnFetchPost(args);
            // check all object rules and property rules
            BusinessRules.CheckRules();
        }
Пример #5
0
 private void DataPortal_Delete(Guid orderID)
 {
     using (var dalManager = DalFactoryActionExtenderSample.GetManager())
     {
         var args = new DataPortalHookArgs();
         // flushes all pending data operations
         FieldManager.UpdateChildren(this);
         OnDeletePre(args);
         var dal = dalManager.GetProvider <IOrderDal>();
         using (BypassPropertyChecks)
         {
             dal.Delete(orderID);
         }
         OnDeletePost(args);
     }
 }
Пример #6
0
 private void Child_Insert(Order parent)
 {
     using (var dalManager = DalFactoryActionExtenderSample.GetManager())
     {
         var args = new DataPortalHookArgs();
         OnInsertPre(args);
         var dal = dalManager.GetProvider <IOrderDetailDal>();
         using (BypassPropertyChecks)
         {
             dal.Insert(
                 parent.OrderID,
                 OrderDetailID,
                 ProductID,
                 PurchaseUnitPrice,
                 Quantity
                 );
         }
         OnInsertPost(args);
     }
 }