Exemple #1
0
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="ADRolePrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class ADRole</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:02 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static ADRole SelectOne(ADRolePrimaryKey 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_ADRole_SelectbyPrimaryKey", ref ExecutionState);

            if (dr.Read())
            {
                ADRole obj = new ADRole();
                PopulateObjectFromReader(obj, dr);
                dr.Close();
                oDatabaseHelper.Dispose();
                return(obj);
            }
            else
            {
                dr.Close();
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
        ///<summary>
        /// This method will update one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="aDRole" type="ADRole">This ADRole  will be updated in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Update(ADRole aDRole)
        {
            _aDRole = POS.DataLayer.ADRole.SelectOne(new POS.DataLayer.ADRolePrimaryKey(aDRole.RoleID));

            _aDRole.RoleName = aDRole.RoleName;
            _aDRole.RolePath = aDRole.RolePath;

            return(_aDRole.Update());
        }
        /// <summary>
        /// This method will insert one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="aDRole" type="ADRole">This ADRole  will be inserted in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Insert(ADRole aDRole)
        {
            _aDRole          = new POS.DataLayer.ADRole();
            _aDRole.RoleID   = aDRole.RoleID;
            _aDRole.RoleName = aDRole.RoleName;
            _aDRole.RolePath = aDRole.RolePath;

            return(_aDRole.Insert());
        }
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="ADRolePrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class ADRole</returns>
        public ADRole SelectOne(ADRolePrimaryKey pk)
        {
            _aDRoleWCF = new ADRole();
            _aDRole    = POS.DataLayer.ADRoleBase.SelectOne(new POS.DataLayer.ADRolePrimaryKey(pk.RoleID));

            _aDRoleWCF.RoleID   = _aDRole.RoleID;
            _aDRoleWCF.RoleName = _aDRole.RoleName;
            _aDRoleWCF.RolePath = _aDRole.RolePath;

            return(_aDRoleWCF);
        }
Exemple #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 ADRoleCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:02 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static ADRoleCollection PopulateObjectsFromReader(IDataReader rdr)
        {
            ADRoleCollection list = new ADRoleCollection();

            while (rdr.Read())
            {
                ADRole obj = new ADRole();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
            }
            return(list);
        }
Exemple #6
0
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="ADRolePrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class ADRole</returns>
		public ADRole SelectOne(ADRolePrimaryKey pk)
		{
			_aDRoleWCF = new ADRole();
			_aDRole = POS.DataLayer.ADRoleBase.SelectOne(new POS.DataLayer.ADRolePrimaryKey(pk.RoleID));
			
				_aDRoleWCF.RoleID = _aDRole.RoleID;
				_aDRoleWCF.RoleName = _aDRole.RoleName;
				_aDRoleWCF.RolePath = _aDRole.RolePath;
				_aDRoleWCF.MenuButton = _aDRole.MenuButton;
				
			return _aDRoleWCF;
		}
Exemple #7
0
		/// <summary>
		/// This method will return a list of objects representing all records in the table.
		/// </summary>
		///
		/// <returns>list of objects of class ADRole in the form of object of ADRoleCollection </returns>
		public ADRoleCollection SelectAll()
		{
			ADRoleCollection aDRoleCollection = new ADRoleCollection();
			foreach (POS.DataLayer.ADRole _aDRole in POS.DataLayer.ADRoleBase.SelectAll())
			{
				_aDRoleWCF = new ADRole();
				
				_aDRoleWCF.RoleID = _aDRole.RoleID;
				_aDRoleWCF.RoleName = _aDRole.RoleName;
				_aDRoleWCF.RolePath = _aDRole.RolePath;
				_aDRoleWCF.MenuButton = _aDRole.MenuButton;
				
				aDRoleCollection.Add(_aDRoleWCF);
			}
			return aDRoleCollection;
		}
Exemple #8
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 ADRoleCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:02 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static ADRoleCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper)
        {
            ADRoleCollection list = new ADRoleCollection();

            if (rdr.Read())
            {
                ADRole obj = new ADRole();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
                while (rdr.Read())
                {
                    obj = new ADRole();
                    PopulateObjectFromReader(obj, rdr);
                    list.Add(obj);
                }
                oDatabaseHelper.Dispose();
                return(list);
            }
            else
            {
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
Exemple #9
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 ADRoleCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			5/2/2015 4:01:01 AM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static ADRoleCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) 
		{

			ADRoleCollection list = new ADRoleCollection();
			
            if (rdr.Read())
			{
				ADRole obj = new ADRole();
				PopulateObjectFromReader(obj, rdr);
				list.Add(obj);
				while (rdr.Read())
				{
					obj = new ADRole();
					PopulateObjectFromReader(obj, rdr);
					list.Add(obj);
				}
				oDatabaseHelper.Dispose();
				return list;
			}
			else
			{
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
Exemple #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 ADRoleCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			5/2/2015 4:01:01 AM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static ADRoleCollection PopulateObjectsFromReader(IDataReader rdr) 
		{
			ADRoleCollection list = new ADRoleCollection();
			
			while (rdr.Read())
			{
				ADRole obj = new ADRole();
				PopulateObjectFromReader(obj,rdr);
				list.Add(obj);
			}
			return list;
			
		}
Exemple #11
0
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="ADRolePrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class ADRole</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			5/2/2015 4:01:01 AM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static ADRole SelectOne(ADRolePrimaryKey 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_ADRole_SelectbyPrimaryKey", ref ExecutionState);
			if (dr.Read())
			{
				ADRole obj=new ADRole();	
				PopulateObjectFromReader(obj,dr);
				dr.Close();              
				oDatabaseHelper.Dispose();
				return obj;
			}
			else
			{
				dr.Close();
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
Exemple #12
0
			///<summary>
		/// This method will update one new row into the database using the property Information
		/// </summary>
		///
		/// <param name="aDRole" type="ADRole">This ADRole  will be updated in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Update(ADRole aDRole)
		{
			_aDRole=POS.DataLayer.ADRole.SelectOne(new POS.DataLayer.ADRolePrimaryKey(aDRole.RoleID));
			
			_aDRole.RoleName=aDRole.RoleName;
			_aDRole.RolePath=aDRole.RolePath;
			_aDRole.MenuButton=aDRole.MenuButton;
			
			return _aDRole.Update();
		}
Exemple #13
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 ADRole</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 ADRole in the form of an object of class ADRoleCollection</returns>
		public ADRoleCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement)
		{
			ADRoleCollection aDRoleCollection = new ADRoleCollection();
			foreach (POS.DataLayer.ADRole _aDRole in POS.DataLayer.ADRoleBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement))
			{
				_aDRoleWCF = new ADRole();
				
				_aDRoleWCF.RoleID = _aDRole.RoleID;
				_aDRoleWCF.RoleName = _aDRole.RoleName;
				_aDRoleWCF.RolePath = _aDRole.RolePath;
				_aDRoleWCF.MenuButton = _aDRole.MenuButton;
				
				aDRoleCollection.Add(_aDRoleWCF);
			}
			return aDRoleCollection;
		}
Exemple #14
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 ADRole in the form of an object of class ADRoleCollection </returns>
		public ADRoleCollection SelectAllPaged(int? pageSize, int? skipPages, string orderByStatement)
		{
			ADRoleCollection aDRoleCollection = new ADRoleCollection();
			foreach (POS.DataLayer.ADRole _aDRole in POS.DataLayer.ADRoleBase.SelectAllPaged(pageSize, skipPages, orderByStatement))
			{
				_aDRoleWCF = new ADRole();
				
				_aDRoleWCF.RoleID = _aDRole.RoleID;
				_aDRoleWCF.RoleName = _aDRole.RoleName;
				_aDRoleWCF.RolePath = _aDRole.RolePath;
				_aDRoleWCF.MenuButton = _aDRole.MenuButton;
				
				aDRoleCollection.Add(_aDRoleWCF);
			}
			return aDRoleCollection;
		}
Exemple #15
0
		/// <summary>
		/// This method will insert one new row into the database using the property Information
		/// </summary>
		///
		/// <param name="aDRole" type="ADRole">This ADRole  will be inserted in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Insert(ADRole aDRole)
		{
			_aDRole = new POS.DataLayer.ADRole();
			_aDRole.RoleID=aDRole.RoleID;
			_aDRole.RoleName=aDRole.RoleName;
			_aDRole.RolePath=aDRole.RolePath;
			_aDRole.MenuButton=aDRole.MenuButton;
			
			return _aDRole.Insert();
		}
Exemple #16
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 ADRole</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 ADRole in the form of an object of class ADRoleCollection</returns>
		public ADRoleCollection SelectByField(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation)
		{
			ADRoleCollection aDRoleCollection = new ADRoleCollection();
			foreach (POS.DataLayer.ADRole _aDRole in POS.DataLayer.ADRoleBase.SelectByField(field, fieldValue, fieldValue2, typeOperation))
			{
				_aDRoleWCF = new ADRole();
				
				_aDRoleWCF.RoleID = _aDRole.RoleID;
				_aDRoleWCF.RoleName = _aDRole.RoleName;
				_aDRoleWCF.RolePath = _aDRole.RolePath;
				_aDRoleWCF.MenuButton = _aDRole.MenuButton;
				
				aDRoleCollection.Add(_aDRoleWCF);
			}
			return aDRoleCollection;
		}