Example #1
0
 public Offer(SellerType sellerType, bool isFba, decimal landedPrice, bool?isBuyBoxWinner = null)
 {
     m_sellerType     = sellerType;
     m_isFba          = isFba;
     m_landedPrice    = landedPrice;
     m_isBuyBoxWinner = isBuyBoxWinner;
 }
        public static ListingOffers MapToListingOffers(this Notification notification)
        {
            List <Offer> offers = notification.NotificationPayload.AnyOfferChangedNotification.Offers
                                  .Where(w => w.SubCondition == "new")
                                  .Select(s =>
            {
                string sellerId       = s.SellerId;
                SellerType sellerType = SellerType.Other;

                if (sellerId == c_jbShopSellerId)
                {
                    sellerType = SellerType.JBShop;
                }
                else if (sellerId == c_amazonSellerId)
                {
                    sellerType = SellerType.Amazon;
                }

                decimal landedPrice = s.ListingPrice.Amount + s.Shipping.Amount;

                return(new Offer(sellerType, s.IsFulfilledByAmazon, landedPrice, s.IsBuyBoxWinner));
            }).ToList();

            return(new ListingOffers(
                       notification.NotificationPayload.AnyOfferChangedNotification.OfferChangeTrigger.ASIN,
                       notification.NotificationMetaData.PublishTime,
                       offers,
                       ListingOffersSource.SubscriptionService));
        }
Example #3
0
    public Seller create(SellerType sellerType)
    {
        switch (sellerType)
        {
        case SellerType.Altruist:
            return(new AltruistSeller("Altruist " + ++_altruistCount));

        case SellerType.Liar:
            return(new LiarSeller("Liar " + ++_liarCount));

        case SellerType.Sly:
            return(new SlySeller("Sly " + ++_slyCount));

        case SellerType.Unpredictable:
            return(new UnpredictableSeller("Unpredictable " + ++_unpredictableCount));

        case SellerType.Vindictive:
            return(new VindictiveSeller("Vindictive " + ++_vindictiveCount));

        case SellerType.Cunning:
            return(new CunningSeller("Cunning " + ++_cunningCount));
        }

        return(null);
    }
Example #4
0
        public Seller(Guid id, SellerType type, string legalName, string businessEmail, string companyTaxId, string applicationUserId)
        {
            Id                = id;
            Type              = type;
            LegalName         = legalName;
            BusinessEmail     = businessEmail;
            CompanyTaxId      = companyTaxId;
            ApplicationUserId = applicationUserId;
            Status            = SellerStatusType.INITIAL;

            RiseEvent(
                new SellerCreatedEvent(
                    Id,
                    JsonConvert.SerializeObject(this)
                    )
                );
        }
Example #5
0
        /// <summary>
        /// Gets the user data.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <returns></returns>
        private EbayUserData GetUserData(UserType user)
        {
            var userData = new EbayUserData {
                BillingEmail       = user.BillingEmail,
                EIASToken          = user.EIASToken,
                EMail              = user.Email,
                eBayGoodStanding   = user.eBayGoodStandingSpecified ? user.eBayGoodStanding : (bool?)null,
                UserID             = user.UserID,
                FeedbackPrivate    = user.FeedbackPrivateSpecified ? user.FeedbackPrivate : (bool?)null,
                FeedbackRatingStar = user.FeedbackRatingStarSpecified ? user.FeedbackRatingStar.ToString() : null,
                FeedbackScore      = user.FeedbackScoreSpecified ? user.FeedbackScore : (int?)null,
                IDChanged          = user.UserIDChangedSpecified ? user.UserIDChanged : (bool?)null,
                IDLastChanged      = user.UserIDLastChangedSpecified ? user.UserIDLastChanged : (DateTime?)null,
                IdVerified         = user.IDVerifiedSpecified ? user.IDVerified : (bool?)null,
                RegistrationDate   = user.RegistrationDateSpecified ? user.RegistrationDate.ToUniversalTime() : (DateTime?)null,

                NewUser             = user.NewUserSpecified ? user.NewUser : (bool?)null,
                PayPalAccountStatus = user.PayPalAccountStatusSpecified ? user.PayPalAccountStatus.ToString() : null,
                PayPalAccountType   = user.PayPalAccountTypeSpecified ? user.PayPalAccountType.ToString() : null,
                QualifiesForSelling = user.QualifiesForSellingSpecified ? user.QualifiesForSelling : (bool?)null,
                Site    = user.SiteSpecified ? user.Site.ToString() : null,
                SkypeID = user.SkypeID != null?string.Join(", ", user.SkypeID.Cast <string>()) : null,
            };

            SellerType sellerInfo = user.SellerInfo;

            if (sellerInfo != null)
            {
                userData.SellerInfoQualifiesForB2BVAT = sellerInfo.QualifiesForB2BVAT;
                userData.SellerInfoSellerBusinessType = sellerInfo.SellerBusinessTypeSpecified ? sellerInfo.SellerBusinessType.ToString() : null;
                userData.SellerInfoStoreOwner         = sellerInfo.StoreOwner;
                userData.SellerInfoStoreSite          = sellerInfo.StoreSiteSpecified ? sellerInfo.StoreSite.ToString() : null;
                userData.SellerInfoStoreURL           = sellerInfo.StoreURL;
                userData.SellerInfoTopRatedSeller     = sellerInfo.TopRatedSellerSpecified ? sellerInfo.TopRatedSeller : (bool?)null;

                var details = sellerInfo.TopRatedSellerDetails;
                if (details != null && CollectionUtils.IsNotEmpty(details.TopRatedProgram))
                {
                    userData.SellerInfoTopRatedProgram = string.Join(", ", details.TopRatedProgram.Cast <string>());
                }
            }

            return(userData);
        }
