/// <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 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 BasketCoupon object from the given database data reader. /// </summary> /// <param name="basketCoupon">The BasketCoupon object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(BasketCoupon basketCoupon, IDataReader dr) { //SET FIELDS FROM ROW DATA basketCoupon.BasketId = dr.GetInt32(0); basketCoupon.CouponId = dr.GetInt32(1); basketCoupon.AppliedDate = LocaleHelper.ToLocalTime(dr.GetDateTime(2)); basketCoupon.IsDirty = false; }
protected string GetDetailUrl(object dataItem) { AffiliateSalesSummary a = (AffiliateSalesSummary)dataItem; StringBuilder url = new StringBuilder(); url.Append("SalesByAffiliateDetail.aspx?AffiliateId=" + a.AffiliateId.ToString()); url.Append(string.Format("&ReportDate={0}", LocaleHelper.ToLocalTime(a.StartDate).ToShortDateString())); return(url.ToString()); }
/// <summary> /// Loads the given Profile object from the given database data reader. /// </summary> /// <param name="profile">The Profile object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(Profile profile, IDataReader dr) { //SET FIELDS FROM ROW DATA profile.UserId = dr.GetInt32(0); profile.PropertyNames = dr.GetString(1); profile.PropertyValuesString = dr.GetString(2); profile.PropertyValuesBinary = NullableData.GetBytes(dr, 3); profile.LastUpdatedDate = LocaleHelper.ToLocalTime(NullableData.GetDateTime(dr, 4)); profile.IsDirty = false; }
/// <summary> /// Loads the given Special object from the given database data reader. /// </summary> /// <param name="special">The Special object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(Special special, IDataReader dr) { //SET FIELDS FROM ROW DATA special.SpecialId = dr.GetInt32(0); special.ProductId = dr.GetInt32(1); special.Price = dr.GetDecimal(2); special.StartDate = LocaleHelper.ToLocalTime(NullableData.GetDateTime(dr, 3)); special.EndDate = LocaleHelper.ToLocalTime(NullableData.GetDateTime(dr, 4)); special.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 Download object from the given database data reader. /// </summary> /// <param name="download">The Download object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(Download download, IDataReader dr) { //SET FIELDS FROM ROW DATA download.DownloadId = dr.GetInt32(0); download.OrderItemDigitalGoodId = dr.GetInt32(1); download.DownloadDate = LocaleHelper.ToLocalTime(dr.GetDateTime(2)); download.RemoteAddr = dr.GetString(3); download.UserAgent = dr.GetString(4); download.Referrer = dr.GetString(5); download.IsDirty = false; }
/// <summary> /// Loads the given UserPersonalization object from the given database data reader. /// </summary> /// <param name="userPersonalization">The UserPersonalization object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(UserPersonalization userPersonalization, IDataReader dr) { //SET FIELDS FROM ROW DATA userPersonalization.PersonalizationPathId = dr.GetInt32(0); userPersonalization.UserId = dr.GetInt32(1); userPersonalization.PageSettings = NullableData.GetBytes(dr, 2); userPersonalization.Theme = NullableData.GetString(dr, 3); userPersonalization.MasterPageFile = NullableData.GetString(dr, 4); userPersonalization.LastUpdatedDate = LocaleHelper.ToLocalTime(dr.GetDateTime(5)); userPersonalization.IsDirty = false; }
/// <summary> /// Loads the given UserPassword object from the given database data reader. /// </summary> /// <param name="userPassword">The UserPassword object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(UserPassword userPassword, IDataReader dr) { //SET FIELDS FROM ROW DATA userPassword.UserId = dr.GetInt32(0); userPassword.PasswordNumber = dr.GetByte(1); userPassword.Password = dr.GetString(2); userPassword.PasswordFormat = NullableData.GetString(dr, 3); userPassword.CreateDate = LocaleHelper.ToLocalTime(dr.GetDateTime(4)); userPassword.ForceExpiration = dr.GetBoolean(5); userPassword.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 ProductReview object from the given database data reader. /// </summary> /// <param name="productReview">The ProductReview object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(ProductReview productReview, IDataReader dr) { //SET FIELDS FROM ROW DATA productReview.ProductReviewId = dr.GetInt32(0); productReview.ProductId = dr.GetInt32(1); productReview.ReviewerProfileId = dr.GetInt32(2); productReview.ReviewDate = LocaleHelper.ToLocalTime(dr.GetDateTime(3)); productReview.Rating = dr.GetByte(4); productReview.ReviewTitle = dr.GetString(5); productReview.ReviewBody = dr.GetString(6); productReview.IsApproved = dr.GetBoolean(7); productReview.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 Option object from the given database data reader. /// </summary> /// <param name="option">The Option object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(Option option, IDataReader dr) { //SET FIELDS FROM ROW DATA option.OptionId = dr.GetInt32(0); option.Name = dr.GetString(1); option.HeaderText = NullableData.GetString(dr, 2); option.ShowThumbnails = dr.GetBoolean(3); option.ThumbnailColumns = dr.GetByte(4); option.ThumbnailWidth = dr.GetInt16(5); option.ThumbnailHeight = dr.GetInt16(6); option.CreatedDate = LocaleHelper.ToLocalTime(dr.GetDateTime(7)); option.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; }
private static ProfileInfoCollection GetProfilesForCommand(DbCommand selectCommand, int pageIndex, int pageSize, out int totalRecords) { if (pageIndex < 0) { throw new ArgumentException("Page index must be non-negative", "pageIndex"); } if (pageSize < 1) { throw new ArgumentException("Page size must be positive", "pageSize"); } long lBound = (long)pageIndex * pageSize; long uBound = lBound + pageSize - 1; if (uBound > System.Int32.MaxValue) { throw new ArgumentException("pageIndex*pageSize too large"); } Database database = Token.Instance.Database; ProfileInfoCollection profiles = new ProfileInfoCollection(); using (IDataReader reader = database.ExecuteReader(selectCommand)) { totalRecords = 0; while (reader.Read()) { totalRecords++; if (totalRecords - 1 < lBound || totalRecords - 1 > uBound) { continue; } string username = reader.GetString(0); bool isAnon = reader.GetBoolean(1); DateTime dtLastActivity = LocaleHelper.ToLocalTime(reader.GetDateTime(2)); DateTime dtLastUpdated = LocaleHelper.ToLocalTime(reader.GetDateTime(3)); int size = reader.GetInt32(4); profiles.Add(new ProfileInfo(username, isAnon, dtLastActivity, dtLastUpdated, size)); } reader.Close(); } return(profiles); }
/// <summary> /// Loads the given WishlistItem object from the given database data reader. /// </summary> /// <param name="wishlistItem">The WishlistItem object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(WishlistItem wishlistItem, IDataReader dr) { //SET FIELDS FROM ROW DATA wishlistItem.WishlistItemId = dr.GetInt32(0); wishlistItem.WishlistId = dr.GetInt32(1); wishlistItem.ProductId = dr.GetInt32(2); wishlistItem.OptionList = NullableData.GetString(dr, 3); wishlistItem.KitList = NullableData.GetString(dr, 4); wishlistItem.Price = NullableData.GetDecimal(dr, 5); wishlistItem.LineMessage = NullableData.GetString(dr, 6); wishlistItem.CreatedDate = LocaleHelper.ToLocalTime(dr.GetDateTime(7)); wishlistItem.LastModifiedDate = LocaleHelper.ToLocalTime(dr.GetDateTime(8)); wishlistItem.Desired = dr.GetInt16(9); wishlistItem.Received = dr.GetInt16(10); wishlistItem.Priority = dr.GetByte(11); wishlistItem.Comment = NullableData.GetString(dr, 12); wishlistItem.IsDirty = false; }
private void BindKey() { EncryptionKey currentKey = EncryptionKeyManager.Instance.CurrentKey; if (currentKey != null) { // create date is stored in utc DateTime createDate = LocaleHelper.ToLocalTime(currentKey.CreateDate); if (createDate > DateTime.MinValue) { LastSet.Text = createDate.ToShortDateString() + " " + createDate.ToShortTimeString(); } else { LastSet.Text = "n/a"; } } ToggleBackupPanels(currentKey != null && EncryptionKeyManager.IsKeyValid(currentKey.KeyData)); }
private void UpdateInventory(bool sendEmails) { foreach (GridViewRow row in InventoryGrid.Rows) { int dataItemIndex = row.DataItemIndex; dataItemIndex = (dataItemIndex - (InventoryGrid.PageSize * InventoryGrid.PageIndex)); int productId = (int)InventoryGrid.DataKeys[dataItemIndex].Values[0]; int productVariantId = AlwaysConvert.ToInt(InventoryGrid.DataKeys[dataItemIndex].Values[1].ToString()); int inStock = GetControlValue(row, "InStock"); int lowStock = GetControlValue(row, "LowStock"); TextBox availDate = (TextBox)row.FindControl("AvailabilityDate"); Product product = ProductDataSource.Load(productId); if (productVariantId.Equals(0)) { product.InStock = inStock; product.InStockWarningLevel = lowStock; product.AvailabilityDate = LocaleHelper.ToLocalTime(AlwaysConvert.ToDateTime(availDate.Text, DateTime.MinValue)); product.Save(); if (sendEmails && product.InStock > 0) { RestockNotify(sendEmails, product, null); } } else { ProductVariant variant = ProductVariantDataSource.Load(productVariantId); variant.InStock = inStock; variant.InStockWarningLevel = lowStock; variant.AvailabilityDate = LocaleHelper.ToLocalTime(AlwaysConvert.ToDateTime(availDate.Text, DateTime.MinValue)); variant.Save(); if (sendEmails && variant.InStock > 0) { RestockNotify(sendEmails, product, variant); } } } SavedMessage.Text = string.Format(SavedMessage.Text, DateTime.Now); SavedMessage.Visible = true; InventoryGrid.DataBind(); }
/// <summary> /// Loads the given Currency object from the given database data reader. /// </summary> /// <param name="currency">The Currency object to load.</param> /// <param name="dr">The database data reader to read data from.</param> public static void LoadDataReader(Currency currency, IDataReader dr) { //SET FIELDS FROM ROW DATA currency.CurrencyId = dr.GetInt32(0); currency.StoreId = dr.GetInt32(1); currency.Name = dr.GetString(2); currency.CurrencySymbol = NullableData.GetString(dr, 3); currency.DecimalDigits = dr.GetInt32(4); currency.DecimalSeparator = NullableData.GetString(dr, 5); currency.GroupSeparator = NullableData.GetString(dr, 6); currency.GroupSizes = NullableData.GetString(dr, 7); currency.NegativePattern = dr.GetByte(8); currency.NegativeSign = NullableData.GetString(dr, 9); currency.PositivePattern = dr.GetByte(10); currency.ISOCode = dr.GetString(11); currency.ISOCodePattern = NullableData.GetByte(dr, 12); currency.ExchangeRate = dr.GetDecimal(13); currency.AutoUpdate = dr.GetBoolean(14); currency.LastUpdate = LocaleHelper.ToLocalTime(NullableData.GetDateTime(dr, 15)); currency.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; }