Ejemplo n.º 1
0
        ///<Summary>
        ///SaveNew
        ///This method persists a new CustomerCustomerDemo record to the store
        ///</Summary>
        ///<returns>
        ///void
        ///</returns>
        ///<parameters>
        ///
        ///</parameters>
        public virtual void SaveNew()
        {
            Doing(this);
            IDAOCustomerCustomerDemo daoCustomerCustomerDemo = _iCustomerCustomerDemoRepository.New();

            RegisterDataObject(_iCustomerCustomerDemoRepository, _iCustomerCustomerDemoRepository.BaseData(daoCustomerCustomerDemo));
            BeginTransaction(_iCustomerCustomerDemoRepository, "savenewBOCustomerCustomerDemo");
            try
            {
                daoCustomerCustomerDemo.CustomerID     = _customerID;
                daoCustomerCustomerDemo.CustomerTypeID = _customerTypeID;
                _iCustomerCustomerDemoRepository.Insert(daoCustomerCustomerDemo);
                CommitTransaction(_iCustomerCustomerDemoRepository);
                Done(this);

                _customerID     = daoCustomerCustomerDemo.CustomerID;
                _customerTypeID = daoCustomerCustomerDemo.CustomerTypeID;
                _isDirty        = false;
            }
            catch (Exception ex)
            {
                Failed(this, ex);
                RollbackTransaction(_iCustomerCustomerDemoRepository, "savenewBOCustomerCustomerDemo");
                Handle(this, ex);
            }
        }
Ejemplo n.º 2
0
        ///<Summary>
        ///AddCustomerCustomerDemo
        ///This method persists a BOCustomerCustomerDemo object to the database collection
        ///</Summary>
        ///<returns>
        ///void
        ///</returns>
        ///<parameters>
        ///BOCustomerCustomerDemo
        ///</parameters>
        public virtual void AddCustomerCustomerDemo(IBOCustomerCustomerDemo boCustomerCustomerDemo)
        {
            Doing(this);
            IDAOCustomerCustomerDemo daoCustomerCustomerDemo = _iCustomerCustomerDemoRepository.New();

            RegisterDataObject(_iCustomerCustomerDemoRepository, _iCustomerCustomerDemoRepository.BaseData(daoCustomerCustomerDemo));
            BeginTransaction(_iCustomerCustomerDemoRepository, "addCustomerCustomerDemo");
            try
            {
                daoCustomerCustomerDemo.CustomerTypeID = boCustomerCustomerDemo.CustomerTypeID;
                daoCustomerCustomerDemo.CustomerID     = _customerID;
                _iCustomerCustomerDemoRepository.Insert(daoCustomerCustomerDemo);
                CommitTransaction(_iCustomerCustomerDemoRepository);
                Done(this);

                /*pick up any primary keys, computed values etc*/
                boCustomerCustomerDemo = new BOCustomerCustomerDemo(daoCustomerCustomerDemo);
                if (_boCustomerCustomerDemoCollection != null)
                {
                    _boCustomerCustomerDemoCollection.Add(boCustomerCustomerDemo);
                }
            }
            catch (Exception ex)
            {
                Failed(this, ex);
                RollbackTransaction(_iCustomerCustomerDemoRepository, "addCustomerCustomerDemo");
                Handle(this, ex);
            }
        }