/// <summary> /// Loads the given OrderItem object from the given database data reader. /// </summary> /// <param name="orderItem">The OrderItem object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(OrderItem orderItem, IDataReader dr) { //SET FIELDS FROM ROW DATA orderItem.OrderItemId = dr.GetInt32(0); orderItem.OrderId = dr.GetInt32(1); orderItem.ParentItemId = NullableData.GetInt32(dr, 2); orderItem.OrderItemTypeId = dr.GetInt16(3); orderItem.ShippableId = dr.GetByte(4); orderItem.OrderShipmentId = NullableData.GetInt32(dr, 5); orderItem.ProductId = NullableData.GetInt32(dr, 6); orderItem.Name = dr.GetString(7); orderItem.OptionList = NullableData.GetString(dr, 8); orderItem.VariantName = NullableData.GetString(dr, 9); orderItem.Sku = NullableData.GetString(dr, 10); orderItem.Price = dr.GetDecimal(11); orderItem.Weight = dr.GetDecimal(12); orderItem.CostOfGoods = dr.GetDecimal(13); orderItem.Quantity = dr.GetInt16(14); orderItem.LineMessage = NullableData.GetString(dr, 15); orderItem.OrderBy = dr.GetInt16(16); orderItem.GiftMessage = NullableData.GetString(dr, 17); orderItem.TaxCodeId = NullableData.GetInt32(dr, 18); orderItem.WrapStyleId = NullableData.GetInt32(dr, 19); orderItem.WishlistItemId = NullableData.GetInt32(dr, 20); orderItem.InventoryStatusId = dr.GetInt16(21); orderItem.TaxRate = dr.GetDecimal(22); orderItem.TaxAmount = dr.GetDecimal(23); orderItem.KitList = NullableData.GetString(dr, 24); orderItem.CustomFields.Parse(NullableData.GetString(dr, 25)); orderItem.IsDirty = false; }
/// <summary> /// Loads the given OrderShipment object from the given database data reader. /// </summary> /// <param name="orderShipment">The OrderShipment object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(OrderShipment orderShipment, IDataReader dr) { //SET FIELDS FROM ROW DATA orderShipment.OrderShipmentId = dr.GetInt32(0); orderShipment.OrderId = dr.GetInt32(1); orderShipment.WarehouseId = NullableData.GetInt32(dr, 2); orderShipment.ShipToFirstName = NullableData.GetString(dr, 3); orderShipment.ShipToLastName = NullableData.GetString(dr, 4); orderShipment.ShipToCompany = NullableData.GetString(dr, 5); orderShipment.ShipToAddress1 = NullableData.GetString(dr, 6); orderShipment.ShipToAddress2 = NullableData.GetString(dr, 7); orderShipment.ShipToCity = NullableData.GetString(dr, 8); orderShipment.ShipToProvince = NullableData.GetString(dr, 9); orderShipment.ShipToPostalCode = NullableData.GetString(dr, 10); orderShipment.ShipToCountryCode = NullableData.GetString(dr, 11); orderShipment.ShipToPhone = NullableData.GetString(dr, 12); orderShipment.ShipToFax = NullableData.GetString(dr, 13); orderShipment.ShipToEmail = NullableData.GetString(dr, 14); orderShipment.ShipToResidence = NullableData.GetBoolean(dr, 15); orderShipment.ShipMethodId = NullableData.GetInt32(dr, 16); orderShipment.ShipMethodName = NullableData.GetString(dr, 17); orderShipment.ShipMessage = NullableData.GetString(dr, 18); orderShipment.ShipDate = LocaleHelper.ToLocalTime(NullableData.GetDateTime(dr, 19)); orderShipment.IsDirty = false; }
/// <summary> /// Loads the given BasketItem object from the given database data reader. /// </summary> /// <param name="basketItem">The BasketItem object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(BasketItem basketItem, IDataReader dr) { //SET FIELDS FROM ROW DATA basketItem.BasketItemId = dr.GetInt32(0); basketItem.ParentItemId = dr.GetInt32(1); basketItem.BasketId = dr.GetInt32(2); basketItem.BasketShipmentId = NullableData.GetInt32(dr, 3); basketItem.ProductId = dr.GetInt32(4); basketItem.OptionList = NullableData.GetString(dr, 5); basketItem.TaxCodeId = NullableData.GetInt32(dr, 6); basketItem.Name = dr.GetString(7); basketItem.Sku = NullableData.GetString(dr, 8); basketItem.Price = dr.GetDecimal(9); basketItem.Weight = dr.GetDecimal(10); basketItem.Quantity = dr.GetInt16(11); basketItem.LineMessage = NullableData.GetString(dr, 12); basketItem.OrderItemTypeId = dr.GetInt16(13); basketItem.OrderBy = dr.GetInt16(14); basketItem.WrapStyleId = NullableData.GetInt32(dr, 15); basketItem.GiftMessage = NullableData.GetString(dr, 16); basketItem.WishlistItemId = NullableData.GetInt32(dr, 17); basketItem.ShippableId = dr.GetByte(18); basketItem.LastModifiedDate = LocaleHelper.ToLocalTime(dr.GetDateTime(19)); basketItem.TaxRate = dr.GetDecimal(20); basketItem.TaxAmount = dr.GetDecimal(21); basketItem.KitList = NullableData.GetString(dr, 22); basketItem.CustomFields.Parse(NullableData.GetString(dr, 23)); basketItem.IsDirty = false; }
/// <summary> /// Loads the given Affiliate object from the given database data reader. /// </summary> /// <param name="affiliate">The Affiliate object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(Affiliate affiliate, IDataReader dr) { //SET FIELDS FROM ROW DATA affiliate.AffiliateId = dr.GetInt32(0); affiliate.StoreId = dr.GetInt32(1); affiliate.Name = dr.GetString(2); affiliate.PayeeName = NullableData.GetString(dr, 3); affiliate.FirstName = NullableData.GetString(dr, 4); affiliate.LastName = NullableData.GetString(dr, 5); affiliate.Company = NullableData.GetString(dr, 6); affiliate.Address1 = NullableData.GetString(dr, 7); affiliate.Address2 = NullableData.GetString(dr, 8); affiliate.City = NullableData.GetString(dr, 9); affiliate.Province = NullableData.GetString(dr, 10); affiliate.PostalCode = NullableData.GetString(dr, 11); affiliate.CountryCode = NullableData.GetString(dr, 12); affiliate.PhoneNumber = NullableData.GetString(dr, 13); affiliate.FaxNumber = NullableData.GetString(dr, 14); affiliate.MobileNumber = NullableData.GetString(dr, 15); affiliate.WebsiteUrl = NullableData.GetString(dr, 16); affiliate.Email = NullableData.GetString(dr, 17); affiliate.CommissionRate = dr.GetDecimal(18); affiliate.CommissionIsPercent = dr.GetBoolean(19); affiliate.CommissionOnTotal = dr.GetBoolean(20); affiliate.ReferralPeriodId = dr.GetByte(21); affiliate.ReferralDays = dr.GetInt16(22); affiliate.GroupId = NullableData.GetInt32(dr, 23); affiliate.IsDirty = false; }
/// <summary> /// Loads the given UserGroup object from the given database data reader. /// </summary> /// <param name="userGroup">The UserGroup object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(UserGroup userGroup, IDataReader dr) { //SET FIELDS FROM ROW DATA userGroup.UserId = dr.GetInt32(0); userGroup.GroupId = dr.GetInt32(1); userGroup.SubscriptionId = NullableData.GetInt32(dr, 2); userGroup.IsDirty = false; }
/// <summary> /// Loads the given TrackingNumber object from the given database data reader. /// </summary> /// <param name="trackingNumber">The TrackingNumber object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(TrackingNumber trackingNumber, IDataReader dr) { //SET FIELDS FROM ROW DATA trackingNumber.TrackingNumberId = dr.GetInt32(0); trackingNumber.OrderShipmentId = dr.GetInt32(1); trackingNumber.ShipGatewayId = NullableData.GetInt32(dr, 2); trackingNumber.TrackingNumberData = dr.GetString(3); trackingNumber.IsDirty = false; }
/// <summary> /// Loads the given PaymentMethod object from the given database data reader. /// </summary> /// <param name="paymentMethod">The PaymentMethod object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(PaymentMethod paymentMethod, IDataReader dr) { //SET FIELDS FROM ROW DATA paymentMethod.PaymentMethodId = dr.GetInt32(0); paymentMethod.StoreId = dr.GetInt32(1); paymentMethod.Name = dr.GetString(2); paymentMethod.PaymentInstrumentId = dr.GetInt16(3); paymentMethod.PaymentGatewayId = NullableData.GetInt32(dr, 4); paymentMethod.OrderBy = dr.GetInt16(5); paymentMethod.IsDirty = false; }
/// <summary> /// Loads the given OrderNote object from the given database data reader. /// </summary> /// <param name="orderNote">The OrderNote object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(OrderNote orderNote, IDataReader dr) { //SET FIELDS FROM ROW DATA orderNote.OrderNoteId = dr.GetInt32(0); orderNote.OrderId = dr.GetInt32(1); orderNote.UserId = NullableData.GetInt32(dr, 2); orderNote.CreatedDate = LocaleHelper.ToLocalTime(dr.GetDateTime(3)); orderNote.Comment = dr.GetString(4); orderNote.NoteTypeId = dr.GetByte(5); orderNote.IsDirty = false; }
/// <summary> /// Loads the given Subscription object from the given database data reader. /// </summary> /// <param name="subscription">The Subscription object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(Subscription subscription, IDataReader dr) { //SET FIELDS FROM ROW DATA subscription.SubscriptionId = dr.GetInt32(0); subscription.ProductId = dr.GetInt32(1); subscription.UserId = dr.GetInt32(2); subscription.OrderItemId = NullableData.GetInt32(dr, 3); subscription.TransactionId = NullableData.GetInt32(dr, 4); subscription.IsActive = dr.GetBoolean(5); subscription.ExpirationDate = LocaleHelper.ToLocalTime(NullableData.GetDateTime(dr, 6)); subscription.GroupId = NullableData.GetInt32(dr, 7); subscription.IsDirty = false; }
/// <summary> /// Loads the given WrapStyle object from the given database data reader. /// </summary> /// <param name="wrapStyle">The WrapStyle object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(WrapStyle wrapStyle, IDataReader dr) { //SET FIELDS FROM ROW DATA wrapStyle.WrapStyleId = dr.GetInt32(0); wrapStyle.WrapGroupId = dr.GetInt32(1); wrapStyle.Name = dr.GetString(2); wrapStyle.TaxCodeId = NullableData.GetInt32(dr, 3); wrapStyle.Price = dr.GetDecimal(4); wrapStyle.ThumbnailUrl = NullableData.GetString(dr, 5); wrapStyle.ImageUrl = NullableData.GetString(dr, 6); wrapStyle.OrderBy = dr.GetInt16(7); wrapStyle.IsDirty = false; }
/// <summary> /// Loads the given EmailList object from the given database data reader. /// </summary> /// <param name="emailList">The EmailList object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(EmailList emailList, IDataReader dr) { //SET FIELDS FROM ROW DATA emailList.EmailListId = dr.GetInt32(0); emailList.StoreId = dr.GetInt32(1); emailList.Name = dr.GetString(2); emailList.Description = NullableData.GetString(dr, 3); emailList.IsPublic = dr.GetBoolean(4); emailList.SignupRuleId = dr.GetInt16(5); emailList.SignupEmailTemplateId = NullableData.GetInt32(dr, 6); emailList.LastSendDate = LocaleHelper.ToLocalTime(NullableData.GetDateTime(dr, 7)); emailList.IsDirty = false; }
/// <summary> /// Loads the given Redirect object from the given database data reader. /// </summary> /// <param name="redirect">The Redirect object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(Redirect redirect, IDataReader dr) { //SET FIELDS FROM ROW DATA redirect.RedirectId = dr.GetInt32(0); redirect.StoreId = dr.GetInt32(1); redirect.SourceUrl = dr.GetString(2); redirect.TargetUrl = dr.GetString(3); redirect.UseRegEx = dr.GetBoolean(4); redirect.CreatedDate = LocaleHelper.ToLocalTime(dr.GetDateTime(5)); redirect.LastVisitedDate = LocaleHelper.ToLocalTime(NullableData.GetDateTime(dr, 6)); redirect.VisitCount = NullableData.GetInt32(dr, 7); redirect.OrderBy = dr.GetInt16(8); redirect.IsDirty = false; }
/// <summary> /// Loads the given SubscriptionPlan object from the given database data reader. /// </summary> /// <param name="subscriptionPlan">The SubscriptionPlan object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(SubscriptionPlan subscriptionPlan, IDataReader dr) { //SET FIELDS FROM ROW DATA subscriptionPlan.ProductId = dr.GetInt32(0); subscriptionPlan.Name = dr.GetString(1); subscriptionPlan.NumberOfPayments = dr.GetInt16(2); subscriptionPlan.PaymentFrequency = dr.GetInt16(3); subscriptionPlan.PaymentFrequencyUnitId = dr.GetByte(4); subscriptionPlan.RecurringCharge = dr.GetDecimal(5); subscriptionPlan.RecurringChargeSpecified = dr.GetBoolean(6); subscriptionPlan.GroupId = NullableData.GetInt32(dr, 7); subscriptionPlan.TaxCodeId = NullableData.GetInt32(dr, 8); subscriptionPlan.IsDirty = false; }
/// <summary> /// Loads the given TaxRule object from the given database data reader. /// </summary> /// <param name="taxRule">The TaxRule object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(TaxRule taxRule, IDataReader dr) { //SET FIELDS FROM ROW DATA taxRule.TaxRuleId = dr.GetInt32(0); taxRule.StoreId = dr.GetInt32(1); taxRule.Name = dr.GetString(2); taxRule.TaxRate = dr.GetDecimal(3); taxRule.UseBillingAddress = dr.GetBoolean(4); taxRule.GroupRuleId = dr.GetByte(5); taxRule.TaxCodeId = NullableData.GetInt32(dr, 6); taxRule.Priority = dr.GetInt16(7); taxRule.RoundingRuleId = dr.GetByte(8); taxRule.UsePerItemTax = dr.GetBoolean(9); taxRule.IsDirty = false; }
/// <summary> /// Loads the given ShipMethod object from the given database data reader. /// </summary> /// <param name="shipMethod">The ShipMethod object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(ShipMethod shipMethod, IDataReader dr) { //SET FIELDS FROM ROW DATA shipMethod.ShipMethodId = dr.GetInt32(0); shipMethod.StoreId = dr.GetInt32(1); shipMethod.ShipMethodTypeId = dr.GetInt16(2); shipMethod.Name = dr.GetString(3); shipMethod.Surcharge = dr.GetDecimal(4); shipMethod.ShipGatewayId = NullableData.GetInt32(dr, 5); shipMethod.ServiceCode = NullableData.GetString(dr, 6); shipMethod.MinPurchase = dr.GetDecimal(7); shipMethod.SurchargeIsVisible = dr.GetBoolean(8); shipMethod.SurchargeIsPercent = NullableData.GetBoolean(dr, 9); shipMethod.TaxCodeId = NullableData.GetInt32(dr, 10); shipMethod.SurchargeTaxCodeId = NullableData.GetInt32(dr, 11); shipMethod.OrderBy = dr.GetInt16(12); shipMethod.IsDirty = false; }
/// <summary> /// Loads the given Transaction object from the given database data reader. /// </summary> /// <param name="transaction">The Transaction object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(Transaction transaction, IDataReader dr) { //SET FIELDS FROM ROW DATA transaction.TransactionId = dr.GetInt32(0); transaction.TransactionTypeId = dr.GetInt16(1); transaction.PaymentId = dr.GetInt32(2); transaction.PaymentGatewayId = NullableData.GetInt32(dr, 3); transaction.ProviderTransactionId = NullableData.GetString(dr, 4); transaction.TransactionDate = LocaleHelper.ToLocalTime(dr.GetDateTime(5)); transaction.Amount = dr.GetDecimal(6); transaction.TransactionStatusId = dr.GetInt16(7); transaction.ResponseCode = NullableData.GetString(dr, 8); transaction.ResponseMessage = NullableData.GetString(dr, 9); transaction.AuthorizationCode = NullableData.GetString(dr, 10); transaction.AVSResultCode = NullableData.GetString(dr, 11); transaction.CVVResultCode = NullableData.GetString(dr, 12); transaction.CAVResultCode = NullableData.GetString(dr, 13); transaction.RemoteIP = NullableData.GetString(dr, 14); transaction.Referrer = NullableData.GetString(dr, 15); transaction.AdditionalData = NullableData.GetString(dr, 16); transaction.IsDirty = false; }
/// <summary> /// Loads the given PageView object from the given database data reader. /// </summary> /// <param name="pageView">The PageView object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(PageView pageView, IDataReader dr) { //SET FIELDS FROM ROW DATA pageView.PageViewId = dr.GetInt32(0); pageView.StoreId = dr.GetInt32(1); pageView.ActivityDate = LocaleHelper.ToLocalTime(dr.GetDateTime(2)); pageView.RemoteIP = dr.GetString(3); pageView.RequestMethod = dr.GetString(4); pageView.UserId = dr.GetInt32(5); pageView.UriStem = dr.GetString(6); pageView.UriQuery = NullableData.GetString(dr, 7); pageView.TimeTaken = dr.GetInt32(8); pageView.UserAgent = NullableData.GetString(dr, 9); pageView.Referrer = NullableData.GetString(dr, 10); pageView.CatalogNodeId = NullableData.GetInt32(dr, 11); pageView.CatalogNodeTypeId = NullableData.GetInt16(dr, 12); pageView.Browser = dr.GetString(13); pageView.BrowserName = dr.GetString(14); pageView.BrowserPlatform = dr.GetString(15); pageView.BrowserVersion = dr.GetString(16); pageView.AffiliateId = dr.GetInt32(17); pageView.IsDirty = false; }
public static List <ProductInventoryDetail> GetLowProductInventory(int maximumRows, int startRowIndex, string sortExpression) { if (string.IsNullOrEmpty(sortExpression)) { sortExpression = "Name, VariantName"; } if (sortExpression.ToUpperInvariant().Equals("NAME")) { sortExpression = "Name, VariantName"; } else if (sortExpression.ToUpperInvariant().Equals("NAME DESC")) { sortExpression = "Name DESC, VariantName DESC"; } List <ProductInventoryDetail> results = new List <ProductInventoryDetail>(); StringBuilder selectQuery = new StringBuilder(); selectQuery.Append("SELECT ProductId, Name, NULL AS ProductVariantId, NULL As VariantName, InStock, InStockWarningLevel"); selectQuery.Append(" FROM ac_Products"); selectQuery.Append(" WHERE InStock <= InStockWarningLevel"); selectQuery.Append(" AND InventoryModeId = 1"); selectQuery.Append(" UNION"); selectQuery.Append(" SELECT V.ProductId, P.Name, V.ProductVariantId, V.VariantName, V.InStock, V.InStockWarningLevel "); selectQuery.Append(" FROM ac_ProductVariants V, ac_Products P"); selectQuery.Append(" WHERE V.ProductId = P.ProductId"); selectQuery.Append(" AND P.InventoryModeId = 2"); selectQuery.Append(" AND V.InStock <= V.InStockWarningLevel"); selectQuery.Append(" ORDER BY " + sortExpression); Database database = Token.Instance.Database; DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString()); //EXECUTE THE COMMAND int thisIndex = 0; int rowCount = 0; using (IDataReader dr = database.ExecuteReader(selectCommand)) { while (dr.Read() && ((maximumRows < 1) || (rowCount < maximumRows))) { if (thisIndex >= startRowIndex) { results.Add(new ProductInventoryDetail(dr.GetInt32(0), dr.GetString(1), NullableData.GetInt32(dr, 2), NullableData.GetString(dr, 3), dr.GetInt32(4), dr.GetInt32(5))); rowCount++; } thisIndex++; } dr.Close(); } return(results); }