Пример #1
1
	    /// <summary>
	    ///     Gets the item price model.
	    /// </summary>
	    /// <param name="item">The item.</param>
	    /// <param name="lowestPrice">The lowest price.</param>
	    /// <param name="tags">Additional tags for promotion evaluation</param>
	    /// <returns>price model</returns>
	    /// <exception cref="System.ArgumentNullException">item</exception>
	    public PriceModel GetItemPriceModel(Item item, Price lowestPrice, Hashtable tags)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (lowestPrice == null)
            {
                return new PriceModel();
            }

            var price = lowestPrice.Sale ?? lowestPrice.List;
            var discount = _client.GetItemDiscountPrice(item, lowestPrice, tags);
            var priceModel = CreatePriceModel(price, price - discount, UserHelper.CustomerSession.Currency);
	        priceModel.ItemId = item.ItemId;
            //If has any variations
            /* performance too slow with this method, need to store value on indexing instead
	        if (CatalogHelper.CatalogClient.GetItemRelations(item.ItemId).Any())
	        {
	            priceModel.PriceTitle = "Starting from:".Localize();
	        }
             * */
            return priceModel;
        }
Пример #2
0
        public OriginQuotation(Instrument instrument, DataRow originQuotation)
        {
            this.modifyState = ModifyState.Unchanged;

            this.instrument = instrument;
            this.timestamp = (DateTime)originQuotation["Timestamp"];
            if (originQuotation["Ask"] != DBNull.Value)
            {
                this.ask = Price.CreateInstance((string)originQuotation["Ask"], instrument.NumeratorUnit, instrument.Denominator);
            }
            if (originQuotation["Bid"] != DBNull.Value)
            {
                this.bid = Price.CreateInstance((string)originQuotation["Bid"], instrument.NumeratorUnit, instrument.Denominator);
            }
            if (originQuotation["High"] != DBNull.Value)
            {
                this.high = Price.CreateInstance((string)originQuotation["High"], instrument.NumeratorUnit, instrument.Denominator);
            }
            if (originQuotation["Low"] != DBNull.Value)
            {
                this.low = Price.CreateInstance((string)originQuotation["Low"], instrument.NumeratorUnit, instrument.Denominator);
            }
            if (originQuotation.Table.Columns.Contains("Volume") && originQuotation["Volume"] != DBNull.Value)
            {
                this.volume = (string)originQuotation["Volume"];
            }
            if (originQuotation.Table.Columns.Contains("TotalVolume") && originQuotation["TotalVolume"] != DBNull.Value)
            {
                this.totalVolume = (string)originQuotation["TotalVolume"];
            }
            this.origin = instrument.CalculateOrigin(this.ask, this.bid, false);
        }
Пример #3
0
        public OriginQuotation(Instrument instrument, CollectorQuotation cq)
        {
            this.modifyState = ModifyState.Added;
            this.instrument = instrument;
            this.timestamp = cq.Timestamp;
            this.ask = Price.CreateInstance(cq.Ask, instrument.NumeratorUnit, instrument.Denominator);
            this.bid = Price.CreateInstance(cq.Bid, instrument.NumeratorUnit, instrument.Denominator);

            this.high = Price.CreateInstance(cq.High, instrument.NumeratorUnit, instrument.Denominator);
            this.low = Price.CreateInstance(cq.Low, instrument.NumeratorUnit, instrument.Denominator);

            this.volume = cq.Volume;
            this.totalVolume = cq.TotalVolume;

            this.origin = instrument.CalculateOrigin(this.ask, this.bid, instrument.OriginQReceived != null);

            //Special handle, it's not so strict
            //NOTE: Has problem for session clear !
            if (this.origin == null && instrument.OriginQReceived != null)
            {
                if (this.ask == null) this.ask = this.instrument.OriginQReceived.ask;
                if (this.bid == null) this.bid = this.instrument.OriginQReceived.bid;
                this.origin = instrument.CalculateOrigin(this.ask, this.bid, false);
            }

            this.FilterErrorHighLow(instrument, false);
        }
