Пример #1
0
        /// <summary>
        /// This method will get row(s) from the database using the value of the field specified
        /// along with the details of the child table.
        /// </summary>
        ///
        /// <param name="pk" type="PURPurchaseLinePrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class PURPurchaseReturnLineCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			3/7/2015 2:37:26 PM				Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static PURPurchaseReturnLineCollection SelectAllByForeignKeyOriginalpurchaseLineID(PURPurchaseLinePrimaryKey pk)
        {
            DatabaseHelper oDatabaseHelper      = new DatabaseHelper();
            bool           ExecutionState       = false;
            PURPurchaseReturnLineCollection obj = null;

            // 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_PURPurchaseReturnLine_SelectAllByForeignKeyOriginalpurchaseLineID", ref ExecutionState);

            obj = new PURPurchaseReturnLineCollection();
            obj = PURPurchaseReturnLine.PopulateObjectsFromReaderWithCheckingReader(dr, oDatabaseHelper);

            dr.Close();
            oDatabaseHelper.Dispose();
            return(obj);
        }
Пример #2
0
        /// <summary>
        /// This method will get row(s) from the database using the value of the field specified
        /// along with the details of the child table.
        /// </summary>
        ///
        /// <param name="pk" type="INVBatchPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class INVBatch</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:17 PM				Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static INVBatch SelectOneWithPURPurchaseReturnLineUsingPurchaseReturnLineID(INVBatchPrimaryKey pk)
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool           ExecutionState  = false;
            INVBatch       obj             = null;

            // 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_INVBatch_SelectOneWithPURPurchaseReturnLineUsingPurchaseReturnLineID", ref ExecutionState);

            if (dr.Read())
            {
                obj = new INVBatch();
                PopulateObjectFromReader(obj, dr);

                dr.NextResult();

                //Get the child records.
                obj.PURPurchaseReturnLineCollectionUsingPurchaseReturnLineID = PURPurchaseReturnLine.PopulateObjectsFromReader(dr);
            }
            dr.Close();
            oDatabaseHelper.Dispose();
            return(obj);
        }
