public IEnumerable <Offer> GetOffers(HtmlDocument document, City city, OfferType offerType)
        {
            var offers     = new List <Offer>();
            var offerNodes = document.DocumentNode.SelectNodes(OFFER_SELECTOR);

            foreach (var node in offerNodes)
            {
                Offer offer;

                try {
                    offer = new Offer()
                    {
                        Title        = node.GetString(TITLE_SELECTOR),
                        Area         = node.GetDouble(AREA_SELECTOR),
                        AreaUnit     = AreaUnit.SquareMeter,
                        PriceUnit    = PriceUnit.PolishZloty,
                        PricePerUnit = node.GetDouble(PRICE_PER_M_SELECTOR),
                        Price        = node.GetDouble(PRICE_SELECTOR),
                        Url          = node.GetHref(URL_SELECTOR),
                        OfferedBy    = node.GetString(OFFERED_BY_SELECTOR),
                        Location     = ParseLocation(node.GetString(LOCATION_SELECTOR)),
                        City         = city,
                        Type         = offerType
                    };
                    offers.Add(offer);
                } catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            return(offers);
        }
예제 #2
0
        public async Task <bool> CreateOfferAsync(string authorId, string estateId, OfferCreateServiceModel model)
        {
            if (model.OfferType == null || string.IsNullOrEmpty(authorId) || string.IsNullOrEmpty(estateId))
            {
                throw new ArgumentNullException(InvlidMethodParameterMessage);
            }

            OfferType parsedEnum = model.OfferType == GlobalConstants.OfferTypeSaleName ? OfferType.Sale : OfferType.Rental;

            string referenceNumber = await this.referenceNumberGenerator.GenerateOfferReferenceNumber(model.OfferType, estateId);

            var author = await this.userServices.GetUserById(authorId);

            var offer = this.mapper.Map <Offer>(model);

            offer.Author          = author;
            offer.AuthorId        = authorId;
            offer.RealEstateId    = estateId;
            offer.OfferType       = parsedEnum;
            offer.ReferenceNumber = referenceNumber;
            offer.IsOfferActive   = true;

            await this.context.Offers.AddAsync(offer);

            var changedRows = await this.context.SaveChangesAsync();

            if (changedRows == 0)
            {
                throw new InvalidOperationException(UnsuccessfullOfferCreationMessage);
            }

            return(true);
        }
예제 #3
0
 public void Init(string offer)
 {
     Offer        = offer.Deserialize <OfferModel>();
     Type         = Offer.type;
     _initialType = Offer.type;
     Category     = Offer.subCategoryModelId;
 }
예제 #4
0
        public string BuildUri(string key, int page, int pageSize, OfferType offerType, Filter filter)
        {
            if (string.IsNullOrWhiteSpace(key))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(key));
            }

            if (filter == null)
            {
                throw new ArgumentNullException(nameof(filter));
            }

            if (page <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(page));
            }

            if (pageSize <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(pageSize));
            }

            var uriBuilder = new StringBuilder();

            uriBuilder.Append(API_ROOT);
            uriBuilder.Append(key);

            // QueryHelpers.AddQueryString escapes slashes in zo, so construct the url manually
            uriBuilder.AppendFormat("/?type={0}", ConvertOfferTypeToQueryParameter(offerType));
            uriBuilder.AppendFormat("&zo={0}", ConvertFilterToQueryParameter(filter));
            uriBuilder.AppendFormat("&page={0}", page);
            uriBuilder.AppendFormat("&pagesize={0}", pageSize);

            return(uriBuilder.ToString());
        }
예제 #5
0
        public IObservable <Property> GetProperties(OfferType offerType, Filter filter)
        {
            return(Observable.Create <Property>(async observer =>
            {
                int pageCount = _settings.MaxPageCountToRetrieve;

                for (int page = 1; page <= pageCount; page++)
                {
                    _logger.LogInformation("Getting page {0}, page size {1}", page, _settings.BatchSize);

                    var pageResults = await _fundaApiClient.GetOffers(page, _settings.BatchSize, offerType, filter);
                    int totalPages = pageResults.Paging.AantalPaginas;

                    _logger.LogInformation("Received page {0}, total pages {1}", page, totalPages);
                    _logger.LogInformation("Received {0} properties", pageResults.Objects.Length);

                    foreach (Object realEstateObject in pageResults.Objects)
                    {
                        var realEstateAgent = new RealEstateAgent(realEstateObject.MakelaarId, realEstateObject.MakelaarNaam);
                        var property = new Property(realEstateObject.Adres, realEstateAgent);

                        observer.OnNext(property);
                    }

                    pageCount = Math.Min(totalPages, _settings.MaxPageCountToRetrieve);
                }
            }));
        }