Пример #4
0
        public void fromApp(QuickFix.Message message, SessionID sessionID)
        {
            // receiving messages
            Symbol sym = new Symbol();
            message.getField(sym);
            Tick k = new TickImpl(sym.getValue());
			
			{
            // bid
            BidPx bp = new BidPx();
            BidSize bs = new BidSize();
            k.bid = (decimal)bp.getValue();
            k.bs = (int)message.getField(bs).getValue();
			}
			
			{
            // ask
            OfferPx op = new OfferPx();
            OfferSize os = new OfferSize();
            k.ask = (decimal)op.getValue();
            k.os = (int)message.getField(os).getValue();
			}
			
			{
            // last
            Price price = new Price();
            message.getField(price);
            k.trade = (decimal)price.getValue();
			}
			
            tl.newTick(k);
            //ClOrdID clOrdID = new ClOrdID();
            //message.getField(clOrdID);
        }
        public static CaptureResponse CaptureAction(OffAmazonPaymentsServicePropertyCollection propertiesCollection,
            IOffAmazonPaymentsService service, string amazonAuthorizationId, string orderAmount, string orderReferenceId, int indicator, string providerId, string creditAmountString)
        {
            //initiate the capture request
            CaptureRequest captureRequest = new CaptureRequest();
            captureRequest.SellerId = propertiesCollection.MerchantID;
            captureRequest.AmazonAuthorizationId = amazonAuthorizationId;

            Price price = new Price();
            price.Amount = orderAmount;
            price.CurrencyCode = propertiesCollection.CurrencyCode;

            captureRequest.CaptureAmount = price;
            captureRequest.CaptureReferenceId = orderReferenceId.Replace('-', 'c') + "captureRef" + indicator.ToString();
            if (!String.IsNullOrEmpty(providerId) && !String.IsNullOrEmpty(creditAmountString))
            {
                ProviderCredit providerCredit = new ProviderCredit();
                providerCredit.ProviderId= providerId;
                Price creditAmount = new Price();
                creditAmount.Amount = creditAmountString;
                creditAmount.CurrencyCode = propertiesCollection.CurrencyCode;
                providerCredit.CreditAmount= creditAmount;
                ProviderCreditList providerCreditList = new ProviderCreditList();
                providerCreditList.member = new List<ProviderCredit>();
                providerCreditList.member.Add(providerCredit);
                captureRequest.ProviderCreditList = providerCreditList;
            }

            return CaptureSample.InvokeCapture(service, captureRequest);
        }
Пример #6
0
    public HtmlString AddPrice(List<Price> oldPrices, Price newPrice)
    {
      List<Price> result = new List<Price>();
      DateTime endingDatePrevious = newPrice.StartingDate.AddDays(-1);

      if (oldPrices != null)
      {
        if (oldPrices.All(price => !price.EndingDate.HasValue || newPrice.StartingDate > price.EndingDate.Value))
        {
          Price currentPrice = oldPrices.FirstOrDefault(price => !price.EndingDate.HasValue);
          if (currentPrice != null)
          {
            currentPrice.EndingDate = endingDatePrevious;
          }
        }
        else
        {
          Price currentPrice = oldPrices.FirstOrDefault(price => price.EndingDate > newPrice.StartingDate);
          DateTime? oldEndingDate = currentPrice.EndingDate;
          currentPrice.EndingDate = endingDatePrevious;
          if (newPrice.EndingDate.HasValue && oldEndingDate > newPrice.EndingDate.Value)
          {
            result.Add(new Price() { Article = currentPrice.Article, BasePrice = currentPrice.BasePrice, StartingDate = newPrice.EndingDate.Value.AddDays(1), EndingDate = oldEndingDate });
          }
        }

        result.AddRange(oldPrices);
      }

      result.Add(newPrice);

      return result.ToHtmlJson();
    }
Пример #7
0
 public static Price Decode(IByteReader stream)
 {
     Price decodedPrice = new Price();
     decodedPrice.N = Int32.Decode(stream);
     decodedPrice.D = Int32.Decode(stream);
     return decodedPrice;
 }
 public void TestAddition()
 {
     var testPrice1 = new Price(100, CurrencyCode.USD);
     var testPrice2 = new Price(100, CurrencyCode.RUB);
     var testPrice3 = new Price(102.674, CurrencyCode.USD);
     Assert.AreEqual(testPrice1 + testPrice2, testPrice3);
 }
        public static Product ToViewModel(this DataContracts.Product product, Price price)
        {
            var productViewModel = new Product();

            if (product.EditorialReviews != null)
            {
                var editorialReview = product.EditorialReviews.FirstOrDefault(er => !string.IsNullOrEmpty(er.ReviewType) && er.ReviewType.Equals("quickreview", StringComparison.OrdinalIgnoreCase));
                if (editorialReview != null)
                {
                    productViewModel.Description = editorialReview.Content;
                }
            }

            if (product.PrimaryImage != null)
            {
                productViewModel.FeaturedImage = product.PrimaryImage.ToViewModel();
            }

            productViewModel.Id = product.Id;
            productViewModel.Price = price;
            productViewModel.Sku = product.Code;

            if (product.Seo != null)
            {
                var seo = product.Seo.FirstOrDefault(s => !string.IsNullOrEmpty(s.Keyword));
                if (seo != null)
                {
                    productViewModel.Slug = seo.Keyword;
                }
            }

            productViewModel.Title = product.Name;

            return productViewModel;
        }
Пример #10
0
 public frmNewMember()
 {
     InitializeComponent();
     price = new Price();
     members = new Member();
     cards = new Cards();
     cardUsage = new CardUsage();
 }
Пример #11
0
 internal Order(
     Price price, OrderState state, Uid market, Uid contract, Side side)
 {
     Price = price;
     State = state;
     Market = market;
     Contract = contract;
     Side = side;
 }