Пример #3
0
        /// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="PURPurchaseReturnLinePrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class PURPurchaseReturnLine</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			3/7/2015 2:37:26 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static PURPurchaseReturnLine SelectOne(PURPurchaseReturnLinePrimaryKey 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_PURPurchaseReturnLine_SelectbyPrimaryKey", ref ExecutionState);

            if (dr.Read())
            {
                PURPurchaseReturnLine obj = new PURPurchaseReturnLine();
                PopulateObjectFromReader(obj, dr);
                dr.Close();
                oDatabaseHelper.Dispose();
                return(obj);
            }
            else
            {
                dr.Close();
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
Пример #4
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 PURPurchaseReturnLineCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			3/7/2015 2:37:26 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static PURPurchaseReturnLineCollection PopulateObjectsFromReader(IDataReader rdr)
        {
            PURPurchaseReturnLineCollection list = new PURPurchaseReturnLineCollection();

            while (rdr.Read())
            {
                PURPurchaseReturnLine obj = new PURPurchaseReturnLine();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
            }
            return(list);
        }
        ///<summary>
        /// This method will update one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="pURPurchaseReturnLine" type="PURPurchaseReturnLine">This PURPurchaseReturnLine  will be updated in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Update(PURPurchaseReturnLine pURPurchaseReturnLine)
        {
            _pURPurchaseReturnLine = POS.DataLayer.PURPurchaseReturnLine.SelectOne(new POS.DataLayer.PURPurchaseReturnLinePrimaryKey(pURPurchaseReturnLine.PurchaseReturnLineID));

            _pURPurchaseReturnLine.Qty    = pURPurchaseReturnLine.Qty;
            _pURPurchaseReturnLine.Reason = pURPurchaseReturnLine.Reason;
            _pURPurchaseReturnLine.OriginalpurchaseLineID = pURPurchaseReturnLine.OriginalpurchaseLineID;
            _pURPurchaseReturnLine.BatchID     = pURPurchaseReturnLine.BatchID;
            _pURPurchaseReturnLine.BatchNumber = pURPurchaseReturnLine.BatchNumber;
            _pURPurchaseReturnLine.ExpiryDate  = pURPurchaseReturnLine.ExpiryDate;

            return(_pURPurchaseReturnLine.Update());
        }
        /// <summary>
        /// This method will insert one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="pURPurchaseReturnLine" type="PURPurchaseReturnLine">This PURPurchaseReturnLine  will be inserted in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Insert(PURPurchaseReturnLine pURPurchaseReturnLine)
        {
            _pURPurchaseReturnLine = new POS.DataLayer.PURPurchaseReturnLine();
            _pURPurchaseReturnLine.PurchaseReturnLineID = pURPurchaseReturnLine.PurchaseReturnLineID;
            _pURPurchaseReturnLine.Qty    = pURPurchaseReturnLine.Qty;
            _pURPurchaseReturnLine.Reason = pURPurchaseReturnLine.Reason;
            _pURPurchaseReturnLine.OriginalpurchaseLineID = pURPurchaseReturnLine.OriginalpurchaseLineID;
            _pURPurchaseReturnLine.BatchID     = pURPurchaseReturnLine.BatchID;
            _pURPurchaseReturnLine.BatchNumber = pURPurchaseReturnLine.BatchNumber;
            _pURPurchaseReturnLine.ExpiryDate  = pURPurchaseReturnLine.ExpiryDate;

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

            _pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
            _pURPurchaseReturnLineWCF.Qty    = _pURPurchaseReturnLine.Qty;
            _pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
            _pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
            _pURPurchaseReturnLineWCF.BatchID     = _pURPurchaseReturnLine.BatchID;
            _pURPurchaseReturnLineWCF.BatchNumber = _pURPurchaseReturnLine.BatchNumber;
            _pURPurchaseReturnLineWCF.ExpiryDate  = _pURPurchaseReturnLine.ExpiryDate;

            return(_pURPurchaseReturnLineWCF);
        }
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="PURPurchaseReturnLinePrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class PURPurchaseReturnLine</returns>
		public PURPurchaseReturnLine SelectOne(PURPurchaseReturnLinePrimaryKey pk)
		{
			_pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();
			_pURPurchaseReturnLine = POS.DataLayer.PURPurchaseReturnLineBase.SelectOne(new POS.DataLayer.PURPurchaseReturnLinePrimaryKey(pk.PurchaseReturnLineID));
			
				_pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
				_pURPurchaseReturnLineWCF.Qty = _pURPurchaseReturnLine.Qty;
				_pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
				_pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
				_pURPurchaseReturnLineWCF.BatchID = _pURPurchaseReturnLine.BatchID;
				_pURPurchaseReturnLineWCF.BatchNumber = _pURPurchaseReturnLine.BatchNumber;
				_pURPurchaseReturnLineWCF.ExpiryDate = _pURPurchaseReturnLine.ExpiryDate;
				_pURPurchaseReturnLineWCF.PurchaseReturnHeaderID = _pURPurchaseReturnLine.PurchaseReturnHeaderID;
				
			return _pURPurchaseReturnLineWCF;
		}
		/// <summary>
		/// This method will return a list of objects representing all records in the table.
		/// </summary>
		///
		/// <returns>list of objects of class PURPurchaseReturnLine in the form of object of PURPurchaseReturnLineCollection </returns>
		public PURPurchaseReturnLineCollection SelectAll()
		{
			PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection = new PURPurchaseReturnLineCollection();
			foreach (POS.DataLayer.PURPurchaseReturnLine _pURPurchaseReturnLine in POS.DataLayer.PURPurchaseReturnLineBase.SelectAll())
			{
				_pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();
				
				_pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
				_pURPurchaseReturnLineWCF.Qty = _pURPurchaseReturnLine.Qty;
				_pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
				_pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
				_pURPurchaseReturnLineWCF.BatchID = _pURPurchaseReturnLine.BatchID;
				_pURPurchaseReturnLineWCF.BatchNumber = _pURPurchaseReturnLine.BatchNumber;
				_pURPurchaseReturnLineWCF.ExpiryDate = _pURPurchaseReturnLine.ExpiryDate;
				_pURPurchaseReturnLineWCF.PurchaseReturnHeaderID = _pURPurchaseReturnLine.PurchaseReturnHeaderID;
				
				pURPurchaseReturnLineCollection.Add(_pURPurchaseReturnLineWCF);
			}
			return pURPurchaseReturnLineCollection;
		}
Пример #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 PURPurchaseReturnLineCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			3/7/2015 2:37:26 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static PURPurchaseReturnLineCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper)
        {
            PURPurchaseReturnLineCollection list = new PURPurchaseReturnLineCollection();

            if (rdr.Read())
            {
                PURPurchaseReturnLine obj = new PURPurchaseReturnLine();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
                while (rdr.Read())
                {
                    obj = new PURPurchaseReturnLine();
                    PopulateObjectFromReader(obj, rdr);
                    list.Add(obj);
                }
                oDatabaseHelper.Dispose();
                return(list);
            }
            else
            {
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
Пример #11
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 PURPurchaseReturnLineCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			11/4/2015 8:46:46 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static PURPurchaseReturnLineCollection PopulateObjectsFromReader(IDataReader rdr) 
		{
			PURPurchaseReturnLineCollection list = new PURPurchaseReturnLineCollection();
			
			while (rdr.Read())
			{
				PURPurchaseReturnLine obj = new PURPurchaseReturnLine();
				PopulateObjectFromReader(obj,rdr);
				list.Add(obj);
			}
			return list;
			
		}
Пример #12
0
        private bool InsertDetails(DatabaseHelper oDatabaseHelper, PURPurchaseReturnLine pURPurchaseReturnLine, int purchaseReturnHeaderID)
        {
            bool ExecutionState = false;
            // Pass the value of '_qty' as parameter 'Qty' of the stored procedure.
            if (pURPurchaseReturnLine.Qty != null)
                oDatabaseHelper.AddParameter("@Qty", pURPurchaseReturnLine.Qty);
            else
                oDatabaseHelper.AddParameter("@Qty", DBNull.Value);
            // Pass the value of '_reason' as parameter 'Reason' of the stored procedure.
            if (pURPurchaseReturnLine.Reason != null)
                oDatabaseHelper.AddParameter("@Reason", pURPurchaseReturnLine.Reason);
            else
                oDatabaseHelper.AddParameter("@Reason", DBNull.Value);
            // Pass the value of '_originalPurchaseLineID' as parameter 'OriginalPurchaseLineID' of the stored procedure.
            if (pURPurchaseReturnLine.OriginalpurchaseLineID != null)
                oDatabaseHelper.AddParameter("@OriginalPurchaseLineID", pURPurchaseReturnLine.OriginalpurchaseLineID);
            else
                oDatabaseHelper.AddParameter("@OriginalPurchaseLineID", DBNull.Value);
            // Pass the value of '_batchID' as parameter 'BatchID' of the stored procedure.
            if (pURPurchaseReturnLine.BatchID != null)
                oDatabaseHelper.AddParameter("@BatchID", pURPurchaseReturnLine.BatchID);
            else
                oDatabaseHelper.AddParameter("@BatchID", DBNull.Value);
            // Pass the value of '_batchNumber' as parameter 'BatchNumber' of the stored procedure.
            if (pURPurchaseReturnLine.BatchNumber != null)
                oDatabaseHelper.AddParameter("@BatchNumber", pURPurchaseReturnLine.BatchNumber);
            else
                oDatabaseHelper.AddParameter("@BatchNumber", DBNull.Value);
            // Pass the value of '_expiryDate' as parameter 'ExpiryDate' of the stored procedure.
            if (pURPurchaseReturnLine.ExpiryDate != null)
                oDatabaseHelper.AddParameter("@ExpiryDate", pURPurchaseReturnLine.ExpiryDate);
            else
                oDatabaseHelper.AddParameter("@ExpiryDate", DBNull.Value);
            // Pass the value of '_salesReturnHeaderID' as parameter 'PurchaseReturnHeaderID' of the stored procedure.
            if (purchaseReturnHeaderID != null)
                oDatabaseHelper.AddParameter("@PurchaseReturnHeaderID", purchaseReturnHeaderID);
            else
                oDatabaseHelper.AddParameter("@PurchaseReturnHeaderID", DBNull.Value);
            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
            oDatabaseHelper.ExecuteScalar("usp_PURPurchaseReturnLine_InsertCommit", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState);

            return ExecutionState;
        }
			///<summary>
		/// This method will update one new row into the database using the property Information
		/// </summary>
		///
		/// <param name="pURPurchaseReturnLine" type="PURPurchaseReturnLine">This PURPurchaseReturnLine  will be updated in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Update(PURPurchaseReturnLine pURPurchaseReturnLine)
		{
			_pURPurchaseReturnLine=POS.DataLayer.PURPurchaseReturnLine.SelectOne(new POS.DataLayer.PURPurchaseReturnLinePrimaryKey(pURPurchaseReturnLine.PurchaseReturnLineID));
			
			_pURPurchaseReturnLine.Qty=pURPurchaseReturnLine.Qty;
			_pURPurchaseReturnLine.Reason=pURPurchaseReturnLine.Reason;
			_pURPurchaseReturnLine.OriginalpurchaseLineID=pURPurchaseReturnLine.OriginalpurchaseLineID;
			_pURPurchaseReturnLine.BatchID=pURPurchaseReturnLine.BatchID;
			_pURPurchaseReturnLine.BatchNumber=pURPurchaseReturnLine.BatchNumber;
			_pURPurchaseReturnLine.ExpiryDate=pURPurchaseReturnLine.ExpiryDate;
			_pURPurchaseReturnLine.PurchaseReturnHeaderID=pURPurchaseReturnLine.PurchaseReturnHeaderID;
			
			return _pURPurchaseReturnLine.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 PURPurchaseReturnLine</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 PURPurchaseReturnLine in the form of an object of class PURPurchaseReturnLineCollection</returns>
		public PURPurchaseReturnLineCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement)
		{
			PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection = new PURPurchaseReturnLineCollection();
			foreach (POS.DataLayer.PURPurchaseReturnLine _pURPurchaseReturnLine in POS.DataLayer.PURPurchaseReturnLineBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement))
			{
				_pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();
				
				_pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
				_pURPurchaseReturnLineWCF.Qty = _pURPurchaseReturnLine.Qty;
				_pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
				_pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
				_pURPurchaseReturnLineWCF.BatchID = _pURPurchaseReturnLine.BatchID;
				_pURPurchaseReturnLineWCF.BatchNumber = _pURPurchaseReturnLine.BatchNumber;
				_pURPurchaseReturnLineWCF.ExpiryDate = _pURPurchaseReturnLine.ExpiryDate;
				_pURPurchaseReturnLineWCF.PurchaseReturnHeaderID = _pURPurchaseReturnLine.PurchaseReturnHeaderID;
				
				pURPurchaseReturnLineCollection.Add(_pURPurchaseReturnLineWCF);
			}
			return pURPurchaseReturnLineCollection;
		}
		/// <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 PURPurchaseReturnLine in the form of an object of class PURPurchaseReturnLineCollection </returns>
		public PURPurchaseReturnLineCollection SelectAllPaged(int? pageSize, int? skipPages, string orderByStatement)
		{
			PURPurchaseReturnLineCollection pURPurchaseReturnLineCollection = new PURPurchaseReturnLineCollection();
			foreach (POS.DataLayer.PURPurchaseReturnLine _pURPurchaseReturnLine in POS.DataLayer.PURPurchaseReturnLineBase.SelectAllPaged(pageSize, skipPages, orderByStatement))
			{
				_pURPurchaseReturnLineWCF = new PURPurchaseReturnLine();
				
				_pURPurchaseReturnLineWCF.PurchaseReturnLineID = _pURPurchaseReturnLine.PurchaseReturnLineID;
				_pURPurchaseReturnLineWCF.Qty = _pURPurchaseReturnLine.Qty;
				_pURPurchaseReturnLineWCF.Reason = _pURPurchaseReturnLine.Reason;
				_pURPurchaseReturnLineWCF.OriginalpurchaseLineID = _pURPurchaseReturnLine.OriginalpurchaseLineID;
				_pURPurchaseReturnLineWCF.BatchID = _pURPurchaseReturnLine.BatchID;
				_pURPurchaseReturnLineWCF.BatchNumber = _pURPurchaseReturnLine.BatchNumber;
				_pURPurchaseReturnLineWCF.ExpiryDate = _pURPurchaseReturnLine.ExpiryDate;
				_pURPurchaseReturnLineWCF.PurchaseReturnHeaderID = _pURPurchaseReturnLine.PurchaseReturnHeaderID;
				
				pURPurchaseReturnLineCollection.Add(_pURPurchaseReturnLineWCF);
			}
			return pURPurchaseReturnLineCollection;
		}
		/// <summary>
		/// This method will insert one new row into the database using the property Information
		/// </summary>
		///
		/// <param name="pURPurchaseReturnLine" type="PURPurchaseReturnLine">This PURPurchaseReturnLine  will be inserted in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Insert(PURPurchaseReturnLine pURPurchaseReturnLine)
		{
			_pURPurchaseReturnLine = new POS.DataLayer.PURPurchaseReturnLine();
			_pURPurchaseReturnLine.PurchaseReturnLineID=pURPurchaseReturnLine.PurchaseReturnLineID;
			_pURPurchaseReturnLine.Qty=pURPurchaseReturnLine.Qty;
			_pURPurchaseReturnLine.Reason=pURPurchaseReturnLine.Reason;
			_pURPurchaseReturnLine.OriginalpurchaseLineID=pURPurchaseReturnLine.OriginalpurchaseLineID;
			_pURPurchaseReturnLine.BatchID=pURPurchaseReturnLine.BatchID;
			_pURPurchaseReturnLine.BatchNumber=pURPurchaseReturnLine.BatchNumber;
			_pURPurchaseReturnLine.ExpiryDate=pURPurchaseReturnLine.ExpiryDate;
			_pURPurchaseReturnLine.PurchaseReturnHeaderID=pURPurchaseReturnLine.PurchaseReturnHeaderID;
			
			return _pURPurchaseReturnLine.Insert();
		}
Пример #17
0
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="PURPurchaseReturnLinePrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class PURPurchaseReturnLine</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			11/4/2015 8:46:46 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static PURPurchaseReturnLine SelectOne(PURPurchaseReturnLinePrimaryKey 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_PURPurchaseReturnLine_SelectbyPrimaryKey", ref ExecutionState);
			if (dr.Read())
			{
				PURPurchaseReturnLine obj=new PURPurchaseReturnLine();	
				PopulateObjectFromReader(obj,dr);
				dr.Close();              
				oDatabaseHelper.Dispose();
				return obj;
			}
			else
			{
				dr.Close();
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
Пример #18
0
        private bool InsertDetails(DatabaseHelper oDatabaseHelper, PURPurchaseReturnLine pURPurchaseReturnLine, int purchaseReturnHeaderID)
        {
            bool ExecutionState = false;

            // Pass the value of '_qty' as parameter 'Qty' of the stored procedure.
            if (pURPurchaseReturnLine.Qty != null)
            {
                oDatabaseHelper.AddParameter("@Qty", pURPurchaseReturnLine.Qty);
            }
            else
            {
                oDatabaseHelper.AddParameter("@Qty", DBNull.Value);
            }
            // Pass the value of '_reason' as parameter 'Reason' of the stored procedure.
            if (pURPurchaseReturnLine.Reason != null)
            {
                oDatabaseHelper.AddParameter("@Reason", pURPurchaseReturnLine.Reason);
            }
            else
            {
                oDatabaseHelper.AddParameter("@Reason", DBNull.Value);
            }
            // Pass the value of '_originalPurchaseLineID' as parameter 'OriginalPurchaseLineID' of the stored procedure.
            if (pURPurchaseReturnLine.OriginalpurchaseLineID != null)
            {
                oDatabaseHelper.AddParameter("@OriginalPurchaseLineID", pURPurchaseReturnLine.OriginalpurchaseLineID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@OriginalPurchaseLineID", DBNull.Value);
            }
            // Pass the value of '_batchID' as parameter 'BatchID' of the stored procedure.
            if (pURPurchaseReturnLine.BatchID != null)
            {
                oDatabaseHelper.AddParameter("@BatchID", pURPurchaseReturnLine.BatchID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@BatchID", DBNull.Value);
            }
            // Pass the value of '_batchNumber' as parameter 'BatchNumber' of the stored procedure.
            if (pURPurchaseReturnLine.BatchNumber != null)
            {
                oDatabaseHelper.AddParameter("@BatchNumber", pURPurchaseReturnLine.BatchNumber);
            }
            else
            {
                oDatabaseHelper.AddParameter("@BatchNumber", DBNull.Value);
            }
            // Pass the value of '_expiryDate' as parameter 'ExpiryDate' of the stored procedure.
            if (pURPurchaseReturnLine.ExpiryDate != null)
            {
                oDatabaseHelper.AddParameter("@ExpiryDate", pURPurchaseReturnLine.ExpiryDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@ExpiryDate", DBNull.Value);
            }
            // Pass the value of '_salesReturnHeaderID' as parameter 'PurchaseReturnHeaderID' of the stored procedure.
            if (purchaseReturnHeaderID != null)
            {
                oDatabaseHelper.AddParameter("@PurchaseReturnHeaderID", purchaseReturnHeaderID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@PurchaseReturnHeaderID", DBNull.Value);
            }
            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);
            oDatabaseHelper.ExecuteScalar("usp_PURPurchaseReturnLine_InsertCommit", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState);

            return(ExecutionState);
        }
Пример #19
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 PURPurchaseReturnLineCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			11/4/2015 8:46:46 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static PURPurchaseReturnLineCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) 
		{

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