Пример #1
0
 public static void LoadSymbolRow(string Symbol, string Name, string Exchange)
 {
     object[] objArray1 = new object[3] {
         Symbol, Name, Exchange
     };
     StockDB.LoadSymbolRow(objArray1);
 }
Пример #2
0
 private void miFavorite_Click(object sender, EventArgs e)
 {
     if (this.dgList.CurrentRowIndex >= 0)
     {
         StockDB.AddToFavorite((string)this.dgList[this.dgList.CurrentRowIndex, this.SymbolColumn]);
     }
 }
Пример #3
0
 public static void DeleteFolderRelRows(object Code, int FolderId)
 {
     object[] objArray1 = new object[5] {
         "FolderId=", FolderId, " and Code='", Code, "'"
     };
     StockDB.DeleteFolderRelRows(string.Concat(objArray1));
 }
Пример #4
0
        public static void OpenChartForm(string Code, Form Owner, bool NewWindow)
        {
            if (idm == null)
            {
                idm = new FileDataManager(SymbolForm.GetSymbolTable());
            }
            IDataProvider iDataProvider = idm[Code];

            if (iDataProvider != null)
            {
                (iDataProvider as CommonDataProvider).Merge(StockDB.GetRealtimeData(Code));
                if (CurrentChartForm == null || NewWindow)
                {
                    CurrentChartForm           = new ChartForm();
                    CurrentChartForm.MdiParent = Owner;
                    CurrentChartForm.Show();
                    FormList.Add(CurrentChartForm);
                }
                CurrentChartForm.om.SaveObject(CurrentChartForm.Code);
                CurrentChartForm.Code = Code;
                CurrentChartForm.ChartControl.ShowChart(iDataProvider);
                CurrentChartForm.Activate();
                CurrentChartForm.om.LoadObject(Code);
            }
        }
Пример #5
0
        public static DataPackage GetRealtimeData(string Code)
        {
            DataTable table1 = StockDB.GetRealtimeList(false);
            DataRow   row1   = table1.Rows.Find(Code);

            return(StockDB.GetRealtimeData(row1));
        }
Пример #6
0
 public static int GetMaxFolderId(string ParentId)
 {
     if (ParentId == "")
     {
         return(StockDB.GetMaxValue(StockDB.dtFolderAll, "FolderId", ""));
     }
     return(StockDB.GetMaxValue(StockDB.dtFolderAll, "FolderId", "ParentId=" + ParentId));
 }
Пример #7
0
 private void miDeleteFavorite_Click(object sender, EventArgs e)
 {
     if (this.dgList.CurrentRowIndex >= 0)
     {
         StockDB.DeleteFolderRelRows(this.GetSelectedSymbol(), this.FolderId);
     }
     this.RefreshData();
 }
