Esempio n. 1
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 VPURPurchaseOrderCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			11/4/2015 9:57:47 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static VPURPurchaseOrderCollection PopulateObjectsFromReader(IDataReader rdr)
        {
            VPURPurchaseOrderCollection list = new VPURPurchaseOrderCollection();

            while (rdr.Read())
            {
                VPURPurchaseOrder obj = new VPURPurchaseOrder();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
            }
            return(list);
        }
Esempio n. 2
0
        /// <summary>
        /// This method will return a list of objects representing all records in the table.
        /// </summary>
        ///
        /// <returns>list of objects of class VPURPurchaseOrder in the form of object of VPURPurchaseOrderCollection </returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			11/4/2015 9:57:47 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static VPURPurchaseOrderCollection SelectAll()
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool           ExecutionState  = false;

            // 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_VPURPurchaseOrder_SelectAll", ref ExecutionState);
            VPURPurchaseOrderCollection VPURPurchaseOrderCollection = PopulateObjectsFromReader(dr);

            dr.Close();
            oDatabaseHelper.Dispose();
            return(VPURPurchaseOrderCollection);
        }
Esempio n. 3
0
        /// <summary>
        /// This method will return a list of objects representing the specified number of entries from the specified record number in the table.
        /// </summary>
        ///
        /// <param name="pageSize" type="int">Number of records returned.</param>
        /// <param name="skipPages" type="int">The number of missing pages.</param>
        /// <param name="orderByStatement" type="string">The field value to number</param>
        ///
        /// <returns>list of objects of class VPURPurchaseOrder in the form of object of VPURPurchaseOrderCollection </returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			11/4/2015 9:57:47 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        public static VPURPurchaseOrderCollection SelectAllPaged(int?pageSize, int?skipPages, string orderByStatement)
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool           ExecutionState  = false;

            // Pass the specified field and its value to the stored procedure.
            oDatabaseHelper.AddParameter("@PageSize", pageSize);
            oDatabaseHelper.AddParameter("@SkipPages", skipPages);
            oDatabaseHelper.AddParameter("@OrderByStatement", orderByStatement);

            // 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_VPURPurchaseOrder_SelectAllPaged", ref ExecutionState);
            VPURPurchaseOrderCollection VPURPurchaseOrderCollection = PopulateObjectsFromReader(dr);

            dr.Close();
            oDatabaseHelper.Dispose();
            return(VPURPurchaseOrderCollection);
        }
Esempio n. 4
0
        public static VPURPurchaseOrderCollection SelectByField(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation)
        {
            DatabaseHelper oDatabaseHelper = new DatabaseHelper();
            bool           ExecutionState  = false;

            // Pass the specified field and its value to the stored procedure.
            oDatabaseHelper.AddParameter("@Field", field);
            oDatabaseHelper.AddParameter("@Value", fieldValue);
            oDatabaseHelper.AddParameter("@Value2", fieldValue2);
            oDatabaseHelper.AddParameter("@Operation", OperationCollection.Operation[(int)typeOperation]);

            // 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_VPURPurchaseOrder_SelectByField", ref ExecutionState);
            VPURPurchaseOrderCollection VPURPurchaseOrderCollection = PopulateObjectsFromReader(dr);

            dr.Close();
            oDatabaseHelper.Dispose();
            return(VPURPurchaseOrderCollection);
        }
Esempio n. 5
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 VPURPurchaseOrderCollection</returns>
        ///
        /// <remarks>
        ///
        /// <RevisionHistory>
        /// Author				Date			Description
        /// DLGenerator			11/4/2015 9:57:47 PM		Created function
        ///
        /// </RevisionHistory>
        ///
        /// </remarks>
        ///
        internal static VPURPurchaseOrderCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper)
        {
            VPURPurchaseOrderCollection list = new VPURPurchaseOrderCollection();

            if (rdr.Read())
            {
                VPURPurchaseOrder obj = new VPURPurchaseOrder();
                PopulateObjectFromReader(obj, rdr);
                list.Add(obj);
                while (rdr.Read())
                {
                    obj = new VPURPurchaseOrder();
                    PopulateObjectFromReader(obj, rdr);
                    list.Add(obj);
                }
                oDatabaseHelper.Dispose();
                return(list);
            }
            else
            {
                oDatabaseHelper.Dispose();
                return(null);
            }
        }