Пример #12
0
        public Stock GetFristCol(string data)
        {
            List<Price> prices = new List<Price>();
            List<DataItem> items = new List<DataItem>();
            string firstCol = string.Empty;
            List<string> lines = data.Split('\n').ToList<string>();
            for (int i = 2; i < lines.Count; i++)
            {
                string line = lines[i];
                List<string> numStrs = line.Split(' ').ToList<string>();
                if (numStrs.Count < 5)
                    continue;
                DataItem item = new DataItem();
                Price price = new Price();
                price.content = new string[4];
                for (int numI = 0; numI < numStrs.Count; numI++)
                {
                    if (numI == 0)
                        item.content = numStrs[numI];
                    if (numI > 0 && numI < 5)
                    {
                        price.content[numI-1] = numStrs[numI];
                        if (numI == 3)
                        {
                            price.content[numI-1] = numStrs[numI+1];
                        }
                        if (numI == 4)
                        {
                            price.content[numI - 1] = numStrs[numI-1];
                        }
                    }
                   // if (numI > 0 && numI < 4)

                        //price.content += ",";

                }
                items.Add(item);
                prices.Add(price);
            }
            Stock stock = new Stock();
            stock.price = new Price[prices.Count];
            for (int itemI = 0; itemI < items.Count; itemI++)
            {
                stock.data += items[itemI].content;
                if (itemI != items.Count - 1)
                    stock.data += ",";
            }
            for (int priceI = 0; priceI < prices.Count; priceI++)
            {
                stock.price[priceI] = prices[priceI];   // += "[" + prices[priceI].content + "]";
                //if (priceI != prices.Count - 2)
                //    stock.price += ";";
            }
               // stock.data = "[" + stock.data + "]";
               // stock.price = "[" + stock.price  + "]";
            return stock;
        }
Пример #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        

        this.Price = Recruit.GetPrice(TroopType.Nobleman);
        int heroCount = this.Village.Heroes.Count + 1;
        this.Price = new Price(this.Price.Name, 0, this.Price.Wood * heroCount, this.Price.Clay * heroCount, this.Price.Iron * heroCount, this.Price.Population);


    }
Пример #14
0
        public static Price ToViewModel(this DataContracts.Price price)
        {
            var priceModel = new Price();

            priceModel.PricelistId = price.PricelistId;
            priceModel.Original = price.List;
            priceModel.ProductId = price.ProductId;
            priceModel.Sale = price.Sale;

            return priceModel;
        }
Пример #15
0
 public NavPosition(InstrumentSize Size, Price ClosingPriceUsed, Decimal ExchangeRateUsed,
     IPriceDetail ClosingPriceRecord, IExRate ExchangeRateRecord)
 {
     this.Size = Size;
     this.ClosingPriceUsed = ClosingPriceUsed;
     this.ExchangeRateUsed = ExchangeRateUsed;
     this.ClosingPriceRecord = ClosingPriceRecord;
     this.ExchangeRateRecord = ExchangeRateRecord;
     setCurrentValue();
     setCurrentBaseValue();
 }
 public bool AddPrice(Price price)
 {
     bool canAddPrice = IsUniquePrice(price);
     if (canAddPrice)
     {
         ticketsDataSet.Price.AddPriceRow(price.Value);
         provider.UpdateAllData();
         return true;
     }
     return false;
 }
 public InvoiceLine()
 {
     CreditedQuantity = new InvoicedQuantity();
     InvoicedQuantity = new InvoicedQuantity();
     DebitedQuantity = new InvoicedQuantity();
     LineExtensionAmount = new PayableAmount();
     PricingReference = new PricingReference();
     AllowanceCharge = new AllowanceCharge();
     TaxTotals = new List<TaxTotal>();
     Item = new Item();
     Price = new Price();
 }
        public QuotePolicyDetail(Instrument instrument, XmlNode quotePolicy)
        {
            this.id = XmlConvert.ToGuid(quotePolicy.Attributes["QuotePolicyID"].Value);
            this.priceType = (PriceType)XmlConvert.ToByte(quotePolicy.Attributes["PriceType"].Value);
            this.autoAdjustPoints = XmlConvert.ToInt32(quotePolicy.Attributes["AutoAdjustPoints"].Value);
            this.spreadPoints = XmlConvert.ToInt32(quotePolicy.Attributes["SpreadPoints"].Value);
            this.isOriginHiLo = XmlConvert.ToBoolean(quotePolicy.Attributes["IsOriginHiLo"].Value);
            this.overrideHigh = null;
            this.overrideLow = null;

            this.SetCrossRef(instrument);
        }
        public QuotePolicyDetail(Instrument instrument, DataRow quotePolicy)
        {
            this.id = (Guid)quotePolicy["QuotePolicyID"];
            this.priceType = (PriceType)(byte)quotePolicy["PriceType"];
            this.autoAdjustPoints = (int)quotePolicy["AutoAdjustPoints"];
            this.spreadPoints = (int)quotePolicy["SpreadPoints"];
            this.isOriginHiLo = (bool)quotePolicy["IsOriginHiLo"];
            this.overrideHigh = null;
            this.overrideLow = null;

            this.SetCrossRef(instrument);
        }
Пример #20
0
 public void TestPriceGoEqual()
 {
     var price = new Price()
     {
         AskPx = 1,
         BidPx = 1
     };
     price.AskPx = 1;
     price.BidPx = 1;
     var b = new PriceCellBackgroundConverter().Convert(new[] { (object)price.AskPx, (object)price.AskPxOld }, null, null, null);
     Assert.AreEqual("#FFFFFFFF", b.ToString());
 }
Пример #21
0
 public PriceModel(Price price)
     : this()
 {
     if (price != null)
     {
         Price = price;
     }
     else
     {
         Price = default(Price);
     }
 }