Example #6
0
 public void SaveSellerType(SellerType sellerType)
 {
     using (DeepBlueEntities context = new DeepBlueEntities()) {
         if (sellerType.SellerTypeID == 0) {
             context.SellerTypes.AddObject(sellerType);
         }
         else {
             // Define an ObjectStateEntry and EntityKey for the current object.
             EntityKey key = default(EntityKey);
             object originalItem = null;
             key = context.CreateEntityKey("SellerTypes", sellerType);
             // Get the original item based on the entity key from the context
             // or from the database.
             if (context.TryGetObjectByKey(key, out originalItem)) {
                 // Call the ApplyCurrentValues method to apply changes
                 // from the updated item to the original version.
                 context.ApplyCurrentValues(key.EntitySetName, sellerType);
             }
         }
         context.SaveChanges();
     }
 }
Example #7
0
 public static MvcHtmlString GetSellerTypeDesc(this HtmlHelper helper, SellerType type)
 {
     return(new MvcHtmlString(Utils.Utils.GetEnumDescription(type)));
 }
Example #8
0
 public ActionResult UpdateSellerType(FormCollection collection)
 {
     EditSellerTypeModel model=new EditSellerTypeModel();
     ResultModel resultModel=new ResultModel();
     this.TryUpdateModel(model);
     string ErrorMessage=SellerAvailable(model.SellerType,model.SellerTypeId);
     if(String.IsNullOrEmpty(ErrorMessage)==false) {
         ModelState.AddModelError("Name",ErrorMessage);
     }
     if(ModelState.IsValid) {
         SellerType sellerType=AdminRepository.FindSellerType(model.SellerTypeId);
         if(sellerType==null) {
             sellerType=new SellerType();
             sellerType.CreatedBy=Authentication.CurrentUser.UserID;
             sellerType.CreatedDate=DateTime.Now;
         }
         sellerType.SellerType1=model.SellerType;
         sellerType.Enabled=model.Enabled;
         sellerType.EntityID=Authentication.CurrentEntity.EntityID;
         sellerType.LastUpdatedBy=Authentication.CurrentUser.UserID;
         sellerType.LastUpdatedDate=DateTime.Now;
         IEnumerable<ErrorInfo> errorInfo=AdminRepository.SaveSellerType(sellerType);
         if(errorInfo!=null) {
             resultModel.Result+=ValidationHelper.GetErrorInfo(errorInfo);
         } else {
             resultModel.Result="True||"+sellerType.SellerTypeID;
         }
     } else {
         foreach(var values in ModelState.Values.ToList()) {
             foreach(var err in values.Errors.ToList()) {
                 if(string.IsNullOrEmpty(err.ErrorMessage)==false) {
                     resultModel.Result+=err.ErrorMessage+"\n";
                 }
             }
         }
     }
     return View("Result",resultModel);
 }