Exemple #1
0
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="VProductPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class VProduct</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			1/13/2015 9:43:39 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static VProduct SelectOne(VProductPrimaryKey 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_VProducts_SelectbyPrimaryKey", ref ExecutionState);

            if (dr.Read())
            {
                VProduct obj = new VProduct();
                PopulateObjectFromReader(obj, dr);
                dr.Close();
                oDatabaseHelper.Dispose();
                return(obj);
            }
            else
            {
                dr.Close();
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
Exemple #2
0
		/// <summary>
		/// This method will return a list of objects representing all records in the table.
		/// </summary>
		///
		/// <returns>list of objects of class VProduct in the form of object of VProductCollection </returns>
		public VProductCollection SelectAll()
		{
			VProductCollection vProductCollection = new VProductCollection();
			foreach (POS.DataLayer.VProduct _vProduct in POS.DataLayer.VProductBase.SelectAll())
			{
				_vProductWCF = new VProduct();
				
				_vProductWCF.ProductID = _vProduct.ProductID;
				_vProductWCF.ProductName = _vProduct.ProductName;
				_vProductWCF.ProductGroupID = _vProduct.ProductGroupID;
				_vProductWCF.ProductCode = _vProduct.ProductCode;
				_vProductWCF.IsAcceptBatch = _vProduct.IsAcceptBatch;
				_vProductWCF.ProductPrice = _vProduct.ProductPrice;
				_vProductWCF.IsFixedPrice = _vProduct.IsFixedPrice;
				_vProductWCF.HasDiscount = _vProduct.HasDiscount;
				_vProductWCF.DiscountAmount = _vProduct.DiscountAmount;
				_vProductWCF.DescountRatio = _vProduct.DescountRatio;
				_vProductWCF.IsActive = _vProduct.IsActive;
				_vProductWCF.Notes = _vProduct.Notes;
				_vProductWCF.MinPrice = _vProduct.MinPrice;
				_vProductWCF.MaxPrice = _vProduct.MaxPrice;
				_vProductWCF.ProductGroupName = _vProduct.ProductGroupName;
				
				vProductCollection.Add(_vProductWCF);
			}
			return vProductCollection;
		}
Exemple #3
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 VProductCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			1/13/2015 9:43:39 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static VProductCollection PopulateObjectsFromReader(IDataReader rdr)
        {
            VProductCollection list = new VProductCollection();

            while (rdr.Read())
            {
                VProduct obj = new VProduct();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
            }
            return(list);
        }
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="VProductPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class VProduct</returns>
        public VProduct SelectOne(VProductPrimaryKey pk)
        {
            _vProductWCF = new VProduct();
            _vProduct    = POS.DataLayer.VProductBase.SelectOne(new POS.DataLayer.VProductPrimaryKey(pk.ProductID));

            _vProductWCF.ProductID        = _vProduct.ProductID;
            _vProductWCF.ProductName      = _vProduct.ProductName;
            _vProductWCF.ProductGroupID   = _vProduct.ProductGroupID;
            _vProductWCF.ProductCode      = _vProduct.ProductCode;
            _vProductWCF.IsAcceptBatch    = _vProduct.IsAcceptBatch;
            _vProductWCF.ProductPrice     = _vProduct.ProductPrice;
            _vProductWCF.IsFixedPrice     = _vProduct.IsFixedPrice;
            _vProductWCF.HasDiscount      = _vProduct.HasDiscount;
            _vProductWCF.DiscountAmount   = _vProduct.DiscountAmount;
            _vProductWCF.DescountRatio    = _vProduct.DescountRatio;
            _vProductWCF.IsActive         = _vProduct.IsActive;
            _vProductWCF.Notes            = _vProduct.Notes;
            _vProductWCF.ProductGroupName = _vProduct.ProductGroupName;
            _vProductWCF.Expr1            = _vProduct.Expr1;

            return(_vProductWCF);
        }
Exemple #5
0
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="VProductPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class VProduct</returns>
		public VProduct SelectOne(VProductPrimaryKey pk)
		{
			_vProductWCF = new VProduct();
			_vProduct = POS.DataLayer.VProductBase.SelectOne(new POS.DataLayer.VProductPrimaryKey(pk.ProductID));
			
				_vProductWCF.ProductID = _vProduct.ProductID;
				_vProductWCF.ProductName = _vProduct.ProductName;
				_vProductWCF.ProductGroupID = _vProduct.ProductGroupID;
				_vProductWCF.ProductCode = _vProduct.ProductCode;
				_vProductWCF.IsAcceptBatch = _vProduct.IsAcceptBatch;
				_vProductWCF.ProductPrice = _vProduct.ProductPrice;
				_vProductWCF.IsFixedPrice = _vProduct.IsFixedPrice;
				_vProductWCF.HasDiscount = _vProduct.HasDiscount;
				_vProductWCF.DiscountAmount = _vProduct.DiscountAmount;
				_vProductWCF.DescountRatio = _vProduct.DescountRatio;
				_vProductWCF.IsActive = _vProduct.IsActive;
				_vProductWCF.Notes = _vProduct.Notes;
				_vProductWCF.MinPrice = _vProduct.MinPrice;
				_vProductWCF.MaxPrice = _vProduct.MaxPrice;
				_vProductWCF.ProductGroupName = _vProduct.ProductGroupName;
				
			return _vProductWCF;
		}
Exemple #6
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 VProductCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			1/13/2015 9:43:39 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static VProductCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper)
        {
            VProductCollection list = new VProductCollection();

            if (rdr.Read())
            {
                VProduct obj = new VProduct();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
                while (rdr.Read())
                {
                    obj = new VProduct();
                    PopulateObjectFromReader(obj, rdr);
                    list.Add(obj);
                }
                oDatabaseHelper.Dispose();
                return(list);
            }
            else
            {
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
Exemple #7
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 VProductCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			4/25/2015 1:10:32 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static VProductCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) 
		{

			VProductCollection list = new VProductCollection();
			
            if (rdr.Read())
			{
				VProduct obj = new VProduct();
				PopulateObjectFromReader(obj, rdr);
				list.Add(obj);
				while (rdr.Read())
				{
					obj = new VProduct();
					PopulateObjectFromReader(obj, rdr);
					list.Add(obj);
				}
				oDatabaseHelper.Dispose();
				return list;
			}
			else
			{
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
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 VProductCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			4/25/2015 1:10:32 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static VProductCollection PopulateObjectsFromReader(IDataReader rdr) 
		{
			VProductCollection list = new VProductCollection();
			
			while (rdr.Read())
			{
				VProduct obj = new VProduct();
				PopulateObjectFromReader(obj,rdr);
				list.Add(obj);
			}
			return list;
			
		}
Exemple #9
0
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="VProductPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class VProduct</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			4/25/2015 1:10:32 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static VProduct SelectOne(VProductPrimaryKey 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_VProducts_SelectbyPrimaryKey", ref ExecutionState);
			if (dr.Read())
			{
				VProduct obj=new VProduct();	
				PopulateObjectFromReader(obj,dr);
				dr.Close();              
				oDatabaseHelper.Dispose();
				return obj;
			}
			else
			{
				dr.Close();
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
Exemple #10
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 VProduct</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 VProduct in the form of an object of class VProductCollection</returns>
		public VProductCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement)
		{
			VProductCollection vProductCollection = new VProductCollection();
			foreach (POS.DataLayer.VProduct _vProduct in POS.DataLayer.VProductBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement))
			{
				_vProductWCF = new VProduct();
				
				_vProductWCF.ProductID = _vProduct.ProductID;
				_vProductWCF.ProductName = _vProduct.ProductName;
				_vProductWCF.ProductGroupID = _vProduct.ProductGroupID;
				_vProductWCF.ProductCode = _vProduct.ProductCode;
				_vProductWCF.IsAcceptBatch = _vProduct.IsAcceptBatch;
				_vProductWCF.ProductPrice = _vProduct.ProductPrice;
				_vProductWCF.IsFixedPrice = _vProduct.IsFixedPrice;
				_vProductWCF.HasDiscount = _vProduct.HasDiscount;
				_vProductWCF.DiscountAmount = _vProduct.DiscountAmount;
				_vProductWCF.DescountRatio = _vProduct.DescountRatio;
				_vProductWCF.IsActive = _vProduct.IsActive;
				_vProductWCF.Notes = _vProduct.Notes;
				_vProductWCF.MinPrice = _vProduct.MinPrice;
				_vProductWCF.MaxPrice = _vProduct.MaxPrice;
				_vProductWCF.ProductGroupName = _vProduct.ProductGroupName;
				
				vProductCollection.Add(_vProductWCF);
			}
			return vProductCollection;
		}
Exemple #11
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 VProduct in the form of an object of class VProductCollection </returns>
		public VProductCollection SelectAllPaged(int? pageSize, int? skipPages, string orderByStatement)
		{
			VProductCollection vProductCollection = new VProductCollection();
			foreach (POS.DataLayer.VProduct _vProduct in POS.DataLayer.VProductBase.SelectAllPaged(pageSize, skipPages, orderByStatement))
			{
				_vProductWCF = new VProduct();
				
				_vProductWCF.ProductID = _vProduct.ProductID;
				_vProductWCF.ProductName = _vProduct.ProductName;
				_vProductWCF.ProductGroupID = _vProduct.ProductGroupID;
				_vProductWCF.ProductCode = _vProduct.ProductCode;
				_vProductWCF.IsAcceptBatch = _vProduct.IsAcceptBatch;
				_vProductWCF.ProductPrice = _vProduct.ProductPrice;
				_vProductWCF.IsFixedPrice = _vProduct.IsFixedPrice;
				_vProductWCF.HasDiscount = _vProduct.HasDiscount;
				_vProductWCF.DiscountAmount = _vProduct.DiscountAmount;
				_vProductWCF.DescountRatio = _vProduct.DescountRatio;
				_vProductWCF.IsActive = _vProduct.IsActive;
				_vProductWCF.Notes = _vProduct.Notes;
				_vProductWCF.MinPrice = _vProduct.MinPrice;
				_vProductWCF.MaxPrice = _vProduct.MaxPrice;
				_vProductWCF.ProductGroupName = _vProduct.ProductGroupName;
				
				vProductCollection.Add(_vProductWCF);
			}
			return vProductCollection;
		}