/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="BDProductPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class BDProduct</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:24 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static BDProduct SelectOne(BDProductPrimaryKey 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_BDProduct_SelectbyPrimaryKey", ref ExecutionState); if (dr.Read()) { BDProduct obj = new BDProduct(); PopulateObjectFromReader(obj, dr); dr.Close(); oDatabaseHelper.Dispose(); return(obj); } else { dr.Close(); oDatabaseHelper.Dispose(); return(null); } }
/// <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="BDProductGroupPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class BDProductGroup</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 12/27/2014 6:55:55 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static BDProductGroup SelectOneWithBDProductUsingProductGroupID(BDProductGroupPrimaryKey pk) { DatabaseHelper oDatabaseHelper = new DatabaseHelper(); bool ExecutionState = false; BDProductGroup 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_BDProductGroup_SelectOneWithBDProductUsingProductGroupID", ref ExecutionState); if (dr.Read()) { obj = new BDProductGroup(); PopulateObjectFromReader(obj, dr); dr.NextResult(); //Get the child records. obj.BDProductCollectionUsingProductGroupID = BDProduct.PopulateObjectsFromReader(dr); } dr.Close(); oDatabaseHelper.Dispose(); return(obj); }
/// <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 BDProductCollection</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:24 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static BDProductCollection PopulateObjectsFromReader(IDataReader rdr) { BDProductCollection list = new BDProductCollection(); while (rdr.Read()) { BDProduct obj = new BDProduct(); PopulateObjectFromReader(obj, rdr); list.Add(obj); } return(list); }
new private static void PopulateObjectFromReader(BDProduct obj, IDataReader rdr) { obj.ProductID = rdr.GetInt32(rdr.GetOrdinal(BDProductFields.ProductID)); obj.ProductName = rdr.GetString(rdr.GetOrdinal(BDProductFields.ProductName)); obj.ProductGroupID = rdr.GetInt32(rdr.GetOrdinal(BDProductFields.ProductGroupID)); if (!rdr.IsDBNull(rdr.GetOrdinal(BDProductFields.ProductCode))) { obj.ProductCode = rdr.GetString(rdr.GetOrdinal(BDProductFields.ProductCode)); } obj.IsAcceptBatch = rdr.GetBoolean(rdr.GetOrdinal(BDProductFields.IsAcceptBatch)); if (!rdr.IsDBNull(rdr.GetOrdinal(BDProductFields.ProductPrice))) { obj.ProductPrice = rdr.GetDecimal(rdr.GetOrdinal(BDProductFields.ProductPrice)); } obj.IsFixedPrice = rdr.GetBoolean(rdr.GetOrdinal(BDProductFields.IsFixedPrice)); obj.HasDiscount = rdr.GetBoolean(rdr.GetOrdinal(BDProductFields.HasDiscount)); if (!rdr.IsDBNull(rdr.GetOrdinal(BDProductFields.DiscountAmount))) { obj.DiscountAmount = rdr.GetDecimal(rdr.GetOrdinal(BDProductFields.DiscountAmount)); } if (!rdr.IsDBNull(rdr.GetOrdinal(BDProductFields.DescountRatio))) { obj.DescountRatio = rdr.GetDouble(rdr.GetOrdinal(BDProductFields.DescountRatio)); } obj.IsActive = rdr.GetBoolean(rdr.GetOrdinal(BDProductFields.IsActive)); if (!rdr.IsDBNull(rdr.GetOrdinal(BDProductFields.Notes))) { obj.Notes = rdr.GetString(rdr.GetOrdinal(BDProductFields.Notes)); } if (!rdr.IsDBNull(rdr.GetOrdinal(BDProductFields.MinPrice))) { obj.MinPrice = rdr.GetDecimal(rdr.GetOrdinal(BDProductFields.MinPrice)); } if (!rdr.IsDBNull(rdr.GetOrdinal(BDProductFields.MaxPrice))) { obj.MaxPrice = rdr.GetDecimal(rdr.GetOrdinal(BDProductFields.MaxPrice)); } if (!rdr.IsDBNull(rdr.GetOrdinal("TotalQty"))) { obj.TotalQty = rdr.GetDecimal(rdr.GetOrdinal("TotalQty")); } }
///<summary> /// This method will update one new row into the database using the property Information /// </summary> /// /// <param name="bDProduct" type="BDProduct">This BDProduct will be updated in the database.</param> /// /// <returns>True if succeeded</returns> public bool Update(BDProduct bDProduct) { _bDProduct = POS.DataLayer.BDProduct.SelectOne(new POS.DataLayer.BDProductPrimaryKey(bDProduct.ProductID)); _bDProduct.ProductName = bDProduct.ProductName; _bDProduct.ProductGroupID = bDProduct.ProductGroupID; _bDProduct.ProductCode = bDProduct.ProductCode; _bDProduct.IsAcceptBatch = bDProduct.IsAcceptBatch; _bDProduct.ProductPrice = bDProduct.ProductPrice; _bDProduct.IsFixedPrice = bDProduct.IsFixedPrice; _bDProduct.HasDiscount = bDProduct.HasDiscount; _bDProduct.DiscountAmount = bDProduct.DiscountAmount; _bDProduct.DescountRatio = bDProduct.DescountRatio; _bDProduct.IsActive = bDProduct.IsActive; _bDProduct.Notes = bDProduct.Notes; return(_bDProduct.Update()); }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// /// <param name="bDProduct" type="BDProduct">This BDProduct will be inserted in the database.</param> /// /// <returns>True if succeeded</returns> public bool Insert(BDProduct bDProduct) { _bDProduct = new POS.DataLayer.BDProduct(); _bDProduct.ProductID = bDProduct.ProductID; _bDProduct.ProductName = bDProduct.ProductName; _bDProduct.ProductGroupID = bDProduct.ProductGroupID; _bDProduct.ProductCode = bDProduct.ProductCode; _bDProduct.IsAcceptBatch = bDProduct.IsAcceptBatch; _bDProduct.ProductPrice = bDProduct.ProductPrice; _bDProduct.IsFixedPrice = bDProduct.IsFixedPrice; _bDProduct.HasDiscount = bDProduct.HasDiscount; _bDProduct.DiscountAmount = bDProduct.DiscountAmount; _bDProduct.DescountRatio = bDProduct.DescountRatio; _bDProduct.IsActive = bDProduct.IsActive; _bDProduct.Notes = bDProduct.Notes; return(_bDProduct.Insert()); }
/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="BDProductPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class BDProduct</returns> public BDProduct SelectOne(BDProductPrimaryKey pk) { _bDProductWCF = new BDProduct(); _bDProduct = POS.DataLayer.BDProductBase.SelectOne(new POS.DataLayer.BDProductPrimaryKey(pk.ProductID)); _bDProductWCF.ProductID = _bDProduct.ProductID; _bDProductWCF.ProductName = _bDProduct.ProductName; _bDProductWCF.ProductGroupID = _bDProduct.ProductGroupID; _bDProductWCF.ProductCode = _bDProduct.ProductCode; _bDProductWCF.IsAcceptBatch = _bDProduct.IsAcceptBatch; _bDProductWCF.ProductPrice = _bDProduct.ProductPrice; _bDProductWCF.IsFixedPrice = _bDProduct.IsFixedPrice; _bDProductWCF.HasDiscount = _bDProduct.HasDiscount; _bDProductWCF.DiscountAmount = _bDProduct.DiscountAmount; _bDProductWCF.DescountRatio = _bDProduct.DescountRatio; _bDProductWCF.IsActive = _bDProduct.IsActive; _bDProductWCF.Notes = _bDProduct.Notes; return(_bDProductWCF); }
/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="BDProductPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class BDProduct</returns> public BDProduct SelectOne(BDProductPrimaryKey pk) { _bDProductWCF = new BDProduct(); _bDProduct = POS.DataLayer.BDProductBase.SelectOne(new POS.DataLayer.BDProductPrimaryKey(pk.ProductID)); _bDProductWCF.ProductID = _bDProduct.ProductID; _bDProductWCF.ProductName = _bDProduct.ProductName; _bDProductWCF.ProductGroupID = _bDProduct.ProductGroupID; _bDProductWCF.ProductCode = _bDProduct.ProductCode; _bDProductWCF.IsAcceptBatch = _bDProduct.IsAcceptBatch; _bDProductWCF.ProductPrice = _bDProduct.ProductPrice; _bDProductWCF.IsFixedPrice = _bDProduct.IsFixedPrice; _bDProductWCF.HasDiscount = _bDProduct.HasDiscount; _bDProductWCF.DiscountAmount = _bDProduct.DiscountAmount; _bDProductWCF.DescountRatio = _bDProduct.DescountRatio; _bDProductWCF.IsActive = _bDProduct.IsActive; _bDProductWCF.Notes = _bDProduct.Notes; _bDProductWCF.MinPrice = _bDProduct.MinPrice; _bDProductWCF.MaxPrice = _bDProduct.MaxPrice; return _bDProductWCF; }
new private static BDProductCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) { BDProductCollection list = new BDProductCollection(); if (rdr.Read()) { BDProduct obj = new BDProduct(); PopulateObjectFromReader(obj, rdr); list.Add(obj); while (rdr.Read()) { obj = new BDProduct(); PopulateObjectFromReader(obj, rdr); list.Add(obj); } oDatabaseHelper.Dispose(); return(list); } else { oDatabaseHelper.Dispose(); return(null); } }
/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="BDProductPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class BDProduct</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:24 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// public static BDProduct SelectOne(BDProductPrimaryKey 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_BDProduct_SelectbyPrimaryKey", ref ExecutionState); if (dr.Read()) { BDProduct obj=new BDProduct(); PopulateObjectFromReader(obj,dr); dr.Close(); oDatabaseHelper.Dispose(); return obj; } else { dr.Close(); oDatabaseHelper.Dispose(); return null; } }
/// <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 BDProductCollection</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:24 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static BDProductCollection PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper) { BDProductCollection list = new BDProductCollection(); if (rdr.Read()) { BDProduct obj = new BDProduct(); PopulateObjectFromReader(obj, rdr); list.Add(obj); while (rdr.Read()) { obj = new BDProduct(); PopulateObjectFromReader(obj, rdr); list.Add(obj); } oDatabaseHelper.Dispose(); return list; } else { oDatabaseHelper.Dispose(); return null; } }
/// <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 BDProductCollection</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 3/7/2015 2:37:24 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static BDProductCollection PopulateObjectsFromReader(IDataReader rdr) { BDProductCollection list = new BDProductCollection(); while (rdr.Read()) { BDProduct obj = new BDProduct(); PopulateObjectFromReader(obj,rdr); list.Add(obj); } return list; }
///<summary> /// This method will update one new row into the database using the property Information /// </summary> /// /// <param name="bDProduct" type="BDProduct">This BDProduct will be updated in the database.</param> /// /// <returns>True if succeeded</returns> public bool Update(BDProduct bDProduct) { _bDProduct=POS.DataLayer.BDProduct.SelectOne(new POS.DataLayer.BDProductPrimaryKey(bDProduct.ProductID)); _bDProduct.ProductName=bDProduct.ProductName; _bDProduct.ProductGroupID=bDProduct.ProductGroupID; _bDProduct.ProductCode=bDProduct.ProductCode; _bDProduct.IsAcceptBatch=bDProduct.IsAcceptBatch; _bDProduct.ProductPrice=bDProduct.ProductPrice; _bDProduct.IsFixedPrice=bDProduct.IsFixedPrice; _bDProduct.HasDiscount=bDProduct.HasDiscount; _bDProduct.DiscountAmount=bDProduct.DiscountAmount; _bDProduct.DescountRatio=bDProduct.DescountRatio; _bDProduct.IsActive=bDProduct.IsActive; _bDProduct.Notes=bDProduct.Notes; _bDProduct.MinPrice=bDProduct.MinPrice; _bDProduct.MaxPrice=bDProduct.MaxPrice; return _bDProduct.Update(); }
/// <summary> /// This method will insert one new row into the database using the property Information /// </summary> /// /// <param name="bDProduct" type="BDProduct">This BDProduct will be inserted in the database.</param> /// /// <returns>True if succeeded</returns> public bool Insert(BDProduct bDProduct) { _bDProduct = new POS.DataLayer.BDProduct(); _bDProduct.ProductID=bDProduct.ProductID; _bDProduct.ProductName=bDProduct.ProductName; _bDProduct.ProductGroupID=bDProduct.ProductGroupID; _bDProduct.ProductCode=bDProduct.ProductCode; _bDProduct.IsAcceptBatch=bDProduct.IsAcceptBatch; _bDProduct.ProductPrice=bDProduct.ProductPrice; _bDProduct.IsFixedPrice=bDProduct.IsFixedPrice; _bDProduct.HasDiscount=bDProduct.HasDiscount; _bDProduct.DiscountAmount=bDProduct.DiscountAmount; _bDProduct.DescountRatio=bDProduct.DescountRatio; _bDProduct.IsActive=bDProduct.IsActive; _bDProduct.Notes=bDProduct.Notes; _bDProduct.MinPrice=bDProduct.MinPrice; _bDProduct.MaxPrice=bDProduct.MaxPrice; return _bDProduct.Insert(); }