Exemplo n.º 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="INVInventoryPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class INVInventory</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			5/3/2015 10:23:04 PM				Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static INVInventory SelectOneWithPURPurchaseHeaderUsingInventoryID(INVInventoryPrimaryKey pk)
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool           ExecutionState  = false;
            INVInventory   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_INVInventory_SelectOneWithPURPurchaseHeaderUsingInventoryID", ref ExecutionState);

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

                dr.NextResult();

                //Get the child records.
                obj.PURPurchaseHeaderCollectionUsingInventoryID = PURPurchaseHeader.PopulateObjectsFromReader(dr);
            }
            dr.Close();
            oDatabaseHelper.Dispose();
            return(obj);
        }
        /// <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;

            return(_pURPurchaseHeaderWCF);
        }
Exemplo n.º 3
0
        public bool SaveAccountUpdates(PURPurchaseHeader purchaseHeader, BDSupplierAccount supplierAccount)
        {
            oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;

            oDatabaseHelper.BeginTransaction();
            ExecutionState = UpdateSupplierAccount(oDatabaseHelper, supplierAccount, ExecutionState);
            if (!UpdatePurchaseHeader(oDatabaseHelper, purchaseHeader))
            {
                ExecutionState = false;
            }
            else
            {
                ExecutionState = true;
            }
            if (ExecutionState)
            {
                oDatabaseHelper.CommitTransaction();
            }
            else
            {
                oDatabaseHelper.RollbackTransaction();
            }
            oDatabaseHelper.Dispose();
            return(ExecutionState);
        }
        ///<summary>
        /// This method will update one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="pURPurchaseHeader" type="PURPurchaseHeader">This PURPurchaseHeader  will be updated in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Update(PURPurchaseHeader pURPurchaseHeader)
        {
            _pURPurchaseHeader = POS.DataLayer.PURPurchaseHeader.SelectOne(new POS.DataLayer.PURPurchaseHeaderPrimaryKey(pURPurchaseHeader.PurcaseHeaderID));

            _pURPurchaseHeader.PurchaseDate        = pURPurchaseHeader.PurchaseDate;
            _pURPurchaseHeader.PaymentTypeID       = pURPurchaseHeader.PaymentTypeID;
            _pURPurchaseHeader.SupplierID          = pURPurchaseHeader.SupplierID;
            _pURPurchaseHeader.InvoiceNumber       = pURPurchaseHeader.InvoiceNumber;
            _pURPurchaseHeader.CreateDate          = pURPurchaseHeader.CreateDate;
            _pURPurchaseHeader.CreatedBy           = pURPurchaseHeader.CreatedBy;
            _pURPurchaseHeader.updateDate          = pURPurchaseHeader.updateDate;
            _pURPurchaseHeader.UpdatedBy           = pURPurchaseHeader.UpdatedBy;
            _pURPurchaseHeader.IsDeleted           = pURPurchaseHeader.IsDeleted;
            _pURPurchaseHeader.DeleteDate          = pURPurchaseHeader.DeleteDate;
            _pURPurchaseHeader.TotalPrice          = pURPurchaseHeader.TotalPrice;
            _pURPurchaseHeader.ServicePrice        = pURPurchaseHeader.ServicePrice;
            _pURPurchaseHeader.PaidAmount          = pURPurchaseHeader.PaidAmount;
            _pURPurchaseHeader.IsClosed            = pURPurchaseHeader.IsClosed;
            _pURPurchaseHeader.IsVoid              = pURPurchaseHeader.IsVoid;
            _pURPurchaseHeader.IsPrinted           = pURPurchaseHeader.IsPrinted;
            _pURPurchaseHeader.RefuseReasonID      = pURPurchaseHeader.RefuseReasonID;
            _pURPurchaseHeader.TotalDiscountAmount = pURPurchaseHeader.TotalDiscountAmount;
            _pURPurchaseHeader.TotalDiscountRatio  = pURPurchaseHeader.TotalDiscountRatio;
            _pURPurchaseHeader.TaxTypeID           = pURPurchaseHeader.TaxTypeID;
            _pURPurchaseHeader.RemainingAmount     = pURPurchaseHeader.RemainingAmount;
            _pURPurchaseHeader.LastDayToPay        = pURPurchaseHeader.LastDayToPay;
            _pURPurchaseHeader.DeletedBy           = pURPurchaseHeader.DeletedBy;
            _pURPurchaseHeader.Notes       = pURPurchaseHeader.Notes;
            _pURPurchaseHeader.InventoryID = pURPurchaseHeader.InventoryID;
            _pURPurchaseHeader.InvoiceDate = pURPurchaseHeader.InvoiceDate;

            return(_pURPurchaseHeader.Update());
        }
