当前位置: 首页>>代码示例>>C#>>正文


C# Quote类代码示例

本文整理汇总了C#中Quote的典型用法代码示例。如果您正苦于以下问题:C# Quote类的具体用法?C# Quote怎么用?C# Quote使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Quote类属于命名空间,在下文中一共展示了Quote类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        private static void Main(string[] args)
        {
            var proxy = new StockTradeServiceClient();

            var msftQuote = new Quote {Ticker = "MSFT", Bid = 30.25M, Ask = 32.00M, Publisher = "PracticalWCF"};
            var ibmQuote = new Quote {Ticker = "IBM", Bid = 80.50M, Ask = 81.00M, Publisher = "PracticalWCF"};
            proxy.PublishQuote(msftQuote);
            proxy.PublishQuote(ibmQuote);

            Quote result = null;
            result = proxy.GetQuote("MSFT");
            Console.WriteLine("Ticker: {0} Ask: {1} Bid: {2}", result.Ticker, result.Ask, result.Bid);

            result = proxy.GetQuote("IBM");
            Console.WriteLine("Ticker: {0} Ask: {1} Bid: {2}", result.Ticker, result.Ask, result.Bid);

            result = null;
            try
            {
                result = proxy.GetQuote("ATT");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            if (result == null)
            {
                Console.WriteLine("Ticker ATT not found!");
            }
        }
开发者ID:bazile,项目名称:Training,代码行数:30,代码来源:Program.cs

示例2: dobkUnderhndlr

 public static ConcurrentQueue<equity> queue = new ConcurrentQueue<equity>();//equity quote
 public static void dobkUnderhndlr(InstrInfo instr, uint ts, byte partid, int mod, byte numbid, byte numask, byte[] bidexch, byte[] askexch, Quote[] bidbk, Quote[] askbk)
 {
     lock (respFlow.locker2)
     {
         try
         {
             output x;
             reqFlow._queue.TryDequeue(out x);
             equity q = new equity
             {
                 Instr = instr,
                 Ts = ts,
                 Bidexch = bidexch,
                 Askexch = askexch,
                 Bidbk = bidbk,
                 Askbk = askbk,
                 x = x
             };
             queue.Enqueue(q);
             Console.WriteLine("response: " + x.under + x.callput + "  " + instr.sym);
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
 }
开发者ID:rbarber8,项目名称:historical_curve,代码行数:28,代码来源:respFlow.cs

示例3: AssignQuote

 public void AssignQuote(int QuoteId, int newUserId)
 {
     Quote q = new Quote(QuoteId);
     q.OwnerId = newUserId;
     q.Save();
     return;
 }
开发者ID:tonybaloney,项目名称:No-More-Spreadsheets,代码行数:7,代码来源:QuoteService.cs

示例4: ConstructorTest

        public void ConstructorTest()
        {
            Int32 quoteID = 25;
            SourceLanguage sourceLanguage = new SourceLanguage("en-gb");
            TargetLanguage[] targetLanguage = new TargetLanguage[2] { new TargetLanguage("en-us"),
                                                                      new TargetLanguage("it-it")};
            Int32 totalTranslations = 14;
            Int32 translationCredit = 4;
            String currency = "USD";
            Decimal totalCost = 100.54m;
            Decimal prepaidCredit = 30.4m;
            Decimal amountDue = 1.4m;
            DateTime creationDate = DateTime.Now;

            var projects = new List<Project>();

            var quote = new Quote(quoteID: quoteID,
                                 creationDate: creationDate,
                                 totalTranslations: totalTranslations,
                                 translationCredit: translationCredit,
                                 currency: currency,
                                 totalCost: totalCost,
                                 prepaidCredit: prepaidCredit,
                                 amountDue: amountDue,
                                 projects: projects);

            Assert.AreEqual(quote.QuoteID, quoteID);
            Assert.AreEqual(quote.TotalTranslations, totalTranslations);
            Assert.AreEqual(quote.TranslationCredit, translationCredit);
            Assert.AreEqual(quote.Currency, currency);
            Assert.AreEqual(quote.TotalCost, totalCost);
            Assert.AreEqual(quote.PrepaidCredit, prepaidCredit);
            Assert.AreEqual(quote.AmountDue, amountDue);
        }
开发者ID:JackMiszencin,项目名称:lionbridge-ondemand-client-csharp,代码行数:34,代码来源:QuoteTest.cs

示例5: GetStockQuote

        public Quote GetStockQuote()
        {
            // sometimes too slow for the demo
            //StockQuote.StockQuoteSoapClient sq = new StockQuote.StockQuoteSoapClient();
            //string raw = sq.GetQuote("MSFT");
            //XmlDocument xml = new XmlDocument();
            //xml.LoadXml(raw);
            //quote.Symbol = xml.DocumentElement.SelectSingleNode("Stock/Symbol").InnerText;
            //quote.Last = decimal.Parse(xml.DocumentElement.SelectSingleNode("Stock/Last").InnerText);
            //quote.Change = xml.DocumentElement.SelectSingleNode("Stock/Change").InnerText;
            //quote.Open = decimal.Parse(xml.DocumentElement.SelectSingleNode("Stock/Open").InnerText);
            //quote.High = decimal.Parse(xml.DocumentElement.SelectSingleNode("Stock/High").InnerText);
            //quote.Low = decimal.Parse(xml.DocumentElement.SelectSingleNode("Stock/Low").InnerText);
            //quote.Volume = Int64.Parse(xml.DocumentElement.SelectSingleNode("Stock/Volume").InnerText);

            Quote quote = new Quote
            {
                Symbol = "MSFT",
                Change = "-0.77",
                Last = 43.48M,
                Low = 43.33M,
                High = 43.99M,
                Volume = 57426153
            };

            return quote;
        }
开发者ID:plasne,项目名称:SpSat,代码行数:27,代码来源:Landing.cs

示例6: GetQuotes

 public static List<Quote> GetQuotes(string[] tickers)
 {
     List<Quote> quotes = new List<Quote>();
     string fullQuoteUrl = quoteUrl1;
     string symbolsString = String.Empty;
     foreach(string q in tickers)
     {
         fullQuoteUrl += q + "+";
     }
     // remove the "+" sign from the end
     fullQuoteUrl = fullQuoteUrl.TrimEnd(new char[] {'+'});
     fullQuoteUrl += quoteUrl2;
     WebClient wc = new WebClient();
     string rawData = wc.DownloadString(fullQuoteUrl);
     // clear out quote marks - don't want
     rawData = rawData.Replace("\"", "");
     wc.Dispose();
     string[] quoteLines = rawData.Split(new char[] {'\r', '\n'});
     foreach(string ql in quoteLines )
     {
         if (ql != String.Empty)
         {
             string[] rawQuote = ql.Split(',');
             Quote quote = new Quote(rawQuote[0], rawQuote[1], rawQuote[2], rawQuote[3], rawQuote[4], rawQuote[5],
                                     rawQuote[6]);
             quotes.Add(quote);
         }
     }
     return quotes;
 }
开发者ID:no1spirite,项目名称:BlackJackWCF,代码行数:30,代码来源:QuoteUtility.cs

示例7: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        int quoteId = Convert.ToInt32(Request.Params["quote_id"]);

        Quote quote = new Quote(quoteId);

        // Remove the old items from this quote
        quote.ClearItems();

        // Get the new quote items, will be a JSON array in the POST field
        string quoteItemsString = Request.Params["quote_items"];
        if ( String.IsNullOrEmpty(Request.Params["quote_items"]) || String.IsNullOrEmpty(Request.Params["quote_id"])){
            Response.StatusCode = 500;
            Response.End();
        }
        // Deserialise the JSON into QuoteItem objects and create each one (insert into DB)
        JavaScriptSerializer jsl = new JavaScriptSerializer();
        List<QuoteItem> quoteItems =(List<QuoteItem>)jsl.Deserialize(quoteItemsString, typeof(List<QuoteItem>));
        foreach (QuoteItem item in quoteItems)
            item.Create();

        // Get the quote and update the fields from the form on the ViewQuote page.
        quote.Revision++;
        quote.DiscountPercent = Convert.ToDouble(Request.Params["discount_percent"]);
        quote.DiscountPercent24 = Convert.ToDouble(Request.Params["discount_percent_24"]);
        quote.DiscountPercent36 = Convert.ToDouble(Request.Params["discount_percent_36"]);
        quote.DiscountPercentSetup = Convert.ToDouble(Request.Params["discount_percent_setup"]);
        quote.DiscountWritein = Convert.ToDouble(Request.Params["discount_writein"]);
        quote.Title = Request.Params["title"];
        quote.LastChange = DateTime.Now;
        quote.Save();
    }
开发者ID:tonybaloney,项目名称:No-More-Spreadsheets,代码行数:32,代码来源:SaveQuote.aspx.cs

示例8: Post

		// POST http://localhost:50481/odata/Quotes
		// User-Agent: Fiddler
		// Host: localhost:14270
		// Content-type: application/json
		// Accept: application/json
		// Content-Length: 26
		// { id:"go-pro-7-steps", title:"Go Pro: 7 Steps to Becoming a Network Marketing Professional", description:"Over twenty years ago at a company convention, Eric Worre had an aha moment that changed his life forever. At that event he made the decision to Go Pro and become a Network Marketing expert." }
		//[Authorize(Roles = "Admin")]
		public async Task<IHttpActionResult> Post(TranslatedQuote translatedQuote, [ValueProvider(typeof(CultureValueProviderFactory))] string culture = "en-US")
		{
			if (translatedQuote == null) return BadRequest();

			translatedQuote.Culture = culture;

			if (!ModelState.IsValid)
			{
				return BadRequest(ModelState);
			}

			try
			{
				var quote = new Quote(translatedQuote, _cultureManager.SupportedCultures);
				var newQuote = _quotesManager.Post(quote);

				await _quotesManager.SaveChanges();
				translatedQuote.Id = newQuote.Id;
				return Created(translatedQuote);
			}
			catch (Exception ex)
			{
				return InternalServerError(ex);
			}
		}
开发者ID:WorkMarketingNet,项目名称:WMN.Quotes,代码行数:33,代码来源:QuotesController.cs

示例9: depofbkhndlr

 public static ConcurrentQueue<quote> queue = new ConcurrentQueue<quote>();//surrounding quote
 public static void depofbkhndlr(InstrInfo instr, uint ts, byte partid, int mod, byte numbid, byte numask, byte[] bidexch, byte[] askexch, Quote[] bidbk, Quote[] askbk)
 {
     lock (respFlow2.locker0)
     {
         //System.Diagnostics.Debug.WriteLine("111 " + ((ConcurrentQueue<output>)_Dict[0][1]).Count);
         try
         {
             output x;
             reqFlow2._queue.TryDequeue(out x);
             quote q = new quote
             {
                 Instr = instr,
                 Ts = ts,
                 Bidexch = bidexch,
                 Askexch = askexch,
                 Bidbk = bidbk,
                 Askbk = askbk,
                 x = x,
             };
             queue.Enqueue(q);
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
 }
开发者ID:rbarber8,项目名称:historical_curve,代码行数:28,代码来源:respFlow2.cs

示例10: Patch

		public TranslatedQuote Patch(string id, Quote patch)
		{
			var quote = _db.Quotes.Include(c => c.Translations).SingleOrDefault(c => c.Id == id);

			quote.Patch(patch);

			return new TranslatedQuote(quote);
		}
开发者ID:WorkMarketingNet,项目名称:WMN.Quotes,代码行数:8,代码来源:QuotesRepository.cs

示例11: Test_Quote_Default_Values

 public void Test_Quote_Default_Values()
 {
     var quote = new Quote();
     Assert.AreEqual<int>(1000, quote.LoanAmount);
     Assert.AreEqual<int>(36, quote.NumberOfRepayments);
     Assert.AreEqual<double>(0.0, quote.Rate);
     Assert.AreEqual<double>(0.00, quote.RepaymentAmount);
 }
开发者ID:KsAdam,项目名称:Exercises,代码行数:8,代码来源:RateCalculatorUnitTest.cs

示例12: BuildFormattedQuote

 private string BuildFormattedQuote(Quote quote)
 {
     var stringBuilder = new StringBuilder();
     stringBuilder.Append("Requested amount: ").AppendLine(quote.LoanAmount.ToString("C"));
     stringBuilder.Append("Rate: ").AppendLine(quote.Rate.ToString("P1"));
     stringBuilder.Append("Monthly repayment: ").AppendLine(quote.RepaymentAmount.ToString("C"));
     stringBuilder.Append("Total repayment: ").AppendLine(quote.TotalRepayment.ToString("C"));
     return stringBuilder.ToString();
 }
开发者ID:KsAdam,项目名称:Exercises,代码行数:9,代码来源:Controller.cs

示例13: CreateQuotes

 private void CreateQuotes() {
     BindingList<Quote> res = new BindingList<Quote>();
     foreach(string name in names) {
         Quote q = new Quote(name);
         q.Value = (decimal)GetRandom().Next(800, 2000) / (decimal)10;
         res.Add(q);
     }
     Session["Quotes"] = res;
 }
开发者ID:vebin,项目名称:soa,代码行数:9,代码来源:Quotes.cs

示例14: getRandomQuote

 static Quote getRandomQuote(Random r) { 
     Quote q = new Quote();
     q.timestamp = (int)(DateTime.Now.Ticks/10000000);
     q.low = (float)r.Next(MAX_PRICE*10)/10;
     q.high = q.low + (float)r.Next(MAX_PRICE*10)/10;
     q.open = (float)r.Next(MAX_PRICE*10)/10;
     q.close = (float)r.Next(MAX_PRICE*10)/10;
     q.volume = r.Next(MAX_VOLUME);
     return q;
 }
开发者ID:yan122725529,项目名称:TripRobot.Crawler,代码行数:10,代码来源:TestKDTree.cs

示例15: SetCopiedFrom_Success

        public void SetCopiedFrom_Success()
        {
            // Assign 
            var quote = new Quote();
            var submission = new globalVM::Validus.Models.Submission();

            // Act 
            SubmissionModuleHelpers.SetCopiedFrom(quote, submission);

            // Assert
        }
开发者ID:Eugene-Murray,项目名称:Contract_Validus,代码行数:11,代码来源:SubmissionModuleHelpersIntegrationFixture.cs


注:本文中的Quote类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。