///<summary>
        /// This method will update one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="iNVProductStockBatch" type="INVProductStockBatch">This INVProductStockBatch  will be updated in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Update(INVProductStockBatch iNVProductStockBatch)
        {
            _iNVProductStockBatch = POS.DataLayer.INVProductStockBatch.SelectOne(new POS.DataLayer.INVProductStockBatchPrimaryKey(iNVProductStockBatch.ProductStockBatchID));

            _iNVProductStockBatch.ProductStockID = iNVProductStockBatch.ProductStockID;
            _iNVProductStockBatch.BatchID        = iNVProductStockBatch.BatchID;
            _iNVProductStockBatch.Qty            = iNVProductStockBatch.Qty;

            return(_iNVProductStockBatch.Update());
        }
        /// <summary>
        /// This method will insert one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="iNVProductStockBatch" type="INVProductStockBatch">This INVProductStockBatch  will be inserted in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Insert(INVProductStockBatch iNVProductStockBatch)
        {
            _iNVProductStockBatch = new POS.DataLayer.INVProductStockBatch();
            _iNVProductStockBatch.ProductStockBatchID = iNVProductStockBatch.ProductStockBatchID;
            _iNVProductStockBatch.ProductStockID      = iNVProductStockBatch.ProductStockID;
            _iNVProductStockBatch.BatchID             = iNVProductStockBatch.BatchID;
            _iNVProductStockBatch.Qty = iNVProductStockBatch.Qty;

            return(_iNVProductStockBatch.Insert());
        }
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="INVProductStockBatchPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class INVProductStockBatch</returns>
		public INVProductStockBatch SelectOne(INVProductStockBatchPrimaryKey pk)
		{
			_iNVProductStockBatchWCF = new INVProductStockBatch();
			_iNVProductStockBatch = POS.DataLayer.INVProductStockBatchBase.SelectOne(new POS.DataLayer.INVProductStockBatchPrimaryKey(pk.ProductStockBatchID));
			
				_iNVProductStockBatchWCF.ProductStockBatchID = _iNVProductStockBatch.ProductStockBatchID;
				_iNVProductStockBatchWCF.ProductStockID = _iNVProductStockBatch.ProductStockID;
				_iNVProductStockBatchWCF.BatchID = _iNVProductStockBatch.BatchID;
				_iNVProductStockBatchWCF.Qty = _iNVProductStockBatch.Qty;
				
			return _iNVProductStockBatchWCF;
		}
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="INVProductStockBatchPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class INVProductStockBatch</returns>
        public INVProductStockBatch SelectOne(INVProductStockBatchPrimaryKey pk)
        {
            _iNVProductStockBatchWCF = new INVProductStockBatch();
            _iNVProductStockBatch    = POS.DataLayer.INVProductStockBatchBase.SelectOne(new POS.DataLayer.INVProductStockBatchPrimaryKey(pk.ProductStockBatchID));

            _iNVProductStockBatchWCF.ProductStockBatchID = _iNVProductStockBatch.ProductStockBatchID;
            _iNVProductStockBatchWCF.ProductStockID      = _iNVProductStockBatch.ProductStockID;
            _iNVProductStockBatchWCF.BatchID             = _iNVProductStockBatch.BatchID;
            _iNVProductStockBatchWCF.Qty = _iNVProductStockBatch.Qty;

            return(_iNVProductStockBatchWCF);
        }
		/// <summary>
		/// This method will return a list of objects representing all records in the table.
		/// </summary>
		///
		/// <returns>list of objects of class INVProductStockBatch in the form of object of INVProductStockBatchCollection </returns>
		public INVProductStockBatchCollection SelectAll()
		{
			INVProductStockBatchCollection iNVProductStockBatchCollection = new INVProductStockBatchCollection();
			foreach (POS.DataLayer.INVProductStockBatch _iNVProductStockBatch in POS.DataLayer.INVProductStockBatchBase.SelectAll())
			{
				_iNVProductStockBatchWCF = new INVProductStockBatch();
				
				_iNVProductStockBatchWCF.ProductStockBatchID = _iNVProductStockBatch.ProductStockBatchID;
				_iNVProductStockBatchWCF.ProductStockID = _iNVProductStockBatch.ProductStockID;
				_iNVProductStockBatchWCF.BatchID = _iNVProductStockBatch.BatchID;
				_iNVProductStockBatchWCF.Qty = _iNVProductStockBatch.Qty;
				
				iNVProductStockBatchCollection.Add(_iNVProductStockBatchWCF);
			}
			return iNVProductStockBatchCollection;
		}
