protected override void InitializeSpecificData( MP_CustomerMarketPlace mp, MarketPlaceModel model, DateTime? history ) { var ebayFeedBack = mp.EbayFeedback.LastOrDefault(); model.Categories = GetEbayCategories(mp); model.EBay = BuildEBay(mp.EbayUserData.LastOrDefault(), mp.EbayUserAccountData.LastOrDefault(), ebayFeedBack); } // InitializeSpecificData
protected override void InitializeSpecificData(MP_CustomerMarketPlace mp, MarketPlaceModel model, DateTime?history) { if (_yodleeModel == null) { try { _yodleeModel = BuildYodlee(mp, history); } catch (Exception ex) { Log.Warn(ex, "Build Yodlee Model Failed."); } } model.Yodlee = _yodleeModel; }
} // GetPaymentAccountModel protected override void InitializeSpecificData( MP_CustomerMarketPlace mp, MarketPlaceModel model, DateTime? history ) { var cfm = new CompanyFilesModel { Files = new List<CompanyFile>() }; IEnumerable<MP_CompanyFilesMetaData> files = this.companyFilesRepo.GetByCustomerId(mp.Customer.Id); foreach (var file in files) { cfm.Files.Add(new CompanyFile { FileName = file.FileName, Id = file.Id, Uploaded = file.Created }); } // for each model.CompanyFiles = cfm; } // InitializeSpecificData
protected override void InitializeSpecificData(MP_CustomerMarketPlace mp, MarketPlaceModel model, DateTime?history) { VendorInfo vi = Configuration.Instance.GetVendorInfo(mp.Marketplace.Name); switch (vi.Behaviour) { case Behaviour.Default: // nothing here break; case Behaviour.HMRC: VatReturnFullData vrd = ObjectFactory.GetInstance <IEzServiceAccessor>().LoadVatReturnFullData(mp.Customer.Id, mp.Id); var datesSummary = new List <VatReturnSummaryDates>(); if (vrd.Summary != null) { foreach (var oSummary in vrd.Summary) { if (oSummary.Quarters.Any()) { datesSummary.Add(new VatReturnSummaryDates( oSummary.Quarters.Min(x => x.DateFrom), oSummary.Quarters.Max(x => x.DateTo) )); } // if has quarters } // for each summary item } // if has summary items model.HmrcData = new HmrcData { VatReturn = vrd.VatReturnRawData, RtiTaxMonths = vrd.RtiTaxMonthRawData, BankStatement = vrd.BankStatement, BankStatementAnnualized = vrd.BankStatementAnnualized, SalariesMultiplier = CurrentValues.Instance.HmrcSalariesMultiplier, VatReturnSummary = vrd.Summary, VatReturnSummaryDates = datesSummary.ToArray(), }; break; default: throw new ArgumentOutOfRangeException(); } // switch } // InitializeSpecificData
public async Task <ActionResult> Index(int?categoryId, int?currencyId, int?locationId, string sortBy, string searchTerm, int?page, MarketItemType?type) { var searchModel = new MarketItemSearchModel { CategoryId = categoryId.HasValue ? categoryId.Value : 0, LocationId = locationId.HasValue ? locationId.Value : 0, CurrencyId = currencyId.HasValue ? currencyId.Value : 0, SortBy = sortBy, ItemType = type, SearchTerm = searchTerm, Page = page.HasValue ? page.Value : 1, ItemsPerPage = 24 //TODO: UI selectable item count?? }; var response = await MarketplaceReader.GetMarketItems(searchModel); if (categoryId != Constant.MARKETPLACE_CATEGORY_ADULT) { response = response.Where(x => !x.IsAdult).ToList(); } var pagedItems = response.Skip(searchModel.ItemsPerPage * (searchModel.Page - 1)).Take(searchModel.ItemsPerPage); var model = new MarketPlaceModel { CategoryId = categoryId.HasValue ? categoryId.Value : 0, LocationId = locationId.HasValue ? locationId.Value : 0, CurrencyId = currencyId.HasValue ? currencyId.Value : 0, ItemType = type == null ? Cryptopia.Resources.Market.itemTypeAll : type.ToString(), SortBy = string.IsNullOrEmpty(sortBy) ? Resources.Market.marketItemSortyByTitle : sortBy, SearchTerm = searchTerm, Categories = await MarketplaceReader.GetMarketCategories(), MarketItems = new StaticPagedList <MarketListItemModel>(pagedItems, Math.Max(searchModel.Page, 1), searchModel.ItemsPerPage, response.Count), Locations = StaticDataCache.Locations.Where(x => x.ParentId == 0).OrderBy(x => x.Name).ToList(), Currencies = await CurrencyReader.GetCurrencies() }; return(View("MarketPlace", model)); }
} // UpdateOriginationDate public virtual void SetAggregationData(MarketPlaceModel model, List <IAnalysisDataParameterInfo> av) { var data = new Dictionary <string, string>(); if (av != null) { foreach (var info in av) { if (info != null && !string.IsNullOrEmpty(info.ParameterName)) { var val = info.ParameterName.Replace(" ", "").Replace("%", "") + info.TimePeriod; string temp; data.TryGetValue(val, out temp); if (temp == null) { data.Add(val, info.Value.ToString()); } } } } model.AnalysisDataInfo = data; } // SetAggregationData
} // GetLastTransaction protected override void InitializeSpecificData( MP_CustomerMarketPlace mp, MarketPlaceModel model, DateTime?history ) { TimeCounter tc = new TimeCounter("MarketplaceModelBuilder Amazon InitializeSpecificData building time for mp " + mp.Id); using (tc.AddStep("AskvilleStatus Time taken")) { var askville = ObjectFactory.GetInstance <AskvilleRepository>(); var askvilleTmp = askville.GetAskvilleByMarketplace(mp); model.AskvilleStatus = askvilleTmp != null ? askvilleTmp.Status.ToString() : AskvilleStatus.NotPerformed.ToString(); model.AskvilleGuid = askvilleTmp != null ? askvilleTmp.Guid : ""; } using (tc.AddStep("GetAmazonCategories Time taken")) { model.Categories = GetAmazonCategories(mp); } Log.Info(tc.ToString()); } // InitializeSpecificData
protected override void InitializeSpecificData(MP_CustomerMarketPlace mp, MarketPlaceModel model, DateTime?history) { model.PayPal = new PayPalAccountModel { PersonalInfo = new PayPalAccountInfoModel(mp.PersonalInfo), }; }
protected override void InitializeSpecificData(MP_CustomerMarketPlace mp, MarketPlaceModel model, DateTime?history) { model.Sage = BuildSage(mp); }
public async Task <ActionResult> MarketItem(int marketItemId) { var response = await MarketplaceReader.GetMarketItem(marketItemId); if (response == null) { return(RedirectToAction("Index")); } var currentUser = new Guid(User.Identity?.GetUserId() ?? Guid.Empty.ToString()); response.AlternateImages.Add(response.MainImage); var marketItem = new MarketItemModel { IsUserListing = (User.Identity.IsAuthenticated && response.UserId == currentUser), IsUserBuyer = response.BuyerUserId.HasValue && (User.Identity.IsAuthenticated && response.BuyerUserId.Value == currentUser), Title = response.Title, Id = response.Id, CategoryId = response.CategoryId, Symbol = response.Symbol, AskingPrice = response.AskingPrice, Description = response.Description, MainImage = response.MainImage, AlternateImages = response.AlternateImages, CloseDate = response.CloseDate, Created = response.Created, CurrencyId = response.CurrencyId, Feature = response.Feature, Location = response.Location, Questions = response.Questions, ReservePrice = response.ReservePrice, CurrentBidPrice = response.CurrentBidPrice, Bids = response.Bids, Status = response.Status, Type = response.Type, UserName = response.UserName, AllowPickup = response.AllowPickup, PickupOnly = response.PickupOnly, ShippingBuyerArrange = response.ShippingBuyerArrange, ShippingNational = response.ShippingNational, ShippingInternational = response.ShippingInternational, ShippingNationalPrice = response.ShippingNationalPrice, ShippingNationalDetails = response.ShippingNationalDetails, ShippingInternationalPrice = response.ShippingInternationalPrice, ShippingInternationalDetails = response.ShippingInternationalDetails, HasBuyersFeedback = response.HasBuyersFeedback, HasSellersFeedback = response.HasSellersFeedback, SellersTrustRating = response.UserTrustRating, BuyerUserName = response.BuyerUserName, BuyersTrustRating = response.BuyerTrustRating, IsAuction = response.Type == MarketItemType.Auction, NoReserve = response.ReservePrice <= 0, ReserveMet = response.CurrentBidPrice >= response.ReservePrice, }; var output = new MarketPlaceModel { CategoryId = marketItem.CategoryId, Categories = await MarketplaceReader.GetMarketCategories(), Locations = StaticDataCache.Locations.Where(x => x.ParentId == 0).OrderBy(x => x.Name).ToList(), Currencies = await CurrencyReader.GetCurrencies(), SortBy = Resources.Market.marketItemSortyByTitle, MarketItem = marketItem }; return(View("MarketPlace", output)); }
} // SetAggregationData protected virtual void InitializeSpecificData(MP_CustomerMarketPlace mp, MarketPlaceModel model, DateTime?history) { } // InitializeSpecificData
} // constructor public MarketPlaceModel Create(MP_CustomerMarketPlace mp, DateTime?history) { string lastChecked = ""; string updatingStatus = ""; string updatingError = ""; string age = ""; string url = ""; DateTime? lastTransactionDate = null; TimeCounter tc = new TimeCounter("MarketplaceModelBuilder building time for mp " + mp.Id); using (tc.AddStep("lastChecked Time taken")) { lastChecked = mp.UpdatingEnd.HasValue ? FormattingUtils.FormatDateToString(mp.UpdatingEnd.Value) : "never/in progress"; } using (tc.AddStep("GetUpdatingStatus Time taken")) { updatingStatus = mp.GetUpdatingStatus(history); } using (tc.AddStep("GetUpdatingError Time taken")) { updatingError = mp.GetUpdatingError(history); } using (tc.AddStep("GetAccountAge Time taken")) { DateTime?originationDate; age = GetAccountAge(mp, out originationDate); } using (tc.AddStep("GetUrl Time taken")) { url = GetUrl(mp, mp.GetRetrieveDataHelper() .RetrieveCustomerSecurityInfo(mp.Id)); } using (tc.AddStep("GetLastTransactionDate Time taken")) { lastTransactionDate = GetLastTransactionDate(mp); } var model = new MarketPlaceModel { Id = mp.Id, Type = mp.DisplayName, Name = mp.Marketplace.Name, LastChecked = lastChecked, UpdatingStatus = updatingStatus, UpdateError = updatingError, AccountAge = age, PositiveFeedbacks = 0, NegativeFeedbacks = 0, NeutralFeedbacks = 0, RaitingPercent = 0, SellerInfoStoreURL = url, IsPaymentAccount = mp.Marketplace.IsPaymentAccount, UWPriority = mp.Marketplace.UWPriority, Disabled = mp.Disabled, IsNew = mp.IsNew, IsHistory = history.HasValue, History = history, LastTransactionDate = lastTransactionDate, }; List <IAnalysisDataParameterInfo> aggregations = new List <IAnalysisDataParameterInfo>(); using (tc.AddStep("SetAggregationData Time taken")) { aggregations = mp.Marketplace.GetAggregations(mp, history).ToList(); SetAggregationData(model, aggregations); } using (tc.AddStep("monthSales Time taken")) { var monthSales = aggregations.FirstOrDefault(x => x.TimePeriod.TimePeriodType == TimePeriodEnum.Month && x.ParameterName == AggregationFunction.Turnover.ToString() ); model.MonthSales = monthSales == null ? 0 : (decimal)monthSales.Value; } using (tc.AddStep("yearSales Time taken")) { var yearSales = aggregations.FirstOrDefault(x => x.TimePeriod.TimePeriodType == TimePeriodEnum.Year && x.ParameterName == AggregationFunction.Turnover.ToString() ); model.AnnualSales = yearSales == null ? 0 : (decimal)yearSales.Value; } using (tc.AddStep("InitializeSpecificData Time taken")) { InitializeSpecificData(mp, model, history); } using (tc.AddStep("GetFeedbackData Time taken")) { var feedbacks = GetFeedbackData(aggregations); model.RaitingPercent = feedbacks.RaitingPercent; model.PositiveFeedbacks = feedbacks.PositiveFeedbacks; model.NegativeFeedbacks = feedbacks.NegativeFeedbacks; model.NeutralFeedbacks = feedbacks.NeutralFeedbacks; model.AmazonSelerRating = feedbacks.AmazonSelerRating; } using (tc.AddStep("GetPaymentAccountModel Time taken")) { if (model.IsPaymentAccount) { var paymentModel = GetPaymentAccountModel(mp, history, aggregations); model.TotalNetInPayments = paymentModel.TotalNetInPayments; model.TotalNetOutPayments = paymentModel.TotalNetOutPayments; model.TransactionsNumber = paymentModel.TransactionsNumber; model.MonthInPayments = paymentModel.MonthInPayments; } // if } Log.Info(tc.ToString()); return(model); } // Create