Ejemplo n.º 1
0
        public int SaveTransaction(SALSalesHeader sALSalesHeader, SALSalesLineCollection sALSalesLineCollection)
        {
            oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;
            int  salesHeaderID  = -1;

            oDatabaseHelper.BeginTransaction();
            if (InsertHeader(oDatabaseHelper, sALSalesHeader, out salesHeaderID))
            {
                foreach (SALSalesLine sALSalesLine in sALSalesLineCollection)
                {
                    if (!InsertDetails(oDatabaseHelper, sALSalesLine, salesHeaderID))
                    {
                        ExecutionState = false;
                        break;
                    }
                    else
                    {
                        ExecutionState = true;
                    }
                }
                if (ExecutionState)
                {
                    oDatabaseHelper.CommitTransaction();
                }
                else
                {
                    oDatabaseHelper.RollbackTransaction();
                }
            }
            return(salesHeaderID);
        }
Ejemplo n.º 2
0
        public bool SaveAccountUpdates(SALSalesHeader salesHeader, BDCustomerAccount customerAccount)
        {
            oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;

            oDatabaseHelper.BeginTransaction();
            ExecutionState = UpdateCustomerAccount(oDatabaseHelper, customerAccount, ExecutionState);
            if (!UpdateSalesHeader(oDatabaseHelper, salesHeader))
            {
                ExecutionState = false;
            }
            else
            {
                ExecutionState = true;
            }
            if (ExecutionState)
            {
                oDatabaseHelper.CommitTransaction();
            }
            else
            {
                oDatabaseHelper.RollbackTransaction();
            }
            oDatabaseHelper.Dispose();
            return(ExecutionState);
        }
Ejemplo n.º 3
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="BDCustomerPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class BDCustomer</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			12/27/2014 6:56:00 PM				Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static BDCustomer SelectOneWithSALSalesHeaderUsingCustomerID(BDCustomerPrimaryKey pk)
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool           ExecutionState  = false;
            BDCustomer     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_BDCustomer_SelectOneWithSALSalesHeaderUsingCustomerID", ref ExecutionState);

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

                dr.NextResult();

                //Get the child records.
                obj.SALSalesHeaderCollectionUsingCustomerID = SALSalesHeader.PopulateObjectsFromReader(dr);
            }
            dr.Close();
            oDatabaseHelper.Dispose();
            return(obj);
        }
Ejemplo n.º 4
0
 public int SaveTransaction(SALSalesHeader sALSalesHeader, SALSalesLineCollection sALSalesLineCollection)
 {
     oDatabaseHelper = new DatabaseHelper();
     bool ExecutionState = false;
     int salesHeaderID = -1;
     oDatabaseHelper.BeginTransaction();
     if (InsertHeader(oDatabaseHelper, sALSalesHeader, out salesHeaderID))
     {
         foreach (SALSalesLine sALSalesLine in sALSalesLineCollection)
         {
             if (!InsertDetails(oDatabaseHelper, sALSalesLine, salesHeaderID))
             {
                 ExecutionState = false;
                 break;
             }
             else
                 ExecutionState = true;
         }
         if (ExecutionState)
             oDatabaseHelper.CommitTransaction();
         else
             oDatabaseHelper.RollbackTransaction();
     }
     return salesHeaderID;
 }
Ejemplo n.º 5
0
 public bool SaveAccountUpdates(SALSalesHeader salesHeader, BDCustomerAccount customerAccount)
 {
     oDatabaseHelper = new DatabaseHelper();
     bool ExecutionState = false;
     oDatabaseHelper.BeginTransaction();
     ExecutionState = UpdateCustomerAccount(oDatabaseHelper, customerAccount, ExecutionState);
     if (!UpdateSalesHeader(oDatabaseHelper, salesHeader))
     {
         ExecutionState = false;
     }
     else
         ExecutionState = true;
     if (ExecutionState)
         oDatabaseHelper.CommitTransaction();
     else
         oDatabaseHelper.RollbackTransaction();
     oDatabaseHelper.Dispose();
     return ExecutionState;
 }