Пример #22
0
 public frmCashier()
 {
     InitializeComponent();
     startPh = 1300;
     startPv = 900;
     price = new Price();
     tPrices = price.GetPrices();
     cards = new Cards();
     members = new Member();
     cardUsage = new CardUsage();
     tCardUsage = new tCardUsage();
     InitListView(true);
 }
Пример #23
0
 public void AddItemToShop()
 {
     Item item = new Item("ID0001", "Cestitka 1");
     Shop shop = new Shop("trgovina 1");
     Price price = new Price(4, 3.2) {ItemId = item.UniqueId, ShopId = shop.Id};
     ShopItem shopItem = new ShopItem {ItemId = item.UniqueId, ShopId = shop.Id, PriceId = price.Id};
     Assert.IsNotNull(shopItem, "Items not added to shop!");
     shopItem.SetNumberOfItems(3);
     Assert.AreEqual(3, shopItem.NumberOfItems, "ShopItem missmatch!");
     Overview overview = new Overview();
     overview.AddShopItem(shopItem);
     Overview temp = overview;
 }
 public bool DeletePrice(Price price)
 {
     bool canDeletePrice = IsUsedPrice(price);
     if (canDeletePrice)
     {
         Tr_Tick_DBDataSet.PriceRow row = ticketsDataSet.Price.FindBypprice_id(price.ID);
         row.Delete();
         //ticketsDataSet.Price.RemovePriceRow(row);
         provider.UpdateAllData();
         return true;
     }
     return false;
 }
 public bool AddPrice(Common.Price price)
 {
     bool canAddPrice = IsUniquePrice(price);
     if (canAddPrice)
     {
         Price priceToAdd = new Price();
         priceToAdd.price_name = price.Value;
         dataBase.Price.Add(priceToAdd);
         dataBase.SaveChanges();
         return true;
     }
     return false;
 }
Пример #26
0
    public AirMatrixFlightMeta()
    {
        _airLine = new Airline();
        _zeroStopPrice = new Price();
        _oneStopPrice = new Price();
        _moreThanTwoStopPrice = new Price();
        _lowFareSelectPrice = new Price();

        _zeroStopFlightList = new List<Component>();
        _oneStopFlightList = new List<Component>();
        _moreThanTwoStopFlightList = new List<Component>();

        _needHide = false;
    }
Пример #27
0
 public static Price GetCurrentPrice()
 {
     String sql = "SELECT * FROM [Price] WHERE InUse=@InUse";
     DataTable table = Database.GetData(sql, "@InUse","1");
     Price price = new Price();
     if (table.Rows.Count > 0)
     {
         int.TryParse(table.Rows[0]["priceID"].ToString(), out price.priceID);
         int.TryParse(table.Rows[0]["fastPrice"].ToString(), out price.fastPrice);
         int.TryParse(table.Rows[0]["lunPrice"].ToString(), out price.lunPrice);
         int.TryParse(table.Rows[0]["dinPrice"].ToString(), out price.dinPrice);
     }
     return price;
 }
Пример #28
0
        public void CompareTo_same_by_current_price()
        {
            var lhs = new Price() { Symbol = "GOOG", CurrentPrice = (decimal)123.45, PreviousPrice = 0 };

              var rhs = new Price();
              rhs.Symbol = "MSFT";
              rhs.CurrentPrice = (decimal)123.45;
              rhs.PreviousPrice = (decimal)999;

              var expected = 0;
              var actual = rhs.CompareTo(lhs, PriceComparisonType.CurrentPrice);

              Assert.Equal(expected, actual);
        }
 public static AuthorizeOnBillingAgreementResponse AuthorizeOnBillingAgreement(OffAmazonPaymentsServicePropertyCollection propertiesCollection,
     IOffAmazonPaymentsService service, string billingAgreementId, String authAmount, int indicator, bool captureNow)
 {
     AuthorizeOnBillingAgreementRequest request = new AuthorizeOnBillingAgreementRequest();
     request.AmazonBillingAgreementId = billingAgreementId;
     request.SellerId = propertiesCollection.MerchantID;
     Price price = new Price();
     price.Amount = authAmount;
     price.CurrencyCode = propertiesCollection.CurrencyCode;
     request.AuthorizationAmount = price;
     request.CaptureNow = captureNow;
     request.AuthorizationReferenceId = billingAgreementId.Replace('-', 'a') + "authRef" + indicator.ToString();
     return InvokeAuthorizeOnBillingAgreement(service, request);
 }
Пример #30
0
        public DividendHistory(DividendTypes dividendType, ISecurityInstrument instrument,
            DateTime exDividendDate, DateTime settlementDate, Price unitPrice, decimal scripRatio)
            : this(instrument)
        {
            if (dividendType == DividendTypes.Cash && (unitPrice == null || unitPrice.IsZero))
                throw new ApplicationException("The unit price can not be null for cash dividend");
            else if (dividendType == DividendTypes.Scrip && scripRatio == 0M)
                throw new ApplicationException("The scrip ratio can not be 0 for scrip dividend");

            this.DividendType = dividendType;
            this.ExDividendDate = exDividendDate;
            this.SettlementDate = settlementDate;
            this.UnitPrice = unitPrice;
            this.ScripRatio = scripRatio;
        }