Пример #8
0
        private void MainForm_Closing(object sender, CancelEventArgs e)
        {
            int num1 = StockDB.RealtimeChangedCount;

            if ((num1 != 0) && (MessageBox.Show("Do you want to merge realtime data to historical database? Total:" + num1, "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes))
            {
                StockDB.MergeRealtime();
            }
        }
Пример #9
0
        private void miSwitchFolder_Click(object sender, EventArgs e)
        {
            int num1 = StockDB.NextFolderId(this.FolderId);

            if (num1 != 0)
            {
                this.FolderId = num1;
            }
        }
Пример #10
0
 public static void AddToFavorite(string Code)
 {
     try
     {
         StockDB.LoadFolderRelRow(Code, StockDB.CurrentFavoriteId);
     }
     catch
     {
     }
 }
Пример #11
0
        private void DeleteSymbol()
        {
            string text1 = this.GetSelectedSymbol();

            if (MessageBox.Show(this, "Do you want to delete symbol '" + text1 + "'", "Worning!", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                StockDB.DeleteSymbol(text1);
                this.RefreshData();
            }
        }
Пример #12
0
 // Methods
 public ListForm()
 {
     this.SymbolColumn    = 1;
     this.folderId        = 0;
     this.SymbolChanged   = true;
     this.RealtimeChanged = true;
     StockDB.Open();
     this.InitializeComponent();
     this.AddStyleColumns(this.dgList.TableStyles[0]);
 }
Пример #13
0
        public static string LookupFolderName(int FolderId)
        {
            StockDB.GetFolderDatatable();
            DataRow row1 = StockDB.dtFolder.Rows.Find(FolderId);

            if (row1 != null)
            {
                return(row1["FolderName"].ToString());
            }
            return("");
        }
Пример #14
0
 private void miGotoFavorite_Click(object sender, EventArgs e)
 {
     if (this.FolderId == StockDB.CurrentFavoriteId)
     {
         this.FolderId             = StockDB.NextFolderId(this.FolderId);
         StockDB.CurrentFavoriteId = this.FolderId;
     }
     else
     {
         this.FolderId = StockDB.CurrentFavoriteId;
     }
 }
Пример #15
0
        public static void UpdateFolderRow(int FolderId, string FolderName)
        {
            StockDB.dtFolderAllChanged = true;
            DataRow row1 = StockDB.dtFolderAll.Rows.Find(FolderId);

            if (row1 != null)
            {
                row1["FolderName"] = FolderName;
            }
            StockDB.ResetFolderDatabase();
            StockDB.GetFolderDatatable();
        }
Пример #16
0
 public static DataTable GetFolderDatatable()
 {
     if (StockDB.dtFolder == null)
     {
         StockDB.dtFolder = StockDB.GetDataTable(StockDB.dtFolderAll, "visible = 1");
         DataColumn[] columnArray1 = new DataColumn[1] {
             StockDB.dtFolder.Columns[0]
         };
         StockDB.dtFolder.PrimaryKey = columnArray1;
     }
     return(StockDB.dtFolder);
 }
Пример #17
0
 public static DataRow GetFirstRow(string TableName, string Filter)
 {
     DataTable[] tableArray1 = StockDB.AllDataBase;
     for (int num1 = 0; num1 < tableArray1.Length; num1++)
     {
         DataTable table1 = tableArray1[num1];
         if (string.Compare(table1.TableName, TableName, true) == 0)
         {
             StockDB.GetFirstRow(table1, Filter);
         }
     }
     return(null);
 }
Пример #18
0
 public static DataRow[] GetDataRows(string TableName, string Filter)
 {
     DataTable[] tableArray1 = StockDB.AllDataBase;
     for (int num1 = 0; num1 < tableArray1.Length; num1++)
     {
         DataTable table1 = tableArray1[num1];
         if (string.Compare(table1.TableName, TableName, true) == 0)
         {
             return(StockDB.GetDataRows(table1, Filter));
         }
     }
     return(new DataRow[0]);
 }
Пример #19
0
        public static DataTable GetDataTable(DataTable dt, string Filter)
        {
            DataRow[] rowArray1 = StockDB.GetDataRows(dt, Filter);
            DataTable table1    = dt.Clone();

            DataRow[] rowArray2 = rowArray1;
            for (int num1 = 0; num1 < rowArray2.Length; num1++)
            {
                DataRow row1 = rowArray2[num1];
                table1.ImportRow(row1);
            }
            return(table1);
        }
Пример #20
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            string text1 = InputBox.ShowInputBox("Folder name:", "Name");

            if (this.CanCreate)
            {
                int num1 = (int)this.CurrentRow["FolderId"];
                StockDB.LoadFolderRow(num1, text1);
                StockDB.ResetFolderDatabase();
                ListForm.Current.FolderId = StockDB.GetMaxFolderId();
            }
            this.CreateTree();
        }
Пример #21
0
 public static void RecreateFolders()
 {
     StockDB.DeleteRows(StockDB.dtFolderAll, "ParentId = " + 2);
     DataRow[] rowArray1 = StockDB.GetDistinctRows(StockDB.dtSymbolList, "Exchange", "not Code like '^%'");
     DataRow[] rowArray2 = rowArray1;
     for (int num1 = 0; num1 < rowArray2.Length; num1++)
     {
         DataRow row1 = rowArray2[num1];
         StockDB.LoadFolderRow(2, row1["Exchange"].ToString(), false);
     }
     StockDB.ResetFolderDatabase();
     StockDB.GetFolderDatatable();
 }
Пример #22
0
 public static void Close()
 {
     if (StockDB.dtSymbolListChanged)
     {
         StockDB.SaveDB(StockDB.dtSymbolList);
     }
     if (StockDB.dtFolderAllChanged)
     {
         StockDB.SaveDB(StockDB.dtFolderAll);
     }
     if (StockDB.dtFolderRelChanged)
     {
         StockDB.SaveDB(StockDB.dtFolderRel);
     }
 }
Пример #23
0
        public void AddFolderShortcut()
        {
            DataTable table1 = StockDB.GetFolderDatatable();

            this.RemoveShortcut(ShortcutType.Folder);
            for (int num1 = 0; num1 < table1.Rows.Count; num1++)
            {
                string   text1     = table1.Rows[num1]["FolderId"].ToString();
                string   text2     = table1.Rows[num1]["FolderName"].ToString();
                object[] objArray1 = new object[4] {
                    2, "F" + text2, text1, text2
                };
                this.dtSymbol.Rows.Add(objArray1);
            }
        }
Пример #24
0
        public static void MergeRealtime()
        {
            FileDataManager manager1 = new FileDataManager(null);

            foreach (DataRow row1 in StockDB.dtSymbolList.Rows)
            {
                if (!object.Equals(row1["LastTime"], row1["MergeTime"]))
                {
                    string text1 = row1["Code"].ToString().Trim();
                    row1["MergeTime"]           = row1["LastTime"];
                    StockDB.dtSymbolListChanged = true;
                    StockDB.MergeOneRealtime(manager1, text1, StockDB.GetRealtimeData(row1));
                }
            }
        }
Пример #25
0
 public void RefreshList()
 {
     if (!this.SymbolChanged && this.RealtimeChanged)
     {
         this.RefreshData();
     }
     else if (this.SymbolChanged || this.RealtimeChanged)
     {
         StockDB.ResetList();
         this.RefreshData();
         StockDB.RecreateFolders();
     }
     this.RealtimeChanged = false;
     this.SymbolChanged   = false;
 }
Пример #26
0
 public static int DeleteFolderRows(int FolderId, bool DeleteRel)
 {
     if (DeleteRel)
     {
         StockDB.DeleteFolderRelRows("FolderId=" + FolderId);
     }
     DataRow[] rowArray1 = StockDB.GetDataRows(StockDB.dtFolderAll, "ParentId=" + FolderId);
     DataRow[] rowArray2 = rowArray1;
     for (int num2 = 0; num2 < rowArray2.Length; num2++)
     {
         DataRow row1 = rowArray2[num2];
         StockDB.DeleteFolderRows((int)row1["FolderId"], DeleteRel);
     }
     return(StockDB.DeleteFolderRows("ParentId=" + FolderId));
 }
Пример #27
0
 public static void Open()
 {
     if (!Directory.Exists(StockDB.DataPath))
     {
         Directory.CreateDirectory(StockDB.DataPath);
     }
     if (!Directory.Exists(StockDB.HistoricalPath))
     {
         Directory.CreateDirectory(StockDB.HistoricalPath);
     }
     StockDB.CreateDBSchema();
     StockDB.LoadDB(StockDB.dtSymbolList);
     StockDB.LoadDB(StockDB.dtFolderAll);
     StockDB.LoadDB(StockDB.dtFolderRel);
     StockDB.RecreateFolders();
 }
Пример #28
0
 private void CreateTree()
 {
     this.tvFolder.BeginUpdate();
     this.Updating = true;
     try
     {
         Hashtable hashtable1 = new Hashtable();
         this.tvFolder.Nodes.Clear();
         DataTable table1 = StockDB.GetFolderDatatable();
         foreach (DataRow row1 in table1.Rows)
         {
             if (((int)row1["Visible"]) != 1)
             {
                 continue;
             }
             TreeNode node1 = new TreeNode(row1["FolderName"].ToString());
             int      num1  = (int)row1["FolderId"];
             int      num2  = (int)row1["ParentId"];
             hashtable1[num1] = node1;
             node1.Tag        = row1;
             if (num2 == 0)
             {
                 this.tvFolder.Nodes.Add(node1);
             }
             else
             {
                 TreeNode node2 = (TreeNode)hashtable1[num2];
                 if (node2 != null)
                 {
                     node1.ImageIndex         = 1;
                     node1.SelectedImageIndex = 1;
                     node2.Nodes.Add(node1);
                 }
             }
             if (ListForm.Current.FolderId == num1)
             {
                 this.tvFolder.SelectedNode = node1;
                 this.CurrentRow            = (DataRow)node1.Tag;
             }
         }
     }
     finally
     {
         this.tvFolder.EndUpdate();
         this.Updating = false;
     }
 }
Пример #29
0
        public static void UpdateRealtime(DataRow drRealtime)
        {
            DataRow row1 = StockDB.dtList.Rows.Find(drRealtime["Code"]);

            if (row1 != null)
            {
                row1["LastA"]     = drRealtime["LastA"];
                row1["OpenA"]     = drRealtime["OpenA"];
                row1["High"]      = drRealtime["High"];
                row1["Low"]       = drRealtime["Low"];
                row1["CloseA"]    = drRealtime["CloseA"];
                row1["Volume"]    = drRealtime["Volume"];
                row1["LastTime"]  = drRealtime["LastTime"];
                row1["MergeTime"] = drRealtime["MergeTime"];
                StockDB.CalChange(row1);
            }
        }
Пример #30
0
        public static int NextFolderId(int FolderId)
        {
            DataTable table1 = StockDB.GetFolderDatatable();
            DataRow   row1   = table1.Rows.Find(FolderId);

            if (row1 != null)
            {
                DataView view1 = new DataView(table1, "ParentId=" + row1["ParentId"], "FolderId", DataViewRowState.CurrentRows);
                int      num1  = view1.Find(FolderId);
                if ((num1 >= 0) && (view1.Count > 0))
                {
                    num1 = ((num1 + 1) + view1.Count) % view1.Count;
                    return((int)view1[num1]["FolderId"]);
                }
            }
            return(0);
        }