Ejemplo n.º 6
0
        public bool UpdateTransaction(SALSalesHeader sALSalesHeader, SALSalesLineCollection sALSalesLineCollection)
        {
            oDatabaseHelper = new DatabaseHelper();
            bool ExecutionState = false;

            oDatabaseHelper.BeginTransaction();
            if (UpdateHeader(oDatabaseHelper, sALSalesHeader))
            {
                if (DeleteDetails(oDatabaseHelper, (int)sALSalesHeader.SalesHeaderID, (int)sALSalesHeader.SellerID))
                {
                    foreach (SALSalesLine sALSalesLine in sALSalesLineCollection)
                    {
                        if (!InsertDetails(oDatabaseHelper, sALSalesLine, (int)sALSalesHeader.SalesHeaderID))
                        {
                            ExecutionState = false;
                            break;
                        }
                        else
                        {
                            ExecutionState = true;
                        }
                    }
                    if (ExecutionState)
                    {
                        oDatabaseHelper.CommitTransaction();
                    }
                    else
                    {
                        oDatabaseHelper.RollbackTransaction();
                    }
                }
                else
                {
                    ExecutionState = false;
                }
            }
            else
            {
                ExecutionState = false;
            }
            return(ExecutionState);
        }
Ejemplo n.º 7
0
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="SALSalesHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class SALSalesHeader</returns>
		public SALSalesHeader SelectOne(SALSalesHeaderPrimaryKey pk)
		{
			_sALSalesHeaderWCF = new SALSalesHeader();
			_sALSalesHeader = POS.DataLayer.SALSalesHeaderBase.SelectOne(new POS.DataLayer.SALSalesHeaderPrimaryKey(pk.SalesHeaderID));
			
				_sALSalesHeaderWCF.SalesHeaderID = _sALSalesHeader.SalesHeaderID;
				_sALSalesHeaderWCF.SalesDate = _sALSalesHeader.SalesDate;
				_sALSalesHeaderWCF.CustomerID = _sALSalesHeader.CustomerID;
				_sALSalesHeaderWCF.InvoiceNumber = _sALSalesHeader.InvoiceNumber;
				_sALSalesHeaderWCF.InvoiceDate = _sALSalesHeader.InvoiceDate;
				_sALSalesHeaderWCF.SellerID = _sALSalesHeader.SellerID;
				_sALSalesHeaderWCF.PaymentTypeID = _sALSalesHeader.PaymentTypeID;
				_sALSalesHeaderWCF.TotalPrice = _sALSalesHeader.TotalPrice;
				_sALSalesHeaderWCF.PaidAmount = _sALSalesHeader.PaidAmount;
				_sALSalesHeaderWCF.RemainingAmount = _sALSalesHeader.RemainingAmount;
				_sALSalesHeaderWCF.LastDayToPay = _sALSalesHeader.LastDayToPay;
				_sALSalesHeaderWCF.TotalDiscountAmount = _sALSalesHeader.TotalDiscountAmount;
				_sALSalesHeaderWCF.TotalDiscountRatio = _sALSalesHeader.TotalDiscountRatio;
				_sALSalesHeaderWCF.IsClosed = _sALSalesHeader.IsClosed;
				_sALSalesHeaderWCF.IsVoid = _sALSalesHeader.IsVoid;
				_sALSalesHeaderWCF.IsPrinted = _sALSalesHeader.IsPrinted;
				_sALSalesHeaderWCF.ServicePrice = _sALSalesHeader.ServicePrice;
				_sALSalesHeaderWCF.TaxTypeID = _sALSalesHeader.TaxTypeID;
				_sALSalesHeaderWCF.RefuseReasonID = _sALSalesHeader.RefuseReasonID;
				_sALSalesHeaderWCF.CreatedBy = _sALSalesHeader.CreatedBy;
				_sALSalesHeaderWCF.CreateDate = _sALSalesHeader.CreateDate;
				_sALSalesHeaderWCF.UpdatedBy = _sALSalesHeader.UpdatedBy;
				_sALSalesHeaderWCF.UpdateDate = _sALSalesHeader.UpdateDate;
				_sALSalesHeaderWCF.IsDeleted = _sALSalesHeader.IsDeleted;
				_sALSalesHeaderWCF.DeletedBy = _sALSalesHeader.DeletedBy;
				_sALSalesHeaderWCF.DeletDate = _sALSalesHeader.DeletDate;
				_sALSalesHeaderWCF.InventoryID = _sALSalesHeader.InventoryID;
				_sALSalesHeaderWCF.FinalPrice = _sALSalesHeader.FinalPrice;
				_sALSalesHeaderWCF.ChequeNumber = _sALSalesHeader.ChequeNumber;
				
			return _sALSalesHeaderWCF;
		}
