public bool InsertOfferDetails(OfferDetails offerDetails, int userId, int categoryId) { lock (padlock) { string index = userId + "_cat" + categoryId; if (userId == 1) { offerDetails.CreatedDate = DateTime.Now; IndexResponse status = client.Index(offerDetails, i => i.Index("offer_details")); return(status.IsValid); } else { var ex = client.Indices.Exists(index); if (ex.Exists == false) { offerDetails.CreatedDate = DateTime.Now; var res = client.Indices.Create(index, c => c .Map <OfferDetails>(x => x.AutoMap()).Settings(s => s.NumberOfReplicas(2).NumberOfShards(2))); if (!res.IsValid || !res.Acknowledged) { throw new Exception("Cannot create index: " + index); } } offerDetails.CreatedDate = DateTime.Now; IndexResponse status = client.Index <OfferDetails>(offerDetails, i => i.Index(index)); _logger.Info("Document elastic: " + status.Result); _logger.Info(offerDetails.Uri + " " + offerDetails.CreatedDate); return(status.IsValid); } } }
private Entry GetEntryFromUrl(string url, OfferKind kind, bool house = false) { var offerToParse = GetParsedHtmlFromUrl(url); var paragraphs = offerToParse.QuerySelectorAll(".c p"); var floor = MatchOrNull(TryGetParagraphValueString(paragraphs, "Piętro:"), "([0-9]+|Parter)")?.Value; floor = floor == "Parter" ? "0" : floor; PolishCity city; var description = offerToParse.QuerySelector(".c .col-md-9 > p").Text(); return(new Entry { OfferDetails = new OfferDetails { Url = url, CreationDateTime = DateTime.Parse(offerToParse.QuerySelector(".ann-panel-right p:last-of-type b:last-of-type").Text()), OfferKind = kind, SellerContact = new SellerContact { //Not a proper email validation but it's simple Email = MatchOrNull(description, @"\w+@\w+\.\w+")?.Value, Telephone = GetParsedHtmlFromUrl( $"{mainUrl}/ajax_daj_telefon.php?hash={offerToParse.QuerySelector(".tel-btn")?.GetAttribute("data-hash")}&token={offerToParse.QuerySelector(".tel-btn")?.GetAttribute("data-token")}") ?.QuerySelector("a") ?.Text() ?? MatchOrNull(description, "([0-9]{3}(-| )?){2}[0-9]{3}")?.Value, Name = offerToParse.QuerySelector(".ann-panel-right > p > b").Text() }, IsStillValid = true }, PropertyAddress = new PropertyAddress { City = Enum.TryParse(MatchOrNull(url, "m_(?<city>[a-z_]+)[-/]").Groups["city"]?.Value.ToUpper(), out city) ? city : default,
public OfferDetails GetOfferDetailsWorkShop(int accident_id, int workshop_id) { OfferQuery offerQuery = new OfferQuery(language); System.Data.DataTable dataTable = conn_db.ReadTable(offerQuery.GetOfferDetailsWorkShop(accident_id, workshop_id)); OfferDetails offerDetails = new OfferDetails(); if (dataTable.Rows.Count == 0) { throw new EmptyViewException(language); } offerDetails = new OfferDetails(); offerDetails.OFFER_ID = Convert.ToInt32(dataTable.Rows[0]["OFFER_ID"]); offerDetails.shop_ID = Convert.ToInt32(dataTable.Rows[0]["WORKSHOP_ID"]); offerDetails.FULLNAME = dataTable.Rows[0]["FULLNAME"].ToString(); offerDetails.SHOPNUMBER = dataTable.Rows[0]["SHOPNUMBER"].ToString(); offerDetails.SHOPNAME = dataTable.Rows[0]["SHOPNAME"].ToString(); offerDetails.LOCATIONX_WORKSHOP = Convert.ToDouble(dataTable.Rows[0]["LOCATIONX"].ToString()); offerDetails.LOCATIONY_WORKSHOP = Convert.ToDouble(dataTable.Rows[0]["LOCATIONY"].ToString()); offerDetails.CONFIRMATION = Convert.ToInt32(dataTable.Rows[0]["CONFIRMATION"].ToString()); offerDetails.timeValue = dataTable.Rows[0]["timeValue"] is DBNull ? 0 : Convert.ToInt32(dataTable.Rows[0]["timeValue"]); offerDetails.timeFlag = dataTable.Rows[0]["timeFlag"] is DBNull ? 0 : Convert.ToInt32(dataTable.Rows[0]["timeFlag"]); offerDetails.PRICE = Convert.ToDouble(dataTable.Rows[0]["PRICE"]); offerDetails.rating = Convert.ToDouble(dataTable.Rows[0]["RATING"]); offerDetails.workshop_image = dataTable.Rows[0]["IMAGE"].ToString(); offerDetails.OFFER_DATETIME = Convert.ToDateTime(dataTable.Rows[0]["OFFER_DATETIME"]).ToString("dd-MM-yyyy"); offerDetails.canFinish = Convert.ToInt32(dataTable.Rows[0]["WAITINGFIX"].ToString()); offerDetails.isDelivered = Convert.ToInt32(dataTable.Rows[0]["FINISHEDFLAG"].ToString()); offerDetails.AreaName = dataTable.Rows[0]["AreaName"].ToString(); offerDetails.phonenumber = dataTable.Rows[0]["phoneNumber"].ToString(); return(offerDetails); }
public ActionResult DeleteOffer(int id) { OfferDetails offer = entity.OfferDetails.Find(id); entity.OfferDetails.Remove(offer); entity.SaveChanges(); return(RedirectToAction("OfferDetails")); }
public ActionResult DeleteOffer(int id) { OfferDetails offer = entities.OfferDetails.Find(id); entities.OfferDetails.Remove(offer); entities.SaveChanges(); return(RedirectToAction("Index", "Admin")); }
public async Task <Statistic> GetStatistic(string id, Func <OfferDetails, string> getStringToAnalyze) { OfferDetails offerDetails = await _offerDetailsService.GetOfferDetails(id); string title = getStringToAnalyze(offerDetails); List <Token> tokens = Tokenize(title); return(new Statistic() { Tokens = tokens, Offer = offerDetails }); }
private OfferDetails CreateModel(JObject responseJsonObject) { OfferDetails result = new OfferDetails(); var attributes = responseJsonObject["attributes"].AsJEnumerable(); foreach (var attribute in attributes) { OfferDetailsAttribute attributeModel = new OfferDetailsAttribute() { Name = attribute["name"].Value <string>(), Attributes = attribute["values"].ToObject <List <string> >() }; result.Attributes.Add(attributeModel); } var breadcrumbs = responseJsonObject["categories"]["breadcrumbs"].AsJEnumerable(); foreach (var breadcrumb in breadcrumbs) { result.Categories.Add(new Category() { Name = breadcrumb["name"].Value <string>(), Id = breadcrumb["id"].Value <string>(), Parent = breadcrumb["parent"].Value <string>() }); } result.Views = Convert.ToInt32(responseJsonObject["views"].Value <string>()); result.Name = responseJsonObject["name"].Value <string>(); result.Description = responseJsonObject["description"]["plainText"].Value <string>(); result.Prices = responseJsonObject["prices"].ToObject <Prices>(); result.Bids = responseJsonObject["bids"].ToObject <Bids>(); result.Seller = responseJsonObject["seller"].ToObject <Seller>(); result.Quantities = responseJsonObject["quantities"].ToObject <Quantities>(); return(result); }
private static Offer PopulateFromDBDetailsObject(OfferDetails obj) { Offer objNew = new Offer(); objNew.OfferId = obj.OfferId; objNew.FullPart = obj.FullPart; objNew.Part = obj.Part; objNew.ManufacturerNo = obj.ManufacturerNo; objNew.DateCode = obj.DateCode; objNew.ProductNo = obj.ProductNo; objNew.PackageNo = obj.PackageNo; objNew.Quantity = obj.Quantity; objNew.Price = obj.Price; objNew.OriginalEntryDate = obj.OriginalEntryDate; objNew.Salesman = obj.Salesman; objNew.SupplierNo = obj.SupplierNo; objNew.CurrencyNo = obj.CurrencyNo; objNew.ROHS = obj.ROHS; objNew.UpdatedBy = obj.UpdatedBy; objNew.DLUP = obj.DLUP; objNew.OfferStatusNo = obj.OfferStatusNo; objNew.OfferStatusChangeDate = obj.OfferStatusChangeDate; objNew.OfferStatusChangeLoginNo = obj.OfferStatusChangeLoginNo; objNew.SupplierName = obj.SupplierName; objNew.Notes = obj.Notes; objNew.ManufacturerName = obj.ManufacturerName; objNew.ProductName = obj.ProductName; objNew.PackageName = obj.PackageName; objNew.ClientNo = obj.ClientNo; objNew.ManufacturerCode = obj.ManufacturerCode; objNew.CurrencyCode = obj.CurrencyCode; objNew.CurrencyDescription = obj.CurrencyDescription; objNew.SupplierEmail = obj.SupplierEmail; objNew.SalesmanName = obj.SalesmanName; objNew.OfferStatusChangeEmployeeName = obj.OfferStatusChangeEmployeeName; objNew.ClientId = obj.ClientId; objNew.ClientName = obj.ClientName; objNew.ClientDataVisibleToOthers = obj.ClientDataVisibleToOthers; return(objNew); }
/// <summary> /// Get /// Calls [usp_select_Offer] /// </summary> public override OfferDetails Get(System.Int32?offerId, bool?isPoHub) { SqlConnection cn = null; SqlCommand cmd = null; string proc = "usp_select_Offer"; try { //proc = isPoHub == true ? "usp_select_OfferPH" : proc; cn = new SqlConnection(this.ConnectionString); cmd = new SqlCommand(proc, cn); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cmd.Parameters.Add("@OfferId", SqlDbType.Int).Value = offerId; cn.Open(); DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow); if (reader.Read()) { //return GetOfferFromReader(reader); OfferDetails obj = new OfferDetails(); obj.OfferId = GetReaderValue_Int32(reader, "OfferId", 0); obj.FullPart = GetReaderValue_String(reader, "FullPart", ""); obj.Part = GetReaderValue_String(reader, "Part", ""); obj.ManufacturerNo = GetReaderValue_NullableInt32(reader, "ManufacturerNo", null); obj.DateCode = GetReaderValue_String(reader, "DateCode", ""); obj.ProductNo = GetReaderValue_NullableInt32(reader, "ProductNo", null); obj.PackageNo = GetReaderValue_NullableInt32(reader, "PackageNo", null); obj.Quantity = GetReaderValue_Int32(reader, "Quantity", 0); obj.Price = GetReaderValue_Double(reader, "Price", 0); obj.OriginalEntryDate = GetReaderValue_NullableDateTime(reader, "OriginalEntryDate", null); obj.Salesman = GetReaderValue_NullableInt32(reader, "Salesman", null); obj.SupplierNo = GetReaderValue_Int32(reader, "SupplierNo", 0); obj.CurrencyNo = GetReaderValue_NullableInt32(reader, "CurrencyNo", null); obj.ROHS = GetReaderValue_NullableByte(reader, "ROHS", null); obj.UpdatedBy = GetReaderValue_NullableInt32(reader, "UpdatedBy", null); obj.DLUP = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue); obj.OfferStatusNo = GetReaderValue_NullableInt32(reader, "OfferStatusNo", null); obj.OfferStatusChangeDate = GetReaderValue_NullableDateTime(reader, "OfferStatusChangeDate", null); obj.OfferStatusChangeLoginNo = GetReaderValue_NullableInt32(reader, "OfferStatusChangeLoginNo", null); obj.SupplierName = GetReaderValue_String(reader, "SupplierName", ""); obj.Notes = GetReaderValue_String(reader, "Notes", ""); obj.ManufacturerName = GetReaderValue_String(reader, "ManufacturerName", ""); obj.ProductName = GetReaderValue_String(reader, "ProductName", ""); obj.PackageName = GetReaderValue_String(reader, "PackageName", ""); obj.SupplierTotalQSA = GetReaderValue_String(reader, "SupplierTotalQSA", ""); obj.SupplierLTB = GetReaderValue_String(reader, "SupplierLTB", ""); obj.SupplierMOQ = GetReaderValue_String(reader, "SupplierMOQ", ""); obj.MSL = GetReaderValue_String(reader, "MSL", ""); obj.SPQ = GetReaderValue_String(reader, "SPQ", ""); obj.LeadTime = GetReaderValue_String(reader, "LeadTime", ""); obj.FactorySealed = GetReaderValue_String(reader, "FactorySealed", ""); obj.RoHSStatus = GetReaderValue_String(reader, "ROHSStatus", ""); obj.ProductDescription = GetReaderValue_String(reader, "ProductDescription", ""); obj.ProductInactive = GetReaderValue_NullableBoolean(reader, "ProductInactive", false); obj.MSLLevelNo = GetReaderValue_Int32(reader, "MSLLevelNo", 0); return(obj); } else { return(null); } } catch (SqlException sqlex) { //LogException(sqlex); throw new Exception("Failed to get Offer", sqlex); } finally { cmd.Dispose(); cn.Close(); cn.Dispose(); } }
public ActionResult DetailsOffer(int id) { OfferDetails offer = entity.OfferDetails.Find(id); return(View(offer)); }
public ActionResult EditOffer(OfferDetails offer) { entity.Entry(offer).State = EntityState.Modified; entity.SaveChanges(); return(RedirectToAction("OfferDetails")); }
public ActionResult CreateOffer(OfferDetails offer) { entity.OfferDetails.Add(offer); entity.SaveChanges(); return(RedirectToAction("OfferDetails")); }
public Task CreateTaskForProcessOrder(IDal dal, Offer offer, IOfferDetailsParser parser) { return(new Task(() => { bool successInsert = false; if (TimeoutError) { SetOfferAsUnprocessed(dal, offer); return; } System.Diagnostics.Debug.WriteLine("start"); try { OfferDetails details = parser.GetPageDetails(offer.Uri, offer); successInsert = ElasticController.Instance.InsertOfferDetails(details, Worker.WebApiUserId, offer.WebsiteCategoryId); if (successInsert) { SumOfProcessedOffers++; } else { Console.WriteLine("Fail insert"); } } catch (OfferDetailsFailException ex) { _logger.Info(ex.Message + " " + ex.StackTrace + " " + offer.Uri); AddErrorLogsToDb(ex.Message + " " + ex.StackTrace + " " + offer.Uri); SetOfferAsInActive(dal, offer); _logger.Info(offer.Uri + ": fail - " + ex.Message + ex.StackTrace); System.Diagnostics.Debug.WriteLine("end"); if (ex.Message.ToLower().Contains("too many req")) { TimeoutError = true; } return; } catch (Exception ex) { _logger.Info(ex.Message + " " + ex.StackTrace + " " + offer.Uri); AddErrorLogsToDb(ex.Message + " " + ex.StackTrace + " " + offer.Uri); SetOfferAsInActive(dal, offer); _logger.Info(offer.Uri + ": fail - " + ex.Message + ex.StackTrace); System.Diagnostics.Debug.WriteLine("end"); if (ex.Message.ToLower().Contains("too many req")) { TimeoutError = true; } return; } try { if (successInsert) { System.Diagnostics.Debug.WriteLine("PROCESSED"); SetOfferAsProcessed(dal, offer); _logger.Info(offer.Uri + ": processed"); } else { _logger.Info(offer.Uri + ": not processed - error during elastic insert"); SetOfferAsUnprocessed(dal, offer); } } catch (OfferDetailsFailException ex) { _logger.Info(ex.Message + " " + ex.StackTrace + " " + offer.Uri); AddErrorLogsToDb(ex.Message + " " + ex.StackTrace + " " + offer.Uri); SetOfferAsInActive(dal, offer); _logger.Info(offer.Uri + ": fail - " + ex.Message + ex.StackTrace); } catch (Exception ex) { _logger.Info(ex.Message + " " + ex.StackTrace + " " + offer.Uri); AddErrorLogsToDb(ex.Message + " " + ex.StackTrace + " " + offer.Uri); SetOfferAsInActive(dal, offer); _logger.Info(offer.Uri + ": fail - " + ex.Message + ex.StackTrace); } })); }
public ActionResult EditOffer(int id) { OfferDetails offer = entities.OfferDetails.Find(id); return(PartialView("_EditOffer", offer)); }
public ActionResult AddOffer(OfferDetails offer) { entities.OfferDetails.Add(offer); entities.SaveChanges(); return(RedirectToAction("Index", "Admin")); }
/// <summary> /// Source /// Calls [[usp_ipobom_source_Offer]] /// /// </summary> public override List <OfferDetails> IPOBOMSource(System.Int32?clientId, System.String partSearch, System.Int32?index, DateTime?startDate, DateTime?endDate, out DateTime?outDate, bool hasServerLocal, System.Boolean?isPOHub) { SqlConnection cn = null; SqlCommand cmd = null; outDate = null; try { if (!hasServerLocal) { cn = new SqlConnection(this.GTConnectionString); } else { cn = new SqlConnection(this.ConnectionString); } if (isPOHub.Value) { cmd = new SqlCommand("usp_IPOBOM_Source_OfferPH", cn); } else { cmd = new SqlCommand("usp_ipobom_source_Offer", cn); } cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 30; cmd.Parameters.Add("@ClientId", SqlDbType.Int).Value = clientId; cmd.Parameters.Add("@PartSearch", SqlDbType.NVarChar).Value = partSearch; cmd.Parameters.Add("@Index", SqlDbType.Int).Value = index; cmd.Parameters.Add("@StartDate", SqlDbType.DateTime).Value = startDate; cmd.Parameters.Add("@FinishDate", SqlDbType.DateTime).Value = endDate; cmd.Parameters.Add("@IsPoHUB", SqlDbType.Bit).Value = isPOHub; cn.Open(); //DbDataReader reader = ExecuteReader(cmd); SqlDataReader reader = cmd.ExecuteReader(); List <OfferDetails> lst = new List <OfferDetails>(); while (reader.Read()) { OfferDetails obj = new OfferDetails(); obj.OfferId = GetReaderValue_Int32(reader, "OfferId", 0); obj.FullPart = GetReaderValue_String(reader, "FullPart", ""); obj.Part = GetReaderValue_String(reader, "Part", ""); obj.ManufacturerNo = GetReaderValue_NullableInt32(reader, "ManufacturerNo", null); obj.DateCode = GetReaderValue_String(reader, "DateCode", ""); obj.ProductNo = GetReaderValue_NullableInt32(reader, "ProductNo", null); obj.PackageNo = GetReaderValue_NullableInt32(reader, "PackageNo", null); obj.Quantity = GetReaderValue_Int32(reader, "Quantity", 0); obj.Price = GetReaderValue_Double(reader, "Price", 0); obj.OriginalEntryDate = GetReaderValue_NullableDateTime(reader, "OriginalEntryDate", null); obj.Salesman = GetReaderValue_NullableInt32(reader, "Salesman", null); obj.SupplierNo = GetReaderValue_Int32(reader, "SupplierNo", 0); obj.CurrencyNo = GetReaderValue_NullableInt32(reader, "CurrencyNo", null); obj.ROHS = GetReaderValue_Byte(reader, "ROHS", (byte)0); obj.UpdatedBy = GetReaderValue_NullableInt32(reader, "UpdatedBy", null); obj.DLUP = GetReaderValue_DateTime(reader, "DLUP", DateTime.MinValue); obj.OfferStatusNo = GetReaderValue_NullableInt32(reader, "OfferStatusNo", null); obj.OfferStatusChangeDate = GetReaderValue_NullableDateTime(reader, "OfferStatusChangeDate", null); obj.OfferStatusChangeLoginNo = GetReaderValue_NullableInt32(reader, "OfferStatusChangeLoginNo", null); obj.SupplierName = GetReaderValue_String(reader, "SupplierName", ""); obj.Notes = GetReaderValue_String(reader, "Notes", ""); obj.ManufacturerName = GetReaderValue_String(reader, "ManufacturerName", ""); obj.ProductName = GetReaderValue_String(reader, "ProductName", ""); obj.PackageName = GetReaderValue_String(reader, "PackageName", ""); obj.ClientNo = GetReaderValue_NullableInt32(reader, "ClientNo", null); obj.ManufacturerCode = GetReaderValue_String(reader, "ManufacturerCode", ""); obj.CurrencyCode = GetReaderValue_String(reader, "CurrencyCode", ""); obj.CurrencyDescription = GetReaderValue_String(reader, "CurrencyDescription", ""); obj.SupplierEmail = GetReaderValue_String(reader, "SupplierEmail", ""); obj.SalesmanName = GetReaderValue_String(reader, "SalesmanName", ""); obj.OfferStatusChangeEmployeeName = GetReaderValue_String(reader, "OfferStatusChangeEmployeeName", ""); obj.ClientId = GetReaderValue_Int32(reader, "ClientId", 0); obj.ClientName = GetReaderValue_String(reader, "ClientName", ""); obj.ClientDataVisibleToOthers = GetReaderValue_NullableBoolean(reader, "ClientDataVisibleToOthers", null); //[001] code start obj.SupplierType = GetReaderValue_String(reader, "SupplierType", ""); //[001] code end obj.ClientCode = GetReaderValue_String(reader, "ClientCode", ""); obj.MSL = GetReaderValue_String(reader, "MSL", ""); obj.SPQ = GetReaderValue_String(reader, "SPQ", ""); obj.LeadTime = GetReaderValue_String(reader, "LeadTime", ""); obj.RoHSStatus = GetReaderValue_String(reader, "RoHSStatus", ""); obj.FactorySealed = GetReaderValue_String(reader, "FactorySealed", ""); obj.IPOBOMNo = GetReaderValue_Int32(reader, "IPOBOMNo", 0); obj.SupplierTotalQSA = GetReaderValue_String(reader, "SupplierTotalQSA", ""); obj.SupplierLTB = GetReaderValue_String(reader, "SupplierLTB", ""); obj.SupplierMOQ = GetReaderValue_String(reader, "SupplierMOQ", ""); obj.IsSourcingHub = GetReaderValue_Boolean(reader, "ishub", false); lst.Add(obj); obj = null; } reader.NextResult(); while (reader.Read()) { outDate = GetReaderValue_NullableDateTime(reader, "OutPutDate", null); } return(lst); } catch (SqlException sqlex) { //LogException(sqlex); throw new Exception("Failed to get Offers", sqlex); } finally { cmd.Dispose(); cn.Close(); cn.Dispose(); } }
public override void ParseFromNetworkMessage(NetworkMessage message) { CategoryName = message.ReadString(); DisplayOfferId = message.ReadUInt32(); WindowType = message.ReadByte(); Collections.Capacity = message.ReadByte(); for (var i = 0; i < Collections.Capacity; ++i) { Collections.Add(message.ReadString()); } if (Client.VersionNumber >= 11900000) { DisplaySubCategory = message.ReadString(); } Offers.Capacity = message.ReadUInt16(); for (var i = 0; i < Offers.Capacity; ++i) { var offer = new Offer { Name = message.ReadString(), IsFeatured = WindowType == 3 }; offer.Details.Capacity = message.ReadByte(); for (var j = 0; j < offer.Details.Capacity; ++j) { var details = new OfferDetails { Id = message.ReadUInt32(), Amount = message.ReadUInt16(), Price = message.ReadUInt32() }; if (Client.VersionNumber >= 11900000) { details.IsConfirmedPrice = message.ReadBool(); } details.IsDisabled = message.ReadBool(); if (details.IsDisabled) { details.DisabledReasons.Capacity = message.ReadByte(); for (var x = 0; x < details.DisabledReasons.Capacity; ++x) { var disabledReason = message.ReadString(); details.DisabledReasons.Add(disabledReason); } } details.HighlightState = message.ReadByte(); if (details.HighlightState == (int)StoreOfferHighlightState.Sale) { // This may actually be wrong, but since there aren't currently // any items on sale I can't confirm it. var saleValidUntilTimestamp = message.ReadUInt32(); var basePrice = message.ReadUInt32(); } offer.Details.Add(details); } offer.DisplayType = message.ReadByte(); if (offer.DisplayType == 0) // image (.png) { offer.DisplayImage = message.ReadString(); } else if (offer.DisplayType == 1) // mount id { offer.DisplayMountId = message.ReadUInt16(); } else if (offer.DisplayType == 2) // outfit { offer.DisplayLooktype = message.ReadUInt16(); offer.DisplayColorHead = message.ReadByte(); offer.DisplayColorTorso = message.ReadByte(); offer.DisplayColorLegs = message.ReadByte(); offer.DisplayColorDetail = message.ReadByte(); } else if (offer.DisplayType == 3) // item id { offer.DisplayItemId = message.ReadUInt16(); } else if (offer.DisplayType == 4) // male/female outfit { offer.GenderToShow = message.ReadByte(); offer.DisplayFemaleLooktype = message.ReadUInt16(); offer.DisplayMaleLooktype = message.ReadUInt16(); offer.DisplayColorHead = message.ReadByte(); offer.DisplayColorTorso = message.ReadByte(); offer.DisplayColorLegs = message.ReadByte(); offer.DisplayColorDetail = message.ReadByte(); } offer.TryType = message.ReadByte(); // 0 = disabled, 1 = mounts/outfits, 2 = hireling dresses offer.Collection = message.ReadString(); offer.PopularityScore = message.ReadUInt16(); offer.NewUntilTimestamp = message.ReadUInt32(); offer.NeedsUserConfigurationBeforeBuying = message.ReadBool(); offer.Products.Capacity = message.ReadUInt16(); for (var j = 0; j < offer.Products.Capacity; ++j) { var subOffer = new Offer { Name = message.ReadString(), DisplayType = message.ReadByte() }; if (subOffer.DisplayType == 0) // image (.png) { subOffer.DisplayImage = message.ReadString(); } else if (subOffer.DisplayType == 1) // mount id { subOffer.DisplayMountId = message.ReadUInt16(); } else if (subOffer.DisplayType == 2) // outfit { subOffer.DisplayLooktype = message.ReadUInt16(); subOffer.DisplayColorHead = message.ReadByte(); subOffer.DisplayColorTorso = message.ReadByte(); subOffer.DisplayColorLegs = message.ReadByte(); subOffer.DisplayColorDetail = message.ReadByte(); } else if (subOffer.DisplayType == 3) // item sprite { subOffer.DisplayItemId = message.ReadUInt16(); } else if (subOffer.DisplayType == 4) // male/female outfit { subOffer.GenderToShow = message.ReadByte(); subOffer.DisplayFemaleLooktype = message.ReadUInt16(); subOffer.DisplayMaleLooktype = message.ReadUInt16(); subOffer.DisplayColorHead = message.ReadByte(); subOffer.DisplayColorTorso = message.ReadByte(); subOffer.DisplayColorLegs = message.ReadByte(); subOffer.DisplayColorDetail = message.ReadByte(); } offer.Products.Add(subOffer); } Offers.Add(offer); } if (CategoryName.Equals("Search", StringComparison.CurrentCultureIgnoreCase)) { TooManySearchResults = message.ReadBool(); } if (WindowType == 3) // Home { Banners.Capacity = message.ReadByte(); for (var i = 0; i < Banners.Capacity; ++i) { var banner = new Banner { Image = message.ReadString(), Type = message.ReadByte() }; if (banner.Type == 2) { banner.Category = message.ReadString(); banner.Collection = message.ReadString(); } else if (banner.Type == 4) { banner.OfferId = message.ReadUInt32(); } banner.Unknown = message.ReadUInt16(); // Always 0x0200 (512)? Banners.Add(banner); } BannerSwitchDelay = message.ReadByte(); } }
public void OfferDetailsServiceTest() { OfferDetailsService service = new OfferDetailsService(); OfferDetails details = service.GetOfferDetails("6754645454").Result; }