Example #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 INVProductStockBatchCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:10 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static INVProductStockBatchCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper)
        {
            INVProductStockBatchCollection list = new INVProductStockBatchCollection();

            if (rdr.Read())
            {
                INVProductStockBatch obj = new INVProductStockBatch();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
                while (rdr.Read())
                {
                    obj = new INVProductStockBatch();
                    PopulateObjectFromReader(obj, rdr);
                    list.Add(obj);
                }
                oDatabaseHelper.Dispose();
                return(list);
            }
            else
            {
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
		/// <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 INVProductStockBatchCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 2:37:14 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static INVProductStockBatchCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) 
		{

			INVProductStockBatchCollection list = new INVProductStockBatchCollection();
			
            if (rdr.Read())
			{
				INVProductStockBatch obj = new INVProductStockBatch();
				PopulateObjectFromReader(obj, rdr);
				list.Add(obj);
				while (rdr.Read())
				{
					obj = new INVProductStockBatch();
					PopulateObjectFromReader(obj, rdr);
					list.Add(obj);
				}
				oDatabaseHelper.Dispose();
				return list;
			}
			else
			{
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
		/// <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 INVProductStockBatchCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 2:37:14 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static INVProductStockBatchCollection PopulateObjectsFromReader(IDataReader rdr) 
		{
			INVProductStockBatchCollection list = new INVProductStockBatchCollection();
			
			while (rdr.Read())
			{
				INVProductStockBatch obj = new INVProductStockBatch();
				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="INVProductStockBatchPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class INVProductStockBatch</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 2:37:14 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static INVProductStockBatch SelectOne(INVProductStockBatchPrimaryKey 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_INVProductStockBatch_SelectbyPrimaryKey", ref ExecutionState);
			if (dr.Read())
			{
				INVProductStockBatch obj=new INVProductStockBatch();	
				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="iNVProductStockBatch" type="INVProductStockBatch">This INVProductStockBatch  will be updated in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Update(INVProductStockBatch iNVProductStockBatch)
		{
			_iNVProductStockBatch=POS.DataLayer.INVProductStockBatch.SelectOne(new POS.DataLayer.INVProductStockBatchPrimaryKey(iNVProductStockBatch.ProductStockBatchID));
			
			_iNVProductStockBatch.ProductStockID=iNVProductStockBatch.ProductStockID;
			_iNVProductStockBatch.BatchID=iNVProductStockBatch.BatchID;
			_iNVProductStockBatch.Qty=iNVProductStockBatch.Qty;
			
			return _iNVProductStockBatch.Update();
		}
		/// <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 INVProductStockBatch</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 INVProductStockBatch in the form of an object of class INVProductStockBatchCollection</returns>
		public INVProductStockBatchCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement)
		{
			INVProductStockBatchCollection iNVProductStockBatchCollection = new INVProductStockBatchCollection();
			foreach (POS.DataLayer.INVProductStockBatch _iNVProductStockBatch in POS.DataLayer.INVProductStockBatchBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement))
			{
				_iNVProductStockBatchWCF = new INVProductStockBatch();
				
				_iNVProductStockBatchWCF.ProductStockBatchID = _iNVProductStockBatch.ProductStockBatchID;
				_iNVProductStockBatchWCF.ProductStockID = _iNVProductStockBatch.ProductStockID;
				_iNVProductStockBatchWCF.BatchID = _iNVProductStockBatch.BatchID;
				_iNVProductStockBatchWCF.Qty = _iNVProductStockBatch.Qty;
				
				iNVProductStockBatchCollection.Add(_iNVProductStockBatchWCF);
			}
			return iNVProductStockBatchCollection;
		}
		/// <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 INVProductStockBatch in the form of an object of class INVProductStockBatchCollection </returns>
		public INVProductStockBatchCollection SelectAllPaged(int? pageSize, int? skipPages, string orderByStatement)
		{
			INVProductStockBatchCollection iNVProductStockBatchCollection = new INVProductStockBatchCollection();
			foreach (POS.DataLayer.INVProductStockBatch _iNVProductStockBatch in POS.DataLayer.INVProductStockBatchBase.SelectAllPaged(pageSize, skipPages, orderByStatement))
			{
				_iNVProductStockBatchWCF = new INVProductStockBatch();
				
				_iNVProductStockBatchWCF.ProductStockBatchID = _iNVProductStockBatch.ProductStockBatchID;
				_iNVProductStockBatchWCF.ProductStockID = _iNVProductStockBatch.ProductStockID;
				_iNVProductStockBatchWCF.BatchID = _iNVProductStockBatch.BatchID;
				_iNVProductStockBatchWCF.Qty = _iNVProductStockBatch.Qty;
				
				iNVProductStockBatchCollection.Add(_iNVProductStockBatchWCF);
			}
			return iNVProductStockBatchCollection;
		}
		/// <summary>
		/// This method will insert one new row into the database using the property Information
		/// </summary>
		///
		/// <param name="iNVProductStockBatch" type="INVProductStockBatch">This INVProductStockBatch  will be inserted in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Insert(INVProductStockBatch iNVProductStockBatch)
		{
			_iNVProductStockBatch = new POS.DataLayer.INVProductStockBatch();
			_iNVProductStockBatch.ProductStockBatchID=iNVProductStockBatch.ProductStockBatchID;
			_iNVProductStockBatch.ProductStockID=iNVProductStockBatch.ProductStockID;
			_iNVProductStockBatch.BatchID=iNVProductStockBatch.BatchID;
			_iNVProductStockBatch.Qty=iNVProductStockBatch.Qty;
			
			return _iNVProductStockBatch.Insert();
		}
		/// <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 INVProductStockBatch</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 INVProductStockBatch in the form of an object of class INVProductStockBatchCollection</returns>
		public INVProductStockBatchCollection SelectByField(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation)
		{
			INVProductStockBatchCollection iNVProductStockBatchCollection = new INVProductStockBatchCollection();
			foreach (POS.DataLayer.INVProductStockBatch _iNVProductStockBatch in POS.DataLayer.INVProductStockBatchBase.SelectByField(field, fieldValue, fieldValue2, typeOperation))
			{
				_iNVProductStockBatchWCF = new INVProductStockBatch();
				
				_iNVProductStockBatchWCF.ProductStockBatchID = _iNVProductStockBatch.ProductStockBatchID;
				_iNVProductStockBatchWCF.ProductStockID = _iNVProductStockBatch.ProductStockID;
				_iNVProductStockBatchWCF.BatchID = _iNVProductStockBatch.BatchID;
				_iNVProductStockBatchWCF.Qty = _iNVProductStockBatch.Qty;
				
				iNVProductStockBatchCollection.Add(_iNVProductStockBatchWCF);
			}
			return iNVProductStockBatchCollection;
		}