Beispiel #1
0
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="AGGroupRolePrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class AGGroupRole</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:01 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static AGGroupRole SelectOne(AGGroupRolePrimaryKey pk)
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool           ExecutionState  = false;

            // Pass the values of all key parameters to the stored procedure.
            System.Collections.Specialized.NameValueCollection nvc = pk.GetKeysAndValues();
            foreach (string key in nvc.Keys)
            {
                oDatabaseHelper.AddParameter("@" + key, nvc[key]);
            }
            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);

            IDataReader dr = oDatabaseHelper.ExecuteReader("gsp_AGGroupRole_SelectbyPrimaryKey", ref ExecutionState);

            if (dr.Read())
            {
                AGGroupRole obj = new AGGroupRole();
                PopulateObjectFromReader(obj, dr);
                dr.Close();
                oDatabaseHelper.Dispose();
                return(obj);
            }
            else
            {
                dr.Close();
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
Beispiel #2
0
        ///<summary>
        /// This method will update one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="aGGroupRole" type="AGGroupRole">This AGGroupRole  will be updated in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Update(AGGroupRole aGGroupRole)
        {
            _aGGroupRole = POS.DataLayer.AGGroupRole.SelectOne(new POS.DataLayer.AGGroupRolePrimaryKey(aGGroupRole.GroupRoleID));

            _aGGroupRole.GroupID = aGGroupRole.GroupID;
            _aGGroupRole.RoleID  = aGGroupRole.RoleID;

            return(_aGGroupRole.Update());
        }
Beispiel #3
0
        /// <summary>
        /// This method will insert one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="aGGroupRole" type="AGGroupRole">This AGGroupRole  will be inserted in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Insert(AGGroupRole aGGroupRole)
        {
            _aGGroupRole             = new POS.DataLayer.AGGroupRole();
            _aGGroupRole.GroupRoleID = aGGroupRole.GroupRoleID;
            _aGGroupRole.GroupID     = aGGroupRole.GroupID;
            _aGGroupRole.RoleID      = aGGroupRole.RoleID;

            return(_aGGroupRole.Insert());
        }
Beispiel #4
0
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="AGGroupRolePrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class AGGroupRole</returns>
        public AGGroupRole SelectOne(AGGroupRolePrimaryKey pk)
        {
            _aGGroupRoleWCF = new AGGroupRole();
            _aGGroupRole    = POS.DataLayer.AGGroupRoleBase.SelectOne(new POS.DataLayer.AGGroupRolePrimaryKey(pk.GroupRoleID));

            _aGGroupRoleWCF.GroupRoleID = _aGGroupRole.GroupRoleID;
            _aGGroupRoleWCF.GroupID     = _aGGroupRole.GroupID;
            _aGGroupRoleWCF.RoleID      = _aGGroupRole.RoleID;

            return(_aGGroupRoleWCF);
        }
Beispiel #5
0
        /// <summary>
        /// Populates the fields for multiple objects from the columns found in an open reader.
        /// </summary>
        ///
        /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param>
        ///
        /// <returns>Object of AGGroupRoleCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:01 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static AGGroupRoleCollection PopulateObjectsFromReader(IDataReader rdr)
        {
            AGGroupRoleCollection list = new AGGroupRoleCollection();

            while (rdr.Read())
            {
                AGGroupRole obj = new AGGroupRole();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
            }
            return(list);
        }
Beispiel #6
0
        /// <summary>
        /// This method will return a list of objects representing all records in the table.
        /// </summary>
        ///
        /// <returns>list of objects of class AGGroupRole in the form of object of AGGroupRoleCollection </returns>
        public AGGroupRoleCollection SelectAll()
        {
            AGGroupRoleCollection aGGroupRoleCollection = new AGGroupRoleCollection();

            foreach (POS.DataLayer.AGGroupRole _aGGroupRole in POS.DataLayer.AGGroupRoleBase.SelectAll())
            {
                _aGGroupRoleWCF = new AGGroupRole();

                _aGGroupRoleWCF.GroupRoleID = _aGGroupRole.GroupRoleID;
                _aGGroupRoleWCF.GroupID     = _aGGroupRole.GroupID;
                _aGGroupRoleWCF.RoleID      = _aGGroupRole.RoleID;

                aGGroupRoleCollection.Add(_aGGroupRoleWCF);
            }
            return(aGGroupRoleCollection);
        }
Beispiel #7
0
        /// <summary>
        /// This method will return a list of objects representing the specified number of entries from the specified record number in the table
        /// using the value of the field specified
        /// </summary>
        ///
        /// <param name="field" type="string">Field of the class AGGroupRole</param>
        /// <param name="fieldValue" type="object">Value for the field specified.</param>
        /// <param name="fieldValue2" type="object">Value for the field specified.</param>
        /// <param name="typeOperation" type="TypeOperation">Operator that is used if fieldValue2=null or fieldValue2="".</param>
        /// <param name="orderByStatement" type="string">The field value to number.</param>
        /// <param name="pageSize" type="int">Number of records returned.</param>
        /// <param name="skipPages" type="int">The number of missing pages.</param>
        ///
        /// <returns>List of object of class AGGroupRole in the form of an object of class AGGroupRoleCollection</returns>
        public AGGroupRoleCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement)
        {
            AGGroupRoleCollection aGGroupRoleCollection = new AGGroupRoleCollection();

            foreach (POS.DataLayer.AGGroupRole _aGGroupRole in POS.DataLayer.AGGroupRoleBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement))
            {
                _aGGroupRoleWCF = new AGGroupRole();

                _aGGroupRoleWCF.GroupRoleID = _aGGroupRole.GroupRoleID;
                _aGGroupRoleWCF.GroupID     = _aGGroupRole.GroupID;
                _aGGroupRoleWCF.RoleID      = _aGGroupRole.RoleID;

                aGGroupRoleCollection.Add(_aGGroupRoleWCF);
            }
            return(aGGroupRoleCollection);
        }
