private string ListProductToEBay( Product product, EBayTemplate template, EBayCategory category, Boolean isScheduleDate, DateTime scheduleDateTime) { string eBayItemID = string.Empty; EBayAccess access = new EBayAccess(UrlPath.StorefrontUrl); eBayItemID = access.AddItem(product, template, category, isScheduleDate, scheduleDateTime); if (access.HasError) { string errorMessage = string.Empty; foreach (EBayErrorType error in access.ErrorTypeList) { errorMessage += HttpUtility.HtmlEncode(error.ErrorLongMessage) + " (" + error.ErrorCode + ")<br/>"; } uxMessage.DisplayError(errorMessage); } return(eBayItemID); }
private void SaveListing(string eBayItemID, EBayTemplate template) { EBayAccess acc = new EBayAccess(); EBayItem item = GetEBayItemDetailByID(eBayItemID, template); ApiContext apiContext = acc.GetApiContext(template.EBayListSite); EBayList eBayList = new EBayList(); if (item.Type.Equals("Chinese")) { eBayList.BuyItNowPrice = ConvertUtilities.ToDecimal(item.Bidding_BuyItNowPrice); } else { eBayList.BuyItNowPrice = ConvertUtilities.ToDecimal(item.BuyItNowPrice); } eBayList.BidPrice = (decimal)item.Bidding_CurrentPrice; eBayList.ItemName = item.Title; eBayList.ItemNumber = item.ID; eBayList.LastStatus = (EBayList.EBayListStatus)Enum.Parse(typeof(EBayList.EBayListStatus), item.ListingStatus, true); eBayList.ListDate = item.StartTime; eBayList.ListType = (EBayList.EBayListType)Enum.Parse(typeof(EBayList.EBayListType), item.Type, true); eBayList.QtyLeft = item.QuantityLeft; eBayList.LastUpdate = DateTime.Now; eBayList.ViewUrl = item.ViewUrl; eBayList.Currency = item.Currency; eBayList = DataAccessContextDeluxe.EBayListRepository.Save(eBayList); }
protected void uxCategory5RadioList_SelectedIndexChanged(object sender, EventArgs e) { if (uxCategory5RadioList.SelectedItem.Text.Contains(">")) { uxPrimaryCategoryList6Panel.Visible = true; string parentPimaryCategoryID = uxCategory5RadioList.SelectedValue.ToString(); EBayAccess eBayAccess = new EBayAccess(); IList <EBayCategory> eBayCategoryList = eBayAccess.GetCategories(parentPimaryCategoryID, 5, ListSite); uxCategory6RadioList.Items.Clear(); foreach (EBayCategory eBayCategory in eBayCategoryList) { ListItem list = new ListItem(); if (!eBayCategory.IsExpire && !eBayCategory.IsVirtual && parentPimaryCategoryID != eBayCategory.PimaryCategoryID) { if (eBayCategory.IsLeafCategory) { list.Text = eBayCategory.PimaryCategoryName; } else { list.Text = eBayCategory.PimaryCategoryName + " >"; } list.Value = eBayCategory.PimaryCategoryID; list.Attributes.Add("IsLeaf", eBayCategory.IsLeafCategory.ToString()); uxCategory6RadioList.Items.Add(list); } } } else { } }
public void PopulateControl() { uxPrimaryCategoryListPanel.Visible = true; uxPrimaryCategoryList1Panel.Visible = true; EBayAccess eBayAccess = new EBayAccess(); IList <EBayCategory> eBayCategoryList = eBayAccess.GetCategories("-1", 0, ListSite); uxCategory1RadioList.Items.Clear(); uxCategory2RadioList.Items.Clear(); uxCategory3RadioList.Items.Clear(); uxCategory4RadioList.Items.Clear(); uxCategory5RadioList.Items.Clear(); uxCategory6RadioList.Items.Clear(); foreach (EBayCategory eBayCategory in eBayCategoryList) { ListItem list = new ListItem(); if (!eBayCategory.IsExpire && !eBayCategory.IsVirtual) { if (eBayCategory.IsLeafCategory) { list.Text = eBayCategory.PimaryCategoryName; } else { list.Text = eBayCategory.PimaryCategoryName + " >"; } list.Value = eBayCategory.PimaryCategoryID; //list.Attributes.Add( "IsLeaf", eBayCategory.IsLeafCategory.ToString() ); uxCategory1RadioList.Items.Add(list); } } }
private void RefreshListingInTable(string listID) { EBayList list = DataAccessContextDeluxe.EBayListRepository.GetOne(listID); if (list.LastStatus != EBayList.EBayListStatus.Completed && list.LastStatus != EBayList.EBayListStatus.Ended) { EBayAccess ebayAccess = new EBayAccess(); list = ebayAccess.GetListUpdateFromItem(list); DataAccessContextDeluxe.EBayListRepository.Save(list); } }
private void ShowListingFee(string[] productIDList, EBayTemplate template, EBayCategory category, Boolean isScheduleDate, DateTime scheduleDateTime) { EBayAccess access = new EBayAccess(UrlPath.StorefrontUrl); IList <EBayFee> feeList = new List <EBayFee>(); int productCount = productIDList.Length - 1; string totalFee = string.Empty; string firstProductID = productIDList[0]; DataTable dt = new DataTable(); dt.Columns.Add("feeName"); dt.Columns.Add("feeCost"); if (!String.IsNullOrEmpty(firstProductID)) { feeList = access.VerifyAddItem(GetProductByProductID(firstProductID), template, category, isScheduleDate, scheduleDateTime); foreach (EBayFee fee in feeList) { if (fee.Name.Equals("ListingFee")) //Total fee for listing the item { Currency currency = DataAccessContext.CurrencyRepository.GetOne(fee.Currency.ToString()); totalFee = currency.FormatPrice((fee.Value * productCount).ToString()); DataRow rowCostPerItem = dt.NewRow(); rowCostPerItem["feeName"] = "Per-Item cost"; rowCostPerItem["feeCost"] = currency.FormatPrice(fee.Value.ToString()); dt.Rows.Add(rowCostPerItem); break; } } foreach (EBayFee fee in feeList) { if (fee.Value != 0 && !fee.Name.Equals("ListingFee")) { Currency currency = DataAccessContext.CurrencyRepository.GetOne(fee.Currency.ToString()); DataRow dr = dt.NewRow(); dr["feeName"] = "- " + fee.Name; dr["feeCost"] = currency.FormatPrice(fee.Value.ToString()); dt.Rows.Add(dr); } } DataRow rowTotal = dt.NewRow(); rowTotal["feeName"] = "Total fees for " + productCount.ToString() + " item(s)"; rowTotal["feeCost"] = totalFee; dt.Rows.Add(rowTotal); } uxFeeDetailGrid.DataSource = dt; uxFeeDetailGrid.DataBind(); uxFeeDetailGrid.Rows[0].CssClass = "CssAdminContentTop"; uxFeeDetailGrid.Rows[uxFeeDetailGrid.Rows.Count - 1].CssClass = "CssAdminContentTop"; }
private EBayCategory GetEBayCategoryByTemplate(EBayTemplate template) { EBayAccess access = new EBayAccess(); EBayCategory primaryCategory = access.GetCategoriesDetailsByID(template.PrimaryeBayCategoryID, template.EBayListSite); EBayCategory eBayCategory = primaryCategory; if (!template.SecondaryeBayCategoryID.Equals("0")) { EBayCategory secondaryCategory = access.GetCategoriesDetailsByID(template.SecondaryeBayCategoryID, template.EBayListSite); eBayCategory.SecondaryCategoryID = secondaryCategory.PimaryCategoryID; eBayCategory.SecondaryCategoryName = secondaryCategory.PimaryCategoryName; } return(eBayCategory); }
protected void uxEndListingButton_Click(object sender, EventArgs e) { EBayAccess eBayAccess = new EBayAccess(); string failedItems = String.Empty; int successCount = 0; foreach (GridViewRow row in uxGirdEBayList.Rows) { CheckBox endCheck = (CheckBox)row.FindControl("uxCheck"); if (endCheck.Checked) { HyperLink hyperlink = (HyperLink)row.FindControl("uxHyperlinkItemNumber"); string listNumber = hyperlink.Text; EBayList.EBayListEndListingReason endType = (EBayList.EBayListEndListingReason)Enum.Parse(typeof(EBayList.EBayListEndListingReason), uxDropDownReason.SelectedValue, true); bool result = eBayAccess.EndListing(listNumber, endType); if (result == false) { failedItems += listNumber + ","; } else { successCount += 1; } } } RefreshListingCurrentPage(); if (failedItems == String.Empty) { uxMessage.DisplayMessage(Resources.EBayMessages.EndListingSuccess + " " + successCount.ToString() + " item(s)."); } else { uxMessage.DisplayError(Resources.EBayMessages.EndListingError + " " + failedItems.Substring(0, failedItems.Length - 1)); } }
private EBayItem GetEBayItemDetailByID(string eBayItemID, EBayTemplate template) { EBayAccess access = new EBayAccess(); return(access.GetItemDetail(eBayItemID, access.GetApiContext(template.EBayListSite))); }
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); }
private EBayItem GetEBayItemDetailByID(string eBayItemID) { EBayAccess acc = new EBayAccess(); return(acc.GetItemDetail(eBayItemID, acc.GetApiContext())); }