Ejemplo n.º 1
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;
            }
        }
Ejemplo n.º 2
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;
     }
 }
Ejemplo n.º 3
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;
            }
        }