public void RefetchAllCompanies() { CompanyCollection companies = CompanyBL.Instance.GetCompanies(); XbrlNodeBL xbrlMngr = new XbrlNodeBL(); Dictionary <string, List <string> > xbrlTaxonomyTree = new Dictionary <string, List <string> >(); //xbrlTaxonomyTree = xbrlMngr.PopulateXbrlTaxonomyTree(); bool start = true; foreach (Company comp in companies) { //if (comp.Symbol.Equals("twc")) //{ // start = true; //} if (start) { try { string xmlUrl = GetXbrlDocument(comp.Symbol); xbrlMngr.ProcessXbrlInstanceDocument(xmlUrl, xbrlTaxonomyTree); Console.WriteLine("loaded {0}", comp.Symbol); } catch (Exception ex) { Console.WriteLine(string.Format("ERROR: DID NOT LOAD symbol: {0} {1}", comp.Symbol, ex.Message)); } } } }
public static CompanyCollection Search(SearchFilter value) { CompanyCollection items = new CompanyCollection(); string key = string.Format(SETTINGS_Search_KEY, value.CompanyID + value.Keyword + value.Page + value.PageSize + value.OrderBy + value.OrderDirection); if (SystemConfig.AllowSearchCache) { object obj2 = HttpCache.Get(key); if ((obj2 != null)) { return((CompanyCollection)obj2); } } using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue)) { HttpResponseMessage response = client.PostAsJsonAsync(Resource + "?method=search", value).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { items = response.Content.ReadAsAsync <CompanyCollection>().GetAwaiter().GetResult(); } } if (SystemConfig.AllowSearchCache) { HttpCache.Max(key, items); } return(items); }
private async Task InitiateAsync() { IsMainViewerInitiating = true; await PowerCompany.LoadFromApplicationUriAsync(); foreach (var company in Enumerable.Range(0, PowerCompany.Companies.Count).Select(index => new PowerCompanyViewModel(index))) { CompanyCollection.Add(company); } await Site.LoadFromApplicationUriAsync(); CheckAreaCoordinates(Site.Sites, MainViewerSize); RaisePropertyChanged(nameof(MainViewerZoomFactor)); RaisePropertyChanged(nameof(MainCanvasCenterPosition)); foreach (var site in Site.Sites.Select((x, index) => new SiteViewModel(index) { Location = ConvertPositionFromReal(x.Longitude, x.Latitude) })) { SiteCollection.Add(site); } // Wait for all site members being loaded. Otherwise, subsequent restoring position // may not work correctly. while (SiteCollection.Any(x => !x.IsLoaded)) { await Task.Delay(TimeSpan.FromMilliseconds(50)); } IsMainViewerInitiating = false; }
private void cmbCategory_SelectedIndexChanged(object sender, EventArgs e) { this.nupAmount.Value = 0; if (cmbCategory.SelectedItem != null) { Guid categoryGuid = new Guid(cmbCategory.SelectedItem.ToString()); CompanyCollection companyList = new CompanyCollection(); if (cmbCompany.SelectedItem == null) { this.cmbCompany.DataSource = companyList; this.cmbCompany.DisplayMember = "DisplayName"; } } this.nupAmount.Value = 0; if (cmbCategory.SelectedItem != null && cmbCompany.SelectedItem != null && cmbItem.SelectedItem != null) { availableStock = 0; Medicines m = new Medicines(); availableStock = m.GetMaxQuantityAvailable(cmbCategory.SelectedItem as Category, cmbCompany.SelectedItem as Company, cmbItem.SelectedItem as Item); lblAvailableQuantity.Text = "Max Available (" + availableStock.ToString() + " )"; lblAvailableQuantity.Visible = true; MedicineSale MSale = new MedicineSale(); decimal mrp = MSale.GetMRP(cmbCategory.SelectedItem as Category, cmbCompany.SelectedItem as Company, cmbItem.SelectedItem as Item); decimal amount = mrp * (this.nupQuantity.Value); this.nupAmount.Value = amount; } }
private async Task CompanyGetAll_OnImplementation(CompanyCollection coll) { coll.Add(new Company { Id = Guid.NewGuid(), Code = "XYZ", Text = "XYZ", IsActive = true, SortOrder = 1, ExternalCode = "usmf" }); await Task.Delay(0); }
public void GetCompanyByMarketCapTest() { var compRepo = new MongoDBRepository <Company>(nameof(Company)); CompanyCollection companyCollection = new CompanyCollection(); var statRepo = new MongoDBRepository <Stat>("IEXStat"); var finRepo = new MongoDBRepository <Financial>(nameof(Financial)); long minCap = 1_000_000; long maxCap = 2_000_000_000; var filter = Builders <Stat> .Filter.Lte(x => x.Marketcap, maxCap) & Builders <Stat> .Filter.Gte(x => x.Marketcap, minCap); var results = statRepo.DbCollection.FindAsync(filter).Result.ToList(); Assert.NotNull(results); results.ForEach((x) => { Console.WriteLine(x.Marketcap); Assert.True(x.Marketcap <= maxCap, $"Actual={x.Marketcap} <= Expected={maxCap}"); }); var companies = companyCollection.GetCompanyId(results.Select(x => x.Symbol).ToList()); Assert.AreEqual(companies.Count, results.Count); }
protected override void OnDataShow() { base.OnDataShow(); this.CheckPermission(); this.Text = "Manage Patient Medicine"; CategoryCollection categoryList = new CategoryCollection(); this.cmbCategory.DataSource = categoryList; this.cmbCategory.DisplayMember = "DisplayName"; CompanyCollection companyList = new CompanyCollection(); this.cmbCompany.DataSource = companyList; this.cmbCompany.DisplayMember = "DisplayName"; cmbPatientType.Select(); if (this.mPatientBill.Patient != null) { if (this.mPatientBill.Patient.IsIPD) { this.cmbPatientType.SelectedItem = "I.P.D"; } else if (this.mPatientBill.Patient.IsOPD) { this.cmbPatientType.SelectedItem = "O.P.D"; } //else // this.cmbPatientType.SelectedItem = "Other"; } if (!string.IsNullOrEmpty(this.mPatientBill.Other)) { this.cmbPatientType.SelectedItem = "Other"; this.txtOtherPatientName.Text = this.mPatientBill.Other; lblOtherPatientName.Visible = txtOtherPatientName.Visible = true; cmbPatient.Visible = lblPatient.Visible = false; } this.cmbPatient.SelectedItem = this.mPatientBill.Patient != null ? this.mPatientBill.Patient as Patient : null; this.txtOtherPatientName.Text = this.mPatientBill.Other; this.dtpBillDate.Value = this.mPatientBill.PatientBillDate != DateTime.MinValue ? this.mPatientBill.PatientBillDate : DateTime.Now.Date; LoadPatientAllMedicine(GetSelectedProcedure(this.dgvData)); if (isPatientMedicineSaleEdit) { this.cmbCategory.SelectedItem = mEntry.Category; this.cmbCompany.SelectedItem = mEntry.Company; this.cmbItem.SelectedItem = mEntry.Item; this.nupQuantity.Value = mEntry.Quantity; this.nupAmount.Value = mEntry.Amount; this.txtNotes.Text = mEntry.Note; } else { this.cmbCategory.SelectedItem = this.cmbCompany.SelectedItem = this.cmbItem.SelectedItem = null; } }
public CompanySerializer Load(string order, string direction) { CompanyCollection coll = new CompanyCollection(); coll.OrderField = order; coll.OrderDirection = direction.ToLower() == "desc" ? CompanyCollection.Direction.DESC : CompanyCollection.Direction.ASC; return new CompanySerializer(coll); }
public CompanySerializer PagingLoad(string order, string direction, long start, long limit) { CompanyCollection coll = new CompanyCollection(); coll.OrderField = order; coll.OrderDirection = direction.ToLower() == "desc" ? CompanyCollection.Direction.DESC : CompanyCollection.Direction.ASC; return new CompanySerializer(coll, Convert.ToInt32(start), Convert.ToInt32(limit)); }
internal static void InsertBatch(IEnumerable <CIKInfo> cikInfos, List <IEXDataType> listIexDataTypes, ChartOption chartOption, int itemCount, Period period) { int total = cikInfos.Count(); int count = 0; int batchCount = 50; CompanyCollection companyRepo = new CompanyCollection(); do { var symbols = cikInfos.Select(x => x.Ticker).Skip(count).Take(batchCount).ToArray(); count += symbols.Count(); var dictSymbolComp = companyRepo.GetCompanyId(symbols.ToList()); //get data IEXClientHandler response = new IEXClientHandler(); var results = response.GetBatchReport(symbols, listIexDataTypes, ChartOption._1d, itemCount, period); //insert to db var comp = new MongoDBRepository <Company>(nameof(Company)); var stat = new MongoDBRepository <Stat>("IEXStat"); var fin = new MongoDBRepository <Financial>(nameof(Financial)); var quote = new MongoDBRepository <Quote>("Quote"); foreach (string symbol in results.Keys) { ObjectId compId = ObjectId.GenerateNewId(); //ObjectId.GenerateNewId().ToString(); results[symbol].Company._id = compId; if (results[symbol].Company != null) { comp.MongoInsert(results[symbol].Company).Wait(); } if (results[symbol].Stat != null) { results[symbol].Stat.companyId = compId; stat.MongoInsert(results[symbol].Stat).Wait(); } if (results[symbol].Financials.financials != null) { Parallel.For(0, results[symbol].Financials.financials.Count, (i) => { results[symbol].Financials.financials[i].companyId = compId; }); fin.MongoInsertMany(results[symbol].Financials.financials).Wait(); } if (results[symbol].Quote != null) { results[symbol].Quote.companyId = compId; quote.MongoInsert(results[symbol].Quote).Wait(); } } } while (count < total); }
public CompanySerializer Load(string order, string direction) { CompanyCollection coll = new CompanyCollection(); coll.OrderField = order; coll.OrderDirection = direction.ToLower() == "desc" ? CompanyCollection.Direction.DESC : CompanyCollection.Direction.ASC; return(new CompanySerializer(coll)); }
private void FillDdlCompany() { CompanyCollection companies = Company.Utils.GetCompanies(); foreach (var item in companies) { ddlCompany.Items.Add(new ListItem(item.Name, item.ID.ToString())); } }
public CompanySerializer PagingLoad(string order, string direction, long start, long limit) { CompanyCollection coll = new CompanyCollection(); coll.OrderField = order; coll.OrderDirection = direction.ToLower() == "desc" ? CompanyCollection.Direction.DESC : CompanyCollection.Direction.ASC; return(new CompanySerializer(coll, Convert.ToInt32(start), Convert.ToInt32(limit))); }
public CompanySerializer(CompanyCollection companies) { this.Companies = companies; if (!this.Companies.IsLoaded) { this.Companies.Load(); } this.Total = this.Companies.Count; }
private void cmbCategory_SelectedIndexChanged(object sender, EventArgs e) { if (cmbCategory.SelectedItem != null) { Guid categoryGuid = new Guid(cmbCategory.SelectedItem.ToString()); CompanyCollection companyList = new CompanyCollection(); this.cmbCompany.DataSource = companyList; this.cmbCompany.DisplayMember = "DisplayName"; } }
private void FillDdlCompany() { CompanyCollection companies = Company.Utils.GetCompanies(); ddlCompany.Items.Add(new ListItem(Resources.DeliveryPlanTexts.ChooseCompany, "-1")); foreach (var item in companies) { ddlCompany.Items.Add(new ListItem(item.Name, item.ID.ToString())); } }
private void FillDdlCompany(Material material) { CompanyCollection companies = Company.Utils.GetCompanies(); foreach (var item in companies) { ddlCompany.Items.Add(new ListItem(item.Name, item.ID.ToString())); } ddlCompany.SelectedValue = material.CompanyID.ToString(); }
private void FillDdlCompanies() { CompanyCollection companies = Company.Utils.GetCompanies(); ddlCompanies.Items.Add(new ListItem(Resources.ContactsTexts.NoCompanyDdlValue, "0")); foreach (var item in companies) { ddlCompanies.Items.Add(new ListItem(item.Name, item.ID.ToString())); } }
public void GetCompanyInfoTest() { CompanyCollection repo = new CompanyCollection(); var collection = repo.DbCollection; Assert.NotNull(collection); var results = collection.Find <Company>(x => x.symbol != null, null) .ToListAsync() .Result; Assert.NotNull(results); }
public void UpdateDataTest() { //insert to db CompanyCollection repo = new CompanyCollection(); var collection = repo.DbCollection; var results = collection.Find <Company>(x => x.symbol.ToLower() == "ge", null) .ToListAsync() .Result; var company = results.First(); company.description = "TEST UPDATE"; repo.MongoUpsert(company).Wait(); }
public static CompanyCollection GetAllItem() { CompanyCollection collection = new CompanyCollection(); using (var reader = SqlHelper.ExecuteReader("Company_GetAll", null)) { while (reader.Read()) { Company obj = new Company(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
private async Task CompanyUpdateAsync() { if (!IsConnectionAvailable) { return; } var updateTasks = CompanyCollection .Where(x => x.CheckTimeNext <= DateTime.Now) .Select(async x => await x.UpdateAsync()); await Task.WhenAll(updateTasks); Debug.WriteLine("Updated companies. {0:HH:mm:ss}", DateTime.Now); }
public static CompanyCollection Search(SearchFilter SearchKey) { CompanyCollection collection = new CompanyCollection(); using (var reader = SqlHelper.ExecuteReader("Company_Search", SearchFilterManager.SqlSearchParam(SearchKey))) { while (reader.Read()) { Company obj = new Company(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public void BatchProcessSymbolsTest() { //getting list of company string[] symbols = new string[] { "ge", "appl", "msft", "ipar", "gntx" }; //get data IEXClientHandler response = new IEXClientHandler(); var results = response.GetBatchReport(symbols, new List <IEXDataType> { IEXDataType.company }, IEXApiHandler.IEXData.Stock.ChartOption._1d, 1); Assert.NotNull(results); //insert to db CompanyCollection repo = new CompanyCollection(); repo.MongoInsertMany(results.Values.Select(x => x.Company).Distinct().ToList()).Wait(); }
public void EnterAllCompaniesStatsFromYahooFinance() { CompanyCollection companies = CompanyBL.Instance.GetCompanies(); foreach (Company comp in companies) { try { AddCompanyToDatabase(comp.Symbol, 2012, 3); Console.WriteLine("Successfully Loaded {0}", comp.Symbol); } catch (Exception ex) { { Console.WriteLine(string.Format("ERROR: DID NOT LOAD symbol: {0} {1}", comp.Symbol, ex.Message)); } } } }
public static CompanyCollection GetCompanies(string MembershipUserid) { CompanyCollection c = new CompanyCollection(); DataTable dt = Execute.FillDataTable(StoredProcedures.GetCompaniesByMembershipUserid, new System.Data.SqlClient.SqlParameter("MembershipUserid", MembershipUserid)); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { Company o = new Company(); LoadCompanyByReader(row, o); c.Add(o); } } return(c); }
//Добавление компании private void AddCompButton_Click(object sender, EventArgs e) { if (!CheckTelephone()) { MessageBox.Show("Некорректно введен номер телефона.", "Некорректные данные", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (!PassAllFields()) { MessageBox.Show("Заполните все поля.", "Некорректные данные", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { CompanyCollection.AddCompany(AddCompanyToTheDatabase()); Close(); } }
public static CompanyCollection GetCompanies() { CompanyCollection c = new CompanyCollection(); DataTable dt = Execute.FillDataTable(StoredProcedures.GetCompanies); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { Company o = new Company(); LoadCompanyByReader(row, o); c.Add(o); } } return(c); }
public static CompanyCollection GetbyUser(string CreatedUser) { CompanyCollection collection = new CompanyCollection(); Company obj; var sqlParams = new SqlParameter[] { new SqlParameter("@CreatedUser", CreatedUser), }; using (var reader = SqlHelper.ExecuteReader("Company_GetAll_byUser", sqlParams)) { while (reader.Read()) { obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
//Сохранение изменений по нажатию на кнопку "ПОДТВЕРДИТЬ" private void BackToMain_Click(object sender, EventArgs e) { if (!CheckTelephone()) { MessageBox.Show("Некорректно введен номер телефона.", "Некорректные данные", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (!PassAllFields()) { MessageBox.Show("Заполните все поля.", "Некорректные данные", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { var comp = CreateCompanyFromForm(); CompanyCollection.ChangeCompany(comp.Id, comp); Close(); } }
internal static void InsertChartData(IEnumerable <CIKInfo> cikInfos) { IEXClientHandler response = new IEXClientHandler(); CompanyCollection compColl = new CompanyCollection(); //symbols from list var symbols = cikInfos.Select(x => x.Ticker).ToList(); //checking for company exists in db var dictComp = compColl.GetCompanyId(symbols); //insert to db var chartCollection = new MongoDBRepository <Chart>("Charts"); foreach (string symbol in dictComp.Keys) { try { var results = response.GetBatchReport(symbol, new List <IEXDataType> { IEXDataType.chart }, ChartOption._5y, 100); if (!dictComp.ContainsKey(symbol)) { Console.WriteLine($"Not data for symbol {symbol}."); continue; } //update charts with companyId Parallel.For(0, results.Charts.Count, (i) => { results.Charts[i].companyId = dictComp[symbol]; }); chartCollection.MongoInsertMany(results.Charts).Wait(); } catch (Exception ex) { Console.WriteLine(ex); } } }
public CompanyCollection GetCompanies() { CompanyCollection companies = null; //Execute Query using (MySqlDataReader rdr = MySqlHelper.ExecuteReader(MySqlHelper.SV_CONN_STRING, SQL_SELECT_COMPANIES)) { if (rdr.Read()) { //If there is one result companies = new CompanyCollection(); //Scroll through the results do { companies.Add(ConvertReaderToCompanyObject(rdr)); }while (rdr.Read()); } } return(companies); }
public static CompanyCollection GetAll(int CompanyID) { CompanyCollection items = new CompanyCollection(); string key = String.Format(SETTINGS_ALL_KEY, CompanyID); object obj2 = HttpCache.Get(key); if ((obj2 != null)) { return((CompanyCollection)obj2); } using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue)) { HttpResponseMessage response = client.GetAsync(string.Format(Resource + "?CompanyID={0}", CompanyID)).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { items = response.Content.ReadAsAsync <CompanyCollection>().GetAwaiter().GetResult(); } } HttpCache.Max(key, items); return(items); }
public CompanyCollection GetCompanies() { CompanyCollection companies = null; //Execute Query using (MySqlDataReader rdr = MySqlHelper.ExecuteReader(MySqlHelper.SV_CONN_STRING, SQL_SELECT_COMPANIES)) { if (rdr.Read()) { //If there is one result companies = new CompanyCollection(); //Scroll through the results do { companies.Add(ConvertReaderToCompanyObject(rdr)); } while (rdr.Read()); } } return companies; }
public CompanySerializer(CompanyCollection companies, int start, int limit) : this(companies) { this.Companies.Page(start, limit); }