Пример #1
0
 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);
         }
     }
 }
Пример #2
0
 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);
         }
     }
 }
		// 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);
			}
		}
Пример #4
0
        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;
        }
        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);
        }
Пример #6
0
 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;
 }
    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();
    }
Пример #8
0
        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!");
            }
        }
 public void AssignQuote(int QuoteId, int newUserId)
 {
     Quote q = new Quote(QuoteId);
     q.OwnerId = newUserId;
     q.Save();
     return;
 }
Пример #10
0
 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);
 }
		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);
		}
Пример #12
0
 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();
 }
Пример #13
0
 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;
 }
Пример #14
0
 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;
 }
Пример #15
0
 public static Quote NewQuote(int timestamp)
 {
     Quote quote = new Quote();
     quote.timestamp = timestamp;
     quote.open = (float)rand.Next(10000) / 100;
     quote.close = (float)rand.Next(10000) / 100;
     quote.high = Math.Max(quote.open, quote.close);
     quote.low = Math.Min(quote.open, quote.close);
     quote.volume = rand.Next(1000);
     return quote;
 }
 private void EmitNewQuoteEvent(IFIXInstrument instrument, Quote quote)
 {
     if (NewQuote != null)
     {
         NewQuote(this, new QuoteEventArgs(quote, instrument, this));
     }
     if (factory != null)
     {
         factory.OnNewQuote(instrument, quote);
     }
 }
 private void LoadQuote()
 {
     var quote = new Quote();
     _connection.GetQuote(objectName.Text, out quote);
     if (null != quote)
         quotes.ItemsSource = new[] { quote };
     else
     {
         MessageBox.Show(_connection.ErrorMessage,"Error",MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
        public void SetCopiedFrom_Success()
        {
            // Assign 
            var quote = new Quote();
            var submission = new globalVM::Validus.Models.Submission();

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

            // Assert
        }
        public void CopyQuote_Success()
        {
            // Assign 
            var quote = new Quote {Id = 1, Comment = "TestComment"};

            // Act 
            var actualQuote = SubmissionModuleHelpers.CopyQuote(quote);

            // Assert
            Assert.AreEqual(quote.Id, actualQuote.Id);
            Assert.AreEqual(quote.Comment, actualQuote.Comment);
        }
Пример #20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (int.TryParse(Request.QueryString["id"], out id))
     {
         quote = QuoteOperation.GetQuoteById(id);
         result = QuoteOperation.GetQuoteDetailByQuoteId(id);
     }
     if (!IsPostBack)
     {
         FormDataBind();
     }
 }
Пример #21
0
        public ActionResult Add(Quote quote, FormCollection form)
        {
            //write activity to the log
            if (quote.ID == 0)
                _activityService.Create("was added", AreaType.Quote, User.Identity.Name, quote.ID);

            _quoteService.Save(quote);

            TempData.Add("StatusMessage", "Quote added");

            return RedirectToAction("Index");
        }
        public void UpdateSubscribeRecord_Success()
        {
            // Assign 
            var quote = new Quote {FacilityRef = "Facility ref"};
            var submission = new globalVM::Validus.Models.Submission();

            // Act 
            var actualUpdatePolicyResponse = SubmissionModuleHelpers.UpdateSubscribeRecord(quote, submission, _logHandler, _mockSubscribeService);

            // Assert
            Assert.IsNotNull(actualUpdatePolicyResponse);
        }
Пример #23
0
		public TranslatedQuote(Quote quote)
		{
			Id = quote.Id;
			Author = quote.Author;

			if (quote.Translations != null && quote.Translations.Any())
			{
				var translation = quote.Translations.First();
				Culture = translation.Culture;
				Content = translation.Content;
				Tags = translation.Tags;
				Source = translation.Source;
			}
		}
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(Request.Params["QuoteId"]))
     {
         this.quoteId = Convert.ToInt32(Request.Params["QuoteId"]);
         this.quote = new Quote(this.quoteId);
         this.hasFullPermissions = false;
     }
     else
     {
         Response.Write("Quote ID not passed.");
         Response.StatusCode = 500;
         Response.End();
     }
 }
Пример #25
0
 public void ShouldCreateHPSMTicket()
 {
     Quote q = new Quote();
     q.Category = "apollo request";
     q.Subcategory = "Workstation Software";
     q.Priority = "4 - R3 Regular";
     q.RequestedEndDate = DateTime.Parse("08/25/10 10:23:55");
     q.CurrentPhase = "Working";
     q.ServiceContact = "a.jgibbon1";
     q.PrimaryContact = "a.jgibbon1";
     q.PartNumber = "ag1003";
     q.ItemCount = "1";
     q.ItemQuantity = "1";
     //q.SaveTicket(); // uncomment this line to do end-end test
     Console.WriteLine("Request ID: " + q.RequestID);
 }
    public static string createInvoice(string quote)
    {
        if ( quote != "" && quote != null)
            q = rtq.getQuote(quote);

        if (q != null)
        {
            // if this email and the saved email are the same
            if ( q.email == customer.People.First().email1 )
                invoice = rtq.createInvoice(q.Id, customer.Id, quote);
        }
        if (invoice != null)
            return "true";
        else
            return "false";
    }
Пример #27
0
		public IVQuote(Quote quote)
		{
			if (quote == null)
				throw new ArgumentNullException("quote");

            this.Price = quote.Price;

			if (quote.OrderDirection == OrderDirections.Buy)
			{
				this.Bid = quote.Volume.ToString();
			}
			else
			{
				this.Ask = quote.Volume.ToString();
			}
		}
Пример #28
0
		/// <summary>
		/// Initializes a new instance of the <see cref="MarketDepthPair"/>.
		/// </summary>
		/// <param name="security">Security.</param>
		/// <param name="bid">Bid.</param>
		/// <param name="ask">Ask.</param>
		public MarketDepthPair(Security security, Quote bid, Quote ask)
		{
			if (security == null)
				throw new ArgumentNullException(nameof(security));

			if (bid != null && bid.OrderDirection != Sides.Buy)
				throw new ArgumentException(LocalizedStrings.Str492);

			if (ask != null && ask.OrderDirection != Sides.Sell)
				throw new ArgumentException(LocalizedStrings.Str493);

			Security = security;
			Bid = bid;
			Ask = ask;

			_isFull = bid != null && ask != null;
		}