Exemplo n.º 5
0
        public int SaveTransaction(PURPurchaseHeader pURPurchaseHeader, PURPurchaseLineCollection sALPurchaseLineCollection)
        {
            oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;
            int  salesHeaderID;

            oDatabaseHelper.BeginTransaction();
            if (InsertHeader(oDatabaseHelper, pURPurchaseHeader, out salesHeaderID))
            {
                foreach (PURPurchaseLine sALPurchaseLine in sALPurchaseLineCollection)
                {
                    if (!InsertDetails(oDatabaseHelper, sALPurchaseLine, salesHeaderID))
                    {
                        ExecutionState = false;
                        break;
                    }
                    else
                    {
                        ExecutionState = true;
                    }
                }
                if (ExecutionState)
                {
                    oDatabaseHelper.CommitTransaction();
                }
                else
                {
                    oDatabaseHelper.RollbackTransaction();
                }
            }
            return(salesHeaderID);
        }
Exemplo n.º 6
0
 public bool SaveAccountUpdates(PURPurchaseHeader purchaseHeader, BDSupplierAccount supplierAccount)
 {
     oDatabaseHelper = new DatabaseHelper();
     bool ExecutionState = false;
     oDatabaseHelper.BeginTransaction();
     ExecutionState = UpdateSupplierAccount(oDatabaseHelper, supplierAccount, ExecutionState);
     if (!UpdatePurchaseHeader(oDatabaseHelper, purchaseHeader))
     {
         ExecutionState = false;
     }
     else
         ExecutionState = true;
     if (ExecutionState)
         oDatabaseHelper.CommitTransaction();
     else
         oDatabaseHelper.RollbackTransaction();
     oDatabaseHelper.Dispose();
     return ExecutionState;
 }
Exemplo n.º 7
0
        public bool UpdateTransaction(PURPurchaseHeader pURPurchaseHeader, PURPurchaseLineCollection sALPurchaseLineCollection)
        {
            oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;

            oDatabaseHelper.BeginTransaction();
            if (UpdateHeader(oDatabaseHelper, pURPurchaseHeader))
            {
                if (DeleteDetails(oDatabaseHelper, (int)pURPurchaseHeader.PurcaseHeaderID, (int)pURPurchaseHeader.CreatedBy))
                {
                    foreach (PURPurchaseLine sALPurchaseLine in sALPurchaseLineCollection)
                    {
                        if (!InsertDetails(oDatabaseHelper, sALPurchaseLine, (int)pURPurchaseHeader.PurcaseHeaderID))
                        {
                            ExecutionState = false;
                            break;
                        }
                        else
                        {
                            ExecutionState = true;
                        }
                    }
                    if (ExecutionState)
                    {
                        oDatabaseHelper.CommitTransaction();
                    }
                    else
                    {
                        oDatabaseHelper.RollbackTransaction();
                    }
                }
                else
                {
                    ExecutionState = false;
                }
            }
            else
            {
                ExecutionState = false;
            }
            return(ExecutionState);
        }
Exemplo n.º 8
0
		/// <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;
		}
Exemplo n.º 9
0
		/// <summary>
		/// This method will insert one new row into the database using the property Information
		/// </summary>
		///
		/// <param name="pURPurchaseHeader" type="PURPurchaseHeader">This PURPurchaseHeader  will be inserted in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Insert(PURPurchaseHeader pURPurchaseHeader)
		{
			_pURPurchaseHeader = new POS.DataLayer.PURPurchaseHeader();
			_pURPurchaseHeader.PurcaseHeaderID=pURPurchaseHeader.PurcaseHeaderID;
			_pURPurchaseHeader.PurchaseDate=pURPurchaseHeader.PurchaseDate;
			_pURPurchaseHeader.PaymentTypeID=pURPurchaseHeader.PaymentTypeID;
			_pURPurchaseHeader.SupplierID=pURPurchaseHeader.SupplierID;
			_pURPurchaseHeader.InvoiceNumber=pURPurchaseHeader.InvoiceNumber;
			_pURPurchaseHeader.CreateDate=pURPurchaseHeader.CreateDate;
			_pURPurchaseHeader.CreatedBy=pURPurchaseHeader.CreatedBy;
			_pURPurchaseHeader.updateDate=pURPurchaseHeader.updateDate;
			_pURPurchaseHeader.UpdatedBy=pURPurchaseHeader.UpdatedBy;
			_pURPurchaseHeader.IsDeleted=pURPurchaseHeader.IsDeleted;
			_pURPurchaseHeader.DeleteDate=pURPurchaseHeader.DeleteDate;
			_pURPurchaseHeader.TotalPrice=pURPurchaseHeader.TotalPrice;
			_pURPurchaseHeader.ServicePrice=pURPurchaseHeader.ServicePrice;
			_pURPurchaseHeader.PaidAmount=pURPurchaseHeader.PaidAmount;
			_pURPurchaseHeader.IsClosed=pURPurchaseHeader.IsClosed;
			_pURPurchaseHeader.IsVoid=pURPurchaseHeader.IsVoid;
			_pURPurchaseHeader.IsPrinted=pURPurchaseHeader.IsPrinted;
			_pURPurchaseHeader.RefuseReasonID=pURPurchaseHeader.RefuseReasonID;
			_pURPurchaseHeader.TotalDiscountAmount=pURPurchaseHeader.TotalDiscountAmount;
			_pURPurchaseHeader.TotalDiscountRatio=pURPurchaseHeader.TotalDiscountRatio;
			_pURPurchaseHeader.TaxTypeID=pURPurchaseHeader.TaxTypeID;
			_pURPurchaseHeader.RemainingAmount=pURPurchaseHeader.RemainingAmount;
			_pURPurchaseHeader.LastDayToPay=pURPurchaseHeader.LastDayToPay;
			_pURPurchaseHeader.DeletedBy=pURPurchaseHeader.DeletedBy;
			_pURPurchaseHeader.Notes=pURPurchaseHeader.Notes;
			_pURPurchaseHeader.InventoryID=pURPurchaseHeader.InventoryID;
			_pURPurchaseHeader.InvoiceDate=pURPurchaseHeader.InvoiceDate;
			_pURPurchaseHeader.ChequeNumber=pURPurchaseHeader.ChequeNumber;
			
			return _pURPurchaseHeader.Insert();
		}
