Example #1
0
        private void LoadLines(int HeaderID)
        {
            try
            {
                PURPurchaseHeaderPrimaryKey headerKey = new PURPurchaseHeaderPrimaryKey();
                headerKey.PurcaseHeaderID = HeaderID;
                PURPurchaseHeaderService headerService  = new PURPurchaseHeaderService();
                PURPurchaseHeader        selectedHeader = headerService.SelectOne(headerKey);

                PURPurchaseLineWrapper    LineService   = new PURPurchaseLineWrapper();
                PURPurchaseLineCollection selectedLines = LineService.SelectByHeaderID(HeaderID);
                LoadHeaderControls(selectedHeader);
                LoadGridLines(selectedLines);
            }
            catch (Exception ex)
            {
                MessageBox.Show("حدث خطأ برجاء تكرار العمليه مره اخرى واذا تكرر الخطا برجاءالاتصال بالشخص المصمم للبرنامج وارسال رسالة الخطا التى ستظهر بعد قليل له");
                MessageBox.Show(ex.Message);
            }
        }
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="PURPurchaseHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class PURPurchaseHeader</returns>
		public PURPurchaseHeader SelectOne(PURPurchaseHeaderPrimaryKey pk)
		{
			_pURPurchaseHeaderWCF = new PURPurchaseHeader();
			_pURPurchaseHeader = POS.DataLayer.PURPurchaseHeaderBase.SelectOne(new POS.DataLayer.PURPurchaseHeaderPrimaryKey(pk.PurcaseHeaderID));
			
				_pURPurchaseHeaderWCF.PurcaseHeaderID = _pURPurchaseHeader.PurcaseHeaderID;
				_pURPurchaseHeaderWCF.PurchaseDate = _pURPurchaseHeader.PurchaseDate;
				_pURPurchaseHeaderWCF.PaymentTypeID = _pURPurchaseHeader.PaymentTypeID;
				_pURPurchaseHeaderWCF.SupplierID = _pURPurchaseHeader.SupplierID;
				_pURPurchaseHeaderWCF.InvoiceNumber = _pURPurchaseHeader.InvoiceNumber;
				_pURPurchaseHeaderWCF.CreateDate = _pURPurchaseHeader.CreateDate;
				_pURPurchaseHeaderWCF.CreatedBy = _pURPurchaseHeader.CreatedBy;
				_pURPurchaseHeaderWCF.updateDate = _pURPurchaseHeader.updateDate;
				_pURPurchaseHeaderWCF.UpdatedBy = _pURPurchaseHeader.UpdatedBy;
				_pURPurchaseHeaderWCF.IsDeleted = _pURPurchaseHeader.IsDeleted;
				_pURPurchaseHeaderWCF.DeleteDate = _pURPurchaseHeader.DeleteDate;
				_pURPurchaseHeaderWCF.TotalPrice = _pURPurchaseHeader.TotalPrice;
				_pURPurchaseHeaderWCF.ServicePrice = _pURPurchaseHeader.ServicePrice;
				_pURPurchaseHeaderWCF.PaidAmount = _pURPurchaseHeader.PaidAmount;
				_pURPurchaseHeaderWCF.IsClosed = _pURPurchaseHeader.IsClosed;
				_pURPurchaseHeaderWCF.IsVoid = _pURPurchaseHeader.IsVoid;
				_pURPurchaseHeaderWCF.IsPrinted = _pURPurchaseHeader.IsPrinted;
				_pURPurchaseHeaderWCF.RefuseReasonID = _pURPurchaseHeader.RefuseReasonID;
				_pURPurchaseHeaderWCF.TotalDiscountAmount = _pURPurchaseHeader.TotalDiscountAmount;
				_pURPurchaseHeaderWCF.TotalDiscountRatio = _pURPurchaseHeader.TotalDiscountRatio;
				_pURPurchaseHeaderWCF.TaxTypeID = _pURPurchaseHeader.TaxTypeID;
				_pURPurchaseHeaderWCF.RemainingAmount = _pURPurchaseHeader.RemainingAmount;
				_pURPurchaseHeaderWCF.LastDayToPay = _pURPurchaseHeader.LastDayToPay;
				_pURPurchaseHeaderWCF.DeletedBy = _pURPurchaseHeader.DeletedBy;
				_pURPurchaseHeaderWCF.Notes = _pURPurchaseHeader.Notes;
				_pURPurchaseHeaderWCF.InventoryID = _pURPurchaseHeader.InventoryID;
				_pURPurchaseHeaderWCF.InvoiceDate = _pURPurchaseHeader.InvoiceDate;
				_pURPurchaseHeaderWCF.ChequeNumber = _pURPurchaseHeader.ChequeNumber;
				
			return _pURPurchaseHeaderWCF;
		}