Пример #29
0
        /// <summary>
        /// Add data to data store
        /// </summary>
        /// <param name="symbol"></param>
        /// <param name="data"></param>
        public static void AddQuotesFromDde(object[][] table)
        {
            //object[][] table = XLTable.Cells(data);

            // Parse rows to bars
            foreach (object[] row in table)
            {
                try
                {
                    // Write to WL streaming provider
                    if (StreamingProvider == null)
                        return;

                    // Load row
                    QuikQuote quikQuote = new QuikQuote(row);
                    // Maybe first ticks are zero ticks
                    if (quikQuote.Close == 0)
                        continue;

                    // Update streaming provider
                    Quote q = new Quote();
                    q.Symbol = quikQuote.Symbol;
                    q.TimeStamp = quikQuote.Time;
                    q.Ask = quikQuote.Close;
                    q.Bid = quikQuote.Close ;
                    q.Price = quikQuote.Close;
                    q.Size = quikQuote.Volume;

                    q.Open = q.Price;
                    q.PreviousClose = q.Price;

                    //StreamingProvider.UpdateQuote(q);

                    StreamingProvider.UpdateMiniBar(q,
                        q.Open,
                        (q.Ask != 0) ? q.Ask : q.Price,
                        (q.Bid != 0) ? q.Bid : q.Price);
                    StreamingProvider.Hearbeat(quikQuote.Time);
                }
                // Header rows contains titles, ignore them
                catch (Exception ex)
                {
                    continue;
                }
            }
        }
Пример #30
0
        static void Main(string[] args)
        {
            TradeServiceClient proxy = new TradeServiceClient();

            Quote msftQuote = new Quote();
            msftQuote.Ticker = "MSFT";
            msftQuote.Bid = 30.25M;
            msftQuote.Ask = 32.00M;
            msftQuote.Publisher = "PracticalWCF";

            Quote ibmQuote = new Quote();
            ibmQuote.Ticker = "IBM";
            ibmQuote.Bid = 80.50M;
            ibmQuote.Ask = 81.00M;
            ibmQuote.Publisher = "PracticalWCF";

            proxy.PublishQuote(msftQuote);
            proxy.PublishQuote(ibmQuote);

            Quote result;
            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);

            try
            {
                result = proxy.GetQuote("ATT");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            if (result == null)
            {
                Console.WriteLine("Ticker ATT not found!");
            }

            Console.WriteLine("Done! Press return to exit");
            Console.ReadLine();
        }
Пример #31
0
        public ActionResult Quote(string firstName, string lastName, string emailAddress, DateTime dateOfBirth,
                                  short carYear, string carMake, string carModel, bool dui, short speedingTickets, string insuranceType)
        {
            if (string.IsNullOrEmpty(firstName) || string.IsNullOrEmpty(lastName) || string.IsNullOrEmpty(emailAddress) ||
                string.IsNullOrEmpty(carMake) || string.IsNullOrEmpty(carModel) || string.IsNullOrEmpty(insuranceType))
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
            else
            {
                decimal monthly = 50;

                // calculating the monthly quote
                var today = DateTime.Today;
                int age   = today.Year - dateOfBirth.Year;
                if (today.Month < dateOfBirth.Month || (today.Month == dateOfBirth.Month && today.Day < dateOfBirth.Day))
                {
                    age--;
                }
                if (age < 18)
                {
                    monthly += 100;
                }
                else if (age < 25 || age >= 100)
                {
                    monthly += 25;
                }

                if (carYear < 2000 || carYear > 2015)
                {
                    monthly += 25;
                }
                if (carMake.ToLower() == "porsche")
                {
                    monthly += 25;
                }
                if (carMake.ToLower() == "porsche" && carModel.ToLower() == "911 carrera")
                {
                    monthly += 25;
                }

                monthly += (speedingTickets * 10);
                if (dui == true)
                {
                    monthly *= (decimal)1.25;
                }
                if (insuranceType == "full")
                {
                    monthly *= (decimal)1.5;
                }

                decimal monthlyFinal = Math.Round(monthly, 2);

                // entering information into database
                using (CarInsuranceEntities db = new CarInsuranceEntities())
                {
                    var quote = new Quote();
                    quote.FirstName       = firstName;
                    quote.LastName        = lastName;
                    quote.EmailAddress    = emailAddress;
                    quote.DateOfBirth     = dateOfBirth;
                    quote.CarYear         = carYear;
                    quote.CarMake         = carMake;
                    quote.CarModel        = carModel;
                    quote.Dui             = dui;
                    quote.SpeedingTickets = speedingTickets;
                    quote.InsuranceType   = insuranceType;
                    quote.InsuranceQuote  = monthlyFinal;

                    db.Quotes.Add(quote);
                    db.SaveChanges();
                }

                // displaying the quote
                ViewBag.MonthlyQuote = "Your monthly car insurance quote is: " + monthlyFinal.ToString();

                return(View());
            }
        }
