コード例 #1
0
 ///<Summary>
 ///DepartmentCollectionCount
 ///This method returns the collection count of BODepartment objects
 ///</Summary>
 ///<returns>
 ///Int32
 ///</returns>
 ///<parameters>
 ///
 ///</parameters>
 public static Int32 DepartmentCollectionCount()
 {
     try
     {
         Int32 objCount = DAODepartment.SelectAllCount();
         return(objCount);
     }
     catch
     {
         throw;
     }
 }
コード例 #2
0
 ///<Summary>
 ///Constructor
 ///This constructor initializes the business object from its respective data object
 ///</Summary>
 ///<returns>
 ///void
 ///</returns>
 ///<parameters>
 ///DAODepartment
 ///</parameters>
 protected internal BODepartment(DAODepartment daoDepartment)
 {
     try
     {
         _id   = daoDepartment.Id;
         _name = daoDepartment.Name;
     }
     catch
     {
         throw;
     }
 }
コード例 #3
0
 ///<Summary>
 ///Constructor
 ///Constructor using primary key(s)
 ///</Summary>
 ///<returns>
 ///void
 ///</returns>
 ///<parameters>
 ///Int32 id
 ///</parameters>
 public BODepartment(Int32 id)
 {
     try
     {
         DAODepartment daoDepartment = DAODepartment.SelectOne(id);
         _id   = daoDepartment.Id;
         _name = daoDepartment.Name;
     }
     catch
     {
         throw;
     }
 }
コード例 #4
0
 ///<Summary>
 ///DepartmentCollectionFromSearchFieldsCount
 ///This method returns the collection count of BODepartment objects, filtered by a search object
 ///</Summary>
 ///<returns>
 ///Int32
 ///</returns>
 ///<parameters>
 ///
 ///</parameters>
 public static Int32 DepartmentCollectionFromSearchFieldsCount(BODepartment boDepartment)
 {
     try
     {
         DAODepartment daoDepartment = new DAODepartment();
         daoDepartment.Id   = boDepartment.Id;
         daoDepartment.Name = boDepartment.Name;
         Int32 objCount = DAODepartment.SelectAllBySearchFieldsCount(daoDepartment);
         return(objCount);
     }
     catch
     {
         throw;
     }
 }
コード例 #5
0
        ///<Summary>
        ///Delete
        ///This method deletes one Department record from the store
        ///</Summary>
        ///<returns>
        ///void
        ///</returns>
        ///<parameters>
        ///
        ///</parameters>
        public virtual void Delete()
        {
            DAODepartment daoDepartment = new DAODepartment();

            RegisterDataObject(daoDepartment);
            BeginTransaction("deleteBODepartment");
            try
            {
                daoDepartment.Id = _id;
                daoDepartment.Delete();
                CommitTransaction();
            }
            catch
            {
                RollbackTransaction("deleteBODepartment");
                throw;
            }
        }
コード例 #6
0
        ///<Summary>
        ///DepartmentCollection
        ///This method returns the collection of BODepartment objects
        ///</Summary>
        ///<returns>
        ///List[BODepartment]
        ///</returns>
        ///<parameters>
        ///
        ///</parameters>
        public static IList <BODepartment> DepartmentCollection()
        {
            try
            {
                IList <BODepartment>  boDepartmentCollection  = new List <BODepartment>();
                IList <DAODepartment> daoDepartmentCollection = DAODepartment.SelectAll();

                foreach (DAODepartment daoDepartment in daoDepartmentCollection)
                {
                    boDepartmentCollection.Add(new BODepartment(daoDepartment));
                }

                return(boDepartmentCollection);
            }
            catch
            {
                throw;
            }
        }
コード例 #7
0
        ///<Summary>
        ///DepartmentCollectionFromSearchFields
        ///This method returns the collection of BODepartment objects, filtered by a search object
        ///</Summary>
        ///<returns>
        ///List<BODepartment>
        ///</returns>
        ///<parameters>
        ///
        ///</parameters>
        public static IList <BODepartment> DepartmentCollectionFromSearchFields(BODepartment boDepartment)
        {
            try
            {
                IList <BODepartment> boDepartmentCollection = new List <BODepartment>();
                DAODepartment        daoDepartment          = new DAODepartment();
                daoDepartment.Id   = boDepartment.Id;
                daoDepartment.Name = boDepartment.Name;
                IList <DAODepartment> daoDepartmentCollection = DAODepartment.SelectAllBySearchFields(daoDepartment);

                foreach (DAODepartment resdaoDepartment in daoDepartmentCollection)
                {
                    boDepartmentCollection.Add(new BODepartment(resdaoDepartment));
                }

                return(boDepartmentCollection);
            }
            catch
            {
                throw;
            }
        }
コード例 #8
0
        ///<Summary>
        ///SaveNew
        ///This method persists a new Department record to the store
        ///</Summary>
        ///<returns>
        ///void
        ///</returns>
        ///<parameters>
        ///
        ///</parameters>
        public virtual void SaveNew()
        {
            DAODepartment daoDepartment = new DAODepartment();

            RegisterDataObject(daoDepartment);
            BeginTransaction("savenewBODepartment");
            try
            {
                daoDepartment.Name = _name;
                daoDepartment.Insert();
                CommitTransaction();

                _id      = daoDepartment.Id;
                _name    = daoDepartment.Name;
                _isDirty = false;
            }
            catch
            {
                RollbackTransaction("savenewBODepartment");
                throw;
            }
        }
コード例 #9
0
        ///<Summary>
        ///Update
        ///This method updates one Department record in the store
        ///</Summary>
        ///<returns>
        ///void
        ///</returns>
        ///<parameters>
        ///BODepartment
        ///</parameters>
        public virtual void Update()
        {
            DAODepartment daoDepartment = new DAODepartment();

            RegisterDataObject(daoDepartment);
            BeginTransaction("updateBODepartment");
            try
            {
                daoDepartment.Id   = _id;
                daoDepartment.Name = _name;
                daoDepartment.Update();
                CommitTransaction();

                _id      = daoDepartment.Id;
                _name    = daoDepartment.Name;
                _isDirty = false;
            }
            catch
            {
                RollbackTransaction("updateBODepartment");
                throw;
            }
        }