///<Summary> ///Update ///This method updates one Staff record in the store ///</Summary> ///<returns> ///void ///</returns> ///<parameters> ///BOStaff ///</parameters> public virtual void Update() { DAOStaff daoStaff = new DAOStaff(); RegisterDataObject(daoStaff); BeginTransaction("updateBOStaff"); try { daoStaff.Id = _id; daoStaff.Name = _name; daoStaff.Designationid = _designationid; daoStaff.Departmentid = _departmentid; daoStaff.Update(); CommitTransaction(); _id = daoStaff.Id; _name = daoStaff.Name; _designationid = daoStaff.Designationid; _departmentid = daoStaff.Departmentid; _isDirty = false; } catch { RollbackTransaction("updateBOStaff"); throw; } }
///<Summary> ///AddStaff ///This method persists a BOStaff object to the database collection ///</Summary> ///<returns> ///void ///</returns> ///<parameters> ///BOStaff ///</parameters> public virtual void AddStaff(BOStaff boStaff) { DAOStaff daoStaff = new DAOStaff(); RegisterDataObject(daoStaff); BeginTransaction("addStaff"); try { daoStaff.Id = boStaff.Id; daoStaff.Name = boStaff.Name; daoStaff.Departmentid = boStaff.Departmentid; daoStaff.Designationid = _id.Value; daoStaff.Insert(); CommitTransaction(); /*pick up any primary keys, computed values etc*/ boStaff = new BOStaff(daoStaff); if (_boStaffCollection != null) { _boStaffCollection.Add(boStaff); } } catch { RollbackTransaction("addStaff"); throw; } }
///<Summary> ///StaffCollectionCount ///This method returns the collection count of BOStaff objects ///</Summary> ///<returns> ///Int32 ///</returns> ///<parameters> /// ///</parameters> public static Int32 StaffCollectionCount() { try { Int32 objCount = DAOStaff.SelectAllCount(); return(objCount); } catch { throw; } }
///<Summary> ///Constructor ///This constructor initializes the business object from its respective data object ///</Summary> ///<returns> ///void ///</returns> ///<parameters> ///DAOStaff ///</parameters> protected internal BOStaff(DAOStaff daoStaff) { try { _id = daoStaff.Id; _name = daoStaff.Name; _designationid = daoStaff.Designationid; _departmentid = daoStaff.Departmentid; } catch { throw; } }
///<Summary> ///Constructor ///Constructor using primary key(s) ///</Summary> ///<returns> ///void ///</returns> ///<parameters> ///Int32 id ///</parameters> public BOStaff(Int32 id) { try { DAOStaff daoStaff = DAOStaff.SelectOne(id); _id = daoStaff.Id; _name = daoStaff.Name; _designationid = daoStaff.Designationid; _departmentid = daoStaff.Departmentid; } catch { throw; } }
///<Summary> ///StaffCollectionFromSearchFieldsCount ///This method returns the collection count of BOStaff objects, filtered by a search object ///</Summary> ///<returns> ///Int32 ///</returns> ///<parameters> /// ///</parameters> public static Int32 StaffCollectionFromSearchFieldsCount(BOStaff boStaff) { try { DAOStaff daoStaff = new DAOStaff(); daoStaff.Id = boStaff.Id; daoStaff.Name = boStaff.Name; daoStaff.Designationid = boStaff.Designationid; daoStaff.Departmentid = boStaff.Departmentid; Int32 objCount = DAOStaff.SelectAllBySearchFieldsCount(daoStaff); return(objCount); } catch { throw; } }
///<Summary> ///LoadStaffCollection ///This method loads the internal collection of BOStaff objects from storage. ///Call this if you need to ensure the collection is up-to-date (concurrency) ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void LoadStaffCollection() { try { _boStaffCollection = new List <BOStaff>(); IList <DAOStaff> daoStaffCollection = DAOStaff.SelectAllByDesignationid(_id.Value); foreach (DAOStaff daoStaff in daoStaffCollection) { _boStaffCollection.Add(new BOStaff(daoStaff)); } } catch { throw; } }
///<Summary> ///Delete ///This method deletes one Staff record from the store ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void Delete() { DAOStaff daoStaff = new DAOStaff(); RegisterDataObject(daoStaff); BeginTransaction("deleteBOStaff"); try { daoStaff.Id = _id; daoStaff.Delete(); CommitTransaction(); } catch { RollbackTransaction("deleteBOStaff"); throw; } }
///<Summary> ///StaffCollection ///This method returns the collection of BOStaff objects ///</Summary> ///<returns> ///List[BOStaff] ///</returns> ///<parameters> /// ///</parameters> public static IList <BOStaff> StaffCollection() { try { IList <BOStaff> boStaffCollection = new List <BOStaff>(); IList <DAOStaff> daoStaffCollection = DAOStaff.SelectAll(); foreach (DAOStaff daoStaff in daoStaffCollection) { boStaffCollection.Add(new BOStaff(daoStaff)); } return(boStaffCollection); } catch { throw; } }
///<Summary> ///DeleteAllStaff ///This method deletes all BOStaff objects from its collection ///</Summary> ///<returns> ///void ///</returns> ///<parameters> /// ///</parameters> public virtual void DeleteAllStaff() { RegisterDataObject(null); BeginTransaction("deleteAllStaff"); try { DAOStaff.DeleteAllByDesignationid(ConnectionProvider, _id.Value); CommitTransaction(); if (_boStaffCollection != null) { _boStaffCollection.Clear(); _boStaffCollection = null; } } catch { RollbackTransaction("deleteAllStaff"); throw; } }
///<Summary> ///StaffCollectionFromSearchFields ///This method returns the collection of BOStaff objects, filtered by a search object ///</Summary> ///<returns> ///List<BOStaff> ///</returns> ///<parameters> /// ///</parameters> public static IList <BOStaff> StaffCollectionFromSearchFields(BOStaff boStaff) { try { IList <BOStaff> boStaffCollection = new List <BOStaff>(); DAOStaff daoStaff = new DAOStaff(); daoStaff.Id = boStaff.Id; daoStaff.Name = boStaff.Name; daoStaff.Designationid = boStaff.Designationid; daoStaff.Departmentid = boStaff.Departmentid; IList <DAOStaff> daoStaffCollection = DAOStaff.SelectAllBySearchFields(daoStaff); foreach (DAOStaff resdaoStaff in daoStaffCollection) { boStaffCollection.Add(new BOStaff(resdaoStaff)); } return(boStaffCollection); } catch { throw; } }
public BUSStaff() { staffDAO = new DAOStaff(); ruleDAO = new DAORule(); }