Ejemplo n.º 8
0
        private bool UpdateHeader(DatabaseHelper oDatabaseHelper, SALSalesHeader sALSalesHeader)
        {
            bool ExecutionState = false;

            // Pass the value of '_salesHeaderID' as parameter 'SalesHeaderID' of the stored procedure.
            oDatabaseHelper.AddParameter("@InventoryID", sALSalesHeader.InventoryID);

            oDatabaseHelper.AddParameter("@SalesHeaderID", sALSalesHeader.SalesHeaderID);
            oDatabaseHelper.AddParameter("@SalesDate", sALSalesHeader.SalesDate);
            // Pass the value of '_customerID' as parameter 'CustomerID' of the stored procedure.
            if (sALSalesHeader.CustomerID != null)
            {
                oDatabaseHelper.AddParameter("@CustomerID", sALSalesHeader.CustomerID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CustomerID", DBNull.Value);
            }
            // Pass the value of '_invoiceNumber' as parameter 'InvoiceNumber' of the stored procedure.

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

            // Pass the value of 'FinalPrice' as parameter 'TotalPrice' of the stored procedure.
            if (sALSalesHeader.FinalPrice != null)
            {
                oDatabaseHelper.AddParameter("@FinalPrice", sALSalesHeader.FinalPrice);
            }
            else
            {
                oDatabaseHelper.AddParameter("@TotalPrice", DBNull.Value);
            }

            // Pass the value of '_paidAmount' as parameter 'PaidAmount' of the stored procedure.
            if (sALSalesHeader.PaidAmount != null)
            {
                oDatabaseHelper.AddParameter("@PaidAmount", sALSalesHeader.PaidAmount);
            }
            else
            {
                oDatabaseHelper.AddParameter("@PaidAmount", DBNull.Value);
            }
            // Pass the value of '_remainingAmount' as parameter 'RemainingAmount' of the stored procedure.
            if (sALSalesHeader.RemainingAmount != null)
            {
                oDatabaseHelper.AddParameter("@RemainingAmount", sALSalesHeader.RemainingAmount);
            }
            else
            {
                oDatabaseHelper.AddParameter("@RemainingAmount", DBNull.Value);
            }
            // Pass the value of '_lastDayToPay' as parameter 'LastDayToPay' of the stored procedure.
            if (sALSalesHeader.LastDayToPay != null)
            {
                oDatabaseHelper.AddParameter("@LastDayToPay", sALSalesHeader.LastDayToPay);
            }
            else
            {
                oDatabaseHelper.AddParameter("@LastDayToPay", DBNull.Value);
            }
            // Pass the value of '_totalDiscountAmount' as parameter 'TotalDiscountAmount' of the stored procedure.
            if (sALSalesHeader.TotalDiscountAmount != null)
            {
                oDatabaseHelper.AddParameter("@TotalDiscountAmount", sALSalesHeader.TotalDiscountAmount);
            }
            else
            {
                oDatabaseHelper.AddParameter("@TotalDiscountAmount", DBNull.Value);
            }
            // Pass the value of '_totalDiscountRatio' as parameter 'TotalDiscountRatio' of the stored procedure.
            if (sALSalesHeader.TotalDiscountRatio != null)
            {
                oDatabaseHelper.AddParameter("@TotalDiscountRatio", sALSalesHeader.TotalDiscountRatio);
            }
            else
            {
                oDatabaseHelper.AddParameter("@TotalDiscountRatio", DBNull.Value);
            }
            // Pass the value of '_isClosed' as parameter 'IsClosed' of the stored procedure.
            if (sALSalesHeader.IsClosed != null)
            {
                oDatabaseHelper.AddParameter("@IsClosed", sALSalesHeader.IsClosed);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsClosed", DBNull.Value);
            }
            // Pass the value of '_isVoid' as parameter 'IsVoid' of the stored procedure.
            if (sALSalesHeader.IsVoid != null)
            {
                oDatabaseHelper.AddParameter("@IsVoid", sALSalesHeader.IsVoid);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsVoid", DBNull.Value);
            }
            // Pass the value of '_isPrinted' as parameter 'IsPrinted' of the stored procedure.
            if (sALSalesHeader.IsPrinted != null)
            {
                oDatabaseHelper.AddParameter("@IsPrinted", sALSalesHeader.IsPrinted);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsPrinted", DBNull.Value);
            }
            // Pass the value of '_servicePrice' as parameter 'ServicePrice' of the stored procedure.
            if (sALSalesHeader.ServicePrice != null)
            {
                oDatabaseHelper.AddParameter("@ServicePrice", sALSalesHeader.ServicePrice);
            }
            else
            {
                oDatabaseHelper.AddParameter("@ServicePrice", DBNull.Value);
            }
            // Pass the value of '_taxTypeID' as parameter 'TaxTypeID' of the stored procedure.
            if (sALSalesHeader.TaxTypeID != null)
            {
                oDatabaseHelper.AddParameter("@TaxTypeID", sALSalesHeader.TaxTypeID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@TaxTypeID", DBNull.Value);
            }
            // Pass the value of '_refuseReasonID' as parameter 'RefuseReasonID' of the stored procedure.
            if (sALSalesHeader.RefuseReasonID != null)
            {
                oDatabaseHelper.AddParameter("@RefuseReasonID", sALSalesHeader.RefuseReasonID);
            }
            else
            {
                oDatabaseHelper.AddParameter("@RefuseReasonID", DBNull.Value);
            }
            // Pass the value of '_createdBy' as parameter 'CreatedBy' of the stored procedure.
            if (sALSalesHeader.CreatedBy != null)
            {
                oDatabaseHelper.AddParameter("@CreatedBy", sALSalesHeader.CreatedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreatedBy", DBNull.Value);
            }
            // Pass the value of '_createDate' as parameter 'CreateDate' of the stored procedure.
            if (sALSalesHeader.CreateDate != null)
            {
                oDatabaseHelper.AddParameter("@CreateDate", sALSalesHeader.CreateDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@CreateDate", DBNull.Value);
            }
            // Pass the value of '_updatedBy' as parameter 'UpdatedBy' of the stored procedure.
            if (sALSalesHeader.UpdatedBy != null)
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", sALSalesHeader.UpdatedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdatedBy", DBNull.Value);
            }
            // Pass the value of '_updateDate' as parameter 'UpdateDate' of the stored procedure.
            if (sALSalesHeader.UpdateDate != null)
            {
                oDatabaseHelper.AddParameter("@UpdateDate", sALSalesHeader.UpdateDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@UpdateDate", DBNull.Value);
            }
            // Pass the value of '_isDeleted' as parameter 'IsDeleted' of the stored procedure.
            if (sALSalesHeader.IsDeleted != null)
            {
                oDatabaseHelper.AddParameter("@IsDeleted", sALSalesHeader.IsDeleted);
            }
            else
            {
                oDatabaseHelper.AddParameter("@IsDeleted", DBNull.Value);
            }
            // Pass the value of '_deletedBy' as parameter 'DeletedBy' of the stored procedure.
            if (sALSalesHeader.DeletedBy != null)
            {
                oDatabaseHelper.AddParameter("@DeletedBy", sALSalesHeader.DeletedBy);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DeletedBy", DBNull.Value);
            }
            // Pass the value of '_deletDate' as parameter 'DeletDate' of the stored procedure.
            if (sALSalesHeader.DeletDate != null)
            {
                oDatabaseHelper.AddParameter("@DeletDate", sALSalesHeader.DeletDate);
            }
            else
            {
                oDatabaseHelper.AddParameter("@DeletDate", DBNull.Value);
            }

            if (sALSalesHeader.ChequeNumber != null)
            {
                oDatabaseHelper.AddParameter("@ChequeNumber", sALSalesHeader.ChequeNumber);
            }
            else
            {
                oDatabaseHelper.AddParameter("@ChequeNumber", 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_SALSalesHeader_Update", CommandType.StoredProcedure, ConnectionState.KeepOpen, ref ExecutionState);

            return(ExecutionState);
        }
Ejemplo n.º 9
0
		/// <summary>
		/// This method will insert one new row into the database using the property Information
		/// </summary>
		///
		/// <param name="sALSalesHeader" type="SALSalesHeader">This SALSalesHeader  will be inserted in the database.</param>
		///
		/// <returns>True if succeeded</returns>
		public bool Insert(SALSalesHeader sALSalesHeader)
		{
			_sALSalesHeader = new POS.DataLayer.SALSalesHeader();
			_sALSalesHeader.SalesHeaderID=sALSalesHeader.SalesHeaderID;
			_sALSalesHeader.SalesDate=sALSalesHeader.SalesDate;
			_sALSalesHeader.CustomerID=sALSalesHeader.CustomerID;
			_sALSalesHeader.InvoiceNumber=sALSalesHeader.InvoiceNumber;
			_sALSalesHeader.InvoiceDate=sALSalesHeader.InvoiceDate;
			_sALSalesHeader.SellerID=sALSalesHeader.SellerID;
			_sALSalesHeader.PaymentTypeID=sALSalesHeader.PaymentTypeID;
			_sALSalesHeader.TotalPrice=sALSalesHeader.TotalPrice;
			_sALSalesHeader.PaidAmount=sALSalesHeader.PaidAmount;
			_sALSalesHeader.RemainingAmount=sALSalesHeader.RemainingAmount;
			_sALSalesHeader.LastDayToPay=sALSalesHeader.LastDayToPay;
			_sALSalesHeader.TotalDiscountAmount=sALSalesHeader.TotalDiscountAmount;
			_sALSalesHeader.TotalDiscountRatio=sALSalesHeader.TotalDiscountRatio;
			_sALSalesHeader.IsClosed=sALSalesHeader.IsClosed;
			_sALSalesHeader.IsVoid=sALSalesHeader.IsVoid;
			_sALSalesHeader.IsPrinted=sALSalesHeader.IsPrinted;
			_sALSalesHeader.ServicePrice=sALSalesHeader.ServicePrice;
			_sALSalesHeader.TaxTypeID=sALSalesHeader.TaxTypeID;
			_sALSalesHeader.RefuseReasonID=sALSalesHeader.RefuseReasonID;
			_sALSalesHeader.CreatedBy=sALSalesHeader.CreatedBy;
			_sALSalesHeader.CreateDate=sALSalesHeader.CreateDate;
			_sALSalesHeader.UpdatedBy=sALSalesHeader.UpdatedBy;
			_sALSalesHeader.UpdateDate=sALSalesHeader.UpdateDate;
			_sALSalesHeader.IsDeleted=sALSalesHeader.IsDeleted;
			_sALSalesHeader.DeletedBy=sALSalesHeader.DeletedBy;
			_sALSalesHeader.DeletDate=sALSalesHeader.DeletDate;
			_sALSalesHeader.InventoryID=sALSalesHeader.InventoryID;
			_sALSalesHeader.FinalPrice=sALSalesHeader.FinalPrice;
			_sALSalesHeader.ChequeNumber=sALSalesHeader.ChequeNumber;
			
			return _sALSalesHeader.Insert();
		}
Ejemplo n.º 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 SALSalesHeaderCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 10:40:24 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static SALSalesHeaderCollection PopulateObjectsFromReader(IDataReader rdr) 
		{
			SALSalesHeaderCollection list = new SALSalesHeaderCollection();
			
			while (rdr.Read())
			{
				SALSalesHeader obj = new SALSalesHeader();
				PopulateObjectFromReader(obj,rdr);
				list.Add(obj);
			}
			return list;
			
		}
Ejemplo n.º 11
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="SALSalesHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class SALSalesHeader</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 10:40:24 PM				Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static SALSalesHeader SelectOneWithBDCustomerAccountsUsingSalesInvoiceId(SALSalesHeaderPrimaryKey pk)
		{
			DatabaseHelper oDatabaseHelper = new DatabaseHelper();
			bool ExecutionState = false;
			SALSalesHeader 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_SALSalesHeader_SelectOneWithBDCustomerAccountsUsingSalesInvoiceId", ref ExecutionState);
			if (dr.Read())
			{
				obj= new SALSalesHeader();
				PopulateObjectFromReader(obj,dr);
				
				dr.NextResult();
				
				//Get the child records.
				obj.BDCustomerAccountCollectionUsingSalesInvoiceId=BDCustomerAccount.PopulateObjectsFromReader(dr);
			}
			dr.Close();  
			oDatabaseHelper.Dispose();
			return obj;
			
		}
Ejemplo n.º 12
0
		/// <summary>
		/// This method will return an object representing the record matching the primary key information specified.
		/// </summary>
		///
		/// <param name="pk" type="SALSalesHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
		///
		/// <returns>object of class SALSalesHeader</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 10:40:24 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		public static SALSalesHeader SelectOne(SALSalesHeaderPrimaryKey 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_SALSalesHeader_SelectbyPrimaryKey", ref ExecutionState);
			if (dr.Read())
			{
				SALSalesHeader obj=new SALSalesHeader();	
				PopulateObjectFromReader(obj,dr);
				dr.Close();              
				oDatabaseHelper.Dispose();
				return obj;
			}
			else
			{
				dr.Close();
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
Ejemplo n.º 13
0
        private bool UpdateSalesHeader(DatabaseHelper oDatabaseHelper, SALSalesHeader sALSalesHeader)
        {
            bool ExecutionState = false;
            // Pass the value of '_salesHeaderID' as parameter 'SalesHeaderID' of the stored procedure.
            oDatabaseHelper.AddParameter("@SalesHeaderID", sALSalesHeader.SalesHeaderID);
            oDatabaseHelper.AddParameter("@SalesDate", sALSalesHeader.SalesDate);
            // Pass the value of '_customerID' as parameter 'CustomerID' of the stored procedure.
            if (sALSalesHeader.CustomerID != null)
                oDatabaseHelper.AddParameter("@CustomerID", sALSalesHeader.CustomerID);
            else
                oDatabaseHelper.AddParameter("@CustomerID", DBNull.Value);
            // Pass the value of '_invoiceNumber' as parameter 'InvoiceNumber' of the stored procedure.

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

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

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

            return ExecutionState;
        }
Ejemplo n.º 14
0
 public bool UpdateTransaction(SALSalesHeader sALSalesHeader, SALSalesLineCollection sALSalesLineCollection)
 {
     oDatabaseHelper = new DatabaseHelper();
     bool ExecutionState = false;
     oDatabaseHelper.BeginTransaction();
     if (UpdateHeader(oDatabaseHelper, sALSalesHeader))
     {
         if (DeleteDetails(oDatabaseHelper, (int)sALSalesHeader.SalesHeaderID, (int)sALSalesHeader.SellerID))
         {
             foreach (SALSalesLine sALSalesLine in sALSalesLineCollection)
             {
                 if (!InsertDetails(oDatabaseHelper, sALSalesLine, (int)sALSalesHeader.SalesHeaderID))
                 {
                     ExecutionState = false;
                     break;
                 }
                 else
                     ExecutionState = true;
             }
             if (ExecutionState)
                 oDatabaseHelper.CommitTransaction();
             else
                 oDatabaseHelper.RollbackTransaction();
         }
         else
             ExecutionState = false;
     }
     else
         ExecutionState = false;
     return ExecutionState;
 }
Ejemplo n.º 15
0
        private static SALSalesHeaderCollection PopulateFromReader(IDataReader rdr)
        {
            SALSalesHeaderCollection sALSalesHeaderCollection = new SALSalesHeaderCollection();
            while (rdr.Read())
            {
                SALSalesHeader obj = new SALSalesHeader();
                obj.SalesHeaderID = rdr.GetInt32(rdr.GetOrdinal(SALSalesHeaderFields.SalesHeaderID));
                obj.SalesDate = rdr.GetDateTime(rdr.GetOrdinal(SALSalesHeaderFields.SalesDate));
                obj.CustomerID = rdr.GetInt32(rdr.GetOrdinal(SALSalesHeaderFields.CustomerID));

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

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

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

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

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

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

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

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

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

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

                if (!rdr.IsDBNull(rdr.GetOrdinal(SALSalesHeaderFields.UpdateDate)))
                {
                    obj.UpdateDate = rdr.GetDateTime(rdr.GetOrdinal(SALSalesHeaderFields.UpdateDate));
                }

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

                if (!rdr.IsDBNull(rdr.GetOrdinal(SALSalesHeaderFields.DeletDate)))
                {
                    obj.DeletDate = rdr.GetDateTime(rdr.GetOrdinal(SALSalesHeaderFields.DeletDate));
                }
                sALSalesHeaderCollection.Add(obj);
            }
            return sALSalesHeaderCollection;
        }
Ejemplo 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 SALSalesHeaderCollection</returns>
		///
		/// <remarks>
		///
		/// <RevisionHistory>
		/// Author				Date			Description
		/// DLGenerator			3/7/2015 10:40:24 PM		Created function
		/// 
		/// </RevisionHistory>
		///
		/// </remarks>
		///
		internal static SALSalesHeaderCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) 
		{

			SALSalesHeaderCollection list = new SALSalesHeaderCollection();
			
            if (rdr.Read())
			{
				SALSalesHeader obj = new SALSalesHeader();
				PopulateObjectFromReader(obj, rdr);
				list.Add(obj);
				while (rdr.Read())
				{
					obj = new SALSalesHeader();
					PopulateObjectFromReader(obj, rdr);
					list.Add(obj);
				}
				oDatabaseHelper.Dispose();
				return list;
			}
			else
			{
				oDatabaseHelper.Dispose();
				return null;
			}
			
		}
Ejemplo n.º 17
0
        private static SALSalesHeaderCollection PopulateFromReader(IDataReader rdr)
        {
            SALSalesHeaderCollection sALSalesHeaderCollection = new SALSalesHeaderCollection();

            while (rdr.Read())
            {
                SALSalesHeader obj = new SALSalesHeader();
                obj.SalesHeaderID = rdr.GetInt32(rdr.GetOrdinal(SALSalesHeaderFields.SalesHeaderID));
                obj.SalesDate     = rdr.GetDateTime(rdr.GetOrdinal(SALSalesHeaderFields.SalesDate));
                obj.CustomerID    = rdr.GetInt32(rdr.GetOrdinal(SALSalesHeaderFields.CustomerID));

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

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

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

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

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

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

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

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

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

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

                if (!rdr.IsDBNull(rdr.GetOrdinal(SALSalesHeaderFields.UpdateDate)))
                {
                    obj.UpdateDate = rdr.GetDateTime(rdr.GetOrdinal(SALSalesHeaderFields.UpdateDate));
                }

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

                if (!rdr.IsDBNull(rdr.GetOrdinal(SALSalesHeaderFields.DeletDate)))
                {
                    obj.DeletDate = rdr.GetDateTime(rdr.GetOrdinal(SALSalesHeaderFields.DeletDate));
                }
                sALSalesHeaderCollection.Add(obj);
            }
            return(sALSalesHeaderCollection);
        }