Exemplo n.º 10
0
        private static PURPurchaseHeaderCollection PopulateFromReader(IDataReader rdr)
        {
            PURPurchaseHeaderCollection pURPurchaseHeaderCollection = new PURPurchaseHeaderCollection();

            while (rdr.Read())
            {
                PURPurchaseHeader obj = new PURPurchaseHeader();
                obj.PurcaseHeaderID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.PurcaseHeaderID));
                obj.PurchaseDate    = rdr.GetDateTime(rdr.GetOrdinal(PURPurchaseHeaderFields.PurchaseDate));
                obj.SupplierID      = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.SupplierID));

                if (!rdr.IsDBNull(rdr.GetOrdinal("SupplierName")))
                {
                    obj.SupplierName = rdr.GetString(rdr.GetOrdinal("SupplierName"));
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.InvoiceNumber)))
                {
                    obj.InvoiceNumber = rdr.GetString(rdr.GetOrdinal(PURPurchaseHeaderFields.InvoiceNumber));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.InvoiceDate)))
                {
                    obj.InvoiceDate = rdr.GetDateTime(rdr.GetOrdinal(PURPurchaseHeaderFields.InvoiceDate));
                }

                // if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.SellerID)))
                // {
                //      obj.SellerID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.SellerID));
                //  }

                //if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.PaymentTypeID)))
                //{
                //    obj.PaymentTypeID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.PaymentTypeID));
                //}

                obj.TotalPrice      = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseHeaderFields.TotalPrice));
                obj.PaidAmount      = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseHeaderFields.PaidAmount));
                obj.RemainingAmount = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseHeaderFields.RemainingAmount));
                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.LastDayToPay)))
                {
                    obj.LastDayToPay = rdr.GetDateTime(rdr.GetOrdinal(PURPurchaseHeaderFields.LastDayToPay));
                }

                obj.TotalDiscountAmount = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseHeaderFields.TotalDiscountAmount));
                obj.TotalDiscountRatio  = rdr.GetDouble(rdr.GetOrdinal(PURPurchaseHeaderFields.TotalDiscountRatio));
                obj.IsClosed            = rdr.GetBoolean(rdr.GetOrdinal(PURPurchaseHeaderFields.IsClosed));
                obj.IsVoid       = rdr.GetBoolean(rdr.GetOrdinal(PURPurchaseHeaderFields.IsVoid));
                obj.IsPrinted    = rdr.GetBoolean(rdr.GetOrdinal(PURPurchaseHeaderFields.IsPrinted));
                obj.ServicePrice = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseHeaderFields.ServicePrice));
                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.TaxTypeID)))
                {
                    obj.TaxTypeID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.TaxTypeID));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.RefuseReasonID)))
                {
                    obj.RefuseReasonID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.RefuseReasonID));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.CreatedBy)))
                {
                    obj.CreatedBy = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.CreatedBy));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.CreateDate)))
                {
                    obj.CreateDate = rdr.GetDateTime(rdr.GetOrdinal(PURPurchaseHeaderFields.CreateDate));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.UpdatedBy)))
                {
                    obj.UpdatedBy = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.UpdatedBy));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.updateDate)))
                {
                    obj.updateDate = rdr.GetDateTime(rdr.GetOrdinal(PURPurchaseHeaderFields.updateDate));
                }

                obj.IsDeleted = rdr.GetBoolean(rdr.GetOrdinal(PURPurchaseHeaderFields.IsDeleted));
                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.DeletedBy)))
                {
                    obj.DeletedBy = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.DeletedBy));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.DeleteDate)))
                {
                    obj.DeleteDate = rdr.GetDateTime(rdr.GetOrdinal(PURPurchaseHeaderFields.DeleteDate));
                }
                pURPurchaseHeaderCollection.Add(obj);
            }
            return(pURPurchaseHeaderCollection);
        }