예제 #6
0
        public async Task <OffersPage> GetOffers(int page, int pageSize, OfferType offerType, Filter filter)
        {
            if (filter == null)
            {
                throw new ArgumentNullException(nameof(filter));
            }

            if (page <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(page));
            }

            if (pageSize <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(pageSize));
            }

            string url = _apiUrlBuilder.BuildUri(_settings.ApiKey, page, pageSize, offerType, filter);

            HttpResponseMessage response = await _httpClient.GetAsync(url);

            response.EnsureSuccessStatusCode();

            string content = await response.Content.ReadAsStringAsync();

            return(JsonConvert.DeserializeObject <OffersPage>(content));
        }
예제 #7
0
 public Offer(string name, int quantity, decimal value, OfferType type = OfferType.MultiBuy)
 {
     this.Name      = name;
     this.OfferType = type;
     this.Value     = value;
     this.Quantity  = quantity;
 }
예제 #8
0
        public static bool SeedDelepmentData(AppDbContext appContext, string userAdminId, string employerUserId)
        {
            var roleAdministrator = new Role(Role.Administrator);

            roleAdministrator.AddUser(userAdminId);
            var roleEmployer = new Role(Role.Employer);

            roleEmployer.AddUser(employerUserId);
            roleEmployer.AddUser(userAdminId);
            appContext.Roles.AddRange(new List <Role> {
                roleAdministrator, roleEmployer
            });

            var offerTypeDevOps    = new OfferType("DevOps");
            var offerTypeQA        = new OfferType("QA");
            var offerTypeDeveloper = new OfferType("Developer");
            var offerTypeManager   = new OfferType("Manager");
            var offerTypePM        = new OfferType("PM");

            appContext.OfferTypes.AddRange(new List <OfferType> {
                offerTypeDevOps,
                offerTypeQA,
                offerTypeDeveloper,
                offerTypeManager,
                offerTypePM
            });

            return(appContext.SaveChanges() >= 0);
        }
예제 #9
0
        public IOfferType New()
        {
            var type = new OfferType();

            this.dataContext.OfferTypes.Add(type);
            return(new OfferTypeDto(type));
        }
        public override Offer Create(XElement xml)
        {
            int        id;
            int        bid;
            int?       cbid;
            bool       isAvailable;
            string     url;
            double     price;
            string     currencyId;
            CategoryId categoryId;
            string     picture;
            bool?      delivery;
            string     description;

            XmlParser.ParseOfferPart(xml, out id, out bid, out cbid, out isAvailable, out url, out price, out currencyId, out categoryId,
                                     out picture, out delivery, out description);
            OfferType type = GetType(xml.Attribute("type").Value, xml);

            return(new Phototechnique()
            {
                Id = id,
                OfferType = type,
                BId = bid,
                IsAvailable = isAvailable,
                CBId = cbid,
                Url = url,
                Price = price,
                CurrencyId = currencyId,
                CategoryId = categoryId,
                Picture = picture,
                Delivery = delivery,
                Description = description
            });
        }
예제 #11
0
        public string GenerateCodes(int quantity, OfferType type)
        {
            message.SetField("protocol", "XCP");
            message.SetField("action", "GENERATE_CODES");
            message.SetField("object", "OFFERS");

            message.AddAttributes(new[]
            {
                new DataItem("quantity", quantity.ToString()),
                new DataItem("offer", type.ToString())
            });

            var postdata = Serialize(message);

            SendRequest(postdata);

            var respmsg = responseObject as MessageEnvelope;

            if (respmsg == null || !respmsg.IsSuccess())
            {
                LogResponseMessage();
                return(null);
            }

            return(respmsg.GetAttribute("code"));
        }
