///<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; } }
///<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; } }
///<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; } }
///<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; } }
///<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; } }
///<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; } }
///<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; } }
///<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; } }
///<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; } }