Beispiel #1
0
        ///<Summary>
        ///AddEmployeeTerritories
        ///This method persists a BOEmployeeTerritories object to the database collection
        ///</Summary>
        ///<returns>
        ///void
        ///</returns>
        ///<parameters>
        ///BOEmployeeTerritories
        ///</parameters>
        public virtual void AddEmployeeTerritories(IBOEmployeeTerritories boEmployeeTerritories)
        {
            Doing(this);
            IDAOEmployeeTerritories daoEmployeeTerritories = _iEmployeeTerritoriesRepository.New();

            RegisterDataObject(_iEmployeeTerritoriesRepository, _iEmployeeTerritoriesRepository.BaseData(daoEmployeeTerritories));
            BeginTransaction(_iEmployeeTerritoriesRepository, "addEmployeeTerritories");
            try
            {
                daoEmployeeTerritories.TerritoryID = boEmployeeTerritories.TerritoryID;
                daoEmployeeTerritories.EmployeeID  = _employeeID.Value;
                _iEmployeeTerritoriesRepository.Insert(daoEmployeeTerritories);
                CommitTransaction(_iEmployeeTerritoriesRepository);
                Done(this);

                /*pick up any primary keys, computed values etc*/
                boEmployeeTerritories = new BOEmployeeTerritories(daoEmployeeTerritories);
                if (_boEmployeeTerritoriesCollection != null)
                {
                    _boEmployeeTerritoriesCollection.Add(boEmployeeTerritories);
                }
            }
            catch (Exception ex)
            {
                Failed(this, ex);
                RollbackTransaction(_iEmployeeTerritoriesRepository, "addEmployeeTerritories");
                Handle(this, ex);
            }
        }
 public EmployeeTerritoriesVm(IBOEmployeeTerritories boEmployeeTerritories)
 {
     EmployeeID  = boEmployeeTerritories.EmployeeID;
     TerritoryID = boEmployeeTerritories.TerritoryID;
 }