예제 #12
0
        public async Task <IActionResult> Edit(int id, [Bind("OfferTypeID,Name,Description")] OfferType offerType)
        {
            if (id != offerType.OfferTypeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(offerType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OfferTypeExists(offerType.OfferTypeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(offerType));
        }
예제 #13
0
        /// <summary>
        ///     Returns true if ReplaceOffer instances are equal
        /// </summary>
        /// <param name="other">Instance of ReplaceOffer to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ReplaceOffer other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return
                ((
                     OfferType == other.OfferType ||
                     OfferType != null &&
                     OfferType.Equals(other.OfferType)
                     ) &&
                 (
                     Resource == other.Resource ||
                     Resource != null &&
                     Resource.Equals(other.Resource)
                 ) &&
                 (
                     OfferResourceId == other.OfferResourceId ||
                     OfferResourceId != null &&
                     OfferResourceId.Equals(other.OfferResourceId)
                 ) &&
                 (
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                 ) &&
                 (
                     Rid == other.Rid ||
                     Rid != null &&
                     Rid.Equals(other.Rid)
                 ));
        }
예제 #14
0
        public IActionResult Search(string searchPhrase, decimal?minPrice, decimal?maxPrice,
                                    Market?market, OfferType offerType, int?minRoomCount, int?maxRoomCount,
                                    int?minArea, int?maxArea,
                                    int page = 1)
        {
            var searchArguments = new SearchArguments()
            {
                MaxPrice     = maxPrice,
                MinPrice     = minPrice,
                Page         = page,
                SearchPhrase = searchPhrase,
                OfferType    = offerType,
                MinArea      = minArea,
                MaxRoomCount = maxRoomCount,
                MinRoomCount = minRoomCount,
                Market       = market == Market.Both ? null : market,
                MaxArea      = maxArea
            };
            var offers    = _offerService.SearchOffers(searchArguments);
            var offerDtos = new List <OfferDto>();

            foreach (var offer in offers)
            {
                var offerDto = _mapper.Map <OfferDto>(offer);
                offerDto.Images = CreateUrlsToPhotos(offer.Images);
                offerDtos.Add(offerDto);
            }
            return(Ok(offerDtos));
        }
        /// <summary>
        /// Determines the offer type from the specified string.
        /// </summary>
        /// <param name="receivedValue">
        /// The field from which the offer type will be determined.
        /// </param>
        /// <param name="fieldName">
        /// The name of the field whose value to verify to place in the log.
        /// </param>
        /// <param name="offerType">
        /// Receives the offer type if possible.
        /// </param>
        /// <param name="recordValid">
        /// A value that indicates whether the record being parsed is so far valid.
        /// </param>
        /// <returns>
        /// * True if the offer type could be determined from the specified string.
        /// * Else returns false.
        /// </returns>
        internal bool DetermineOfferType(string receivedValue,
                                         string fieldName,
                                         out OfferType offerType,
                                         bool recordValid)
        {
            offerType = OfferType.ConsumerClipped;
            if (recordValid == true)
            {
                switch (receivedValue.ToUpperInvariant())
                {
                case "PURCHASED":
                    offerType = OfferType.Purchased;
                    break;

                case "CONSUMER CLIPPED":
                    offerType = OfferType.ConsumerClipped;
                    break;

                case "MERCHANT FUNDED":
                    offerType = OfferType.MerchantFunded;
                    break;

                default:
                    Log.Warning("Error parsing \"{0}\" record #{1} from file \"{2}\". Received value \"{3}\" in field " +
                                "\"{4}\" is not properly formatted.", (int)ResultCode.InvalidValue, RecordTypeDescriptor,
                                RecordNumber, FileName, receivedValue, fieldName);
                    recordValid = false;
                    break;
                }
                ;
            }

            return(recordValid);
        }
예제 #16
0
        public override Offer Create(XElement xml)
        {
            int        id;
            int        bid;
            int?       cbid;
            bool       isAvailable;
            string     url;
            double     price;
            string     currencyId;
            CategoryId categoryId;
            string     picture;
            bool?      delivery;
            string     description;

            XmlParser.ParseOfferPart(xml, out id, out bid, out cbid, out isAvailable, out url, out price, out currencyId, out categoryId,
                                     out picture, out delivery, out description);
            OfferKind kindOfBook = GetOfferKindById(Convert.ToInt32(categoryId.Text), xml);
            string    name       = xml.Element("name").Value;
            string    author     = xml.Element("author").Value;
            int       year       = Convert.ToInt32(xml.Element("year").Value);
            string    publisher  = xml.Element("publisher").Value;
            string    isbn       = xml.Element("ISBN").Value;
            string    language   = xml.Element("language").Value;
            string    series;

            if (xml.Elements().SingleOrDefault(el => el.Name == "series") != null)
            {
                series = xml.Element("series").Value;
            }
            {
                series = null;
            }
            bool      downloadable = Convert.ToBoolean(xml.Element("downloadable").Value);
            OfferType newType      = GetType(xml.Attribute("type").Value, xml);

            return(new Book()
            {
                Id = id,
                OfferType = newType,
                BId = bid,
                IsAvailable = isAvailable,
                CBId = cbid,
                Url = url,
                Price = price,
                CurrencyId = currencyId,
                CategoryId = categoryId,
                Picture = picture,
                Delivery = delivery,
                Description = description,
                Name = name,
                Author = author,
                Year = year,
                Publisher = publisher,
                ISBN = isbn,
                Language = language,
                Series = series,
                Downloadable = downloadable,
                KindOfBook = kindOfBook
            });
        }
        public SubscriptionOffer(JObject node)
        {
            asin    = (string)node["asin"];
            buyable = (bool)node["buyable"];

            switch ((string)node["offerType"])
            {
            case "SUBSCRIPTION":
                offerType = OfferType.Subscription;
                break;

            case "PURCHASE":
                offerType = OfferType.Purchase;
                break;

            case "RENTAL":
                offerType = OfferType.Rental;
                break;

            case "SEASON_PURCHASE":
                offerType = OfferType.SeasonPurchase;
                break;

            case "SEASON_RENTAL":
                offerType = OfferType.SeasonRental;
                break;

            case "TV_PASS":
                offerType = OfferType.TvPass;
                break;
            }
        }
예제 #18
0
        /// <summary>
        /// Tworzy nową ofertę.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="target"></param>
        /// <param name="type"></param>
        /// <param name="price"></param>
        /// <param name="data"></param>
        /// <param name="name"></param>
        /// <param name="system"></param>
        public static void CreateOffer(Client player, Client target, OfferType type, uint price,
                                       Dictionary <string, object> data, string name, bool system = false)
        {
            Offer newOffer = new Offer
            {
                Id          = GetFreeOfferIndex(),
                Player      = player,
                Target      = target,
                Type        = type,
                Price       = price,
                Data        = data,
                StartedAt   = Global.GetTimestamp(),
                SystemOffer = system
            };

            OffersList.Add(newOffer.Id, newOffer);
            if (player != null)
            {
                Ui.ShowInfo(player, "Oferta została złożona.");
            }

            // TODO: logi

            string pName = player == null ? "System" : Player.GetPlayerIcName(player);

            NAPI.ClientEvent.TriggerClientEvent(target, "client.offers.showOffer",
                                                $"{pName} ofertuje {name}", price);
            Log.ConsoleLog("OFFERS", $"Oferta o Id {newOffer.Id} zostala utworzona.", LogType.Debug);
        }
예제 #19
0
 public Offer(Commodity commodity, int amount, float price, OfferType type, Trader trader)
 {
     Commodity = commodity;
     Amount    = amount;
     Price     = price;
     Type      = type;
     Trader    = trader;
 }
예제 #20
0
 public static OfferTypeDto From(OfferType offerType)
 {
     return(new OfferTypeDto()
     {
         Id = offerType.Id,
         Name = offerType.Name
     });
 }
예제 #21
0
        /// <summary>
        /// For backward compatibility with old wrappers.
        /// </summary>
        public SellingStatusType PlaceOffer(OfferType Offer, string ItemID)
        {
            this.Offer  = Offer;
            this.ItemID = ItemID;

            Execute();
            return(ApiResponse.SellingStatus);
        }
예제 #22
0
        public void ParseTest()
        {
            string sType = "Limit";

            OfferType type = OfferTypeExtension.Parse(sType);

            Assert.AreEqual(OfferType.LIMIT, type);
        }
예제 #23
0
        public void OffertTypeToLowerStringTest()
        {
            OfferType type = OfferType.STOP_LIMIT;

            string sType = type.ToLowerString();

            Assert.AreEqual("stop-limit", sType);
        }
예제 #24
0
파일: Offer.cs 프로젝트: esandstedt/laguna
 public Offer(OfferType type, string commodity, double price, double amount)
 {
     Type      = type;
     Commodity = commodity;
     Price     = price;
     Amount    = amount;
     Results   = new List <OfferResult>();
 }
예제 #25
0
        public ActionResult CreateOfferType()
        {
            var model = new OfferType();

            ViewBag.offerTypes = offerTypes.GetAll();
            ViewBag.rooms      = rooms.GetAll();
            return(View(model));
        }
예제 #26
0
        public void ParseLowerWithLowerDashTest()
        {
            string sType = "Stop_limit";

            OfferType type = OfferTypeExtension.Parse(sType);

            Assert.AreEqual(OfferType.STOP_LIMIT, type);
        }
예제 #27
0
        public static string ToLowerString(this OfferType offerType)
        {
            string output = offerType.ToString();

            output = output.Replace('_', '-');
            output = output.ToLower();

            return(output);
        }
예제 #28
0
 public static IOffer CreateOffer(OfferType type)
 {
     switch (type)
     {
         case OfferType.Rent: return new RentOffer(OfferType.Rent);
         case OfferType.Sale: return new SaleOffer(OfferType.Sale);
         default: throw new NotSupportedException("This offer is not supported.");
     }
 }
예제 #29
0
 public static IOffer CreateOffer(OfferType type)
 {
     switch (type)
     {
         case OfferType.Sale: return new SaleOffer(type);
         case OfferType.Rent: return new RentOffer(type);
         default: return new SaleOffer(type);
     }
 }
예제 #30
0
        public void Reject()
        {
            if (offer != OfferType.Resign)
            {
                throw new InvalidOperationException("Cannot reject when there's no resign offer.");
            }

            offer          = OfferType.None;
            player_on_turn = 1 - player_on_turn;
        }
예제 #31
0
 public Auction(String seller, DateTime time, OfferType offer, Card card, string mssg, int price, int amountOffered)
 {
     this.seller        = seller;
     this.time          = time;
     this.offer         = offer;
     this.card          = card;
     this.price         = price;
     this.message       = mssg;
     this.amountOffered = amountOffered;
 }
예제 #32
0
 public Auction(String seller, DateTime time, OfferType offer, Card card, string mssg, int price, int amountOffered)
 {
     this.seller = seller;
     this.time = time;
     this.offer = offer;
     this.card = card;
     this.price = price;
     this.message = mssg;
     this.amountOffered = amountOffered;
 }
예제 #33
0
 private TradeOffer(TradeOffer offer, OfferType type = OfferType.Outbound)
 {
     Id               = offer.Id;
     CreatedAt        = offer.CreatedAt;
     Author           = offer.Author;
     Target           = offer.Target;
     ItemIds          = offer.ItemIds;
     RequestedItemIds = offer.RequestedItemIds;
     Type             = type;
 }
예제 #34
0
 public static IOffer CreateOffer(OfferType type)
 {
     switch (type)
     {
         case OfferType.Sale:
             return new Sale();
         case OfferType.Rent:
             return new Rent();
         default:
             throw new ArgumentException("That type does not exist.");
     }
 }
예제 #35
0
 public static IOffer CreateOffer(OfferType type)
 {
     switch (type)
     {
         case OfferType.Rent:
             return new RentOffer();
         case OfferType.Sale:
             return new SaleOffer();
         default:
             throw new ArgumentOutOfRangeException(type.ToString(), "OfferType not supported");
     }
 }
예제 #36
0
 public static IOffer CreateOffer(OfferType type)
 {
     switch (type)
     {
         case OfferType.Rent:
             return new RentOffer();
         case OfferType.Sale:
             return new SaleOffer();
         default:
             throw new ArgumentException("Invalid type!", "type");
     }
 }
예제 #37
0
 public static IOffer CreateOffer(OfferType type)
 {
     switch (type)
     {
         case OfferType.Sale: return new SaleOffer(type);
         case OfferType.Rent: return new RentOffer(type);
         default:
             {
                 throw new NotImplementedException("Unknown offer type " + type);
             }
     }
 }
 public static IOffer CreateOffer(OfferType type)
 {
     switch (type)
     {
         case OfferType.Rent:
             return new Rent();
         case OfferType.Sale:
             return new Sale();
         default:
             throw new NotImplementedException("Offer type not supported: " + type);
     }
 }
예제 #39
0
 public static IOffer CreateOffer(OfferType type)
 {
     switch (type)
     {
         case OfferType.Rent:
             return new RentOffer();
         case OfferType.Sale:
             return new SaleOffer();
         default:
             throw new AggregateException();
     }
 }
예제 #40
0
 public static IOffer CreateOffer(OfferType type)
 {
     switch (type)
     {
         case OfferType.Sale:
             return new SaleOffer();
             break;
         case OfferType.Rent:
             return new RentOffer();
             break;
         default:
             throw new ArgumentOutOfRangeException("type", "Invalid Offer type specified.");
     }
 }
예제 #41
0
 public static IOffer CreateOffer(OfferType type)
 {
     IOffer offer = null;
     switch (type)
     {
         case OfferType.Sale:
             offer = new SaleOffer();
             break;
         case OfferType.Rent:
             offer = new RentOffer();
             break;
         default:
             break;
     }
     return offer;
 }
예제 #42
0
파일: ProductApi.cs 프로젝트: ZyLob/1688
        /// <summary>
        /// 获取会员所有的产品
        /// <para>
        /// 需要授权
        /// </para>
        /// <para>
        /// 接口地址:http://open.1688.com/doc/api/cn/api.htm?ns=cn.alibaba.open&amp;n=offer.getAllOfferList&amp;v=1
        /// </para>
        /// </summary>
        /// <param name="type">商品所属类型,目前只支持SALE</param>
        /// <param name="categoryId">商品发布类目ID</param>
        /// <param name="groupIds">卖家自定义的商品分类ID,多个之间用“,”分隔</param>
        /// <param name="page">页码。取值范围:大于零的整数;默认值为1,即返回第一页数据。</param>
        /// <param name="pageSize">返回offer列表结果集分页条数。取值范围:大于零的整数;最大值:50。</param>
        /// <param name="timeStamp">格式:yyyy-MM-dd HH:mm:ss;1、如果传了时间戳参数,则按增量返回,即返回按指定获取条件且对应商品信息的最近更新时间(GMTModified)晚于该时间戳的商品列表信息。2、如果没有传时间戳参数,则取所有的满足条件的商品信息;</param>
        /// <param name="orderBy">当前支持:gmtexpire:asc|desc,gmt_modified:asc|desc</param>
        /// <param name="site">站点</param>
        /// <param name="returnFields">自定义返回字段,字段为offerDetailInfo子集。多个字段以半角','分隔。若此字段为空,则返回offer数组信息为空;其中如下参数无法通过该API获得:amountOnSale、details、detailsUrl、saledCount、skuArray、termOfferProcess、tradingType</param>
        /// <returns>产品分页信息</returns>
        public IPagedList<OfferDetailInfo> GetAllOffers(OfferType type = OfferType.SALE, long categoryId = default(long),
            long[] groupIds = null, int page = 1, int pageSize = 20, DateTime timeStamp = default(DateTime), string orderBy = "", string site = "china",
            string returnFields = "offerId,privateProperties,subject,details,imageList,productFeatureList,unit,amountOnSale,saledCount,priceRanges")
        {
            string url = "http://gw.open.1688.com/openapi/param2/1/cn.alibaba.open/offer.getAllOfferList/{0}".FormatStr(_context.Config.AppKey);
            var otherParas = _context.GetParas();
            otherParas.Add("page", page + "");
            otherParas.Add("pageSize", pageSize + "");
            otherParas.Add("type", type.ToString());
            if (categoryId != default(long))
            {
                otherParas.Add("categoryId", categoryId + "");

            }
            if (groupIds != null)
            {
                otherParas.Add("groupIds", groupIds + "");

            }
            if (orderBy != "")
            {
                otherParas.Add("orderBy", orderBy);
            }
            if (timeStamp != default(DateTime))
            {
                otherParas.Add("timeStamp", timeStamp.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (returnFields.IsNotNullOrEmpty())
            {
                otherParas.Add("returnFields", returnFields);

            }
            if (site.IsNotNullOrEmpty())
            {
                otherParas.Add("site", site);

            }

            _context.Util.AddAliApiUrlSignPara(url, otherParas);
            var results = _context.Util.Send<AliResult<AliResultList<OfferDetailInfo>>>(url, otherParas);

            if (results.Result.Total > 0)
            {
                return new PagedList<OfferDetailInfo>(results.Result.ToReturn, page, pageSize, results.Result.Total);
            }
            return new PagedList<OfferDetailInfo>(new List<OfferDetailInfo>(), page, pageSize);
        }
        public static IOffer CreateOffer(OfferType type)
        {
            Offer offer;
            switch (type)
            {
                    case OfferType.Rent:
                    offer = new RentOffer();
                    break;
                    case OfferType.Sale:
                    offer = new SaleOffer();
                    break;
                default:
                    throw new ArgumentException("Invalid type for offer.");
            }

            return offer;
        }
예제 #44
0
        public static IOffer CreateOffer(OfferType type)
        {
            IOffer offer = null;

            switch (type)
            {
                case OfferType.Rent:
                    offer = new RentOffer(OfferType.Rent);
                    break;
                case OfferType.Sale:
                    offer = new SaleOffer(OfferType.Sale);
                    break;
                default:
                    throw new ArgumentException("Unsuported office type");
            }

            return offer;
        }
예제 #45
0
        public GameState(GameType game_type)
        {
            dice = new int[2];
            SetDice(0, 0);
            board = new Board();

            player_on_roll = -1;
            player_on_turn = -1;
            cube.Value = 1;
            cube.Owner = -1;
            offer = OfferType.None;
            resign_offer_value = ResignValue.None;
            score = new int[] { 0, 0 };
            match_to = 1;
            crawford = false;
            stake = 0;
            limit = 0;
            names = new string[] { "", "" };

            this.game_type = game_type;
        }
		public void PlaceOfferFull()
		{
			string originalToken = this.apiContext.ApiCredential.eBayToken;

			try
			{

				Assert.IsNotNull(TestData.ChineseAuctionItem,"ChineseAuctionItem is null");
				ItemType item=TestData.ChineseAuctionItem;
				//change user
				this.apiContext.ApiCredential.eBayToken=TestData.BuyerToken;

				PlaceOfferCall api=new PlaceOfferCall(this.apiContext);
				api.ItemID=TestData.ChineseAuctionItem.ItemID;

				OfferType offer = new OfferType();
				offer.Action = BidActionCodeType.Bid;
				offer.Quantity = 1;
				AmountType at = new AmountType();
				at.Value = 1;
				offer.ConvertedPrice = at;
				at.Value=2;
				offer.MaxBid=at;
				api.Offer=offer;
                api.AbstractRequest.EndUserIP = "10.249.72.135";
			
				api.Execute();

				//check whether the call is success.
				Assert.IsTrue(api.ApiResponse.Ack==AckCodeType.Success || api.ApiResponse.Ack==AckCodeType.Warning,"do not success!");
			}
			finally
			{
				//reset token
				this.apiContext.ApiCredential.eBayToken=originalToken;
			}
			
		}
예제 #47
0
 public SaleOffer(OfferType type)
     : base(type)
 {
 }
예제 #48
0
 public SaleOffer(OfferType type, IEstate estate, decimal price)
     : base(type, estate)
 {
     this.Price = price;
 }
예제 #49
0
 public RentOffer(OfferType type, IEstate estate,decimal Price):base(OfferType.Rent,estate)
 {
     this.PricePerMonth = Price;
 }
예제 #50
0
 public RentOffer(OfferType type)
     : base(type)
 {
 }
예제 #51
0
 public RentOffer(OfferType type, IEstate estate, decimal pricePerMonth)
     : base(type, estate)
 {
     this.PricePerMonth = pricePerMonth;
 }
예제 #52
0
 protected Offer(OfferType type)
 {
     this.Type = type;
 }
예제 #53
0
 protected Offer(OfferType type, IEstate estate)
 {
     this.Type = type;
     this.Estate = estate;
 }
예제 #54
0
		/// <summary>
		/// Enables the authenticated user to to make a bid, a best offer, or
		/// a purchase on the item specified by the ItemID input field.
		/// </summary>
		/// 
		/// <param name="Offer">
		/// Specifies the type of offer being made. If the item is a
		/// competitive-bidding listing, the offer is a bid. If the item is a
		/// fixed-price listing, then the offer purchases the item. If the item is a
		/// competitive-bidding listing and the offer is of type with an active,
		/// unexercised Buy It Now option, then the offer can either purchase the
		/// item or be a bid. See the schema documentation for OfferType for details
		/// on its properties and their meanings.
		/// </param>
		///
		/// <param name="ItemID">
		/// Unique item ID that identifies the item listing for which the action is being
		/// submitted.
		/// 
		/// If the item was listed with Variations, you must also specify
		/// VariationSpecifics in the request to uniquely identify the
		/// variant being purchased.
		/// </param>
		///
		/// <param name="BlockOnWarning">
		/// If a warning message exists and BlockOnWarning is true,
		/// the warning message is returned and the bid is blocked. If no warning message
		/// exists and BlockOnWarning is true, the bid is placed. If BlockOnWarning
		/// is false, the bid is placed, regardless of warning.
		/// </param>
		///
		/// <param name="AffiliateTrackingDetails">
		/// Container for affiliate-related tags, which enable the tracking of user
		/// activity. If you include AffiliateTrackingDetails in your PlaceOffer call, then
		/// it is possible to receive affiliate commissions based on calls made by your
		/// application. (See the <a href=
		/// "http://www.ebaypartnernetwork.com/" target="_blank">eBay Partner Network</a>
		/// for information about commissions.) Please note that affiliate tracking is not
		/// available in the Sandbox environment, and that affiliate tracking is not
		/// available when you make a best offer.
		/// </param>
		///
		/// <param name="VariationSpecificList">
		/// Name-value pairs that identify a single variation within the
		/// listing identified by ItemID. Required when the seller
		/// listed the item with Item Variations.
		/// 
		/// If you want to buy items from multiple variations in the same
		/// listing, use a separate PlaceOffer request for each variation.
		/// For example, if you want to buy 3 red shirts and 2 black shirts
		/// from the same listing, use one PlaceOffer request for the
		/// 3 red shirts, and another PlaceOffer request for the 2
		/// black shirts.
		/// </param>
		///
		public SellingStatusType PlaceOffer(OfferType Offer, string ItemID, bool BlockOnWarning, AffiliateTrackingDetailsType AffiliateTrackingDetails, NameValueListTypeCollection VariationSpecificList)
		{
			this.Offer = Offer;
			this.ItemID = ItemID;
			this.BlockOnWarning = BlockOnWarning;
			this.AffiliateTrackingDetails = AffiliateTrackingDetails;
			this.VariationSpecificList = VariationSpecificList;

			Execute();
			return ApiResponse.SellingStatus;
		}
예제 #55
0
 public RentOffer(OfferType initType, IEstate initEstate, decimal pricePerMonth)
     : base(initType, initEstate)
 {
     this.PricePerMonth = pricePerMonth;
 }
예제 #56
0
 public Offer(OfferType initType)
 {
     this.Type = initType;
 }
예제 #57
0
 public Offer(OfferType type)
 {
     this.Type = type;
 }
예제 #58
0
         public RentOffer(OfferType type):base(OfferType.Rent)
         {

         }
예제 #59
0
 public Offer(OfferType initType, IEstate initEstate)
 {
     this.Type = initType;
     this.Estate = initEstate;
 }
예제 #60
0
		/// <summary>
		/// For backward compatibility with old wrappers.
		/// </summary>
		public SellingStatusType PlaceOffer(OfferType Offer, string ItemID)
		{
			this.Offer = Offer;
			this.ItemID = ItemID;

			Execute();
			return ApiResponse.SellingStatus;
		}