Example #1
0
        private void GetArrData(string name)
        {
            IteratorModel     iterator   = IteratorModel.GetInstance(null, null);
            List <PointModel> points     = iterator.GetListPoint(Tiker, Scale);
            List <string>     items      = new List <string>();
            List <ResultArr>  resultArrs = new List <ResultArr>();

            foreach (var item in  points[points.Count() - 2].AnalysisResults.Find(i => i.Name == name).ResultArr)
            {
                items.Add(item.Name);
            }
            GetTable(items);
            foreach (var tmp in points)
            {
                var tmpItem = tmp.AnalysisResults.Find(i => i.Name == name);
                if (tmpItem != null)
                {
                    resultArrs.Clear();
                    foreach (var item in tmpItem.ResultArr)
                    {
                        resultArrs.Add(item);
                    }
                    GetRows(tmp.Date, resultArrs);
                }
            }
        }
Example #2
0
        public TabData(IDataService data, bool flagMaster)
            : base("Данные")
        {
            FlagMaster = flagMaster;
            if (flagMaster)
            {
                base.Header = "Master Data";
                Flag        = Visibility.Collapsed;
            }
            else
            {
                base.Header = "Work Data";
                Flag        = Visibility.Visible;
            }
            Files        = new ObservableCollection <FileViewModel>();
            Points       = new ObservableCollection <PointModel>();
            _dataService = data;
            List <FileArrModel> f = data.GetFileArrs();

            foreach (var i in f)
            {
                if (i.Work)
                {
                    Files.Add(new FileViewModel(i));
                    ListComboBoxItems.Add(i.Tiker);
                }
            }
            listScaleItems.Add("60");
            listScaleItems.Add("D");
            iterator = IteratorModel.GetInstance(data.GetMasterPoints(), data.GetFileArrs());
        }
Example #3
0
        private void GetListComboBoxItems()
        {
            IteratorModel     iterator = IteratorModel.GetInstance(null, null);
            List <PointModel> points   = iterator.GetListPoint(Tiker, Scale);

            foreach (var tmp in points[points.Count() - 2].AnalysisResults)
            {
                ListComboBoxItems.Add(tmp.Name);
            }
        }
Example #4
0
        private void LoadData()
        {
            IteratorModel iterator = IteratorModel.GetInstance(null, null);
            //List<PointModel> points = iterator.GetListPoint(Tiker, Scale);

            List <ResultArr>     resultArrs = new List <ResultArr>();
            List <string>        items      = new List <string>();
            Type                 type;
            IEnumerable <object> _list;

            if (NameType == "Ордера")
            {
                type  = Type.GetType("MainApp.Model.OrderModel");
                _list = iterator.orderModels.FindAll(i => i.Tiker == Tiker);
            }
            else //if (NameType == "Сделки")
            {
                type  = Type.GetType("MainApp.Model.DealModel");
                _list = iterator.dealModels.FindAll(i => i.Tiker == Tiker);
            }

            foreach (var tmp in type.GetProperties())
            {
                items.Add(tmp.Name);
            }
            GetTable(items);

            foreach (var tmp in _list)
            {
                DataRow       row  = Table.NewRow();
                List <object> list = new List <object>();
                list.Add(null);

                foreach (var tmp1 in type.GetProperties())
                {
                    PropertyInfo fi;
                    if (NameType == "Ордера")
                    {
                        fi = typeof(OrderModel).GetProperty(tmp1.Name.ToString());
                    }
                    else //if (NameType == "Сделки")
                    {
                        fi = typeof(DealModel).GetProperty(tmp1.Name.ToString());
                    }

                    list.Add(fi.GetValue(tmp).ToString());
                }
                row.ItemArray = list.ToArray();
                Table.Rows.Add(row);
            }
            InitializeRolesColumns();
        }
Example #5
0
        public void UpLoadDeal()
        {
            string        path     = @"C:\TXT\Deal.txt";
            IteratorModel iterator = IteratorModel.GetInstance(null, null);
            Type          type     = Type.GetType("MainApp.Model.DealModel");

            using (FileStream fstream = new FileStream(path, FileMode.Create))
            {
                string str = "";
                foreach (var tmp in type.GetProperties())
                {
                    if (str != "")
                    {
                        str = str + "^" + tmp.Name.ToString();
                    }
                    else
                    {
                        str = tmp.Name.ToString();
                    }
                }
                AddText(fstream, str + "\r\n");

                foreach (var tmp in iterator.dealModels)
                {
                    str = "";
                    foreach (var tmp1 in type.GetProperties())
                    {
                        PropertyInfo fi = typeof(DealModel).GetProperty(tmp1.Name.ToString());
                        if (str != "")
                        {
                            str = str + "^" + fi.GetValue(tmp).ToString();
                        }
                        else
                        {
                            str = fi.GetValue(tmp).ToString();
                        }
                    }
                    AddText(fstream, str + "\r\n");
                }
                Console.WriteLine("Текст записан в файл");
            }
        }
Example #6
0
        public void UpLoadAnalysis()
        {
            string        path     = @"C:\TXT\Analysis.txt";
            IteratorModel iterator = IteratorModel.GetInstance(null, null);

            Type type = Type.GetType("MainApp.Model.DealModel");

            using (FileStream fstream = new FileStream(path, FileMode.Create))
            {
                string str = "";
                #region Шапка
                foreach (var tmp in type.GetProperties())
                {
                    if (str != "")
                    {
                        str = str + "^" + tmp.Name.ToString();
                    }
                    else
                    {
                        str = tmp.Name.ToString();
                    }
                }
                AddText(fstream, str + "\r\n");
                #endregion
                #region Тело отчета
                List <string> tmplist = new List <string>();
                foreach (var tmp in iterator.WorkPoints)
                {
                    DateModel Points = tmp.Data.Find(i => i.Scale == "D");
                    foreach (var tmp1 in Points.Points)
                    {
                        tmplist.Add(tmp.Tiker.ToString());
                        tmplist.Add(tmp1.Date.ToString());

                        tmplist.Add(tmp1.Open.ToString());
                        tmplist.Add(tmp1.High.ToString());
                        tmplist.Add(tmp1.Low.ToString());
                        tmplist.Add(tmp1.Close.ToString());
                        //DateTime date = new DateTime(2019, 11, 12, 11, 00, 00);
                        //if (tmp1.Date == date) { MessageBox.Show("!"); }
                        foreach (var results in tmp1.AnalysisResults)
                        {
                            tmplist.Add(results.Name);
                            foreach (var result in results.ResultArr)
                            {
                                tmplist.Add(result.Name);
                                List <string> AtrStr = result.ValStr.Split(';').ToList();
                                AtrStr.ForEach(i => { tmplist.Add(i); });
                            }
                            tmplist.Add(results.Result);
                        }
                        int index = Points.Points.FindIndex(i => i.Date == tmp1.Date);
                        if ((index != -1) && (index + 1 < Points.Points.Count()))
                        {
                            tmplist.Add(Points.Points[index + 1].Date.ToString());
                            tmplist.Add(Points.Points[index + 1].Open.ToString());
                            tmplist.Add(Points.Points[index + 1].Close.ToString());
                        }

                        str = "";
                        foreach (var tmpstr in tmplist)
                        {
                            if (str != "")
                            {
                                str = str + "^" + tmpstr;
                            }
                            else
                            {
                                str = tmpstr;
                            }
                        }

                        tmplist.Clear();
                        if (tmp1.AnalysisResults.Count != 0)
                        {
                            AddText(fstream, str + "\r\n");
                        }
                    }
                }
                #endregion
                Console.WriteLine("Текст записан в файл");
            }
        }