private DiscountGroup SetUpDiscontRuleFromGrid(DiscountGroup discountGroup, GridViewRow row, string discountRuleID) { for (int i = 0; i < discountGroup.DiscountRules.Count; i++) { if (discountGroup.DiscountRules[i].DiscountRuleID == discountRuleID) { string minitemText = ((TextBox)row.FindControl("uxToItemsText")).Text; discountGroup.DiscountRules[i].ToItems = (String.IsNullOrEmpty(minitemText)) ? 0 : int.Parse(minitemText); string amountText = ((TextBox)row.FindControl("uxAmountText")).Text; string discountResult = (String.IsNullOrEmpty(amountText) ? "0" : amountText); switch (CurrentDiscountType) { case "Percentage": discountGroup.DiscountRules[i].Percentage = ConvertUtilities.ToDouble(discountResult); discountGroup.DiscountRules[i].Amount = 0; break; case "Price": discountGroup.DiscountRules[i].Amount = decimal.Parse(discountResult); discountGroup.DiscountRules[i].Percentage = 0; break; default: discountGroup.DiscountRules[i].Percentage = 0; discountGroup.DiscountRules[i].Amount = 0; break; } } } return(discountGroup); }
public string ShowFromWeight(object toWeight) { double fromWeight = 0; IList <ShippingWeightRate> shippingWeightRateList = DataAccessContext.ShippingWeightRateRepository.GetAllByShippingID(ShippingID, "ToWeight"); for (int i = 0; i < shippingWeightRateList.Count; i++) { if (shippingWeightRateList[i].ToWeight == ConvertUtilities.ToDouble(toWeight)) { break; } else { fromWeight = shippingWeightRateList[i].ToWeight; } } if (fromWeight == 0) { return(String.Format("{0}", fromWeight)); } else { return(String.Format("> {0}", fromWeight)); } }
private void CreateYearData(DataTable table, DateTime day, int numMonth) { DateTime newDay; for (int i = 0; i < numMonth; i++) { bool existMonth = false; if (table.Rows.Count != 0) { for (int j = 0; j < table.Rows.Count; j++) { int orderMonth = ConvertUtilities.ToInt32(table.Rows[j]["MonthNumber"]); int orderYear = ConvertUtilities.ToInt32(table.Rows[j]["Year"]); newDay = day.AddMonths(i); if (orderMonth == newDay.Month && orderYear == newDay.Year) { _data1.Add(ConvertUtilities.ToDouble(table.Rows[j][_value])); existMonth = true; break; } } } if (existMonth == false) { _data1.Add(0); } newDay = day.AddMonths(i); _label1.Add(newDay.ToString("MMM, yy")); } _xLegend = "Month"; }
private Coupon SetupCoupon(Coupon coupon) { _couponID = uxCouponIDText.Text; coupon.CouponID = uxCouponIDText.Text.Trim(); coupon.DiscountType = GetDiscountType(); coupon.DiscountAmount = ConvertUtilities.ToDecimal(uxDiscountAmountText.Text); coupon.Percentage = ConvertUtilities.ToDouble(uxPercentageText.Text); coupon.MinimumQuantity = ConvertUtilities.ToInt32(uxMinimumQuantityText.Text); coupon.PromotionQuantity = ConvertUtilities.ToInt32(uxPromotionQuantityText.Text); coupon.RepeatDiscount = uxRepeatDiscountCheckBox.Checked; coupon.ExpirationType = GetExpirationType(); coupon.ExpirationDate = GetExpirationDate(); coupon.ExpirationQuantity = ConvertUtilities.ToInt32(uxExpirationQuantityText.Text); coupon.CurrentQuantity = ConvertUtilities.ToInt32(uxCurrentQuantityText.Text); coupon.MerchantNotes = uxMerchantNotesText.Text; coupon.ProductFilter = uxCouponCondition.ProductFilter; coupon.ProductIDs = uxCouponCondition.ProductIDText; coupon.CategoryIDs = uxCouponCondition.CategoryText; coupon.CustomerFilter = uxCouponCondition.CustomerFilter; coupon.CustomerUserName = uxCouponCondition.CustomerNameText; coupon.GenerateCouponCustomerByUserNamesOnceOnly(uxCouponCondition.CustomerNameOnceOnlyText); coupon.MinimumSubtotal = ConvertUtilities.ToDecimal(uxMinimumSubtotalText.Text); coupon.ProductCostType = GetProductCostType(); coupon.FreeShippingType = GetFreeShippingType(); return(coupon); }
private void CreateMonthData(DataTable table, DateTime day, int numDay) { DateTime newDay; for (int i = 0; i < numDay; i++) { bool existDay = false; if (table.Rows.Count != 0) { for (int j = 0; j < table.Rows.Count; j++) { DateTime orderDay = ConvertUtilities.ToDateTime(table.Rows[j]["RegisterPeriod"]); newDay = day; if (orderDay.Day == newDay.AddDays(i).Day&& orderDay.Month == newDay.AddDays(i).Month) { _data1.Add(ConvertUtilities.ToDouble(table.Rows[j][_value])); existDay = true; break; } } } if (existDay == false) { _data1.Add(0); } newDay = new DateTime(day.Year, day.Month, day.Day).AddDays(i); _label1.Add(newDay.ToString("MMM d, yy")); } _xLegend = "Date"; }
protected void uxProductReturnGrid_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { OrderItem item = (OrderItem)e.Row.DataItem; Product product = DataAccessContext.ProductRepository.GetOne( StoreContext.Culture, item.ProductID, StoreContext.CurrentStore.StoreID); Order order = DataAccessContext.OrderRepository.GetOne(item.OrderID); DateTime currectDate = DateTime.Now.Date; DateTime orderDate = order.OrderDate.Date; DateTime expireDate = orderDate.Date.AddDays(ConvertUtilities.ToDouble(product.ReturnTime)); if (currectDate > expireDate || item.ProductID.Equals("0") || product.ReturnTime == 0) { CheckBox box = (CheckBox)e.Row.FindControl("uxSelectBox"); box.Visible = false; Label quantity = (Label)e.Row.FindControl("uxQuantityLabel"); quantity.Text = "[$NotReturn]"; TextBox text = (TextBox)e.Row.FindControl("uxQuantityText"); text.Visible = false; RangeValidator range = (RangeValidator)e.Row.FindControl("uxQuantityRange"); range.Visible = false; range.Enabled = false; e.Row.ForeColor = Color.FromArgb(160, 160, 160); } } }
private void CreateDayData(DataTable table, DateTime day) { DateTime newDay; for (int i = 0; i < 24; i++) { bool existHour = false; if (table.Rows.Count != 0) { for (int j = 0; j < table.Rows.Count; j++) { newDay = new DateTime(day.Year, day.Month, day.Day, day.Hour, day.Minute, day.Second).AddHours(i); int orderHour = ConvertUtilities.ToInt32(table.Rows[j]["RegisterPeriod"]); DateTime orderDate = ConvertUtilities.ToDateTime(table.Rows[j]["RegisterDate"]); if (orderHour == newDay.Hour && orderDate.Day == newDay.Day) { _data1.Add(ConvertUtilities.ToDouble(table.Rows[j][_value])); existHour = true; break; } } } if (existHour == false) { _data1.Add(0); } newDay = day.AddHours(i); _label1.Add(newDay.Hour.ToString()); } _xLegend = "Hours"; }
private DiscountRule GetNewDiscontRuleFromGrid(DiscountRule discountRule, GridViewRow row) { string minitemText = ((TextBox)row.FindControl("uxToItemsText")).Text; discountRule.ToItems = (String.IsNullOrEmpty(minitemText)) ? 0 : int.Parse(minitemText); string amountText = ((TextBox)row.FindControl("uxAmountText")).Text; string discountResult = (String.IsNullOrEmpty(amountText) ? "0" : amountText); switch (CurrentDiscountType) { case "Percentage": discountRule.Percentage = ConvertUtilities.ToDouble(discountResult); discountRule.Amount = 0; break; case "Price": discountRule.Amount = decimal.Parse(discountResult); discountRule.Percentage = 0; break; default: discountRule.Percentage = 0; discountRule.Amount = 0; break; } return(discountRule); }
internal object ToPrimitivePropertyType() { if (Type == TypeCategory.String) { return(Value.ToString()); } if (Type == TypeCategory.Number) { return(Value == null ? 0.0 : ConvertUtilities.ToDouble(Value.ToString())); } if (Type == TypeCategory.Enum) { if (PropertyType == typeof(Enum)) { return(Value); } return(Enum.Parse(PropertyType, Value.ToString(), true)); } if (Type == TypeCategory.Boolean) { return(Convert.ToBoolean(Value)); } if (Type == null) { throw new InvalidOperationException($"{nameof(TypeCategory)} was null, however this should be impossible. Was method {nameof(ParseValue)} run first?"); } throw new InvalidOperationException($"Cannot convert value of category '{Type}' to a primitive type."); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); DateTime startOrderDate; DateTime endOrderDate; if (Period == PeriodType.Custom) { startOrderDate = Convert.ToDateTime(StartDate); endOrderDate = Convert.ToDateTime(EndDate); } else { ReportFilterUtilities.GetOrderDateRange(Period, out startOrderDate, out endOrderDate); } SetUpChart(chart, startOrderDate, endOrderDate); double maxRange = 0; DataTable table = CreateDataAndLabel(startOrderDate, endOrderDate); if (table.Rows.Count < 1) { maxRange = InitialMaxYAxisRange; } else { foreach (DataRow row in table.Rows) { double val = ConvertUtilities.ToDouble(row[_value]); if (val > maxRange) { maxRange = val; if (val < InitialMaxYAxisRange) { maxRange = InitialMaxYAxisRange; } } } } chart.AddElement(CreateLine(_data1)); SetChartStyle(chart); SetRangeScale(chart, (int)maxRange); SetYLengend(chart, _yLegend); SetXLengend(chart, _xLegend); SetXAxis(chart, _label1); Response.Clear(); //Response.CacheControl = "no-cache"; Response.Write(chart.ToString()); Response.End(); }
private string GetValue(string value) { if (uxSearchFilter.FieldName.ToLower() == "reviewrating") { return(ConvertUtilities.ToString(ConvertUtilities.ToDouble(value) / ConvertUtilities.ToDouble(DataAccessContext.Configurations.GetValue("StarRatingAmount")))); } else { return(value); } }
private ShippingWeightRate GetDetailsFromGrid(GridViewRow row, ShippingWeightRate shippingWeightRate) { shippingWeightRate.ShippingID = ShippingID; string toWeightText = ((TextBox)row.FindControl("uxToWeightText")).Text; shippingWeightRate.ToWeight = ConvertUtilities.ToDouble(toWeightText); string shippingWeightRateText = ((TextBox)row.FindControl("uxShippingWeightRate")).Text; shippingWeightRate.WeightRate = ConvertUtilities.ToDecimal(shippingWeightRateText); return(shippingWeightRate); }
private PromotionGroup SetUpPromotionGroup(PromotionGroup promotionGroup) { promotionGroup.Name = uxPromotionGroupNameText.Text; promotionGroup.Description = uxDescriptionText.Text; promotionGroup.Price = ConvertUtilities.ToDecimal(uxPriceText.Text); promotionGroup.TaxClassID = uxTaxClassDrop.SelectedValue; promotionGroup.Weight = ConvertUtilities.ToDouble(uxWeightText.Text); promotionGroup.IsEnabled = uxIsEnabeldCheck.Checked; promotionGroup.IsFreeShipping = uxIsFreeShippingCheck.Checked; promotionGroup.StoreID = StoreID; promotionGroup.SubGroupIDs = uxMultiSubGroup.ConvertToSubGroupIDs(); promotionGroup = uxPromotionImage.SetupImage(promotionGroup); return(promotionGroup); }
private bool IsExisted(object addToWeight) { bool isExisted = false; IList <ShippingWeightRate> shippingWeightRateList = DataAccessContext.ShippingWeightRateRepository.GetAllByShippingID(ShippingID, "ToWeight"); for (int i = 0; i < shippingWeightRateList.Count; i++) { if (shippingWeightRateList[i].ToWeight == ConvertUtilities.ToDouble(addToWeight)) { isExisted = true; } } return(isExisted); }
private void GetDetailsFromGrid(OptionItem optionItem, GridViewRow rowGrid) { optionItem.Name = ((TextBox)rowGrid.FindControl("uxNameText")).Text; optionItem.OptionItemType = GetOptionItemType(((DropDownList)rowGrid.FindControl("uxPriceTypeDrop")).SelectedValue); optionItem.WeightToAdd = ConvertUtilities.ToDouble(((TextBox)rowGrid.FindControl("uxweightToAddText")).Text); optionItem.ImageFile = ((TextBox)rowGrid.FindControl("uxImageFileText")).Text; if (optionItem.OptionItemType == OptionItem.PriceType.Price) { optionItem.PriceToAdd = ConvertUtilities.ToDecimal(((TextBox)rowGrid.FindControl("uxPriceTypeText")).Text); optionItem.PercentageChange = 0; } else { optionItem.PriceToAdd = 0; optionItem.PercentageChange = ConvertUtilities.ToDouble(((TextBox)rowGrid.FindControl("uxPriceTypeText")).Text); } }
private OptionItem GetDetailsFromPanel() { OptionItem optionItem = new OptionItem(uxLanguageControl.CurrentCulture); optionItem.OptionGroupID = CurrentID; optionItem.Name = uxNameText.Text; optionItem.OptionItemType = GetOptionItemType(uxPriceTypeDrop.SelectedValue); optionItem.WeightToAdd = ConvertUtilities.ToDouble(uxWeightToAddText.Text); optionItem.ImageFile = uxImageFileText.Text; if (optionItem.OptionItemType == OptionItem.PriceType.Price) { optionItem.PriceToAdd = ConvertUtilities.ToDecimal(uxPriceTypeText.Text); } else { optionItem.PercentageChange = ConvertUtilities.ToDouble(uxPriceTypeText.Text); } return(optionItem); }
private void UpdateOrder() { Order order = DataAccessContext.OrderRepository.GetOne(CurrentOrderID); order.OrderDate = GetOrderDate(GetCalendarDate("uxOrderDateCalendarPopup")); order.UserName = GetText("uxUserNameText"); order.Billing = new Address(GetText("uxFirstNameText"), GetText("uxLastNameText"), GetText("uxCompanyText"), GetText("uxAddress1Text"), GetText("uxAddress2Text"), GetText("uxCityText"), GetStateList("uxStateList"), GetText("uxZipText"), GetCountryList("uxCountryList"), GetText("uxPhoneText"), GetText("uxFaxText")); order.Email = GetText("uxEmailText"); order.Shipping = new ShippingAddress( new Address(GetText("uxShippingFirstNameText"), GetText("uxShippingLastNameText"), GetText("uxShippingCompanyText"), GetText("uxShippingAddress1Text"), GetText("uxShippingAddress2Text"), GetText("uxShippingCityText"), GetStateList("StateListShipping"), GetText("uxShippingZipText"), GetCountryList("CountryListShipping"), GetText("uxShippingPhoneText"), GetText("uxShippingFaxText")), false); order.PaymentMethod = GetText("uxPaymentMethodText"); order.ShippingMethod = GetText("uxShippingMethodText"); order.PaymentComplete = GetCheck("uxPaymentCompleteCheck"); order.Processed = GetCheck("uxProcessedCheck"); order.Status = GetDrop("uxStatusDrop"); order.Cancelled = GetCheck("uxCancelledCheck"); order.IPAddress = GetText("uxIPAddressText"); order.Subtotal = DataAccessContext.OrderItemRepository.GetSubtotal(CurrentOrderID); order.Tax = ConvertUtilities.ToDecimal(GetText("uxTaxText")); order.ShippingCost = ConvertUtilities.ToDecimal(GetText("uxShippingCostText")); order.CouponID = GetText("uxCouponIDText"); order.CouponDiscount = ConvertUtilities.ToDecimal(GetText("uxCouponDiscountText")); order.CustomerComments = GetText("uxCommentText"); order.BaseCurrencyCode = GetText("uxBaseCodeText"); order.UserCurrencyCode = GetText("uxUserCurrencyCodeText"); order.UserConversionRate = ConvertUtilities.ToDouble(GetText("uxConversionRateText")); order.InvoiceNotes = GetText("uxInvoiceNotesText"); order.GiftCertificateCode = GetText("uxGiftCertificateCodeText"); order.GiftCertificate = ConvertUtilities.ToDecimal((GetText("uxGiftCertificateText"))); order.TrackingNumber = GetText("uxTrackingNumerText"); order.TrackingMethod = GetDrop("uxTrackingMethodDrop"); order.HandlingFee = ConvertUtilities.ToDecimal(GetText("uxHandlingFeeText")); order.ContainsRecurring = IsOrderContainRecurring(); order.AvsAddrStatus = ((DropDownList)uxFormView.Row.FindControl("uxAvsAddrDrop")).SelectedValue; order.AvsZipStatus = ((DropDownList)uxFormView.Row.FindControl("uxAvsZipDrop")).SelectedValue; order.CvvStatus = ((DropDownList)uxFormView.Row.FindControl("uxCvvDrop")).SelectedValue; order.PONumber = GetText("uxPONumberText"); if (IsSaleTaxExemptVisible(true) && !String.IsNullOrEmpty(GetText("uxTaxExepmtIDText"))) { order.IsTaxExempt = true; order.TaxExemptID = GetText("uxTaxExepmtIDText"); order.TaxExemptCountry = GetCountryList("uxTaxExemptCountryList"); order.TaxExemptState = GetStateList("uxTaxExemptStateList"); } else { order.IsTaxExempt = false; order.TaxExemptID = String.Empty; order.TaxExemptCountry = String.Empty; order.TaxExemptState = String.Empty; } DataAccessContext.OrderRepository.Save(order); if (order.PaymentComplete) { CustomerRewardPoint.UpdateRewardPoint(order); if (!order.IsSubscriptionApplied) { OrderNotifyService orderNotifyService = new OrderNotifyService(order.OrderID); orderNotifyService.UpdateCustomerSubscription(order); order.IsSubscriptionApplied = true; DataAccessContext.OrderRepository.Save(order); } } }
private Boolean CheckCondition(string templateID, string[] productIDList) { Boolean conditionPass = true; EBayAccess access = new EBayAccess(UrlPath.StorefrontUrl); EBayTemplate eBayTemplate = DataAccessContextDeluxe.EBayTemplateRepository.GetOne(templateID); EBayCategory category = access.GetCategoriesDetailsByID(eBayTemplate.PrimaryeBayCategoryID, eBayTemplate.EBayListSite); EBayCategoryFeature feature = access.GetCategoryFeatureDetail(category.PimaryCategoryID, category.CategoryLevel, eBayTemplate.EBayListSite); ShowMessageByCondition(feature, category); if (feature.IsReturnPolicyEnabled) { if (!eBayTemplate.IsAcceptReturn) { lcMessage.Text = "Return Policy is required for listing. Please check your listing template."; return(false); } } foreach (string productID in productIDList) { if (productID.Equals("")) { break; } Product product = GetProductByProductID(productID); double productPrice = 0.0; foreach (ProductPrice price in product.ProductPrices) { if (price.StoreID.Equals("0")) //use defalut price { productPrice = (double)price.Price; break; } } if (eBayTemplate.DomesticShippingType == "Calculate" || eBayTemplate.InternationalShippingType == "Calculate") { if (product.Weight <= 0) { lcMessage.Text = "Cannot list to eBay because some product does not have weight."; return(false); } } if (String.IsNullOrEmpty(product.ShortDescription)) { lcMessage.Text = "Cannot list to eBay because some product does not have short description."; return(false); } if (product.IsCustomPrice) { lcMessage.Text = "Cannot list to eBay because some product(s) enabled custom price."; return(false); } if (product.IsCallForPrice) { lcMessage.Text = "Cannot list to eBay because some product(s) enabled call for price."; return(false); } IList <ProductOptionGroup> optionGroupList = product.ProductOptionGroups; if (optionGroupList.Count > 0) { lcMessage.Text = "Cannot list to eBay because some product(s) has option."; return(false); } if (product.IsRecurring) { lcMessage.Text = "Cannot list to eBay because some product(s) enabled recurring option."; return(false); } double eBayTemplateReservePrice = 0.0; double eBayTemplateStartingPrice = 0.0; double eBayTemplateBuyItNowPrice = 0.0; if (eBayTemplate.SellingMethod.Equals("Online Auction")) { if (eBayTemplate.UseReservePrice) { switch (eBayTemplate.ReservePriceType) { case "ProductPrice": eBayTemplateReservePrice = productPrice; break; case "PricePlusAmount": eBayTemplateReservePrice = productPrice + ConvertUtilities.ToDouble(eBayTemplate.ReservePriceValue); break; case "PricePlusPercentage": eBayTemplateReservePrice = productPrice + (productPrice * (ConvertUtilities.ToDouble(eBayTemplate.ReservePriceValue) / 100)); break; case "CustomPrice": eBayTemplateReservePrice = ConvertUtilities.ToDouble(eBayTemplate.ReservePriceValue); break; default: eBayTemplateReservePrice = productPrice; break; } } if (eBayTemplate.UseBuyItNowPrice) { switch (eBayTemplate.BuyItNowPriceType) { case "ProductPrice": eBayTemplateBuyItNowPrice = productPrice; break; case "PricePlusAmount": eBayTemplateBuyItNowPrice = productPrice + ConvertUtilities.ToDouble(eBayTemplate.BuyItNowPriceValue); break; case "PricePlusPercentage": eBayTemplateBuyItNowPrice = productPrice + (productPrice * (ConvertUtilities.ToDouble(eBayTemplate.BuyItNowPriceValue) / 100)); break; case "CustomPrice": eBayTemplateBuyItNowPrice = ConvertUtilities.ToDouble(eBayTemplate.BuyItNowPriceValue); break; default: eBayTemplateBuyItNowPrice = productPrice; break; } } switch (eBayTemplate.StartingPriceType) { case "ProductPrice": eBayTemplateStartingPrice = productPrice; break; case "PricePlusAmount": eBayTemplateStartingPrice = productPrice + ConvertUtilities.ToDouble(eBayTemplate.StartingPriceValue); break; case "PricePlusPercentage": eBayTemplateStartingPrice = productPrice + (productPrice * (ConvertUtilities.ToDouble(eBayTemplate.StartingPriceValue) / 100)); break; case "CustomPrice": eBayTemplateStartingPrice = ConvertUtilities.ToDouble(eBayTemplate.StartingPriceValue); break; default: eBayTemplateStartingPrice = productPrice; break; } if (eBayTemplate.UseReservePrice) { if (eBayTemplateReservePrice < feature.MinimumReservePrice) { lcMessage.Text = "Reserve Price in template is less than eBay minimun reserve price. Please check your template."; return(false); } if (eBayTemplateReservePrice <= eBayTemplateStartingPrice) { lcMessage.Text = "The starting price must be less than the reserve price. Please check your template."; return(false); } } if (eBayTemplate.UseBuyItNowPrice) { double eBayTemplateStartingPricePlusTenPercent = eBayTemplateStartingPrice + (eBayTemplateStartingPrice * 0.1); if (eBayTemplateBuyItNowPrice <= eBayTemplateStartingPricePlusTenPercent) { lcMessage.Text = "Buy It Now price should be at least 10% more than your starting price. Please check your template."; return(false); } } } } access.VerifyAddItem(GetProductByProductID(productIDList[0]), eBayTemplate, category, false, DateTime.Now); if (access.HasError) { foreach (EBayErrorType error in access.ErrorTypeList) { lcMessage.Text += HttpUtility.HtmlEncode(error.ErrorLongMessage) + " (" + error.ErrorCode + ")<br/>"; } lcMessage.ForeColor = System.Drawing.Color.Red; return(false); } return(conditionPass); }