Beispiel #8
0
        /// <summary>
        /// This method will return a list of objects representing the specified number of entries from the specified record number in the table.
        /// </summary>
        ///
        /// <param name="pageSize" type="int">Number of records returned.</param>
        /// <param name="skipPages" type="int">The number of missing pages.</param>
        /// <param name="orderByStatement" type="string">The field value to number.</param>
        ///
        /// <returns>list of objects of class AGGroupRole in the form of an object of class AGGroupRoleCollection </returns>
        public AGGroupRoleCollection SelectAllPaged(int?pageSize, int?skipPages, string orderByStatement)
        {
            AGGroupRoleCollection aGGroupRoleCollection = new AGGroupRoleCollection();

            foreach (POS.DataLayer.AGGroupRole _aGGroupRole in POS.DataLayer.AGGroupRoleBase.SelectAllPaged(pageSize, skipPages, orderByStatement))
            {
                _aGGroupRoleWCF = new AGGroupRole();

                _aGGroupRoleWCF.GroupRoleID = _aGGroupRole.GroupRoleID;
                _aGGroupRoleWCF.GroupID     = _aGGroupRole.GroupID;
                _aGGroupRoleWCF.RoleID      = _aGGroupRole.RoleID;

                aGGroupRoleCollection.Add(_aGGroupRoleWCF);
            }
            return(aGGroupRoleCollection);
        }
Beispiel #9
0
        /// <summary>
        /// This method will get row(s) from the database using the value of the field specified
        /// </summary>
        ///
        /// <param name="field" type="string">Field of the class AGGroupRole</param>
        /// <param name="fieldValue" type="object">Value for the field specified.</param>
        /// <param name="fieldValue2" type="object">Value for the field specified.</param>
        /// <param name="typeOperation" type="TypeOperation">Operator that is used if fieldValue2=null or fieldValue2="".</param>
        ///
        /// <returns>List of object of class AGGroupRole in the form of an object of class AGGroupRoleCollection</returns>
        public AGGroupRoleCollection SelectByField(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation)
        {
            AGGroupRoleCollection aGGroupRoleCollection = new AGGroupRoleCollection();

            foreach (POS.DataLayer.AGGroupRole _aGGroupRole in POS.DataLayer.AGGroupRoleBase.SelectByField(field, fieldValue, fieldValue2, typeOperation))
            {
                _aGGroupRoleWCF = new AGGroupRole();

                _aGGroupRoleWCF.GroupRoleID = _aGGroupRole.GroupRoleID;
                _aGGroupRoleWCF.GroupID     = _aGGroupRole.GroupID;
                _aGGroupRoleWCF.RoleID      = _aGGroupRole.RoleID;

                aGGroupRoleCollection.Add(_aGGroupRoleWCF);
            }
            return(aGGroupRoleCollection);
        }
Beispiel #10
0
        /// <summary>
        /// Populates the fields for multiple objects from the columns found in an open reader.
        /// </summary>
        ///
        /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param>
        ///
        /// <returns>Object of AGGroupRoleCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:01 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static AGGroupRoleCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper)
        {
            AGGroupRoleCollection list = new AGGroupRoleCollection();

            if (rdr.Read())
            {
                AGGroupRole obj = new AGGroupRole();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
                while (rdr.Read())
                {
                    obj = new AGGroupRole();
                    PopulateObjectFromReader(obj, rdr);
                    list.Add(obj);
                }
                oDatabaseHelper.Dispose();
                return(list);
            }
            else
            {
                oDatabaseHelper.Dispose();
                return(null);
            }
        }