Example #1
0
    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";
    }
Example #2
0
    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);
    }