Esempio n. 1
0
        ///<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;
            }
        }
Esempio n. 2
0
        ///<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;
            }
        }
Esempio n. 3
0
 ///<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;
     }
 }
Esempio n. 4
0
 ///<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;
     }
 }
Esempio n. 5
0
 ///<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;
     }
 }
Esempio n. 6
0
 ///<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;
     }
 }
Esempio n. 7
0
        ///<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;
            }
        }
Esempio n. 8
0
        ///<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;
            }
        }
Esempio n. 9
0
        ///<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;
            }
        }
Esempio n. 10
0
 ///<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;
     }
 }
Esempio n. 11
0
        ///<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;
            }
        }
Esempio n. 12
0
 public BUSStaff()
 {
     staffDAO = new DAOStaff();
     ruleDAO  = new DAORule();
 }