Пример #31
0
 public override string ToString()
 {
     return($"{Id}, {Name}, {Price.ToString("F2", CultureInfo.InvariantCulture)}, {Category.Name}, {Category.Tier}");
 }
Пример #32
0
 /// <inheritdoc/>
 public void ModifyOrder(Order order, Quantity modifiedQuantity, Price modifiedPrice)
 {
     this.CalledMethods.Add(nameof(this.ModifyOrder));
     this.ReceivedObjects.Add((order, modifiedQuantity, modifiedPrice));
 }
        /// <summary>
        /// Attempts to add the game, returns errors if there are any.
        /// </summary>
        /// <returns>Returns Constants.AddGameErrors enum, depicting what error occured, if any.</returns>
        public Constants.AddGameErrors AddGame()
        {
            // Checks if any of the variables are either null or empty, and returns with an error if they are.
            if (Name.IsNullOrEmpty())
            {
                return(Constants.AddGameErrors.NameInvalid);
            }
            else if (Categories.IsNullOrEmpty())
            {
                return(Constants.AddGameErrors.CategoriesInvalid);
            }
            else if (Price.IsNullOrEmpty())
            {
                return(Constants.AddGameErrors.PriceInvalid);
            }
            else if (Description.IsNullOrEmpty())
            {
                return(Constants.AddGameErrors.DescriptionInvalid);
            }

            // Parses the price string to a float.
            float _price = float.Parse(Price, System.Globalization.CultureInfo.InvariantCulture);

            // Creates a list of categories, and splits the Categories string into it.
            List <String> _categories = new List <string>();

            _categories = Categories.Split(",").ToList();
            List <CarrouselItem> _carrouselItems = new List <CarrouselItem>();

            // Creates and adds CarrouselItems to the list above, depending on what type of CarrouselItem it is.
            foreach (StorageFile file in CarrouselImages)
            {
                _carrouselItems.Add(new CarrouselItem(Constants.CarrouselItemType.Image, file.Path));
            }
            foreach (StorageFile file in CarrouselVideos)
            {
                _carrouselItems.Add(new CarrouselItem(Constants.CarrouselItemType.Video, file.Path));
            }
            foreach (ListviewString item in CarrouselYoutubeVids)
            {
                _carrouselItems.Add(new CarrouselItem(Constants.CarrouselItemType.YoutubeVideo, item.Value));
            }

            // Checks the price, and returns an error depending on whether or not it is valid.
            if (_price.ToString().Length == 0 || _price < 1 || _price > 1000)
            {
                return(Constants.AddGameErrors.PriceInvalid);
            }

            // Creates a new game with all the information.
            Game newGame = new Game(AccountHandler.Account, ThumbnailImagePath, Name, _price, 0, Description, "", _categories, _carrouselItems, _releaseDate);

            // Checks if the identifier for the game is identical to any game already in the list. Return with error if it does.
            foreach (Game game in _gameList.StoreGameCollection)
            {
                if (game.Identifier == newGame.Identifier)
                {
                    return(Constants.AddGameErrors.GameExists);
                }
            }

            // Adds the newly created game to the gamelist.
            _gameList.AddGame(newGame);

            // Returns with no errors.
            return(Constants.AddGameErrors.NoError);
        }
 public void ConfirmPrice(Price validUnitPrice)
 {
     this.UnitPrice = validUnitPrice;
 }
Пример #35
0
 public void AddTick(Price price)
 {
     AddTick(price.Time, price.Ask, price.Bid);
 }
Пример #36
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(PriceDate.Month.GetHashCode() + PriceDate.Day.GetHashCode() + PriceDate.Year.GetHashCode() * 13 + Price.GetHashCode() * 7 + Index.GetHashCode());
     }
 }
Пример #37
0
        private void btnSaveMenu_Click(object sender, EventArgs e)
        {
            MenuBusinessLogic  menuBusinessLogic  = new MenuBusinessLogic();
            PriceBusinessLogic priceBusinessLogic = new PriceBusinessLogic();

            Model.Menu menu = new Model.Menu();
            menu.MenuID = Guid.NewGuid().ToString();
            if (txbMenuName.Text.Trim() != "")
            {
                menu.MenuName = txbMenuName.Text.Trim();
                if (menuBusinessLogic.GetMenuByName(menu.MenuName) != null)
                {
                    MessageBox.Show("该菜品已存在,不能重复添加!");
                    return;
                }
            }
            else
            {
                MessageBox.Show("菜品名称不能为空!");
                return;
            }

            if (txbUint.Text.Trim() == "")
            {
                MessageBox.Show("菜品单价不能为空!");
                return;
            }
            else
            {
                menu.Unit = txbUint.Text.Trim();
            }
            double Quote = 0;

            if (!double.TryParse(txbQuote.Text.Trim(), out Quote))
            {
                MessageBox.Show("报价处请输入数字!");
                return;
            }
            menu.MenuQuote = Quote;
            double Rate = 1.0;

            if (!double.TryParse(txbRate.Text.Trim(), out Rate))
            {
                MessageBox.Show("请输入优惠率!");
                return;
            }
            menu.MenuRate  = Rate;
            menu.MenuPrice = Quote * Rate;
            menu.InputDate = DateTime.Now;

            Price price = new Price();

            price.PriceID   = Guid.NewGuid().ToString();
            price.MenuID    = menu.MenuID;
            price.Quote     = Quote;
            price.Rate      = Rate;
            price.Price1    = Quote * Rate;
            price.InputDate = Convert.ToDateTime(menu.InputDate);
            if (menuBusinessLogic.AddMenu(menu) && priceBusinessLogic.AddPrice(price))
            {
                MessageBox.Show("添加成功!");
                txbMenuName.Clear();
                txbUint.Clear();
                txbQuote.Clear();
                txbRate.Clear();
                loadMenu();
            }
            else
            {
                MessageBox.Show("添加失败!");
            }
        }
