public void GuoteManagerCheckFail() { IQuoteManager q = new QuoteManager(); Assert.IsFalse(q.startWatching("asdf")); Assert.IsTrue(q.startWatching("GOOG")); }
private void SaveQuote(bool bUpdate) { lblMessage.Text = ""; try { var qm = new QuoteManager(); if (bUpdate) { qm.UpdateQuote(calculate(HeaderReq())); } else { qm.AddQuote(calculate(HeaderReq())); } util.ErroDisplay(5, string.Empty, ref lblMessage); BlockQuote(); btnUpdateQuote.Visible = true; btnUpdateQuoteGuardar.Visible = false; btnAddQuote.Visible = false; } catch (ArgumentException ae) { util.ErroDisplay(3, ae.Message, ref lblMessage); } catch (Exception ex) { util.ErroDisplay(1, ex.Message, ref lblMessage); } }
/// <summary> /// Button event that adds an item to a Watchlist. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAddToWatchList_Click(object sender, EventArgs e) { bool success = false; IQuoteManager qm = new QuoteManager(); string symbol = tbAddToWatchList.Text.Trim().ToUpper(); string listName = radioLists.SelectedValue; if (symbol.Length > 0) { // If it is valid, add it to the list if (qm.startWatching(symbol)) { IWatchList wl = new WatchList(); success = wl.AddToList(new Symbol(symbol), listName); if (success) { setStatus(String.Format("{0} added to list \"{1}.\"", symbol, listName), true); } else { setStatus(String.Format("{0} could not be added to \"{1}.\"", symbol, listName), false); } strategy.startWatching(symbol); updateList(true); } else // If it's not, display invalid symbol message. { setStatus("Invalid symbol.", false); } } else { setStatus("Stock symbol cannot be blank.", false); } }
public QuoteController(IMemoryCache _cache, IConfiguration _config) { qMgr = new QuoteManager(_cache, _config); eMgr = new EquityManager(_cache, _config); egMgr = new EquityGroupManager(_cache, _config); umMgr = new UserModelManager(_cache, _config); }
public QuoteController(AppSettings _appSettings) { appSettings = _appSettings; qMgr = new QuoteManager(); eMgr = new EquityManager(); }
public App() { InitializeComponent(); DependencyService.Register <MockDataStore>(); QuoteManager = new QuoteManager(new RestService()); MainPage = new MainPage(); }
public ActionResult Edit(Quote quote) { quote.IsActive = true; using (var qm = new QuoteManager()) { quote = qm.Edit(quote); } return(RedirectToAction("List")); }
public void onParsed(QuoteManager mgr) { if (mgr == mStockQuoteManager) { txtCrawledStockQuoteCount.Text = string.Format("{0}", mgr.Quotes.Count); } else { txtCrawledWarrantQuoteCount.Text = string.Format("{0}", mgr.Quotes.Count); } }
public ActionResult List() { List <Quote> quotes; using (var qm = new QuoteManager()) { quotes = qm.All().ToList(); } ViewBag.Quotes = quotes; return(View("QuoteList")); }
void Start() { player = Camera.main.transform; quoteManager = GameObject.Find("QuoteManager").GetComponent <QuoteManager>(); // overlay SetOverlay(); if (currentState == State.Walking) { MoveToRandomPoint(); } }
public async Task GetMileageLimit_When_Valid_Returns_ListOfMileageLimitVM( [Frozen] Mock <IUnitOfWork> _uow, List <MileageLimitVM> moqResponse, [Greedy] QuoteManager sut) { // Arrange _uow.Setup(x => x.MileageLimitRepository.GetMileageLimit()).ReturnsAsync(moqResponse); // Act var result = await sut.GetMileageLimit(); // Assert Assert.NotNull(result); }
public ActionResult AddQuoteItem(QuoteItem item) { Material material; List <WasteFactor> wasteFactors = new List <WasteFactor>(); using (var mm = new MaterialsManager()) { material = mm.SingleMaterial(item.MaterialID.GetValueOrDefault()); } using (var qm = new QuoteManager()) { var quote = qm.Single(item.QuoteID); using (var wfm = new WasteFactorManager()) { wasteFactors = wfm.ByCompany(quote.CompanyID.GetValueOrDefault()).ToList(); } decimal wasteFactor = wasteFactors.Any( wf => wf.ProductID == item.ProductID && wf.ProductLineID == item.ProductLineID) ? wasteFactors.First( wf => wf.ProductID == item.ProductID && wf.ProductLineID == item.ProductLineID) .WasteFactor1.GetValueOrDefault() : 0M; // calculate the amount and save switch (item.Measurement) { case (Measurement.SquareFeet): if (item.SquareFt.GetValueOrDefault() == 0) { item.SquareFt = item.Height * item.Width; } var pieceSqFt = (material.Height - material.Overlap.GetValueOrDefault()) * (1M / 12M) * material.Width; var pieces = Math.Ceiling((decimal)(item.SquareFt.GetValueOrDefault() * (1M + wasteFactor) / pieceSqFt)); item.Amount = pieces * material.UnitCost; break; case (Measurement.LinearFeet): item.Amount = item.LinearFt * (1M + wasteFactor) * material.UnitCost / material.Width; break; case (Measurement.Constant): item.Amount = item.Dollars; break; } item = qm.CreateItem(item); } return(RedirectToAction("Edit", new { id = item.QuoteID })); }
public void loadLevel(string levelName) { currentStage = loadJSON(levelName); GameObject quoteObject = GameObject.FindGameObjectWithTag("quote"); QuoteManager quoteManager = quoteObject.GetComponent <QuoteManager>(); quoteManager.showQuoteOverlay(currentStage.quote, currentStage.levelName); Timer.RunWithDelay(this, quoteDelayTimeInSeconds, () => { quoteManager.hideQuoteOverlay(); playStage(currentStage); }); }
private void Awake() { if (instance == null) { instance = this; oblivionCounter = 0; //Debug.Log("instance created"); } else { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); }
public async Task SaveQuoteAsync_When_Vaid_Quote_Returns_Quote( [Frozen] Mock <IUnitOfWork> uow, QuoteVM MoqResponse, QuoteVM request, [Greedy] QuoteManager sut ) { // Arrange uow.Setup(x => x.QuoteRepository.SaveQuoteAsync(It.IsAny <QuoteVM>())).ReturnsAsync(MoqResponse); // Act var result = await sut.SaveQuoteAsync(request); // Assert Assert.NotNull(result); }
public ActionResult Edit2(int id) { Quote quote; List <QuoteOption> options; using (var qm = new QuoteManager()) { quote = qm.Single(id); options = qm.QuoteOptions(id).ToList(); ViewBag.Quote = quote; } // determine the supplier and materials available List <CompanyToSupplier> companySuppliers; using (var sm = new SupplierManager()) { companySuppliers = sm.ByCompanyID(quote.CompanyID.GetValueOrDefault()).ToList(); } List <Product> products; using (var mm = new MaterialsManager()) { List <Material> allMaterials = new List <Material>(); foreach (var companyToSupplier in companySuppliers) { allMaterials.AddRange(mm.BySupplier(companyToSupplier.SupplierID)); } ViewBag.AvailableMaterials = allMaterials; products = mm.ActiveProducts(quote.CompanyID.GetValueOrDefault()).ToList(); var productLines = mm.ActiveProductLines().ToList(); ViewBag.PartsOfHouse = productLines.AsEnumerable(); ViewBag.ProductToProductLine = mm.AllProductToProductLine().ToList(); ViewBag.MaterialToProducts = mm.AllMaterialToProducts().ToList(); } ViewBag.Products = products; return(View("Edit")); }
public ActionResult ListByEmployee() { List <Quote> quotes; int userID = 0; using (var um = new UserManager()) { // any normal user can only see their own quotes var currentUser = um.ByUsername(User.Identity.Name); userID = currentUser.ID; } using (var qm = new QuoteManager()) { quotes = qm.ActiveByEmployee(userID).OrderByDescending(q => q.CreatedOn).ToList(); } ViewBag.Quotes = quotes; return(View("QuoteList")); }
public ActionResult ListByCompany() { List <Quote> quotes; int companyID = 0; using (var um = new UserManager()) { // any user tied to a company can only see their company quotes var currentUser = um.ByUsername(User.Identity.Name); if (currentUser.CompanyID != null) { companyID = currentUser.CompanyID.GetValueOrDefault(); } } using (var qm = new QuoteManager()) { quotes = qm.ActiveByCompany(companyID).OrderByDescending(q => q.CreatedOn).ToList(); } ViewBag.Quotes = quotes; return(View("QuoteList")); }
public ActionResult Options(QuoteOptionsModel model) { using (var qm = new QuoteManager()) { foreach (var psm in model.ProductLineSelectionModels) { if (psm.IsSelected) { // add it to the quote options database var option = new QuoteOption { QuoteID = model.QuoteID, ContentCategory = QuoteOptionCategory.ProductLineMapping, ForeignKey = psm.ProductLineID, TableName = TableName.ProductLine }; option = qm.CreateOption(option); } } foreach (var msm in model.ManufacturerSelectionModels) { if (msm.IsSelected) { // add it to the quote options database var option = new QuoteOption { QuoteID = model.QuoteID, ContentCategory = QuoteOptionCategory.ManufacturerDefault, ForeignKey = msm.ManufacturerID, TableName = TableName.Manufacturer }; option = qm.CreateOption(option); } } } return(RedirectToAction("Edit", new { id = model.QuoteID })); }
public ActionResult Create() { // We create a shell of a quote and redirect to the edit var quote = new Quote(); quote.CreatedOn = DateTime.Now; quote.ModifiedOn = DateTime.Now; quote.IsActive = false; using (var um = new UserManager()) { var user = um.ByUsername(User.Identity.Name); if (user.CompanyID != null) { quote.CompanyID = user.CompanyID; } quote.EmployeeID = user.ID; } using (var qm = new QuoteManager()) { quote = qm.Create(quote); } return(RedirectToAction("Options", new { id = quote.ID })); }
public void InitializeFixture() { _quoteRepoMock = Substitute.For <IQuoteRepo <IQuote> >(); _quoteManager = new QuoteManager(_quoteRepoMock); }
static void Main(string[] args) { string line; Console.WriteLine("Enter one or more lines of text (press CTRL+Z to exit):"); Console.WriteLine("Enter AQ for Adding to the Quote"); Console.WriteLine("Enter UQ for Updating a Quote"); Console.WriteLine("Enter RQ for Removing a single Quote By Id"); Console.WriteLine("Enter RAQ for Removing all quotes by a Symbol"); Console.WriteLine("Enter GB to get the best quote with available volume"); Console.WriteLine("Enter ET to execute a trade"); Console.WriteLine("Enter RT to run tests and exit"); Console.WriteLine("Enter EXIT to run tests and quit the application"); Console.WriteLine(); IQuoteManager quoteManager = new QuoteManager(); do { Console.Write("Enter a quote manager action: "); line = Console.ReadLine(); if (!string.IsNullOrWhiteSpace(line)) { switch (line.ToUpper()) { case "RT": RunTests(); Environment.Exit(0); return; case "AQ": AddQuote(quoteManager); break; case "UQ": UpdatedQuote(quoteManager); break; case "RQ": RemoveQuote(quoteManager); break; case "RAQ": RemoveAllQuotes(quoteManager); break; case "GB": GetBestQuote(quoteManager); break; case "ET": ExecuteTrade(quoteManager); break; case "EXIT": Environment.Exit(0); break; } } } while (line != null); }
private void Quote() { if (ddlPartListC.Items.Count > 0) { pnQuoteA.Visible = true; pnQuoteNon.Visible = false; var plct = new DS.SAI.Data.PartListCompositeType(); var plm = new PartListManager(); var ect = new DS.SAI.Data.ExchangeCompositeType(); var em = new ExchangeManager(); var qct = new DS.SAI.Data.QuoteCompositeType(); var qm = new QuoteManager(); qct.iExchange = int.Parse(lblIdExchange.Text.ToString()); qct.iPartList = int.Parse(ddlPartListC.SelectedValue.ToString()); plct = plm.getPartListById(int.Parse(ddlPartListC.SelectedValue.ToString())); ect = em.getExchangeById(int.Parse(lblIdExchange.Text)); lblNoParC.Text = plct.iNumber.ToString(); lblClientC.Text = ect.sClient.ToString(); lblProyectC.Text = ect.sProyect.ToString(); lblDescriptionC.Text = ect.sDescription.ToString(); if (qm.ExistQuoteDuplicate(qct)) { qct = qm.getQuoteById(qct); txtDateIn.Text = qct.dIn.ToShortDateString(); txtDateProm.Text = qct.dProm.ToShortDateString(); txtDateOut.Text = qct.dOut.ToShortDateString(); txtSOPClientC.Text = qct.SOPCliente; txtMoldC.Text = qct.iMoldProt.ToString(); txtMoldSC.Text = qct.iMoldSerie.ToString(); txtCFC.Text = qct.iCF.ToString(); txtDeviceC.Text = qct.iDevice.ToString(); txtObsoletC.Text = qct.iObsolet.ToString(); txtManEngC.Text = qct.iEngMan.ToString(); txtDesignC.Text = qct.iDesign.ToString(); txtComponentsC.Text = qct.iComponents.ToString(); txtOthersTitleWC.Text = qct.sOthers.ToString(); txtOthersWC.Text = qct.iOthers.ToString(); txtPaintC.Text = qct.iPaint.ToString(); txtEmpC.Text = qct.iEmp.ToString(); txtBankC.Text = qct.iBank.ToString(); txtPrue.Text = qct.iOthersC.ToString(); txtPoundC.Text = qct.iPound.ToString(); txtDelta1.Text = qct.iDelta1.ToString(); txtDelta2.Text = qct.iDelta2.ToString(); txtCost.Text = qct.iCost.ToString(); txtR1.Text = qct.iFR1.ToString(); txtR2.Text = qct.iFR2.ToString(); txtMoldPlazoC.Text = qct.iMoldP.ToString(); txtMoldProtC.Text = qct.iMoldProtP.ToString(); txtDateStart.Text = qct.iStart.ToString(); txtObsC.Text = qct.sDescription.ToString(); lblINVTotal.Text = qct.iTotalInv.ToString(); lblTotalPieceTotal.Text = qct.iTotalP.ToString(); chkMoldC.Checked = qct.bMoldProt; chkMoldSC.Checked = qct.bMoldSerie; chkCFC.Checked = qct.bCF; chkDeviceC.Checked = qct.bDevice; chkObsoletC.Checked = qct.bObsolet; chkManEngC.Checked = qct.bEngMan; chkDesingC.Checked = qct.bDesign; chkComponetsC.Checked = qct.bComponents; chkOthersWC.Checked = qct.bOthers; chkPaintC.Checked = qct.bPaint; chkEmpC.Checked = qct.bEmp; chkBankC.Checked = qct.bBank; setVisibleChecked(); BlockQuote(); btnUpdateQuote.Visible = true; btnUpdateQuoteGuardar.Visible = false; btnAddQuote.Visible = false; } else { clearControlsQuote(); UnblockQuote(); } } else { pnQuoteA.Visible = false; pnQuoteNon.Visible = true; } }
public QuoteController() { _quoteManager = new QuoteManager(new DatabaseEntities()); }
public QuoteController() { _quoteManager = new QuoteManager(); }