public ProductDTO(string productCode, int stock, double price) { id = new Guid(); ProductCode = new ProductCodeObject(productCode); Stock = new StockObject(stock); RealPrice = new PriceObject(price); SetPrice(price); }
public async Task PublisherAdvertising(uint packageId, ulong userid) { Console.WriteLine("pub1 " + packageId); PackageObject package = await GetPackage(packageId); PackageHeadObject packageHead = await GetPackageHead(packageId); PriceObject packagePrice = await GetPackagePrice(packageId); Console.WriteLine("pub2"); (string, Stream)r = await GetPublisherAdvertisting(userid, package, packageHead, packagePrice); Console.WriteLine("pub3"); var channel = _client.GetChannel(Settings.GetUnityNewsChannel()) as ISocketMessageChannel; await channel.SendFileAsync(r.Item2, "image.jpg", r.Item1); }
public async Task <(string, Stream)> GetPublisherAdvertisting(ulong userid, PackageObject package, PackageHeadObject packageHead, PriceObject packagePrice) { string descStrippedHtml = Regex.Replace(package.content.description, "<.*?>", String.Empty); descStrippedHtml = Regex.Replace(descStrippedHtml, " ", String.Empty); StringBuilder sb = new StringBuilder(); sb.Append("**--- Publisher everyday Advertising ---**\n\n"); sb.Append($"Today's daily advertisting goes to {_client.GetUser(userid).Mention} (**{packageHead.result.publisher}**)\n"); sb.Append($"With their package : {packageHead.result.title}, priced at {packagePrice.price}\n"); sb.Append("For any inquiry you can contact them here on **Unity Developer Hub** by mentioning them in the chat or PM.\n\n"); sb.Append("*Rating* "); for (int i = 0; i < package.content.rating.average; i++) { sb.Append("★"); } sb.Append($"(:bust_in_silhouette:{package.content.rating.count})\n"); sb.Append($"Unity Asset Store Link - https://www.assetstore.unity3d.com/en/#!/content/{package.content.link.id}?utm_source=udh&utm_medium=discord\n"); sb.Append($"```{descStrippedHtml.Substring(0, 250)}[...]```\n"); sb.Append("To be part of this kind of advertising use `!pInfo` for more informations."); //TODO: add image Stream image; using (var httpClient = new HttpClient()) { httpClient.Timeout = TimeSpan.FromSeconds(30); image = await httpClient.GetStreamAsync($"https:{package.content.keyimage.big}"); //image = ImageSharp.Image.Load(img); } return(sb.ToString(), image); }
public void SetPriceSales(double price) { PriceSales = new PriceObject(price); }
public void SetPrice(double price) { Price = new PriceObject(price); }
public PriceObject GetTicketAmount(int TicketCategoryID, string TicketCategoryName, int NoOfPersons, string CouponValue, string eventName) { var rtv = new PriceObject(); var ticketId = repoEventCategory.GetNonAsync(o => o.Itbid == TicketCategoryID && o.CategoryName == TicketCategoryName); if (ticketId != null) { if (!string.IsNullOrEmpty(CouponValue)) { var setUp = repoCouponSetUp.GetNonAsync(null); if (setUp.CouponType == "P") { rtv.OrigAmount = FormattedAmount(Convert.ToDecimal(ticketId.Amount * NoOfPersons)); rtv.Amount = FormattedAmount((Convert.ToDecimal(CouponValue) / 100) * Convert.ToDecimal(ticketId.Amount * NoOfPersons)); rtv.nErrorCode = 0; return(rtv); } else { rtv.OrigAmount = FormattedAmount(Convert.ToDecimal(ticketId.Amount * NoOfPersons)); rtv.Amount = FormattedAmount(Convert.ToDecimal(ticketId.Amount * NoOfPersons) - Convert.ToDecimal(CouponValue)); rtv.nErrorCode = 0; return(rtv); } } else { //rtv.OrigAmount = FormattedAmount(Convert.ToDecimal(ticketId.Amount * NoOfPersons)); //rtv.Amount = FormattedAmount(Convert.ToDecimal(ticketId.Amount * NoOfPersons) - Convert.ToDecimal(CouponValue)); //rtv.nErrorCode = 0; if (eventName == "Mask and Mysteries") { if (TicketCategoryName == "VIP single") { if (NoOfPersons == 2) { rtv.Amount = FormattedAmount(Convert.ToDecimal(ticketId.Amount * NoOfPersons * 0.8M)); //rtv.discountPercentage = Convert.ToDecimal(0.8); rtv.nErrorCode = 0; return(rtv); } else { rtv.Amount = FormattedAmount(Convert.ToDecimal(ticketId.Amount * NoOfPersons)); rtv.nErrorCode = 0; return(rtv); } } else { rtv.Amount = FormattedAmount(Convert.ToDecimal(ticketId.Amount * NoOfPersons)); rtv.nErrorCode = 0; return(rtv); } } else { rtv.Amount = FormattedAmount(Convert.ToDecimal(ticketId.Amount * NoOfPersons)); rtv.nErrorCode = 0; return(rtv); } //if(ticketId.ExtraCharges != null) //{ // rtv.Amount = FormattedAmount(Convert.ToDecimal((ticketId.Amount + ticketId.ExtraCharges) * NoOfPersons)); // rtv.nErrorCode = 1; //} //else //{ // rtv.Amount = FormattedAmount(Convert.ToDecimal(ticketId.Amount * NoOfPersons)); // rtv.nErrorCode = 1; //} //return rtv; } } return(rtv); }