/// <summary> /// Get values for the profit chart /// </summary> /// <param name="date"></param> /// <param name="ticker"></param> /// <returns></returns> public RadObservableCollection <KeyValuePair <String, double> > GetRadarProfitData(String date, String ticker) { int id_fga = GetSectorFromTicker(ticker); Dictionary <object, object> values = connection.ProcedureStockeeDico("ACT_Radar_Growth", new List <String> { "@date", "@Pres", "@TICKER", "@FGA", "@MM" }, new List <Object> { date, "Qualite", ticker, id_fga.ToString(), "" }); RadObservableCollection <KeyValuePair <String, double> > res = new RadObservableCollection <KeyValuePair <string, double> >(); foreach (var o in values) { if (o.Value == null || o.Value.ToString() == "") { res.Add(new KeyValuePair <String, double>(o.Key.ToString(), 0)); } else { res.Add(new KeyValuePair <String, double>(o.Key.ToString(), (double)o.Value)); } } return(res); }
/// <summary> /// Get all SuperSectors (GICS Sectors) from the database /// </summary> /// <returns></returns> public RadObservableCollection <Sector> getSuperSectors() { RadObservableCollection <Sector> collection = new RadObservableCollection <Sector>(); String sql = "SELECT CODE AS Id, LABEL AS Libelle FROM ref_security.SECTOR WHERE"; sql += " class_name = 'GICS'"; sql += " and [level] = 0 ORDER BY label"; collection.Add(new Sector(-1, "")); collection.Add(new Sector(-1, ALLSUPERSECTORS)); foreach (Sector s in co.sqlToListObject(sql, () => new Sector())) { collection.Add(s); } return(collection); }
public SimpleViewModel() { var data = new RadObservableCollection<SalesInfo>(); DateTime startDate = new DateTime(2012, 12, 15); for (int i = 0; i < 20; i += 1) { data.Add(new SalesInfo() { Time = startDate.AddDays(i), Value = i }); } this.Data = data; }
public void showZero() { if (containsNegative) { ZeroLine = new RadObservableCollection <KeyValuePair <string, float> >(); foreach (var v in DataList5) { ZeroLine.Add(new KeyValuePair <string, float>(v.Key, 0)); } foreach (var u in DataList6) { ZeroLine.Add(new KeyValuePair <string, float>(u.Key, 0)); } containsNegative = false; } else { ZeroLine = null; containsNegative = false; } }
public void FillCountriesChart() { _countryChartDataSource = new RadObservableCollection <ChartSerie>(); RadObservableCollection <ChartPoint> othersDataSource = null; String currentBench = PortToBench(SelectedPortefeuille.Replace("Ecart_", "")); foreach (DataRow row in CountriesDataSource.Rows) { ChartSerie tmp = _model.GetChartDataForCountry(SelectedPortefeuille, row["COUNTRY"].ToString()); if (IsCountryInBench(tmp.Label, currentBench)) { _countryChartDataSource.Add(tmp); } else { if (othersDataSource == null) { othersDataSource = tmp.Data; } else { for (int i = 0; i < tmp.Data.Count; i++) { othersDataSource[i].Value += tmp.Data[i].Value; othersDataSource[i].Label = "Others"; } } } } ChartSerie others = new ChartSerie() { Label = "Others", Data = othersDataSource }; _countryChartDataSource.Add(others); CountryChartDataSource = _countryChartDataSource; }
public void showChart4() { DataList4 = new RadObservableCollection <KeyValuePair <string, float> >(); foreach (DataRow row in _ratesDataSource4.Rows) { string date = row["Date"].ToString(); date = date.Substring(0, 10); string ratetmp = row["Valeur"].ToString(); float rate = float.Parse(ratetmp) * 10; DataList4.Add(new KeyValuePair <string, float>(date, rate)); } }
public RadObservableCollection <String> GetAllTickers() { List <object> tmp = _connection.SqlWithReturn("SELECT TICKER FROM DATA_FACTSET WHERE DATE = (SELECT MAX(DATE) FROM DATA_FACTSET)"); RadObservableCollection <String> res = new RadObservableCollection <string>(); foreach (var v in tmp) { res.Add(v.ToString()); } return(res); }
public RadObservableCollection <String> GetDates() { RadObservableCollection <String> collection = new RadObservableCollection <String>(); if (coBase.State == ConnectionState.Open) { foreach (DateTime d in SelectDistinctSimple("DATA_FACTSET", "DATE", "DESC")) { collection.Add(d.ToShortDateString()); } } return(collection); }
public static RadObservableCollection <Club> GetClubs() { RadObservableCollection <Club> clubs = new RadObservableCollection <Club>(); Club club; // Liverpool club = new Club("Liverpool", "England", 1); club.Players.Add(new Player("Pepe Reina", "Spain", 1)); club.Players.Add(new Player("Jamie Carragher", "England", 7)); club.Players.Add(new Player("Steven Gerrard", "England", 4)); club.Players.Add(new Player("Fernando Torres", "Spain", 90)); clubs.Add(club); // Manchester Utd. club = new Club("Manchester Utd.", "England", 2); club.Players.Add(new Player("Edwin van der Sar", "Netherlands", 2)); club.Players.Add(new Player("Rio Ferdinand", "England", 34)); club.Players.Add(new Player("Ryan Giggs", "Wales", 7)); club.Players.Add(new Player("Wayne Rooney", "England", 9)); clubs.Add(club); // Chelsea club = new Club("Chelsea", "England", 3); //club.Players.Add(new Player("Petr Čech", "Czech Republic",3)); //club.Players.Add(new Player("John Terry", "England", 45)); //club.Players.Add(new Player("Frank Lampard", "England", 45)); //club.Players.Add(new Player("Nicolas Anelka", "France",23)); clubs.Add(club); // Arsenal club = new Club("Arsenal", "England", 4); club.Players.Add(new Player("Manuel Almunia", "Spain", 48)); club.Players.Add(new Player("Gaël Clichy", "France", 21)); club.Players.Add(new Player("Cesc Fàbregas", "Spain", 22)); club.Players.Add(new Player("Robin van Persie", "Netherlands", 23)); clubs.Add(club); return(clubs); }
public static RadObservableCollection <Club> GetClubs() { RadObservableCollection <Club> clubs = new RadObservableCollection <Club>(); Club club; for (int i = 0; i < 20; i++) { club = new Club("Liverpool" + i, new DateTime(1892, 1, 1), i); clubs.Add(club); } return(clubs); }
public RadObservableCollection <String> GetDates() { String sql = "select distinct DATE from TX_AGGREGATE_DATA order by Date"; RadObservableCollection <String> collection = new RadObservableCollection <String>(); if (co.IsOpen()) { foreach (DateTime d in co.SqlWithReturn(sql)) { collection.Add(d.ToShortDateString()); } } return(collection); }
public RadObservableCollection <String> GetPays() { String sql = "select distinct key2 from TX_AGGREGATE_DATA WHERE key1 = 'YTM_I' order by key2"; RadObservableCollection <String> collection = new RadObservableCollection <string>(); if (co.IsOpen()) { foreach (String d in co.SqlWithReturn(sql)) { collection.Add(d.ToString()); } } return(collection); }
public RadObservableCollection <String> getIsin() { String sql = "select distinct ISINId from ref_security.PRICE where Price_Source = 'IBOXX_EUR' or Price_Source = 'BARCLAYS' order by ISINId"; RadObservableCollection <String> collection = new RadObservableCollection <String>(); if (_connection.IsOpen()) { foreach (String d in _connection.SqlWithReturn(sql)) { collection.Add(d.ToString()); } } return(collection); }
public RadObservableCollection <String> GetSource() { String sql = "select distinct key5 from TX_AGGREGATE_DATA"; RadObservableCollection <String> collection = new RadObservableCollection <string>(); if (co.IsOpen()) { foreach (String s in co.SqlWithReturn(sql)) { collection.Add(s.ToString()); } } return(collection); }
public RadObservableCollection <KeyValuePair <string, int> > GetQuintiles(String ticker, String dateMin, String dateMax) { RadObservableCollection <KeyValuePair <string, int> > res = new RadObservableCollection <KeyValuePair <string, int> >(); String request = "SELECT CONVERT(DATE, date, 103) as Date, GARPN_QUINTILE_S as Quint FROM DATA_FACTSET WHERE TICKER='" + ticker + "' AND GARPN_QUINTILE_S IS NOT NULL AND DATE <= '" + dateMin + "' AND DATE >= '" + dateMax + "' ORDER BY DATE"; List <KeyValuePair <string, int> > values = _connection.sqlToListKeyValuePair(request); foreach (var v in values) { res.Add(new KeyValuePair <string, int>(v.Key.Substring(0, 10), v.Value)); } return(res); }
public PlotStats() { plots = new RadObservableCollection <plot>(); var filiere = from f in cl.filiere select f; foreach (var x in filiere) { var tmp = from e in cl.etudiant where e.id_filiere == x.id_filiere select e; plots.Add(new plot(x.nom_filiere, tmp.Count())); } }
public void showChart2() { DataList2 = new RadObservableCollection <KeyValuePair <string, float> >(); foreach (DataRow row in _ratesDataSource2.Rows) { string date = row["Date"].ToString(); int year = int.Parse(date.Substring(6, 4)); date = date.Substring(0, 6) + year.ToString(); String rateTmp = row["Rate"].ToString(); float rate = float.Parse(rateTmp); DataList2.Add(new KeyValuePair <String, float>(date, rate)); } }
public SimpleViewModel() { var data = new RadObservableCollection <SalesInfo>(); DateTime startDate = new DateTime(2012, 12, 15); for (int i = 0; i < 20; i += 1) { data.Add(new SalesInfo() { Time = startDate.AddDays(i), Value = i }); } this.Data = data; }
public void FillSectorsChart() { _sectorsChartDataSource = new RadObservableCollection <ChartSerie>(); RadObservableCollection <ChartSerie> tmpChart = new RadObservableCollection <ChartSerie>(); foreach (DataRow row in SectorsDataSource.Rows) { ChartSerie tmp = _model.GetChartDataForSector(_selectedPortefeuille, row["SECTOR GICS"].ToString()); if (tmp.Data.Count > 0) { tmpChart.Add(tmp); } } SectorsChartDataSource = tmpChart; }
public void showChart6() { DataList6 = new RadObservableCollection <KeyValuePair <string, float> >(); foreach (DataRow row in _ratesDataSource6.Rows) { string date = row["Date"].ToString(); date = date.Substring(0, 10); string ratetmp = row["Valeur"].ToString(); float rate = float.Parse(ratetmp) * 10; if (rate < 0) { containsNegative = true; } DataList6.Add(new KeyValuePair <string, float>(date, rate)); } }
/// <summary> /// Fill the List used for the datagrid /// </summary> public void FillStocks() { List <Dictionary <String, object> > tmp = _model.GetDoublonsData(FIND_DOUBLE_EQUITY_SQL); StockList = new RadObservableCollection <S_Stock>(); foreach (Dictionary <String, object> stock in tmp) { StockList.Add(new S_Stock(stock["date"].ToString(), stock["name"].ToString(), stock["isin"].ToString(), stock["country"].ToString(), stock["ticker"].ToString()) ); } }
public RadObservableCollection <int> GetMaturity() { String sql = "select distinct key4 from TX_AGGREGATE_DATA order by key4"; RadObservableCollection <int> collection = new RadObservableCollection <int>(); if (co.IsOpen()) { foreach (object i in co.SqlWithReturn(sql)) { if (i.ToString() != "") { collection.Add(int.Parse(i.ToString())); } } } return(Sort(collection)); }
public void showChart3(ObservableCollection <KeyValuePair <string, float> > Datalist, RadObservableCollection <KeyValuePair <string, float> > Datalist2) { DataList3 = new RadObservableCollection <KeyValuePair <string, float> >(); for (int i = 0; i < ((Datalist.Count < Datalist2.Count) ? DataList.Count : Datalist2.Count); i++) { if (Datalist[i].Key == Datalist2[i].Key) { float val = Datalist[i].Value - Datalist2[i].Value; if (val < 0) { containsNegative = true; } DataList3.Add(new KeyValuePair <string, float>(Datalist[i].Key, val)); } } }
public RadObservableCollection <KeyValuePair <string, int> > GetQuintile(String ticker) { RadObservableCollection <KeyValuePair <string, int> > res = new RadObservableCollection <KeyValuePair <string, int> >(); String request = "SELECT CONVERT(DATE, date, 103) as Date, GARPN_QUINTILE_S as Quint FROM DATA_FACTSET WHERE TICKER='" + ticker + "' AND GARPN_QUINTILE_S IS NOT NULL ORDER BY DATE"; List <KeyValuePair <string, int> > values = connection.sqlToListKeyValuePair(request); // VOIR DANS LE CAHIER L'ALGO. values = GetfinDeMois(values); values = GetLastDates(values, 12); foreach (var v in values) { res.Add(new KeyValuePair <string, int>(v.Key.Substring(0, 10), v.Value)); } return(res); }
private RadObservableCollection <DTPoint> GenerateRandomSerie(int size, DateTime initialDateTime, double minValue = 0, double maxValue = 300, int intervalBetweenPoints = 1) { RadObservableCollection <DTPoint> serie = new RadObservableCollection <DTPoint>(); DateTime currentDate = initialDateTime; Random rd = new Random(random.Next()); for (int i = 0; i < size; i++) { DTPoint point = new DTPoint { XValue = currentDate, YValue = rd.NextDouble() * (maxValue - minValue) + minValue, }; serie.Add(point); currentDate = currentDate.AddMonths(intervalBetweenPoints); } return(serie); }
/// <summary> /// Get all date from the database in DESC ORDER /// </summary> /// <returns>All Dates as Collection of Strings</returns> public RadObservableCollection <String> getDates() { RadObservableCollection <String> collection = new RadObservableCollection <String>(); if (co.IsOpen()) { try { foreach (DateTime d in co.SelectDistinctSimple("DATA_FACTSET", "DATE", "DESC")) { collection.Add(d.ToShortDateString()); } } catch { } } return(collection); }
//private Random rand = new Random(); public void BindData() { if (ChartData == null) { ChartData = new RadObservableCollection<BarChartDataPoint>(); for (int i = 0; i < XAsisCategories.Length; i++) ChartData.Add(new BarChartDataPoint(YAxisValues[i], XAsisCategories[i])); NotifyOfPropertyChange(() => this.ChartData); } else { ChartData.SuspendNotifications(); var max = 0L; for (int i = 0; i < XAsisCategories.Length; i++) { // NOTE: for testing data changes //var nextRand = rand.Next(0, 2); //nextRand = nextRand == 0 ? -1 : nextRand; //var nextVal = WidgetData[i].Amount + nextRand; //nextVal = nextVal < 0 ? 0 : nextVal; //WidgetData[i].Amount = nextVal; ChartData[i].Amount = YAxisValues[i]; max = ChartData[i].Amount > max ? ChartData[i].Amount : max; } YAxisMaxValue = max + 1; ChartData.ResumeNotifications(); } NotifyOfPropertyChange(() => this.YAxisMaxValue); }
public RadObservableCollection <ChartSerie> GetChartIndustriesDataSource(String ptf, String sector) { if (ptf == null) { return(null); } String idsector = _connection.GetIdSectorFromName(sector).ToString().Trim(); String ptff = "[" + ptf.Replace("Ecart_", "") + "]"; List <DateIndustryValue> tmp; if (ptf.Contains("Ecart_")) { String bench = ""; if (ptff == "[6100002]") { bench = "MXFR"; } else if (ptff == "[6100030]" || ptff == "[AVEURO]" || ptff == "[6100004]" || ptff == "[6100063]" || ptff == "[AVEUROPE]" || ptff == "[6100001]" || ptff == "[6100033]") { bench = "MXEM"; } else if (ptff == "[6100062]") { bench = "MXEUM"; } else if (ptff == "[6100026]") { bench = "MXEU"; } else if (ptff == "[6100024]" || ptff == "[6100066]") { bench = "MXUSLC"; } tmp = _connection.ProckStockToDateIndustryValue("ACT_RepartitionIndustries", idsector, ptff, bench); } else { tmp = _connection.ProckStockToDateIndustryValue("ACT_RepartitionIndustries", idsector, ptff, "null"); } if (tmp == null) { return(null); } List <List <KeyValuePair <String, double> > > tmp2 = new List <List <KeyValuePair <String, double> > >(); List <KeyValuePair <String, double> > currentList = new List <KeyValuePair <String, double> >(); List <String> industriesName = new List <string>(); String currentIndustry = ""; foreach (var v in tmp) { if (currentIndustry == "") { currentIndustry = v.Industry; } if (currentIndustry != v.Industry) { industriesName.Add(currentIndustry); currentIndustry = v.Industry; tmp2.Add(currentList); currentList = new List <KeyValuePair <String, double> >(); currentList.Add(new KeyValuePair <String, double>(v.Date.Substring(0, 10), v.Value)); currentIndustry = v.Industry; } else { currentList.Add(new KeyValuePair <String, double>(v.Date.Substring(0, 10), v.Value)); } } tmp2.Add(currentList); industriesName.Add(currentIndustry); for (int i = 0; i < tmp2.Count; i++) { tmp2[i] = GetfinDeMois(tmp2[i]); tmp2[i] = GetLastDates(tmp2[i], 12); } RadObservableCollection <ChartSerie> res = new RadObservableCollection <ChartSerie>(); for (int i = 0; i < tmp2.Count; i++) { ChartSerie serie = new ChartSerie(); serie.Label = industriesName[i]; serie.Data = new RadObservableCollection <ChartPoint>(); foreach (var v in tmp2[i]) { serie.Data.Add(new ChartPoint(v.Key, v.Value, industriesName[i])); } res.Add(serie); } return(res); /* * String industries = ""; * industries += " SELECT "; * industries += " distinct fac.DATE as Date, "; * industries += " s.label, "; * industries += " convert(decimal(10, 2),SUM(fac.[" + ptf + "] * 100)) as '" + ptf + "' "; * industries += " FROM ref_security.SECTOR s "; * industries += " INNER JOIN ref_security.SECTOR_TRANSCO st on "; * industries += " st.id_sector1 = s.id "; * industries += " INNER JOIN ref_security.SECTOR fils on "; * industries += " fils.id = st.id_sector2 "; * industries += " LEFT OUTER JOIN ref_security.SECTOR ss ON "; * industries += " fils.id_parent = ss.id "; * industries += " INNER JOIN DATA_FACTSET fac on "; * industries += " fac.FGA_SECTOR = s.code "; * industries += " WHERE fac.GICS_SECTOR is null "; * industries += " AND ss.class_name = 'GICS' "; * industries += " AND ss.label = '" + sector + "' "; * industries += " GROUP BY fac.DATE, s.label ORDER BY s.label, DATE"; * * List<DateIndustryValue> tmp = _connection.sqlToDateIndustryValue(industries); * List<List<KeyValuePair<String, double>>> tmp2 = new List<List<KeyValuePair<String, double>>>(); * * List<KeyValuePair<String, double>> currentList = new List<KeyValuePair<String, double>>(); * List<String> industriesName = new List<string>(); * * String currentIndustry = ""; * foreach (var v in tmp) * { * if (currentIndustry == "") * currentIndustry = v.Industry; * * if (currentIndustry != v.Industry) * { * industriesName.Add(currentIndustry); * currentIndustry = v.Industry; * tmp2.Add(currentList); * currentList = new List<KeyValuePair<String, double>>(); * currentList.Add(new KeyValuePair<String, double>(v.Date.Substring(0, 10), v.Value)); * currentIndustry = v.Industry; * } * else * currentList.Add(new KeyValuePair<String, double>(v.Date.Substring(0, 10), v.Value)); * } * tmp2.Add(currentList); * industriesName.Add(currentIndustry); * * for (int i = 0; i < tmp2.Count; i++) * { * tmp2[i] = GetfinDeMois(tmp2[i]); * tmp2[i] = GetLastDates(tmp2[i], 12); * } * * RadObservableCollection<CharSerie> res = new RadObservableCollection<CharSerie>(); * * for (int i = 0; i < tmp2.Count; i++) * { * CharSerie serie = new CharSerie(); * serie.Label = industriesName[i]; * serie.Data = new RadObservableCollection<ChartPoint>(); * * foreach (var v in tmp2[i]) * serie.Data.Add(new ChartPoint(v.Key, v.Value, industriesName[i])); * * res.Add(serie); * } * * return res; */ }
/// <summary> /// Get all the sectors (Industry FGA) from the database /// </summary> /// <param name="univers">Must find in a univers</param> /// <param name="supersector">And a GICS Sector</param> /// <returns></returns> public RadObservableCollection <Sector> getSectors(String univers, Sector supersector) { RadObservableCollection <Sector> collection = new RadObservableCollection <Sector>(); String ALLSECTORS = "**Industries FGA**"; if (univers == null || univers.CompareTo("") == 0) { return(collection); } string sql = null; if (supersector != null) { if (supersector.Id > 0) { sql = "SELECT distinct fga.code AS Id, fga.LABEL AS Libelle"; sql += " FROM ref_security.SECTOR s"; sql += " INNER JOIN ref_security.SECTOR_TRANSCO st on st.id_sector1 = s.id"; sql += " INNER JOIN ref_security.SECTOR fga on fga.id = st.id_sector2"; sql += " WHERE s.class_name = 'GICS' and s.id_parent = (select id from ref_security.SECTOR where code = " + supersector.Id.ToString() + ")"; if (univers == "ALL") { sql += " AND fga.class_name = 'FGA_ALL'"; } else if (univers == "EUROPE") { sql += " AND fga.class_name = 'FGA_EU'"; } else if (univers == "USA") { sql += " AND fga.class_name = 'FGA_US'"; } else { sql += " AND fga.class_name = 'FGA_ALL'"; } sql += " ORDER BY Libelle"; } else { sql = "SELECT code AS Id, LABEL AS Libelle FROM ref_security.SECTOR WHERE"; if (univers == "ALL") { sql += " class_name = 'FGA_ALL'"; } else if (univers == "EUROPE") { sql += " class_name = 'FGA_EU'"; } else if (univers == "USA") { sql += " class_name = 'FGA_US'"; } else { sql += " class_name = 'FGA_ALL'"; } sql += " AND [level] = 0 "; sql += " ORDER BY Libelle"; } collection.Add(new Sector(-1, "")); collection.Add(new Sector(-1, ALLSECTORS)); foreach (Sector s in co.sqlToListObject(sql, () => new Sector())) { collection.Add(s); } } return(collection); }
/// <summary> /// get all univers from the database /// </summary> /// <returns></returns> public RadObservableCollection <String> getUnivers() { RadObservableCollection <String> collection = new RadObservableCollection <String>(); collection.Add(""); collection.Add("ALL"); collection.Add("USA"); collection.Add("EUROPE"); collection.Add("EUROPE EX EMU"); collection.Add("EMU"); collection.Add("FRANCE"); collection.Add(""); collection.Add("FEDERIS NORTH AMERICA"); collection.Add("FEDERIS ISR AMERIQUE"); collection.Add("FEDERIS EUROPE ACTIONS"); collection.Add("FEDERIS EX EURO"); collection.Add("FEDERIS EURO ACTIONS"); collection.Add("AVENIR EURO"); collection.Add("FEDERIS ISR EURO"); collection.Add("FEDERIS ACTIONS"); collection.Add("FEDERIS IRC ACTIONS"); collection.Add("FEDERIS CROISSANCE EURO"); collection.Add("FEDERIS VALUE EURO"); collection.Add("FEDERIS FRANCE ACTIONS"); return(collection); }
void Timer1_Tick(object sender, EventArgs e) { foreach (Item item in Items) { string itemName = item.ItemName; int itemId = item.ItemId; TunnelLog currentLog = null; currentLog = Tunnel.GetValue(x => x.VarName == itemName); if (currentLog != null) { TunnelLog lastLog = LastTunnelLogs.FirstOrDefault(x => x.VarName == itemName); if (lastLog == null) { Log log = new Log(); log.ItemId = itemId; if (itemId == 2) { log.ItemValue = currentLog.VarValue / 10; } else { log.ItemValue = currentLog.VarValue; } log.Date = DateTime.Now; Entities.Logs.Add(log); Entities.SaveChanges(); var beforeHash = new StringBuilder(); beforeHash.Append(log.LogId); beforeHash.Append(log.ItemId); beforeHash.Append(log.ItemValue); beforeHash.Append(log.Date); var afterHash = ComputeHash(beforeHash.ToString()); log.HashValue = afterHash; Entities.SaveChanges(); LastTunnelLogs.Add(currentLog); if (item.ItemId == 1) { if (item1Live.Count > 61) { item1Live.RemoveAt(0); } item1Live.Add(log); } else if (item.ItemId == 2) { if (item2Live.Count > 61) { item2Live.RemoveAt(0); } item2Live.Add(log); } else if (item.ItemId == 3) { if (item3Live.Count > 61) { item3Live.RemoveAt(0); } item3Live.Add(log); } } else { if (lastLog.Time_ms != currentLog.Time_ms) { LastTunnelLogs.Remove(lastLog); Log log = new Log(); log.ItemId = itemId; if (itemId == 2) { log.ItemValue = currentLog.VarValue / 10; } else { log.ItemValue = currentLog.VarValue; } //log.ItemValue = currentLog.VarValue; log.Date = DateTime.Now; Entities.Logs.Add(log); Entities.SaveChanges(); var beforeHash = new StringBuilder(); beforeHash.Append(log.LogId); beforeHash.Append(log.ItemId); beforeHash.Append(log.ItemValue); beforeHash.Append(log.Date); var afterHash = ComputeHash(beforeHash.ToString()); log.HashValue = afterHash; Entities.SaveChanges(); LastTunnelLogs.Add(currentLog); if (item.ItemId == 1) { if (item1Live.Count > 61) { item1Live.RemoveAt(0); } item1Live.Add(log); } else if (item.ItemId == 2) { if (item2Live.Count > 61) { item2Live.RemoveAt(0); } item2Live.Add(log); } else if (item.ItemId == 3) { if (item3Live.Count > 61) { item3Live.RemoveAt(0); } item3Live.Add(log); } } } } } }
public void FillData() { RadObservableCollection <ChartBusinessObject> collection1 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection2 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection3 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection4 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection5 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection6 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection7 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection8 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection9 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection10 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection11 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection12 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection13 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection14 = new RadObservableCollection <ChartBusinessObject>(); RadObservableCollection <ChartBusinessObject> collection15 = new RadObservableCollection <ChartBusinessObject>(); IsStart = false; this.lastDate = DateTime.Now; this.alignmentDate = this.lastDate; for (int i = 0; i < 101; i++) { this.lastDate = this.lastDate.AddMilliseconds(TimerInterval); collection1.Add(this.CreateBusinessObject1()); collection2.Add(this.CreateBusinessObject2()); collection3.Add(this.CreateBusinessObject3()); collection4.Add(this.CreateBusinessObject4()); collection5.Add(this.CreateBusinessObject5()); collection6.Add(this.CreateBusinessObject6()); collection7.Add(this.CreateBusinessObject7()); collection8.Add(this.CreateBusinessObject8()); collection9.Add(this.CreateBusinessObject9()); collection10.Add(this.CreateBusinessObject10()); collection11.Add(this.CreateBusinessObject11()); collection12.Add(this.CreateBusinessObject12()); collection13.Add(this.CreateBusinessObject13()); collection14.Add(this.CreateBusinessObject14()); collection15.Add(this.CreateBusinessObject15()); } this.P_Source_Data = collection1; this.P_TCC_Data = collection2; this.P_Line_Data = collection3; this.P_Shift_Data = collection4; this.P_C1234_Data = collection5; this.P_CB26_Data = collection6; this.P_C35R_Data = collection7; this.P_C456_Data = collection8; this.temperature_Data = collection9; this.inputSpeed_Data = collection10; this.outputSpeed_Data = collection11; this.TCUInputSpeed_Data = collection12; this.TCUOnputSpeed_Data = collection13; this.TCUtemperature_Data = collection14; this.GreaNum_Data = collection15; }
public static RadObservableCollection<Club> GetClubs() { RadObservableCollection<Club> clubs = new RadObservableCollection<Club>(); Club club; for (int i = 0; i < 20; i++) { club = new Club("Liverpool" + i, new DateTime(1892, 1, 1), i); clubs.Add(club); } return clubs; }