Example #3
0
        public bool SaveAccountUpdates(BDSupplierAccount _supplierAccount)
        {
            #region select area
            PURPurchaseHeaderPrimaryKey purchaseHeaderpk = new PURPurchaseHeaderPrimaryKey();
            purchaseHeaderpk.PurcaseHeaderID = _supplierAccount.PurcaseInvoiceID;
            PURPurchaseHeader _pURPurchaseHeader = _purchaseHeaderService.SelectOne(purchaseHeaderpk);

            BDSupplierAccountPrimaryKey supplierAccountpk = new BDSupplierAccountPrimaryKey();
            supplierAccountpk.SupplierAccountId = _supplierAccount.SupplierAccountId;
            BDSupplierAccount supplierAccount = SelectOne(supplierAccountpk);
            #endregion

            #region supplier account area
            POS.DataLayer.BDSupplierAccount supplierAccountDal = new POS.DataLayer.BDSupplierAccount();
            supplierAccountDal.CreateDate        = supplierAccount.CreateDate;
            supplierAccountDal.CreatedBy         = supplierAccount.CreatedBy;
            supplierAccountDal.DeleteDate        = supplierAccount.DeleteDate;
            supplierAccountDal.DeletedBy         = supplierAccount.DeletedBy;
            supplierAccountDal.InvoiceNumber     = supplierAccount.InvoiceNumber;
            supplierAccountDal.IsDeleted         = supplierAccount.IsDeleted;
            supplierAccountDal.IsVoid            = supplierAccount.IsVoid;
            supplierAccountDal.PurcaseInvoiceID  = supplierAccount.PurcaseInvoiceID;
            supplierAccountDal.PurchaseDate      = supplierAccount.PurchaseDate;
            supplierAccountDal.SupplierAccountId = supplierAccount.SupplierAccountId;
            supplierAccountDal.SupplierID        = supplierAccount.SupplierID;
            supplierAccountDal.updateDate        = supplierAccount.updateDate;
            supplierAccountDal.UpdatedBy         = supplierAccount.UpdatedBy;
            ////////// Updated area
            supplierAccountDal.PaidAmount      = _supplierAccount.PaidAmount;
            supplierAccountDal.RemainingAmount = _supplierAccount.RemainingAmount;
            supplierAccountDal.TotalPrice      = _supplierAccount.TotalPrice;
            #endregion

            #region purchase area

            POS.DataLayer.PURPurchaseHeader _purchaseHeaderDAL = new POS.DataLayer.PURPurchaseHeader();
            _purchaseHeaderDAL.PurcaseHeaderID     = _pURPurchaseHeader.PurcaseHeaderID;
            _purchaseHeaderDAL.PurchaseDate        = _pURPurchaseHeader.PurchaseDate;
            _purchaseHeaderDAL.SupplierID          = _pURPurchaseHeader.SupplierID;
            _purchaseHeaderDAL.SupplierName        = _pURPurchaseHeader.SupplierName;
            _purchaseHeaderDAL.InvoiceNumber       = _pURPurchaseHeader.InvoiceNumber;
            _purchaseHeaderDAL.InvoiceDate         = _pURPurchaseHeader.InvoiceDate;
            _purchaseHeaderDAL.PaymentTypeID       = _pURPurchaseHeader.PaymentTypeID;
            _purchaseHeaderDAL.LastDayToPay        = _pURPurchaseHeader.LastDayToPay;
            _purchaseHeaderDAL.TotalDiscountAmount = _pURPurchaseHeader.TotalDiscountAmount;
            _purchaseHeaderDAL.TotalDiscountRatio  = _pURPurchaseHeader.TotalDiscountRatio;
            _purchaseHeaderDAL.IsClosed            = _pURPurchaseHeader.IsClosed;
            _purchaseHeaderDAL.IsVoid         = _pURPurchaseHeader.IsVoid;
            _purchaseHeaderDAL.IsPrinted      = _pURPurchaseHeader.IsPrinted;
            _purchaseHeaderDAL.ServicePrice   = _pURPurchaseHeader.ServicePrice;
            _purchaseHeaderDAL.TaxTypeID      = _pURPurchaseHeader.TaxTypeID;
            _purchaseHeaderDAL.RefuseReasonID = _pURPurchaseHeader.RefuseReasonID;
            _purchaseHeaderDAL.CreatedBy      = _pURPurchaseHeader.CreatedBy;
            _purchaseHeaderDAL.CreateDate     = _pURPurchaseHeader.CreateDate;
            _purchaseHeaderDAL.UpdatedBy      = _pURPurchaseHeader.UpdatedBy;
            _purchaseHeaderDAL.updateDate     = _pURPurchaseHeader.updateDate;
            _purchaseHeaderDAL.IsDeleted      = _pURPurchaseHeader.IsDeleted;
            _purchaseHeaderDAL.DeletedBy      = _pURPurchaseHeader.DeletedBy;
            _purchaseHeaderDAL.DeleteDate     = _pURPurchaseHeader.DeleteDate;
            ///////////// updated area
            _purchaseHeaderDAL.TotalPrice      = _supplierAccount.TotalPrice;
            _purchaseHeaderDAL.PaidAmount      = _supplierAccount.PaidAmount;
            _purchaseHeaderDAL.RemainingAmount = _supplierAccount.RemainingAmount;
            #endregion

            POS.DataLayer.BDSupplierAccount supplierAccountObj = new DataLayer.BDSupplierAccount();
            return(supplierAccountObj.SaveAccountUpdates(_purchaseHeaderDAL, supplierAccountDal));
        }
		/// <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="PURPurchaseHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		/// <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>object of class PURPurchaseLineCollection</returns>
		public PURPurchaseLineCollection SelectAllByForeignKeyPurchaseHeaderIDPaged(PURPurchaseHeaderPrimaryKey pk, int pageSize, int skipPages, string orderByStatement)
		{
			PURPurchaseLineCollection pURPurchaseLineCollection=new PURPurchaseLineCollection();
			foreach (POS.DataLayer.PURPurchaseLine _pURPurchaseLine in POS.DataLayer.PURPurchaseLineBase.SelectAllByForeignKeyPurchaseHeaderIDPaged(new POS.DataLayer.PURPurchaseHeaderPrimaryKey(pk.PurcaseHeaderID), pageSize, skipPages, orderByStatement))
			{
				_pURPurchaseLineWCF = new PURPurchaseLine();
				_pURPurchaseLineWCF.PurchaseLineID = _pURPurchaseLine.PurchaseLineID;
				_pURPurchaseLineWCF.PurchaseHeaderID = _pURPurchaseLine.PurchaseHeaderID;
				_pURPurchaseLineWCF.ProductID = _pURPurchaseLine.ProductID;
				_pURPurchaseLineWCF.TotalQty = _pURPurchaseLine.TotalQty;
				_pURPurchaseLineWCF.BonusQty = _pURPurchaseLine.BonusQty;
				_pURPurchaseLineWCF.DiscountRatio = _pURPurchaseLine.DiscountRatio;
				_pURPurchaseLineWCF.DiscountAmount = _pURPurchaseLine.DiscountAmount;
				_pURPurchaseLineWCF.Unitprice = _pURPurchaseLine.Unitprice;
				_pURPurchaseLineWCF.CreatedDate = _pURPurchaseLine.CreatedDate;
				_pURPurchaseLineWCF.CreatedBy = _pURPurchaseLine.CreatedBy;
				_pURPurchaseLineWCF.UpdateDate = _pURPurchaseLine.UpdateDate;
				_pURPurchaseLineWCF.UpdatedBy = _pURPurchaseLine.UpdatedBy;
				_pURPurchaseLineWCF.IsDeleted = _pURPurchaseLine.IsDeleted;
				_pURPurchaseLineWCF.DeleteDate = _pURPurchaseLine.DeleteDate;
				_pURPurchaseLineWCF.DeletedBy = _pURPurchaseLine.DeletedBy;
				
				pURPurchaseLineCollection.Add(_pURPurchaseLineWCF);
			}
			return pURPurchaseLineCollection;
		}
		/// <summary>
		/// This method will delete 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="PURPurchaseHeaderPrimaryKey">Primary Key information based on which data is to be deleted.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool DeleteAllByForeignKeyPurchaseHeaderID(PURPurchaseHeaderPrimaryKey pk)
		{
			return POS.DataLayer.PURPurchaseLineBase.DeleteAllByForeignKeyPurchaseHeaderID(new POS.DataLayer.PURPurchaseHeaderPrimaryKey(pk.PurcaseHeaderID));
		}
		/// <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="PURPurchaseHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		/// <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>object of class BDSupplierAccountCollection</returns>
		public BDSupplierAccountCollection SelectAllByForeignKeyPurcaseInvoiceIDPaged(PURPurchaseHeaderPrimaryKey pk, int pageSize, int skipPages, string orderByStatement)
		{
			BDSupplierAccountCollection bDSupplierAccountCollection=new BDSupplierAccountCollection();
			foreach (POS.DataLayer.BDSupplierAccount _bDSupplierAccount in POS.DataLayer.BDSupplierAccountBase.SelectAllByForeignKeyPurcaseInvoiceIDPaged(new POS.DataLayer.PURPurchaseHeaderPrimaryKey(pk.PurcaseHeaderID), pageSize, skipPages, orderByStatement))
			{
				_bDSupplierAccountWCF = new BDSupplierAccount();
				_bDSupplierAccountWCF.SupplierAccountId = _bDSupplierAccount.SupplierAccountId;
				_bDSupplierAccountWCF.PurcaseInvoiceID = _bDSupplierAccount.PurcaseInvoiceID;
				_bDSupplierAccountWCF.PurchaseDate = _bDSupplierAccount.PurchaseDate;
				_bDSupplierAccountWCF.SupplierID = _bDSupplierAccount.SupplierID;
				_bDSupplierAccountWCF.InvoiceNumber = _bDSupplierAccount.InvoiceNumber;
				_bDSupplierAccountWCF.TotalPrice = _bDSupplierAccount.TotalPrice;
				_bDSupplierAccountWCF.PaidAmount = _bDSupplierAccount.PaidAmount;
				_bDSupplierAccountWCF.IsVoid = _bDSupplierAccount.IsVoid;
				_bDSupplierAccountWCF.RemainingAmount = _bDSupplierAccount.RemainingAmount;
				_bDSupplierAccountWCF.CreateDate = _bDSupplierAccount.CreateDate;
				_bDSupplierAccountWCF.CreatedBy = _bDSupplierAccount.CreatedBy;
				_bDSupplierAccountWCF.updateDate = _bDSupplierAccount.updateDate;
				_bDSupplierAccountWCF.UpdatedBy = _bDSupplierAccount.UpdatedBy;
				_bDSupplierAccountWCF.IsDeleted = _bDSupplierAccount.IsDeleted;
				_bDSupplierAccountWCF.DeleteDate = _bDSupplierAccount.DeleteDate;
				_bDSupplierAccountWCF.DeletedBy = _bDSupplierAccount.DeletedBy;
				_bDSupplierAccountWCF.Depit = _bDSupplierAccount.Depit;
				_bDSupplierAccountWCF.Credit = _bDSupplierAccount.Credit;
				_bDSupplierAccountWCF.LstDayToPay = _bDSupplierAccount.LstDayToPay;
				_bDSupplierAccountWCF.ChequeNumber = _bDSupplierAccount.ChequeNumber;
				_bDSupplierAccountWCF.InvoiceType = _bDSupplierAccount.InvoiceType;
				
				bDSupplierAccountCollection.Add(_bDSupplierAccountWCF);
			}
			return bDSupplierAccountCollection;
		}
			/// <summary>
		/// This method will delete 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="PURPurchaseHeaderPrimaryKey">Primary Key information based on which data is to be deleted.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool DeleteAllByForeignKeyPurcaseInvoiceID(PURPurchaseHeaderPrimaryKey pk)
		{
			return POS.DataLayer.BDSupplierAccountBase.DeleteAllByForeignKeyPurcaseInvoiceID(new POS.DataLayer.PURPurchaseHeaderPrimaryKey(pk.PurcaseHeaderID));
		}
        public bool SaveAccountUpdates( BDSupplierAccount _supplierAccount)
        {
            #region select area
            PURPurchaseHeaderPrimaryKey purchaseHeaderpk = new PURPurchaseHeaderPrimaryKey();
            purchaseHeaderpk.PurcaseHeaderID = _supplierAccount.PurcaseInvoiceID;
            PURPurchaseHeader _pURPurchaseHeader = _purchaseHeaderService.SelectOne(purchaseHeaderpk);

            BDSupplierAccountPrimaryKey supplierAccountpk = new BDSupplierAccountPrimaryKey();
            supplierAccountpk.SupplierAccountId = _supplierAccount.SupplierAccountId;
            BDSupplierAccount supplierAccount = SelectOne(supplierAccountpk);
            #endregion

            #region supplier account area
            POS.DataLayer.BDSupplierAccount supplierAccountDal = new POS.DataLayer.BDSupplierAccount();
            supplierAccountDal.CreateDate = supplierAccount.CreateDate ;
            supplierAccountDal.CreatedBy = supplierAccount.CreatedBy ;
            supplierAccountDal.DeleteDate = supplierAccount.DeleteDate ;
            supplierAccountDal.DeletedBy = supplierAccount.DeletedBy ;
            supplierAccountDal.InvoiceNumber = supplierAccount.InvoiceNumber ;
            supplierAccountDal.IsDeleted = supplierAccount.IsDeleted ;
            supplierAccountDal.IsVoid = supplierAccount.IsVoid ;
            supplierAccountDal.PurcaseInvoiceID = supplierAccount.PurcaseInvoiceID ;
            supplierAccountDal.PurchaseDate = supplierAccount.PurchaseDate ;
            supplierAccountDal.SupplierAccountId = supplierAccount.SupplierAccountId ;
            supplierAccountDal.SupplierID = supplierAccount.SupplierID ;
            supplierAccountDal.updateDate = supplierAccount.updateDate;
            supplierAccountDal.UpdatedBy = supplierAccount.UpdatedBy;
            ////////// Updated area
            supplierAccountDal.PaidAmount = _supplierAccount.PaidAmount;
            supplierAccountDal.RemainingAmount = _supplierAccount.RemainingAmount;
            supplierAccountDal.TotalPrice = _supplierAccount.TotalPrice;
            #endregion

            #region purchase area

            POS.DataLayer.PURPurchaseHeader _purchaseHeaderDAL = new POS.DataLayer.PURPurchaseHeader();
            _purchaseHeaderDAL.PurcaseHeaderID = _pURPurchaseHeader.PurcaseHeaderID;
            _purchaseHeaderDAL.PurchaseDate = _pURPurchaseHeader.PurchaseDate;
            _purchaseHeaderDAL.SupplierID = _pURPurchaseHeader.SupplierID;
            _purchaseHeaderDAL.SupplierName = _pURPurchaseHeader.SupplierName;
            _purchaseHeaderDAL.InvoiceNumber = _pURPurchaseHeader.InvoiceNumber;
            _purchaseHeaderDAL.InvoiceDate = _pURPurchaseHeader.InvoiceDate;
            _purchaseHeaderDAL.PaymentTypeID = _pURPurchaseHeader.PaymentTypeID;
            _purchaseHeaderDAL.LastDayToPay = _pURPurchaseHeader.LastDayToPay;
            _purchaseHeaderDAL.TotalDiscountAmount = _pURPurchaseHeader.TotalDiscountAmount;
            _purchaseHeaderDAL.TotalDiscountRatio = _pURPurchaseHeader.TotalDiscountRatio;
            _purchaseHeaderDAL.IsClosed = _pURPurchaseHeader.IsClosed;
            _purchaseHeaderDAL.IsVoid = _pURPurchaseHeader.IsVoid;
            _purchaseHeaderDAL.IsPrinted = _pURPurchaseHeader.IsPrinted;
            _purchaseHeaderDAL.ServicePrice = _pURPurchaseHeader.ServicePrice;
            _purchaseHeaderDAL.TaxTypeID = _pURPurchaseHeader.TaxTypeID;
            _purchaseHeaderDAL.RefuseReasonID = _pURPurchaseHeader.RefuseReasonID;
            _purchaseHeaderDAL.CreatedBy = _pURPurchaseHeader.CreatedBy;
            _purchaseHeaderDAL.CreateDate = _pURPurchaseHeader.CreateDate;
            _purchaseHeaderDAL.UpdatedBy = _pURPurchaseHeader.UpdatedBy;
            _purchaseHeaderDAL.updateDate = _pURPurchaseHeader.updateDate;
            _purchaseHeaderDAL.IsDeleted = _pURPurchaseHeader.IsDeleted;
            _purchaseHeaderDAL.DeletedBy = _pURPurchaseHeader.DeletedBy;
            _purchaseHeaderDAL.DeleteDate = _pURPurchaseHeader.DeleteDate;
            ///////////// updated area
            _purchaseHeaderDAL.TotalPrice = _supplierAccount.TotalPrice;
            _purchaseHeaderDAL.PaidAmount = _supplierAccount.PaidAmount;
            _purchaseHeaderDAL.RemainingAmount = _supplierAccount.RemainingAmount;
            #endregion

            POS.DataLayer.BDSupplierAccount supplierAccountObj = new DataLayer.BDSupplierAccount();
            return supplierAccountObj.SaveAccountUpdates(_purchaseHeaderDAL, supplierAccountDal);
        }
		/// <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="PURPurchaseHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		/// <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>object of class PURPurchaseReturnHeaderCollection</returns>
		public PURPurchaseReturnHeaderCollection SelectAllByForeignKeyOriginalHeaderIDPaged(PURPurchaseHeaderPrimaryKey pk, int pageSize, int skipPages, string orderByStatement)
		{
			PURPurchaseReturnHeaderCollection pURPurchaseReturnHeaderCollection=new PURPurchaseReturnHeaderCollection();
			foreach (POS.DataLayer.PURPurchaseReturnHeader _pURPurchaseReturnHeader in POS.DataLayer.PURPurchaseReturnHeaderBase.SelectAllByForeignKeyOriginalHeaderIDPaged(new POS.DataLayer.PURPurchaseHeaderPrimaryKey(pk.PurcaseHeaderID), pageSize, skipPages, orderByStatement))
			{
				_pURPurchaseReturnHeaderWCF = new PURPurchaseReturnHeader();
				_pURPurchaseReturnHeaderWCF.PurchaseReturnID = _pURPurchaseReturnHeader.PurchaseReturnID;
				_pURPurchaseReturnHeaderWCF.ReturnDate = _pURPurchaseReturnHeader.ReturnDate;
				_pURPurchaseReturnHeaderWCF.OriginalHeaderID = _pURPurchaseReturnHeader.OriginalHeaderID;
				_pURPurchaseReturnHeaderWCF.CreatedBy = _pURPurchaseReturnHeader.CreatedBy;
				_pURPurchaseReturnHeaderWCF.CreateDate = _pURPurchaseReturnHeader.CreateDate;
				_pURPurchaseReturnHeaderWCF.UpdatedBy = _pURPurchaseReturnHeader.UpdatedBy;
				_pURPurchaseReturnHeaderWCF.UpdateDate = _pURPurchaseReturnHeader.UpdateDate;
				_pURPurchaseReturnHeaderWCF.IsDeleted = _pURPurchaseReturnHeader.IsDeleted;
				_pURPurchaseReturnHeaderWCF.DeletedBy = _pURPurchaseReturnHeader.DeletedBy;
				_pURPurchaseReturnHeaderWCF.DeleteDate = _pURPurchaseReturnHeader.DeleteDate;
				_pURPurchaseReturnHeaderWCF.IsClosed = _pURPurchaseReturnHeader.IsClosed;
				_pURPurchaseReturnHeaderWCF.IsVoid = _pURPurchaseReturnHeader.IsVoid;
				_pURPurchaseReturnHeaderWCF.ReturnMoney = _pURPurchaseReturnHeader.ReturnMoney;
				
				pURPurchaseReturnHeaderCollection.Add(_pURPurchaseReturnHeaderWCF);
			}
			return pURPurchaseReturnHeaderCollection;
		}
		/// <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="PURPurchaseHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class PURPurchaseReturnHeaderCollection</returns>
		public PURPurchaseReturnHeaderCollection SelectAllByForeignKeyOriginalHeaderID(PURPurchaseHeaderPrimaryKey pk)
		{
			PURPurchaseReturnHeaderCollection pURPurchaseReturnHeaderCollection=new PURPurchaseReturnHeaderCollection();
			foreach (POS.DataLayer.PURPurchaseReturnHeader _pURPurchaseReturnHeader in POS.DataLayer.PURPurchaseReturnHeaderBase.SelectAllByForeignKeyOriginalHeaderID(new POS.DataLayer.PURPurchaseHeaderPrimaryKey(pk.PurcaseHeaderID)))
			{
				_pURPurchaseReturnHeaderWCF = new PURPurchaseReturnHeader();
				_pURPurchaseReturnHeaderWCF.PurchaseReturnID = _pURPurchaseReturnHeader.PurchaseReturnID;
				_pURPurchaseReturnHeaderWCF.ReturnDate = _pURPurchaseReturnHeader.ReturnDate;
				_pURPurchaseReturnHeaderWCF.OriginalHeaderID = _pURPurchaseReturnHeader.OriginalHeaderID;
				_pURPurchaseReturnHeaderWCF.CreatedBy = _pURPurchaseReturnHeader.CreatedBy;
				_pURPurchaseReturnHeaderWCF.CreateDate = _pURPurchaseReturnHeader.CreateDate;
				_pURPurchaseReturnHeaderWCF.UpdatedBy = _pURPurchaseReturnHeader.UpdatedBy;
				_pURPurchaseReturnHeaderWCF.UpdateDate = _pURPurchaseReturnHeader.UpdateDate;
				_pURPurchaseReturnHeaderWCF.IsDeleted = _pURPurchaseReturnHeader.IsDeleted;
				_pURPurchaseReturnHeaderWCF.DeletedBy = _pURPurchaseReturnHeader.DeletedBy;
				_pURPurchaseReturnHeaderWCF.DeleteDate = _pURPurchaseReturnHeader.DeleteDate;
				_pURPurchaseReturnHeaderWCF.IsClosed = _pURPurchaseReturnHeader.IsClosed;
				_pURPurchaseReturnHeaderWCF.IsVoid = _pURPurchaseReturnHeader.IsVoid;
				_pURPurchaseReturnHeaderWCF.ReturnMoney = _pURPurchaseReturnHeader.ReturnMoney;
				
				pURPurchaseReturnHeaderCollection.Add(_pURPurchaseReturnHeaderWCF);
			}
			return pURPurchaseReturnHeaderCollection;
		}
		///<summary>
		///This method will Delete the object from the database
		///</summary>
		///<param name="pk" type="PURPurchaseHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		/// <returns>True if succeeded</returns>
		public bool Delete(PURPurchaseHeaderPrimaryKey pk)
		{
			return POS.DataLayer.PURPurchaseHeaderBase.Delete(new POS.DataLayer.PURPurchaseHeaderPrimaryKey(pk.PurcaseHeaderID));
		}