Пример #32
0
        // =====>>>>>>>>>> JSONText Message Received

        public override void OnWebSocketJSONText(string JSONText)
        {
            try
            {
                string ObjJSONText;

                List <object> PGBaseList = JsonConvert.DeserializeObject <List <object> >(JSONText);
                foreach (var pgBase in PGBaseList)
                {
                    ObjJSONText = pgBase.ToString();
                    PolygonBase pGBase = JsonConvert.DeserializeObject <PolygonBase>(ObjJSONText);

                    switch (pGBase.ev)
                    {
                    case "Q":
                        Quote quote = JsonConvert.DeserializeObject <Quote>(ObjJSONText);
                        if (quote != null)
                        {
                            OnQuoteEvent?.Invoke(quote);
                        }
                        break;

                    case "T":
                        Trade trade = JsonConvert.DeserializeObject <Trade>(ObjJSONText);
                        if (trade != null)
                        {
                            OnTradeEvent?.Invoke(trade);
                        }
                        break;

                    case "status":
                        Status status = JsonConvert.DeserializeObject <Status>(ObjJSONText);
                        HandleStatusMessage(status);
                        break;

                    case "A":
                        ASecond ASecRef = JsonConvert.DeserializeObject <ASecond>(ObjJSONText);
                        if (ASecRef != null)
                        {
                            OnASecondEvent?.Invoke(ASecRef);
                        }
                        break;

                    case "AM":
                        AMinute AMinRef = JsonConvert.DeserializeObject <AMinute>(ObjJSONText);
                        if (AMinRef != null)
                        {
                            OnAMinuteEvent?.Invoke(AMinRef);
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (System.Exception ex)
            {
                HandleJSONTextException("websocket_MessageReceived", JSONText, ex);
            }
        }
Пример #33
0
        public Models.TigerPaw.ServiceOrdersPostResponse CreateServiceOrderWithPartsUsed(Quote quote, List <QuoteItem> partsUsed)
        {
            // create service order via POST /api/ServiceOrders CreateServiceOrderModel ServiceOrderResponse
            var serviceOrder = CreateServiceOrderFromQuote(quote);

            // if response is not successful or no ServiceOrder number is returned
            if (serviceOrder == null)
            {
                throw new ApplicationException($"Failed to create new service order for quote {quote.Name}");
            }
            // for each part/item, via POST /api/serviceorders/{serviceOrderNumber}/parts
            foreach (object part in partsUsed)
            {
                CreateServiceOrderPartsUsed(serviceOrder.ServiceOrderSummary.ServiceOrderNumber, part);
            }
            return(serviceOrder);
        }
Пример #34
0
        public IActionResult UploadQuote(QuoteModel model)
        {
            GetProjectType();

            if (string.IsNullOrEmpty(model.Company))
            {
                ModelState.AddModelError("", "Company can not be empty.");
            }

            if (string.IsNullOrEmpty(model.Name))
            {
                ModelState.AddModelError("", "Name can not be empty.");
            }

            if (string.IsNullOrEmpty(model.Email))
            {
                ModelState.AddModelError("", "Email can not be empty.");
            }

            if (string.IsNullOrEmpty(model.Phone))
            {
                ModelState.AddModelError("", "Phone can not be empty.");
            }

            if (Request.Form.Files == null || Request.Form.Files.Count == 0)
            {
                ModelState.AddModelError("", "Please upload file.");
            }

            var code = TempData["code"].ToString();

            if (string.IsNullOrEmpty(model.Code) || model.Code.ToLower() != code.ToLower())
            {
                ModelState.AddModelError("", "Captcha error.");
            }

            IFormFile file = null;
            string    ext  = string.Empty;

            if (Request.Form.Files.Count > 0)
            {
                file = Request.Form.Files[0];
                if (file.Length > 1024 * 1024 * 10)
                {
                    ModelState.AddModelError("", "Upload file is too large.");
                }
                ext = Path.GetExtension(file.FileName);

                if (string.IsNullOrEmpty(ext))
                {
                    ModelState.AddModelError("", "Upload file must be zip ,pdf, rar ,arj .");
                }

                ext = ext.ToLower();
                //zip, tgz, rar, arj, pdf
                string[] extarray = new string[] { ".zip", ".pdf", ".rar", ".arj" };
                if (!extarray.ToList().Contains(ext))
                {
                    ModelState.AddModelError("", "Upload file must be zip ,pdf, rar ,arj.");
                }
            }
            else
            {
                ModelState.AddModelError("", "Please upload file");
            }

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


            string fileid   = Guid.NewGuid().ToString();
            var    filepath = Directory.GetCurrentDirectory() + "\\upload\\" + fileid + ext;

            if (file.Length > 0)
            {
                using (var inputStream = new FileStream(filepath, FileMode.Create))
                {
                    // read file to stream
                    file.CopyTo(inputStream);
                }
            }

            Quote domainmodel = new Quote
            {
                Commnet    = model.Commnet,
                Company    = model.Company,
                Deleted    = false,
                Email      = model.Email,
                Leadtime   = model.Leadtime,
                Name       = model.Name,
                PartNo     = model.PartNo,
                Phone      = model.Phone,
                Quantity   = model.Quantity,
                Type       = model.Type == "0" ? string.Empty : model.Type,
                Uploadfile = fileid + ext
            };

            _quoteService.AddQuote(domainmodel);
            SendMail(domainmodel, filepath);

            return(RedirectToAction("Success"));
        }
Пример #35
0
/// <summary>
/// ///////////////////////////////////////////////////////////////////////////////////////////////////////////
/// </summary>
        public async Task <Quote> GetQuoteByname(Quote quote)
        {
            return(await appDbContext.Quotes.Where(n => n.Text == quote.Text && n.Id != quote.Id)
                   .FirstOrDefaultAsync());
        }
        private Quote GetPolicyObject(SearchParameter searchParam)
        {
            Quote Quote = new Quote();

            Quote.Customer = new Customer();
            bool isOtherAnyParam = false;

            if (searchParam != null)
            {
                var isFilterValue = searchParam.SearchColumnValue.Any(e => !string.IsNullOrWhiteSpace(e));

                if ((searchParam.SearchColumn != null && searchParam.SearchColumn.Count > 0) &&
                    searchParam.SearchColumn.Count == searchParam.SearchColumnValue.Count - 1 && isFilterValue) // minus -1 means, skipping action column from search list
                {
                    var filterValueProp = new Dictionary <string, string>();
                    for (int idx = 0; idx < searchParam.SearchColumnValue.Count; idx++)
                    {
                        if (!string.IsNullOrWhiteSpace(searchParam.SearchColumnValue[idx]))
                        {
                            if (searchParam.SearchColumn[idx] == "Id")
                            {
                                Quote.Id = Convert.ToInt32(searchParam.SearchColumnValue[idx]); isOtherAnyParam = true;
                            }
                            else if (searchParam.SearchColumn[idx] == "CustomerName")
                            {
                                Quote.Customer.FirstName = searchParam.SearchColumnValue[idx]; isOtherAnyParam = true;
                            }
                            else if (searchParam.SearchColumn[idx] == "PersonalProperty")
                            {
                                Quote.PersonalProperty = Convert.ToDecimal(searchParam.SearchColumnValue[idx]); isOtherAnyParam = true;
                            }
                            else if (searchParam.SearchColumn[idx] == "Liability")
                            {
                                Quote.Liability = Convert.ToDecimal(searchParam.SearchColumnValue[idx]); isOtherAnyParam = true;
                            }
                            else if (searchParam.SearchColumn[idx] == "Premium")
                            {
                                Quote.Premium = Convert.ToDecimal(searchParam.SearchColumnValue[idx]); isOtherAnyParam = true;
                            }
                            else if (searchParam.SearchColumn[idx] == "EffectiveDate")
                            {
                                DateTime tempDate;
                                bool     result = DateTime.TryParse(searchParam.SearchColumnValue[idx], out tempDate);
                                if (result)
                                {
                                    Quote.EffectiveDate = Convert.ToDateTime(searchParam.SearchColumnValue[idx]);
                                    isOtherAnyParam     = true;
                                }
                            }
                            else if (searchParam.SearchColumn[idx] == "InsuredName")
                            {
                                Quote.ProposalNumber = searchParam.SearchColumnValue[idx]; isOtherAnyParam = true;
                            }
                            else if (searchParam.SearchColumn[idx] == "InsuredAddress")
                            {
                                Quote.ProposalNumber = searchParam.SearchColumnValue[idx]; isOtherAnyParam = true;
                            }
                            else if (searchParam.SearchColumn[idx] == "InsuredPhone")
                            {
                                Quote.ProposalNumber = searchParam.SearchColumnValue[idx]; isOtherAnyParam = true;
                            }
                            else if (searchParam.SearchColumn[idx] == "InsuredEmail")
                            {
                                Quote.ProposalNumber = searchParam.SearchColumnValue[idx]; isOtherAnyParam = true;
                            }
                            else if (searchParam.SearchColumn[idx] == "ProposalNumber")
                            {
                                Quote.ProposalNumber = searchParam.SearchColumnValue[idx]; isOtherAnyParam = true;
                            }
                        }
                    }
                }
                searchParam.IsFilterValue = isFilterValue;
            }
            return(Quote);
        }
        public decimal generateQuote(DateTime EffectiveDate, decimal PersonalProperty, decimal Deductible,
                                     decimal Liability, int CustomerId, int NoOfInstallments,
                                     bool SendLandlord, ref int quoteId, out string ProposalNo,
                                     out decimal premiumChargedToday, out decimal installmentFee, out decimal processingFee,
                                     out decimal totalChargedToday)
        {
            decimal Premium  = 0;
            Quote   quoteObj = null;

            if (quoteId == 0)
            {
                //saving quote generated
                quoteObj = new Quote
                {
                    EffectiveDate    = EffectiveDate,
                    ExpiryDate       = EffectiveDate.AddYears(1),
                    PersonalProperty = PersonalProperty,
                    Deductible       = Deductible,
                    Liability        = Liability,
                    Premium          = Premium,
                    CustomerId       = CustomerId,
                    NoOfInstallments = NoOfInstallments,
                    CreationDate     = DateTime.Now,
                    SendLandLord     = SendLandlord,
                    CompanyId        = 1,
                    IsActive         = true
                };
                _context.Quotes.Add(quoteObj);
            }
            else
            {
                quoteObj = _context.Quotes.Find(quoteId);

                //Initializing Premium Values again
                quoteObj.ProcessingFee       = 0;
                quoteObj.InstallmentFee      = 0;
                quoteObj.PremiumChargedToday = 0;
                quoteObj.PremiumChargedToday = 0;
                quoteObj.Premium             = 0;
                quoteObj.EffectiveDate       = EffectiveDate;
                quoteObj.PersonalProperty    = PersonalProperty;
                quoteObj.Deductible          = Deductible;
                quoteObj.Liability           = Liability;
                quoteObj.Premium             = Premium;
                quoteObj.CustomerId          = CustomerId;
                quoteObj.NoOfInstallments    = NoOfInstallments;
                quoteObj.CreationDate        = DateTime.Now;
                quoteObj.SendLandLord        = SendLandlord;
                quoteObj.IsActive            = (quoteObj.IsActive ? quoteObj.IsActive : !quoteObj.IsActive);

                _context.Entry(quoteObj).State = System.Data.Entity.EntityState.Modified;
            }

            //Get Premium calculation service result
            var result = new MobileHoome.Insure.ExtService.CalculateHomePremiumService();

            quoteObj.Premium = Premium = result.GetPremiumDetail(quoteObj);

            var customerObj = GetCustomerById(CustomerId);

            if (quoteObj.NoOfInstallments.HasValue && quoteObj.NoOfInstallments.Value != 0 && quoteObj.NoOfInstallments.Value != 1)
            {
                quoteObj.InstallmentFee      = getInstallmentFee(customerObj.State.Abbr);
                quoteObj.PremiumChargedToday = quoteObj.Premium / quoteObj.NoOfInstallments.Value;
                quoteObj.TotalChargedToday   = quoteObj.InstallmentFee + quoteObj.PremiumChargedToday;
            }
            else
            {
                quoteObj.PremiumChargedToday = Premium;
                quoteObj.ProcessingFee       = (Premium * Convert.ToDecimal(System.Configuration.ConfigurationManager.AppSettings["RentalProcessingFee"]) / 100);
                quoteObj.TotalChargedToday   = quoteObj.ProcessingFee + quoteObj.PremiumChargedToday;
            }

            premiumChargedToday = quoteObj.PremiumChargedToday.HasValue ? Math.Ceiling(quoteObj.PremiumChargedToday.Value * 100) * 0.01M : 0;
            processingFee       = Convert.ToDecimal(quoteObj.ProcessingFee);
            installmentFee      = Convert.ToDecimal(quoteObj.InstallmentFee);
            totalChargedToday   = Convert.ToDecimal(quoteObj.TotalChargedToday);
            ProposalNo          = string.Empty;

            quoteObj.ProposalNumber = string.Empty;

            _context.SaveChanges();

            quoteId = quoteObj.Id;
            return(Premium);
        }
Пример #38
0
 public Guid Post(Quote quote)
 {
     return(_quoteRepository.Create(quote));
 }
Пример #39
0
 public QuoteEventArg(Quote quote)
 {
     Quote = quote;
 }
Пример #40
0
 public override int GetHashCode()
 {
     return(Quote != null ? Quote.GetHashCode() : 0);
 }
Пример #41
0
 public void Put(Quote quote)
 {
     _quoteRepository.Update(quote);
 }
Пример #42
0
        //
        // Output via the console a single quote given the quote ID
        // from the commandline argument "--qid".
        //
        public static void GetQuoteByQid(IConfiguration config)
        {
            _logger.Trace("Retrieving quote...");

            string cs = null;

            try
            {
                cs = GetConnectionString();
            }
            catch (System.ArgumentException ex)
            {
                _logger.Fatal($"Cannot get connection string: {ex.Message}");

                Console.WriteLine($"Error: Operation aborted - {ex.Message}.");

                return;
            }
            catch (Exception ex)
            {
                _logger.Fatal($"Unable to access database : {ex.Message}");

                Console.WriteLine($"Error: Operation aborted - {ex.Message}.");

                return;
            }

            MySqlConnection conn = new MySqlConnection(cs);

            PrincipalTable.DatabaseConnection = conn;

            if (!PrincipalTable.TableExists())
            {
                _logger.Fatal("Table does not already exist, " +
                              "cannot locate quotes by ID.");

                Console.WriteLine("Error: Operation aborted.");

                return;
            }

            string quoteId = config["qid"];

            string qid = config["qid"];

            Quote quote = null;

            if (null != qid)
            {
                quote = PrincipalTable.GetQuoteByQid(qid);
            }

            if (null == quote)
            {
                string message = $"No quote with ID '{qid}' found.";

                _logger.Info(message);

                Console.WriteLine(message);

                return;
            }

            _logger.Info("Quote = " + quote.ToString());

            Console.WriteLine("-- Quote ID = {0}.", quote.ID);

            Console.WriteLine("-- Ext Ref ID = {0}.", quote.ExternalRefID);

            Console.WriteLine("-- Quote text = {0}.", quote.Content);

            Console.WriteLine("-- Quote source = {0}.", quote.Source);

            Console.WriteLine("-- Source URL = {0}.", quote.SourceUrl);

            Console.WriteLine("-- Quote entry datetime = {0}.",
                              quote.EntryDatetime);

            Console.WriteLine("-- Quote last mod = {0}.",
                              quote.ModTimestamp);

            Console.WriteLine("-- Quote = {0}.", quote.ToString());
        }
Пример #43
0
 GeneralizedBlackScholesProcess makeProcess(Quote u, YieldTermStructure q, YieldTermStructure r, BlackVolTermStructure vol)
 {
     return(new BlackScholesMertonProcess(new Handle <Quote>(u), new Handle <YieldTermStructure>(q),
                                          new Handle <YieldTermStructure>(r), new Handle <BlackVolTermStructure>(vol)));
 }
        protected override async Task UpdateAsync(
            CancellationToken cancellationToken = default)
        {
            Log.Debug("Start of update");

            var isAvailable = true;

            try
            {
                foreach (var symbol in Quotes.Keys.ToList())
                {
                    var request = $"pubticker/{symbol.ToLower()}";

                    isAvailable = await HttpHelper.GetAsync(
                        baseUri : BaseUrl,
                        requestUri : request,
                        responseHandler : response =>
                    {
                        if (!response.IsSuccessStatusCode)
                        {
                            return(false);
                        }

                        var responseContent = response.Content
                                              .ReadAsStringAsync()
                                              .WaitForResult();

                        var data = JsonConvert.DeserializeObject <JObject>(responseContent);

                        Quotes[symbol] = new Quote
                        {
                            Bid = data["bid"].Value <decimal>(),
                            Ask = data["ask"].Value <decimal>()
                        };

                        return(true);
                    },
                        cancellationToken : cancellationToken)
                                  .ConfigureAwait(false);
                }

                Log.Debug("Update finished");
            }
            catch (Exception e)
            {
                Log.Error(e, e.Message);

                isAvailable = false;
            }

            LastUpdateTime = DateTime.Now;

            if (isAvailable)
            {
                LastSuccessUpdateTime = LastUpdateTime;
            }

            if (IsAvailable != isAvailable)
            {
                IsAvailable = isAvailable;
                RiseAvailabilityChangedEvent(EventArgs.Empty);
            }

            if (IsAvailable)
            {
                RiseQuotesUpdatedEvent(EventArgs.Empty);
            }
        }
Пример #45
0
 async public void showWindowUpdateQuotes(Quote quote)
 {
     await Navigation.PushModalAsync(new UpdateQuotes(quote));
 }
Пример #46
0
 protected virtual void OnNewQuote(Instrument instrument, Quote quote)
 {
 }
        public List <QuoteDto> GetPolicies(SearchParameter searchParam)
        {
            List <QuoteDto> result = null;
            List <Quote>    items  = null;

            if (searchParam != null)
            {
                Quote   Quote            = GetPolicyObject(searchParam);
                Decimal PersonalProperty = Convert.ToDecimal(Quote.PersonalProperty);
                Decimal Liability        = Convert.ToDecimal(Quote.Liability);
                Decimal Premium          = Convert.ToDecimal(Quote.Premium);
                Int32   day   = Convert.ToDateTime(Quote.EffectiveDate).Date.Day;
                Int32   month = Convert.ToDateTime(Quote.EffectiveDate).Date.Month;
                Int32   year  = Convert.ToDateTime(Quote.EffectiveDate).Date.Year;

                string InsuredName    = searchParam.SearchColumnValue[searchParam.SearchColumn.IndexOf("InsuredName")];
                string InsuredAddress = searchParam.SearchColumnValue[searchParam.SearchColumn.IndexOf("InsuredAddress")];
                string InsuredPhone   = searchParam.SearchColumnValue[searchParam.SearchColumn.IndexOf("InsuredPhone")];
                string InsuredEmail   = searchParam.SearchColumnValue[searchParam.SearchColumn.IndexOf("InsuredEmail")];
                //string PolicyNumber = searchParam.SearchColumnValue[searchParam.SearchColumn.IndexOf("PolicyNumber")];

                if (!searchParam.IsFilterValue)
                {
                    searchParam.TotalRecordCount = _context.Quotes.Where(c => c.IsActive == true &&
                                                                         ((c.Payments.Where(x => x.TransactionId != null).Any()) ||
                                                                          c.IsParkSitePolicy == true)).Count();

                    items = _context.Quotes.Include("Customer").Where(c => c.IsActive == true &&
                                                                      ((c.Payments.Where(x => x.TransactionId != null).Any()) ||
                                                                       c.IsParkSitePolicy == true)).OrderByDescending(x => x.Id)
                            .Skip(searchParam.StartIndex).Take((searchParam.PageSize > 0 ?
                                                                searchParam.PageSize : searchParam.TotalRecordCount)).
                            ToList();
                }
                else
                {
                    items = _context.Quotes.Include("Customer")
                            .Where(c => c.IsActive == true &&
                                   ((c.Payments.Where(x => x.TransactionId != null).Any()) ||
                                    c.IsParkSitePolicy == true) &&

                                   (Quote.Id == 0 ? 1 == 1 : c.Id == Quote.Id) &&
                                   (string.IsNullOrEmpty(Quote.ProposalNumber) ? 1 == 1 : c.ProposalNumber.ToUpper().StartsWith(Quote.ProposalNumber.ToUpper())) &&
                                   (string.IsNullOrEmpty(InsuredName) ? 1 == 1 : c.Customer.FirstName.ToUpper().StartsWith(InsuredName.ToUpper())) &&
                                   (string.IsNullOrEmpty(InsuredAddress) ? 1 == 1 : c.Customer.Address.ToUpper().StartsWith(InsuredAddress.ToUpper())) &&
                                   (string.IsNullOrEmpty(InsuredPhone) ? 1 == 1 : c.Customer.Phone.ToUpper().StartsWith(InsuredPhone.ToUpper())) &&
                                   (string.IsNullOrEmpty(InsuredEmail) ? 1 == 1 : c.Customer.Email.ToUpper().StartsWith(InsuredEmail.ToUpper())) &&
                                   (PersonalProperty == 0 ? 1 == 1 : SqlFunctions.StringConvert((double)c.PersonalProperty).ToUpper().StartsWith(SqlFunctions.StringConvert((double)PersonalProperty).ToUpper())) &&
                                   (Liability == 0 ? 1 == 1 : SqlFunctions.StringConvert((double)c.Liability).ToUpper().StartsWith(SqlFunctions.StringConvert((double)Liability).ToUpper())) &&
                                   (Premium == 0 ? 1 == 1 : SqlFunctions.StringConvert((double)c.Premium).ToUpper().StartsWith(SqlFunctions.StringConvert((double)Premium).ToUpper())) &&
                                   ((day == 1 && month == 1 && year == 1 ? 1 == 1 :
                                     SqlFunctions.DatePart("dd", c.EffectiveDate) == day &&
                                     SqlFunctions.DatePart("mm", c.EffectiveDate) == month &&
                                     SqlFunctions.DatePart("yyyy", c.EffectiveDate) == year))
                                   ).OrderByDescending(x => x.Id).ToList();

                    searchParam.TotalRecordCount = items.Count();
                }
                result = items.Select(x => new QuoteDto
                {
                    Id               = x.Id,
                    ProposalNumber   = x.ProposalNumber,
                    PersonalProperty = x.PersonalProperty,
                    Liability        = x.Liability,
                    Premium          = x.Premium,
                    EffectiveDate    = x.EffectiveDate,
                    NoOfInstallments = x.NoOfInstallments,
                    SendLandLord     = x.SendLandLord,
                    InsuredName      = (x.Customer != null ? x.Customer.FirstName + " " + x.Customer.LastName : string.Empty),
                    InsuredAddress   = (x.Customer != null ? x.Customer.Address : string.Empty),
                    InsuredEmail     = (x.Customer != null ? x.Customer.Email : string.Empty),
                    InsuredPhone     = (x.Customer != null ? x.Customer.Phone : string.Empty),
                }).ToList();
            }
            searchParam.SearchedCount = (!searchParam.IsFilterValue ? searchParam.TotalRecordCount : result.Count);
            return(result);
        }
Пример #48
0
        void StockQueryResultsListView_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            Quote Item = (Quote)e.Item;

            ViewModel.AddSelectedItemFromList(Item);
        }
        public List <QuoteDto> GetQuotes(SearchParameter searchParam)
        {
            List <QuoteDto> result = null;
            List <Quote>    items  = null;

            if (searchParam != null)
            {
                Quote   Quote            = GetPolicyObject(searchParam);
                Decimal PersonalProperty = Convert.ToDecimal(Quote.PersonalProperty);
                Decimal Liability        = Convert.ToDecimal(Quote.Liability);
                Decimal Premium          = Convert.ToDecimal(Quote.Premium);
                Int32   day               = Convert.ToDateTime(Quote.EffectiveDate).Date.Day;
                Int32   month             = Convert.ToDateTime(Quote.EffectiveDate).Date.Month;
                Int32   year              = Convert.ToDateTime(Quote.EffectiveDate).Date.Year;
                string  customerFirstName = Quote.Customer.FirstName;

                if (!searchParam.IsFilterValue)
                {
                    searchParam.TotalRecordCount = _context.Quotes.Where(c => c.IsActive == true &&
                                                                         string.IsNullOrEmpty(c.ProposalNumber)
                                                                         ).Count();

                    items = _context.Quotes.Where(c => c.IsActive == true &&
                                                  string.IsNullOrEmpty(c.ProposalNumber.Trim())
                                                  ).OrderByDescending(x => x.Id)
                            .Skip(searchParam.StartIndex).Take((searchParam.PageSize > 0 ?
                                                                searchParam.PageSize : searchParam.TotalRecordCount)).
                            ToList();
                }
                else
                {
                    items = _context.Quotes.Where(c => c.IsActive == true &&
                                                  ((c.Payments.Where(x => x.TransactionId != null).Any())
                                                  ) &&

                                                  (Quote.Id == 0 ? 1 == 1 : c.Id == Quote.Id) &&
                                                  (string.IsNullOrEmpty(Quote.ProposalNumber)) &&
                                                  (PersonalProperty == 0 ? 1 == 1 : SqlFunctions.StringConvert((double)c.PersonalProperty).ToUpper().StartsWith(SqlFunctions.StringConvert((double)PersonalProperty).ToUpper())) &&
                                                  (Liability == 0 ? 1 == 1 : SqlFunctions.StringConvert((double)c.Liability).ToUpper().StartsWith(SqlFunctions.StringConvert((double)Liability).ToUpper())) &&
                                                  (Premium == 0 ? 1 == 1 : SqlFunctions.StringConvert((double)c.Premium).ToUpper().StartsWith(SqlFunctions.StringConvert((double)Premium).ToUpper())) &&
                                                  ((day == 1 && month == 1 && year == 1 ? 1 == 1 :
                                                    SqlFunctions.DatePart("dd", c.EffectiveDate) == day &&
                                                    SqlFunctions.DatePart("mm", c.EffectiveDate) == month &&
                                                    SqlFunctions.DatePart("yyyy", c.EffectiveDate) == year)) &&
                                                  (string.IsNullOrEmpty(customerFirstName) ? 1 == 1 : c.Customer.FirstName.StartsWith(customerFirstName))
                                                  ).OrderByDescending(x => x.Id).ToList();

                    searchParam.TotalRecordCount = items.Count();
                }
                result = items.Select(x => new QuoteDto
                {
                    Id               = x.Id,
                    ProposalNumber   = x.ProposalNumber,
                    PersonalProperty = x.PersonalProperty,
                    Liability        = x.Liability,
                    Premium          = x.Premium,
                    EffectiveDate    = x.EffectiveDate,
                    NoOfInstallments = x.NoOfInstallments,
                    SendLandLord     = x.SendLandLord,
                    CustomerName     = x.Customer.FirstName + " " + x.Customer.LastName
                }).ToList();
            }
            searchParam.SearchedCount = (!searchParam.IsFilterValue ? searchParam.TotalRecordCount : result.Count);
            return(result);
        }
Пример #50
0
		public override bool ShouldSellInvestment(Quote quote, Investment investment)
		{
			return ShouldSellInvestment(quote, investment, HIGHPERCENTAGE, LOWPERCENTAGE, DAYS);
		}
Пример #51
0
        internal SourcePositioner(Quote q, string escapePrefix)
        {
            Contract.Requires(q != null);

            quoteSpan = q.Span;
            int  line = 0, col = 0;
            int  escapeId = 0;
            int  length;
            int  prefixLength = escapePrefix == null ? 0 : escapePrefix.Length;
            bool isNewLine;

            QuoteRun qr;

            foreach (var n in q.Contents)
            {
                if (n.NodeKind == NodeKind.QuoteRun)
                {
                    qr     = (QuoteRun)n;
                    length = qr.Text.Length;
                    if (length == 0)
                    {
                        continue;
                    }

                    isNewLine = qr.Text[length - 1] == '\n';
                    transforms.Add(
                        new LineColTransform(
                            line,
                            col,
                            isNewLine ? int.MaxValue : col + length - 1,
                            n.Span.StartLine,
                            n.Span.StartCol,
                            false));

                    if (isNewLine)
                    {
                        col = 0; ++line;
                    }
                    else
                    {
                        col += length;
                    }
                }
                else
                {
                    length = prefixLength + escapeId.ToString().Length;
                    ++escapeId;
                    transforms.Add(
                        new LineColTransform(
                            line,
                            col,
                            col + length - 1,
                            n.Span.StartLine,
                            n.Span.StartCol,
                            true));
                    col += length;
                }
            }

            lastLine = line;
        }
 public QuoteHandle(Quote arg0) : this(NQuantLibcPINVOKE.new_QuoteHandle__SWIG_0(Quote.getCPtr(arg0)), true)
 {
     if (NQuantLibcPINVOKE.SWIGPendingException.Pending)
     {
         throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #53
0
 public void OnTick(Quote qt)
 {
     m_TickBar.InsertTick(qt);
     m_OneMinBar.InsertTick(qt);
 }
Пример #54
0
        public void DataAccess()
        {
            using (var client = ClientFactory.InitSingleNode("CacheClientConfig.xml", "localhost", _serverPort))
            {
                var clientImplementation = (
                    CacheClient)client;
                var serverDescription = clientImplementation.GetServerDescription();
                Assert.IsNotNull(serverDescription);

                var tradeDescription = clientImplementation.KnownTypes["UnitTests.TestData.Trade"];
                var quoteDescription = clientImplementation.KnownTypes["UnitTests.TestData.Quote"];


                Assert.AreEqual(serverDescription.KnownTypesByFullName.Count, 2);
                Assert.AreEqual(tradeDescription.AsTypeDescription.IndexFields.Count, 3);
                Assert.AreEqual(tradeDescription.AsTypeDescription.ListFields.Count, 2);
                Assert.AreEqual(quoteDescription.AsTypeDescription.IndexFields.Count, 3);


                ////////////////////////////////////////////:
                // test trades

                var trade1 = new Trade(1, 1001, "XXX", new DateTime(2009, 1, 15), (float)10000.25);
                var trade2 = new Trade(2, 1002, "XXX", new DateTime(2009, 1, 15), (float)20000.25);

                client.Put(trade1);
                client.Put(trade2);


                //build a query the "hard" way

                var tradeQueryBuilder = new QueryBuilder(tradeDescription.AsTypeDescription);
                var q1  = tradeQueryBuilder.MakeAtomicQuery("Nominal", QueryOperator.Gt, 1000F);
                var q2  = tradeQueryBuilder.MakeAtomicQuery("Nominal", QueryOperator.Le, 20000.25F);
                var q12 = tradeQueryBuilder.MakeAndQuery();
                q12.Elements.Add(q1);
                q12.Elements.Add(q2);
                var q = tradeQueryBuilder.MakeOrQuery(q12);

                Assert.IsTrue(q.IsValid);
                Assert.IsTrue(q.Match(CachedObject.Pack(trade1, tradeDescription)));
                Assert.IsTrue(q.Match(CachedObject.Pack(trade2, tradeDescription)));


                var trades = client.GetMany <Trade>(q).ToList();
                Assert.IsNotNull(trades);
                Assert.AreEqual(trades.Count, 2);

                //////////////////////////////////////////////////////
                // test quotes


                //put a quote with some null index values
                //RefSet is null
                var quote1 = new Quote {
                    Name = "aaa", Mid = 2.2F, Ask = 2.1F, Bid = 2.3F
                };


                client.Put(quote1);

                var quote1Reloaded = client.GetOne <Quote>("aaa");
                Assert.AreEqual(quote1Reloaded.QuoteType, QuoteType.INVALID);


                //get by null index value
                //need to create the query the "hard way" ( cause null can not be specified in a query string)
                var quoteQueryBuilder = new QueryBuilder(quoteDescription.AsTypeDescription);
                q = quoteQueryBuilder.MakeOrQuery(quoteQueryBuilder.MakeAtomicQuery("RefSet", null));
                var quotes = client.GetMany <Quote>(q).ToList();
                Assert.AreEqual(quotes.Count, 1);
                Assert.AreEqual(quotes[0].Name, "aaa");
            }
        }
Пример #55
0
 protected void AddNewQuote(Quote q)
 {
     _currentSource.Quotes.Add(q);
     _currentQuote = q;
     _currentWord  = null;
 }
Пример #56
0
 public decimal GetShippingCost(Quote order)
 {
     return(order.TotalWithoutShippingCost / 100 * ShippingCostPercentage);
 }
Пример #57
0
 private Models.TigerPaw.ServiceOrdersPostResponse CreateServiceOrderFromQuote(Quote quote)
 {
     // todo: create service order with reference
     return(new Models.TigerPaw.ServiceOrdersPostResponse());
 }
Пример #58
0
 private void EmitHistoricalQuote(string requestID, IFIXInstrument instrument, Quote quote)
 {
     if (this.NewHistoricalQuote != null)
     {
         this.NewHistoricalQuote(this, new HistoricalQuoteEventArgs(quote, requestID, instrument, this, -1));
     }
 }
Пример #59
0
 // POST: api/Quotes
 public /*void*/ IHttpActionResult Post([FromBody] Quote quote)
 {
     quotesDbContext.Quotes.Add(quote);
     quotesDbContext.SaveChanges();
     return(StatusCode(HttpStatusCode.Created));
 }
Пример #60
0
        VanillaOption makeOption(StrikedTypePayoff payoff, Exercise exercise, Quote u, YieldTermStructure q,
                                 YieldTermStructure r, BlackVolTermStructure vol, EngineType engineType, int binomialSteps, int samples)
        {
            GeneralizedBlackScholesProcess stochProcess = makeProcess(u, q, r, vol);

            IPricingEngine engine;

            switch (engineType)
            {
            case EngineType.Analytic:
                engine = new AnalyticEuropeanEngine(stochProcess);
                break;

            case EngineType.JR:
                engine = new BinomialVanillaEngine <JarrowRudd>(stochProcess, binomialSteps);
                break;

            case EngineType.CRR:
                engine = new BinomialVanillaEngine <CoxRossRubinstein>(stochProcess, binomialSteps);
                break;

            case EngineType.EQP:
                engine = new BinomialVanillaEngine <AdditiveEQPBinomialTree>(stochProcess, binomialSteps);
                break;

            case EngineType.TGEO:
                engine = new BinomialVanillaEngine <Trigeorgis>(stochProcess, binomialSteps);
                break;

            case EngineType.TIAN:
                engine = new BinomialVanillaEngine <Tian>(stochProcess, binomialSteps);
                break;

            case EngineType.LR:
                engine = new BinomialVanillaEngine <LeisenReimer>(stochProcess, binomialSteps);
                break;

            case EngineType.JOSHI:
                engine = new BinomialVanillaEngine <Joshi4>(stochProcess, binomialSteps);
                break;

            case EngineType.FiniteDifferences:
                engine = new FDEuropeanEngine(stochProcess, binomialSteps, samples);
                break;

            case EngineType.Integral:
                engine = new IntegralEngine(stochProcess);
                break;

            //case EngineType.PseudoMonteCarlo:
            //  engine = MakeMCEuropeanEngine<PseudoRandom>(stochProcess)
            //      .withSteps(1)
            //      .withSamples(samples)
            //      .withSeed(42);
            //  break;
            //case EngineType.QuasiMonteCarlo:
            //  engine = MakeMCEuropeanEngine<LowDiscrepancy>(stochProcess)
            //      .withSteps(1)
            //      .withSamples(samples);
            //  break;
            default:
                throw new ArgumentException("unknown engine type");
            }

            VanillaOption option = new EuropeanOption(payoff, exercise);

            option.setPricingEngine(engine);
            return(option);
        }