Пример #38
0
 public void AddTick(Price price)
 {
     AddTick(price.Time.ToUniversalTime(), price.Ask, price.Bid);
 }
Пример #39
0
 public Tick(Price price, int row, bool isHistory)
     : base(price, isHistory)
 {
     Row = row;
 }
Пример #40
0
 public void isValidForCreation_givenNegativePrice_thenNotValidForCreation()
 {
     Assert.False(new ItemValidator().IsValidForCreation(ItemTestBuilder.AnItem().WithPrice(Price.Create(new decimal(-1))).Build()));
 }
Пример #41
0
        private static async Task NotifyOfPriceReduction(Item item, decimal currentPrice, Price prevPrice)
        {
            log.LogInformation($"Informing {item.SubscribersEmails.Length} user(s) about price decrease of {item.Name}.");

            try
            {
                await emailSender.SendEmailAboutPriceDecreaseAsync(item, currentPrice, prevPrice.ItemPrice);
            }
            catch (Exception ex)
            {
                log.LogError($"Can't send Emails to subscribers: {ex.Message}");
            }
        }
Пример #42
0
 public override void Display(int orderTotal)
 {
     Console.WriteLine("Slider #" + orderTotal + ": " + Name + " - topped with " + Cheese +
                       " cheese and " + Toppings + "! $" + Price.ToString(CultureInfo.InvariantCulture));
 }
Пример #43
0
 public int CompareTo(FlightPrice other) => Price.CompareTo(other.Price);
Пример #44
0
 public string GetDisplayBook()
 {
     return(ISBN + "        " + Author + "        " + Title + "                  " + Price.ToString());
 }
Пример #45
0
 protected string FormatPrice(Price price)
 => formatter.Format(price);
Пример #46
0
 public override string PriceTag()
 {
     return(Name + " $ " + Price.ToString("F2", CultureInfo.InvariantCulture) +
            " (Manufacture date: " + ManufactureDate.ToString("dd/MM/yyyy") + ")");
 }
 public override String PriceTag()
 {
     return($"{Name},$ {Price.ToString("F2", CultureInfo.InvariantCulture)}, {ManufactureDate.ToString("dd/MM/YYYY")}");
 }
Пример #48
0
 public string SearchQuery()
 {
     return(Id + "/" + Name + "/" + Category + "/" + Description + "/"
            + Quantity.SearchQuery() + "/" + Price.SearchQuery() + "/" + Detail.SearchQuery());
 }
 public Row(string amount, string price, Price priceR)
 {
     Amount = amount ?? throw new ArgumentNullException(nameof(amount), "amount cannot be null");
     Price  = price ?? throw new ArgumentNullException(nameof(price), "price cannot be null");
     PriceR = priceR ?? throw new ArgumentNullException(nameof(priceR), "priceR cannot be null");
 }
Пример #50
0
        public async Task <Price> GetPrice(string pair)
        {
            string supportedCur;

            try
            {
                supportedCur = await GetSupprtedCurrency(pair);
            }
            catch
            {
                supportedCur = null;
            }
            supportedCur = await GetSupprtedCurrency(pair);

            if (string.IsNullOrEmpty(supportedCur))
            {
                return(null);
            }

            var first    = pair.Substring(0, pair.Length - supportedCur.Length);
            var currency = await _coinGeckoRepository.GetCurrency(first);

            if (currency == null)
            {
                return(null);
            }

            var oPrice = new List <CoinGeckoMarketCurrency>();

            using (var client = new HttpClient())
                using (var requets = new HttpRequestMessage(HttpMethod.Get, $"{_coinGeckoOptions.APIUri}coins/markets?ids={currency.Id}&vs_currency={supportedCur}"))
                {
                    using (var response = await client.SendAsync(requets, HttpCompletionOption.ResponseHeadersRead))
                    {
                        if (response.IsSuccessStatusCode)
                        {
                            oPrice = await _httpResponseService.DeserializeJsonFromStream <List <CoinGeckoMarketCurrency> >(response);
                        }
                        else
                        {
                            var content = await _httpResponseService.StreamToStringAsync(await response.Content.ReadAsStreamAsync());

                            throw new ApiException(message: content)
                                  {
                                      StatusCode = (int)response.StatusCode,
                                      Content    = content
                                  };
                        }
                    }
                }

            var price = new Price()
            {
                Change = oPrice.FirstOrDefault().PriceChangePercentage24H.ToString(),
                High   = oPrice.FirstOrDefault().High24H.ToString(),
                Last   = oPrice.FirstOrDefault().CurrentPrice.ToString(),
                Low    = oPrice.FirstOrDefault().Low24H.ToString(),
                ATH    = oPrice.FirstOrDefault().Ath.ToString()
            };

            return(price);
        }