Exemplo n.º 11
0
        private bool UpdatePurchaseHeader(DatabaseHelper oDatabaseHelper, PURPurchaseHeader purchaseHeader)
        {
            bool ExecutionState = false;
            // Pass the value of '_salesHeaderID' as parameter 'PurchaseHeaderID' of the stored procedure.
            oDatabaseHelper.AddParameter("@PurcaseHeaderID", purchaseHeader.PurcaseHeaderID);
            oDatabaseHelper.AddParameter("@PurchaseDate", purchaseHeader.PurchaseDate);
            // Pass the value of '_customerID' as parameter 'SupplierID' of the stored procedure.
            if (purchaseHeader.SupplierID != null)
                oDatabaseHelper.AddParameter("@SupplierID", purchaseHeader.SupplierID);
            else
                oDatabaseHelper.AddParameter("@SupplierID", DBNull.Value);
            // Pass the value of '_invoiceNumber' as parameter 'InvoiceNumber' of the stored procedure.

            oDatabaseHelper.AddParameter("@InvoiceNumber", purchaseHeader.InvoiceNumber);


            // Pass the value of '_invoiceDate' as parameter 'Notes' of the stored procedure.
            if (purchaseHeader.Notes != null)
                oDatabaseHelper.AddParameter("@Notes", purchaseHeader.Notes);
            else
                oDatabaseHelper.AddParameter("@Notes", DBNull.Value);


            // Pass the value of '_invoiceDate' as parameter 'InventoryID' of the stored procedure.
            if (purchaseHeader.InventoryID != null)
                oDatabaseHelper.AddParameter("@InventoryID", purchaseHeader.InventoryID);
            else
                oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value);

            // Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure.
            if (purchaseHeader.InvoiceDate != null)
                oDatabaseHelper.AddParameter("@InvoiceDate", purchaseHeader.InvoiceDate);
            else
                oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value);
            // Pass the value of '_paymentTypeID' as parameter 'PaymentTypeID' of the stored procedure.
            if (purchaseHeader.PaymentTypeID != null)
                oDatabaseHelper.AddParameter("@PaymentTypeID", purchaseHeader.PaymentTypeID);
            else
                oDatabaseHelper.AddParameter("@PaymentTypeID", DBNull.Value);
            // Pass the value of '_totalPrice' as parameter 'TotalPrice' of the stored procedure.
            if (purchaseHeader.TotalPrice != null)
                oDatabaseHelper.AddParameter("@TotalPrice", purchaseHeader.TotalPrice);
            else
                oDatabaseHelper.AddParameter("@TotalPrice", DBNull.Value);
            // Pass the value of '_paidAmount' as parameter 'PaidAmount' of the stored procedure.
            if (purchaseHeader.PaidAmount != null)
                oDatabaseHelper.AddParameter("@PaidAmount", purchaseHeader.PaidAmount);
            else
                oDatabaseHelper.AddParameter("@PaidAmount", DBNull.Value);
            // Pass the value of '_remainingAmount' as parameter 'RemainingAmount' of the stored procedure.
            if (purchaseHeader.RemainingAmount != null)
                oDatabaseHelper.AddParameter("@RemainingAmount", purchaseHeader.RemainingAmount);
            else
                oDatabaseHelper.AddParameter("@RemainingAmount", DBNull.Value);
            // Pass the value of '_lastDayToPay' as parameter 'LastDayToPay' of the stored procedure.
            if (purchaseHeader.LastDayToPay != null)
                oDatabaseHelper.AddParameter("@LastDayToPay", purchaseHeader.LastDayToPay);
            else
                oDatabaseHelper.AddParameter("@LastDayToPay", DBNull.Value);
            // Pass the value of '_totalDiscountAmount' as parameter 'TotalDiscountAmount' of the stored procedure.
            if (purchaseHeader.TotalDiscountAmount != null)
                oDatabaseHelper.AddParameter("@TotalDiscountAmount", purchaseHeader.TotalDiscountAmount);
            else
                oDatabaseHelper.AddParameter("@TotalDiscountAmount", DBNull.Value);
            // Pass the value of '_totalDiscountRatio' as parameter 'TotalDiscountRatio' of the stored procedure.
            if (purchaseHeader.TotalDiscountRatio != null)
                oDatabaseHelper.AddParameter("@TotalDiscountRatio", purchaseHeader.TotalDiscountRatio);
            else
                oDatabaseHelper.AddParameter("@TotalDiscountRatio", DBNull.Value);
            // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure.
            if (purchaseHeader.IsClosed != null)
                oDatabaseHelper.AddParameter("@IsClosed", purchaseHeader.IsClosed);
            else
                oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value);
            // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure.
            if (purchaseHeader.IsVoid != null)
                oDatabaseHelper.AddParameter("@IsVoid", purchaseHeader.IsVoid);
            else
                oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value);
            // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure.
            if (purchaseHeader.IsPrinted != null)
                oDatabaseHelper.AddParameter("@IsPrinted", purchaseHeader.IsPrinted);
            else
                oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value);
            // Pass the value of '_servicePrice' as parameter 'ServicePrice' of the stored procedure.
            if (purchaseHeader.ServicePrice != null)
                oDatabaseHelper.AddParameter("@ServicePrice", purchaseHeader.ServicePrice);
            else
                oDatabaseHelper.AddParameter("@ServicePrice", DBNull.Value);
            // Pass the value of '_taxTypeID' as parameter 'TaxTypeID' of the stored procedure.
            if (purchaseHeader.TaxTypeID != null)
                oDatabaseHelper.AddParameter("@TaxTypeID", purchaseHeader.TaxTypeID);
            else
                oDatabaseHelper.AddParameter("@TaxTypeID", DBNull.Value);
            // Pass the value of '_refuseReasonID' as parameter 'RefuseReasonID' of the stored procedure.
            if (purchaseHeader.RefuseReasonID != null)
                oDatabaseHelper.AddParameter("@RefuseReasonID", purchaseHeader.RefuseReasonID);
            else
                oDatabaseHelper.AddParameter("@RefuseReasonID", DBNull.Value);
            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            if (purchaseHeader.CreatedBy != null)
                oDatabaseHelper.AddParameter("@CreatedBy", purchaseHeader.CreatedBy);
            else
                oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value);
            // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
            if (purchaseHeader.CreateDate != null)
                oDatabaseHelper.AddParameter("@CreateDate", purchaseHeader.CreateDate);
            else
                oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value);
            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            if (purchaseHeader.UpdatedBy != null)
                oDatabaseHelper.AddParameter("@UpdatedBy", purchaseHeader.UpdatedBy);
            else
                oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value);
            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            if (purchaseHeader.updateDate != null)
                oDatabaseHelper.AddParameter("@UpdateDate", purchaseHeader.updateDate);
            else
                oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value);
            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            if (purchaseHeader.IsDeleted != null)
                oDatabaseHelper.AddParameter("@IsDeleted", purchaseHeader.IsDeleted);
            else
                oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value);
            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
            if (purchaseHeader.DeletedBy != null)
                oDatabaseHelper.AddParameter("@DeletedBy", purchaseHeader.DeletedBy);
            else
                oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value);
            // Pass the value of '_deletDate' as parameter 'DeletDate' of the stored procedure.
            if (purchaseHeader.DeleteDate != null)
                oDatabaseHelper.AddParameter("@DeletDate", purchaseHeader.DeleteDate);
            else
                oDatabaseHelper.AddParameter("@DeletDate", 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("gsp_PURPurchaseHeader_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState);

            return ExecutionState;

        }
Exemplo n.º 12
0
        private bool UpdateHeader(DatabaseHelper oDatabaseHelper, PURPurchaseHeader pURPurchaseHeader)
        {
            bool ExecutionState = false;

            // Pass the value of '_salesDate' as parameter 'PurchaseDate' of the stored procedure.
            oDatabaseHelper.AddParameter("@PurcaseHeaderID", pURPurchaseHeader.PurcaseHeaderID);
            oDatabaseHelper.AddParameter("@PurchaseDate", pURPurchaseHeader.PurchaseDate);
            // Pass the value of '_customerID' as parameter 'SupplierID' of the stored procedure.
            if (pURPurchaseHeader.SupplierID != null)
            {
                oDatabaseHelper.AddParameter("@SupplierID", pURPurchaseHeader.SupplierID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@SupplierID", DBNull.Value);
            }
            // Pass the value of '_invoiceNumber' as parameter 'InvoiceNumber' of the stored procedure.

            oDatabaseHelper.AddParameter("@InvoiceNumber", DBNull.Value);
            // Pass the value of '_invoiceDate' as parameter 'InvoiceDate' of the stored procedure.
            if (pURPurchaseHeader.InvoiceDate != null)
            {
                oDatabaseHelper.AddParameter("@InvoiceDate", pURPurchaseHeader.InvoiceDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@InvoiceDate", DBNull.Value);
            }
            // Pass the value of '_sellerID' as parameter 'SellerID' of the stored procedure.
            //if (pURPurchaseHeader.SellerID != null)
            //    oDatabaseHelper.AddParameter("@SellerID", pURPurchaseHeader.SellerID);
            //else
            //    oDatabaseHelper.AddParameter("@SellerID", DBNull.Value);
            // Pass the value of '_paymentTypeID' as parameter 'PaymentTypeID' of the stored procedure.
            if (pURPurchaseHeader.PaymentTypeID != null)
            {
                oDatabaseHelper.AddParameter("@PaymentTypeID", pURPurchaseHeader.PaymentTypeID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@PaymentTypeID", DBNull.Value);
            }

            if (pURPurchaseHeader.InventoryID != null)
            {
                oDatabaseHelper.AddParameter("@InventoryID", pURPurchaseHeader.InventoryID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@InventoryID", DBNull.Value);
            }


            // Pass the value of '_totalPrice' as parameter 'TotalPrice' of the stored procedure.
            if (pURPurchaseHeader.TotalPrice != null)
            {
                oDatabaseHelper.AddParameter("@TotalPrice", pURPurchaseHeader.TotalPrice);
            }
            else
            {
                oDatabaseHelper.AddParameter("@TotalPrice", DBNull.Value);
            }
            // Pass the value of '_paidAmount' as parameter 'PaidAmount' of the stored procedure.
            if (pURPurchaseHeader.PaidAmount != null)
            {
                oDatabaseHelper.AddParameter("@PaidAmount", pURPurchaseHeader.PaidAmount);
            }
            else
            {
                oDatabaseHelper.AddParameter("@PaidAmount", DBNull.Value);
            }
            // Pass the value of '_remainingAmount' as parameter 'RemainingAmount' of the stored procedure.
            if (pURPurchaseHeader.RemainingAmount != null)
            {
                oDatabaseHelper.AddParameter("@RemainingAmount", pURPurchaseHeader.RemainingAmount);
            }
            else
            {
                oDatabaseHelper.AddParameter("@RemainingAmount", DBNull.Value);
            }
            // Pass the value of '_lastDayToPay' as parameter 'LastDayToPay' of the stored procedure.
            if (pURPurchaseHeader.LastDayToPay != null)
            {
                oDatabaseHelper.AddParameter("@LastDayToPay", pURPurchaseHeader.LastDayToPay);
            }
            else
            {
                oDatabaseHelper.AddParameter("@LastDayToPay", DBNull.Value);
            }

            if (pURPurchaseHeader.ChequeNumber != null)
            {
                oDatabaseHelper.AddParameter("@ChequeNumber", pURPurchaseHeader.ChequeNumber);
            }
            else
            {
                oDatabaseHelper.AddParameter("@ChequeNumber", DBNull.Value);
            }
            // Pass the value of '_totalDiscountAmount' as parameter 'TotalDiscountAmount' of the stored procedure.
            if (pURPurchaseHeader.TotalDiscountAmount != null)
            {
                oDatabaseHelper.AddParameter("@TotalDiscountAmount", pURPurchaseHeader.TotalDiscountAmount);
            }
            else
            {
                oDatabaseHelper.AddParameter("@TotalDiscountAmount", DBNull.Value);
            }
            // Pass the value of '_totalDiscountRatio' as parameter 'TotalDiscountRatio' of the stored procedure.
            if (pURPurchaseHeader.TotalDiscountRatio != null)
            {
                oDatabaseHelper.AddParameter("@TotalDiscountRatio", pURPurchaseHeader.TotalDiscountRatio);
            }
            else
            {
                oDatabaseHelper.AddParameter("@TotalDiscountRatio", DBNull.Value);
            }
            // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure.
            if (pURPurchaseHeader.IsClosed != null)
            {
                oDatabaseHelper.AddParameter("@IsClosed", pURPurchaseHeader.IsClosed);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value);
            }
            // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure.
            if (pURPurchaseHeader.IsVoid != null)
            {
                oDatabaseHelper.AddParameter("@IsVoid", pURPurchaseHeader.IsVoid);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value);
            }
            // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure.
            if (pURPurchaseHeader.IsPrinted != null)
            {
                oDatabaseHelper.AddParameter("@IsPrinted", pURPurchaseHeader.IsPrinted);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value);
            }
            // Pass the value of '_servicePrice' as parameter 'ServicePrice' of the stored procedure.
            if (pURPurchaseHeader.ServicePrice != null)
            {
                oDatabaseHelper.AddParameter("@ServicePrice", pURPurchaseHeader.ServicePrice);
            }
            else
            {
                oDatabaseHelper.AddParameter("@ServicePrice", DBNull.Value);
            }
            // Pass the value of '_taxTypeID' as parameter 'TaxTypeID' of the stored procedure.
            if (pURPurchaseHeader.TaxTypeID != null)
            {
                oDatabaseHelper.AddParameter("@TaxTypeID", pURPurchaseHeader.TaxTypeID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@TaxTypeID", DBNull.Value);
            }
            // Pass the value of '_refuseReasonID' as parameter 'RefuseReasonID' of the stored procedure.
            if (pURPurchaseHeader.RefuseReasonID != null)
            {
                oDatabaseHelper.AddParameter("@RefuseReasonID", pURPurchaseHeader.RefuseReasonID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@RefuseReasonID", DBNull.Value);
            }
            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.

            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            if (pURPurchaseHeader.UpdatedBy != null)
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", pURPurchaseHeader.UpdatedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value);
            }
            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            if (pURPurchaseHeader.updateDate != null)
            {
                oDatabaseHelper.AddParameter("@UpdateDate", pURPurchaseHeader.updateDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value);
            }
            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            if (pURPurchaseHeader.IsDeleted != null)
            {
                oDatabaseHelper.AddParameter("@IsDeleted", pURPurchaseHeader.IsDeleted);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value);
            }
            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.

            // The parameter '@dlgErrorCode' will contain the status after execution of the stored procedure.
            oDatabaseHelper.AddParameter("@dlgErrorCode", -1, System.Data.ParameterDirection.Output);

            oDatabaseHelper.ExecuteScalar("usp_PURPurchaseHeader_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState);

            return(ExecutionState);
        }
Exemplo n.º 13
0
 public int SaveTransaction(PURPurchaseHeader pURPurchaseHeader, PURPurchaseLineCollection sALPurchaseLineCollection)
 {
     oDatabaseHelper = new DatabaseHelper();
     bool ExecutionState = false;
     int salesHeaderID;
     oDatabaseHelper.BeginTransaction();
     if (InsertHeader(oDatabaseHelper, pURPurchaseHeader, out salesHeaderID))
     {
         foreach (PURPurchaseLine sALPurchaseLine in sALPurchaseLineCollection)
         {
             if (!InsertDetails(oDatabaseHelper, sALPurchaseLine, salesHeaderID))
             {
                 ExecutionState = false;
                 break;
             }
             else
                 ExecutionState = true;
         }
         if (ExecutionState)
             oDatabaseHelper.CommitTransaction();
         else
             oDatabaseHelper.RollbackTransaction();
     }
     return salesHeaderID;
 }
Exemplo n.º 14
0
 public bool UpdateTransaction(PURPurchaseHeader pURPurchaseHeader, PURPurchaseLineCollection sALPurchaseLineCollection)
 {
     oDatabaseHelper = new DatabaseHelper();
     bool ExecutionState = false;
     oDatabaseHelper.BeginTransaction();
     if (UpdateHeader(oDatabaseHelper, pURPurchaseHeader))
     {
         if (DeleteDetails(oDatabaseHelper, (int)pURPurchaseHeader.PurcaseHeaderID, (int)pURPurchaseHeader.CreatedBy))
         {
             foreach (PURPurchaseLine sALPurchaseLine in sALPurchaseLineCollection)
             {
                 if (!InsertDetails(oDatabaseHelper, sALPurchaseLine, (int)pURPurchaseHeader.PurcaseHeaderID))
                 {
                     ExecutionState = false;
                     break;
                 }
                 else
                     ExecutionState = true;
             }
             if (ExecutionState)
                 oDatabaseHelper.CommitTransaction();
             else
                 oDatabaseHelper.RollbackTransaction();
         }
         else
             ExecutionState = false;
     }
     else
         ExecutionState = false;
     return ExecutionState;
 }
Exemplo n.º 15
0
        private static PURPurchaseHeaderCollection PopulateFromReader(IDataReader rdr)
        {
            PURPurchaseHeaderCollection pURPurchaseHeaderCollection = new PURPurchaseHeaderCollection();
            while (rdr.Read())
            {
                PURPurchaseHeader obj = new PURPurchaseHeader();
                obj.PurcaseHeaderID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.PurcaseHeaderID));
                obj.PurchaseDate = rdr.GetDateTime(rdr.GetOrdinal(PURPurchaseHeaderFields.PurchaseDate));
                obj.SupplierID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.SupplierID));

                if (!rdr.IsDBNull(rdr.GetOrdinal("SupplierName")))
                {
                    obj.SupplierName = rdr.GetString(rdr.GetOrdinal("SupplierName"));
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.InvoiceNumber)))
                {
                    obj.InvoiceNumber = rdr.GetString(rdr.GetOrdinal(PURPurchaseHeaderFields.InvoiceNumber));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.InvoiceDate)))
                {
                    obj.InvoiceDate = rdr.GetDateTime(rdr.GetOrdinal(PURPurchaseHeaderFields.InvoiceDate));
                }

               // if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.SellerID)))
               // {
              //      obj.SellerID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.SellerID));
              //  }

                //if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.PaymentTypeID)))
                //{
                //    obj.PaymentTypeID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.PaymentTypeID));
                //}

                obj.TotalPrice = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseHeaderFields.TotalPrice));
                obj.PaidAmount = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseHeaderFields.PaidAmount));
                obj.RemainingAmount = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseHeaderFields.RemainingAmount));
                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.LastDayToPay)))
                {
                    obj.LastDayToPay = rdr.GetDateTime(rdr.GetOrdinal(PURPurchaseHeaderFields.LastDayToPay));
                }

                obj.TotalDiscountAmount = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseHeaderFields.TotalDiscountAmount));
                obj.TotalDiscountRatio = rdr.GetDouble(rdr.GetOrdinal(PURPurchaseHeaderFields.TotalDiscountRatio));
                obj.IsClosed = rdr.GetBoolean(rdr.GetOrdinal(PURPurchaseHeaderFields.IsClosed));
                obj.IsVoid = rdr.GetBoolean(rdr.GetOrdinal(PURPurchaseHeaderFields.IsVoid));
                obj.IsPrinted = rdr.GetBoolean(rdr.GetOrdinal(PURPurchaseHeaderFields.IsPrinted));
                obj.ServicePrice = rdr.GetDecimal(rdr.GetOrdinal(PURPurchaseHeaderFields.ServicePrice));
                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.TaxTypeID)))
                {
                    obj.TaxTypeID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.TaxTypeID));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.RefuseReasonID)))
                {
                    obj.RefuseReasonID = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.RefuseReasonID));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.CreatedBy)))
                {
                    obj.CreatedBy = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.CreatedBy));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.CreateDate)))
                {
                    obj.CreateDate = rdr.GetDateTime(rdr.GetOrdinal(PURPurchaseHeaderFields.CreateDate));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.UpdatedBy)))
                {
                    obj.UpdatedBy = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.UpdatedBy));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.updateDate)))
                {
                    obj.updateDate = rdr.GetDateTime(rdr.GetOrdinal(PURPurchaseHeaderFields.updateDate));
                }

                obj.IsDeleted = rdr.GetBoolean(rdr.GetOrdinal(PURPurchaseHeaderFields.IsDeleted));
                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.DeletedBy)))
                {
                    obj.DeletedBy = rdr.GetInt32(rdr.GetOrdinal(PURPurchaseHeaderFields.DeletedBy));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(PURPurchaseHeaderFields.DeleteDate)))
                {
                    obj.DeleteDate = rdr.GetDateTime(rdr.GetOrdinal(PURPurchaseHeaderFields.DeleteDate));
                }
                pURPurchaseHeaderCollection.Add(obj);
            }
            return pURPurchaseHeaderCollection;
        }