Esempio n. 6
0
 public Enumerator(VPURPurchaseOrderCollection t)
 {
     this.t = t;
 }
Esempio n. 7
0
        internal static VPURPurchaseOrderCollection PopulateObjectsFromReader(IDataReader rdr)
        {
            VPURPurchaseOrderCollection list = new VPURPurchaseOrderCollection();

            while (rdr.Read())
            {
                VPURPurchaseOrder obj = new VPURPurchaseOrder();
                obj.SupplierID   = rdr.GetInt32(rdr.GetOrdinal(VPURPurchaseOrderFields.SupplierID));
                obj.SupplierName = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.SupplierName));
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.Qty)))
                {
                    obj.Qty = rdr.GetDecimal(rdr.GetOrdinal(VPURPurchaseOrderFields.Qty));
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.PurchaseLineID)))
                {
                    obj.PurchaseLineID = rdr.GetInt32(rdr.GetOrdinal(VPURPurchaseOrderFields.PurchaseLineID));
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.TotalQty)))
                {
                    obj.TotalQty = rdr.GetDecimal(rdr.GetOrdinal(VPURPurchaseOrderFields.TotalQty));
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.UnitPrice)))
                {
                    obj.UnitPrice = rdr.GetDecimal(rdr.GetOrdinal(VPURPurchaseOrderFields.UnitPrice));
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.BatchNumber)))
                {
                    obj.BatchNumber = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.BatchNumber));
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.ExpiryDate)))
                {
                    obj.ExpiryDate = rdr.GetDateTime(rdr.GetOrdinal(VPURPurchaseOrderFields.ExpiryDate));
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.TaxValue)))
                {
                    obj.TaxValue = rdr.GetDecimal(rdr.GetOrdinal(VPURPurchaseOrderFields.TaxValue));
                }

                obj.PurcaseHeaderID = rdr.GetInt32(rdr.GetOrdinal(VPURPurchaseOrderFields.PurcaseHeaderID));
                obj.PurchaseDate    = rdr.GetDateTime(rdr.GetOrdinal(VPURPurchaseOrderFields.PurchaseDate));
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.InvoiceNumber)))
                {
                    obj.InvoiceNumber = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.InvoiceNumber));
                }

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

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

                obj.TotalDiscountRatio = rdr.GetDouble(rdr.GetOrdinal(VPURPurchaseOrderFields.TotalDiscountRatio));
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.TaxTypeName)))
                {
                    obj.TaxTypeName = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.TaxTypeName));
                }

                obj.IsClosed = rdr.GetBoolean(rdr.GetOrdinal(VPURPurchaseOrderFields.IsClosed));
                obj.IsVoid   = rdr.GetBoolean(rdr.GetOrdinal(VPURPurchaseOrderFields.IsVoid));
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.ChequeNumber)))
                {
                    obj.ChequeNumber = rdr.GetDecimal(rdr.GetOrdinal(VPURPurchaseOrderFields.ChequeNumber));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.ProductName)))
                {
                    obj.ProductName = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.ProductName));
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.ProductCode)))
                {
                    obj.ProductCode = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.ProductCode));
                }

                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.IsAcceptBatch)))
                {
                    obj.IsAcceptBatch = rdr.GetBoolean(rdr.GetOrdinal(VPURPurchaseOrderFields.IsAcceptBatch));
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.UserFullName)))
                {
                    obj.UserFullName = rdr.GetString(rdr.GetOrdinal(VPURPurchaseOrderFields.UserFullName));
                }
                if (!rdr.IsDBNull(rdr.GetOrdinal(VPURPurchaseOrderFields.ProductID)))
                {
                    obj.ProductID = rdr.GetInt32(rdr.GetOrdinal(VPURPurchaseOrderFields.ProductID));
                }

                list.Add(obj);
            }
            return(list);
        }