Пример #51
0
        }                                //its the house of create the flavor and made the final product


        public string ToFixedLengthString()
        {
            return($"{string.Format("{0,-20}", Name)}|{string.Format("{0,-20}", Flavor)}|" +
                   $"{Volum.ToString("00000000;-00000000")}|{Price.ToString("00000000;-00000000")}|" +
                   $"{string.Format("{0,-20}", Made)}");
        }
Пример #52
0
 public string ToStringDetailed()
 {
     return(string.Format("General -\t Id: {0},  Name: {1},  Category: {2},  Description: {3}\n{4}\n{5}\n{6}",
                          Id, Name, Category, Description,
                          Quantity.ToStringDetailed(), Price.ToStringDetailed(), Detail.ToStringDetailed()));
 }
Пример #53
0
        public override string PriceTag()
        {
            string tag = Name + "(used) $ " + Price.ToString("F2") + " (Manufacture date: " + ManufactureDate.ToString("dd/MM/yyyy") + ")";

            return(tag);
        }
Пример #54
0
 public override string ToString()
 {
     return(string.Format("'{0}', '{1}', '{2}', '{3}', {4}, {5}, {6}",
                          Id, Name, Description, Category,
                          Quantity.ToString(), Price.ToString(), Detail.ToString()));
 }
        public static List <Property> ReadPricingData(OperationsJsonLogger <PricePushResult> logger)
        {
            List <Property> properties       = null;
            IFormatProvider culture          = new System.Globalization.CultureInfo("en-US", true);
            int             propertCodeIndex = 0;
            int             seasonStartIndex = 0;
            int             seasonEndIndex   = 0;
            int             minLosStartIndex = 0;
            int             dateStampIndex   = 0;
            int             priceRowIndex    = 7;

            try
            {
                //var lines = File.ReadAllLines(Config.I.AirBnbPricingPushFile);
                var lines = WriteSafeReadAllLines(Config.I.PricingPushFile);
                if (lines.Length > 0)
                {
                    properties = new List <Property>();
                }

                for (int index = 0; index < lines.Length; index++)
                {
                    // Getting the list of properties.
                    if (index == propertCodeIndex)
                    {
                        string[] propertyArray      = lines[index].Split(',');
                        int      propertyCellIndex  = Array.IndexOf(propertyArray, PricingPushCsv.PropertyCode);
                        int      propertyCodesIndex = propertyCellIndex + 1;
                        while (propertyCodesIndex < propertyArray.Length)
                        {
                            if (!string.IsNullOrEmpty(propertyArray[propertyCodesIndex]))
                            {
                                Property property = new Property(propertyArray[propertyCodesIndex], propertyCodesIndex);
                                properties.Add(property);
                            }
                            propertyCodesIndex++;
                        }
                    }

                    // Better than checking whether the index is greater than 1 would be to check if its greater than or equal to 0
                    // The whole purpose is to check whether the line exists or not.
                    // Getting the stream line home names.
                    if (Array.IndexOf(lines[index].Split(','), PricingPushCsv.StreamLineHomeName) >= 0)
                    {
                        string[] streamLineHomeNames = lines[index].Split(',');
                        foreach (Property property in properties)
                        {
                            property.StreamLineHomeName = streamLineHomeNames[property.PropertyIndex].Trim();
                        }
                    }

                    // Parsing and reading the stream line home id's
                    if (Array.IndexOf(lines[index].Split(','), PricingPushCsv.StreamLineHomeId) >= 0)
                    {
                        string[] streamLineHomeIds = lines[index].Split(',');
                        foreach (Property property in properties)
                        {
                            property.StreamLineHomeId = streamLineHomeIds[property.PropertyIndex].Trim();
                        }
                    }

                    //Getting the airbnb accounts.
                    if (Array.IndexOf(lines[index].Split(','), PricingPushCsv.AirbnbAccount) >= 0)
                    {
                        string[] airBnbAccountNames = lines[index].Split(',');
                        foreach (Property property in properties)
                        {
                            //property.AirbnbAccount = airBnbAccountNames[property.PropertyIndex].Trim();
                            property.LoginAccount.Email = airBnbAccountNames[property.PropertyIndex].Trim();
                        }
                    }

                    //Getting the airbnb passswords.
                    if (Array.IndexOf(lines[index].Split(','), PricingPushCsv.AirbnbPassword) >= 0)
                    {
                        string[] airBnbAccountPasswords = lines[index].Split(',');
                        foreach (Property property in properties)
                        {
                            property.LoginAccount.Password = airBnbAccountPasswords[property.PropertyIndex].Trim();
                        }
                    }

                    //Getting the ProxyIP for the accounts.
                    if (Array.IndexOf(lines[index].Split(','), PricingPushCsv.ProxyIp) >= 0)
                    {
                        string[] proxyIps = lines[index].Split(',');
                        foreach (Property property in properties)
                        {
                            property.LoginAccount.ProxyAddress = new List <string> {
                                proxyIps[property.PropertyIndex].Trim()
                            };
                            //property.ProxyIP = proxyIps[property.PropertyIndex].Trim();
                        }
                    }

                    //Getting the Airbnb title for the properties.
                    if (Array.IndexOf(lines[index].Split(','), PricingPushCsv.AirbnbTitle) >= 0)
                    {
                        string[] airBnbTitles = lines[index].Split(',');
                        foreach (Property property in properties)
                        {
                            property.AirbnbTitle = airBnbTitles[property.PropertyIndex].Trim();
                        }
                    }

                    if (Array.IndexOf(lines[index].Split(','), PricingPushCsv.AirbnbListingId) >= 0)
                    {
                        string[] airBnbListingIds = lines[index].Split(',');
                        foreach (Property property in properties)
                        {
                            property.AirbnbId = airBnbListingIds[property.PropertyIndex].Trim();
                        }
                    }


                    //Getting the price index for the properties.
                    if (Array.IndexOf(lines[index].Split(','), PricingPushCsv.DateStamp) >= 0)
                    {
                        string[] propertyPriceHeadings = lines[index].Split(',');
                        seasonStartIndex = Array.IndexOf(propertyPriceHeadings, PricingPushCsv.SeasonStartDate);
                        seasonEndIndex   = Array.IndexOf(propertyPriceHeadings, PricingPushCsv.SeasonEndDate);
                        dateStampIndex   = Array.IndexOf(propertyPriceHeadings, PricingPushCsv.DateStamp);
                        minLosStartIndex = Array.IndexOf(propertyPriceHeadings, PricingPushCsv.MinimumLOS);
                        priceRowIndex    = index + 1;
                    }

                    // Getting and populating the object with prices.
                    if (index >= priceRowIndex)
                    {
                        string[] prices = lines[index].Split(',');
                        if (string.IsNullOrEmpty(prices[0]))
                        {
                            continue;
                        }

                        try
                        {
                            string dayPrice = string.Empty;
                            foreach (Property property in properties)
                            {
                                Price propertyPrice = new Price();
                                propertyPrice.SeasonStartDate = DateTime.Parse(prices[seasonStartIndex].Trim(), CultureInfo.InvariantCulture);
                                propertyPrice.SeasonEndDate   = DateTime.Parse(prices[seasonEndIndex].Trim(), CultureInfo.InvariantCulture);
                                dayPrice = prices[property.PropertyIndex].Trim(new char[] { '$' });
                                if (!string.IsNullOrEmpty(dayPrice))
                                {
                                    propertyPrice.PropertyPrice = Convert.ToDouble(dayPrice);
                                    //Convert.ToDouble(prices[property.PropertyIndex].Trim(new char[] { '$' }));
                                }
                                propertyPrice.MinimumLos = Convert.ToInt32(prices[minLosStartIndex].Trim());
                                propertyPrice.DateStamp  = DateTime.Parse(prices[dateStampIndex].Trim(), CultureInfo.InvariantCulture);
                                property.Prices.Add(propertyPrice);
                            }
                        }
                        catch (Exception ex)
                        {
                            logger.Log(new PricePushResult(Channel.Common, PricePushLogArea.ParsingCSV, PricingPushLogType.Error, ex.Message + ", Season Start Date :" + prices[seasonStartIndex].Trim() + ", Season End Date :" + prices[seasonEndIndex].Trim()));
                        }
                    }
                }

                return(properties);
            }
            catch (FileNotFoundException ex)
            {
                logger.Log(new PricePushResult(Channel.Common, PricePushLogArea.CSVFileNotFound, PricingPushLogType.Error, ex.Message));
            }
            catch (Exception ex)
            {
                logger.Log(new PricePushResult(Channel.Common, PricePushLogArea.ParsingCSV, PricingPushLogType.Error, ex.Message));
            }
            return(properties);
        }