Exemplo n.º 16
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 PURPurchaseHeaderCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			31/5/2015 10:35:27 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static PURPurchaseHeaderCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) 
		{

			PURPurchaseHeaderCollection list = new PURPurchaseHeaderCollection();
			
            if (rdr.Read())
			{
				PURPurchaseHeader obj = new PURPurchaseHeader();
				PopulateObjectFromReader(obj, rdr);
				list.Add(obj);
				while (rdr.Read())
				{
					obj = new PURPurchaseHeader();
					PopulateObjectFromReader(obj, rdr);
					list.Add(obj);
				}
				oDatabaseHelper.Dispose();
				return list;
			}
			else
			{
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
Exemplo n.º 17
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 PURPurchaseHeaderCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			31/5/2015 10:35:27 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static PURPurchaseHeaderCollection PopulateObjectsFromReader(IDataReader rdr) 
		{
			PURPurchaseHeaderCollection list = new PURPurchaseHeaderCollection();
			
			while (rdr.Read())
			{
				PURPurchaseHeader obj = new PURPurchaseHeader();
				PopulateObjectFromReader(obj,rdr);
				list.Add(obj);
			}
			return list;
			
		}
Exemplo n.º 18
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="PURPurchaseHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class PURPurchaseHeader</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			31/5/2015 10:35:27 PM				Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static PURPurchaseHeader SelectOneWithPURPurchaseReturnHeaderUsingOriginalHeaderID(PURPurchaseHeaderPrimaryKey pk)
		{
			DatabaseHelper oDatabaseHelper = new DatabaseHelper();
			bool ExecutionState = false;
			PURPurchaseHeader 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_PURPurchaseHeader_SelectOneWithPURPurchaseReturnHeaderUsingOriginalHeaderID", ref ExecutionState);
			if (dr.Read())
			{
				obj= new PURPurchaseHeader();
				PopulateObjectFromReader(obj,dr);
				
				dr.NextResult();
				
				//Get the child records.
				obj.PURPurchaseReturnHeaderCollectionUsingOriginalHeaderID=PURPurchaseReturnHeader.PopulateObjectsFromReader(dr);
			}
			dr.Close();  
			oDatabaseHelper.Dispose();
			return obj;
			
		}