Пример #56
0
        public override string ToString()
        {
            string lcString = ""; //Serial.ToString() + "\t" + ModelName + "\t\t" + Gears.ToString() + "\t";

            if (Type == 'U')
            {
                lcString = lcString + "Used";
            }
            else
            {
                lcString = lcString + "New";
            }
            lcString = lcString + "\t" + ModelName.PadRight(40 - ModelName.Length) + "\t" + Gears + "\t $" + Price.ToString();

            return(lcString);
        }
Пример #57
0
 public IActionResult Index([FromQuery] int id)
 {
     Price = _unitOfWork.Price.Get(1);
     return(View(Price));
 }
Пример #58
0
 /// <summary>
 /// создает представление машины в виде строки
 /// </summary>
 /// <returns>Строка, представляющая машину</returns>
 public override string ToString()
 {
     return(Model + "_" + Description + "_" + ID.ToString() + "_" + Price.ToString() + "_" + Image + "_" + IsConfirned.ToString() + "_" + IsSold.ToString() + "_" + Owner);
 }
Пример #59
0
 public Rate(Price price, bool isHistory) : this(price.Time, price.Ask, price.Bid, isHistory)
 {
 }
Пример #60
0
 protected override int HashCode()
 {
     return(Key.GetHashCode() ^ ArtikleCode.GetHashCode() ^ ColorCode.GetHashCode() ^ Description.GetHashCode() ^
            Price.GetHashCode() ^ DiscountPrice.GetHashCode() ^ DeliveredIn.GetHashCode() ^ Q1.GetHashCode() ^ Size.GetHashCode() ^ Color.GetHashCode());
 }