Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
        public static DataView GetStockList(int FolderId)
        {
            if (StockDB.dtList == null)
            {
                StockDB.dtList = StockDB.dtSymbolList.Copy();
                StockDB.dtList.BeginLoadData();
                StockDB.dtList.Columns.Add("Change", typeof(double));
                StockDB.dtList.Columns.Add("Num", typeof(int));
                StockDB.dtList.Columns.Add("ChangeP", typeof(double));
                StockDB.dtList.Columns.Add("UpDown", typeof(int));
                DataColumn[] columnArray1 = new DataColumn[1] {
                    StockDB.dtList.Columns["Code"]
                };
                StockDB.dtList.PrimaryKey = columnArray1;
                for (int num1 = 0; num1 < StockDB.dtList.Rows.Count; num1++)
                {
                    DataRow row1 = StockDB.dtList.Rows[num1];
                    row1["Num"] = num1 + 1;
                    string text1 = row1["Code"].ToString();
                    StockDB.CalChange(row1);
                }
                StockDB.dtList.TableName = "NameList";
                StockDB.dtList.EndLoadData();
                StockDB.dtList.AcceptChanges();
            }
            DataRow row2 = StockDB.GetFirstRow(StockDB.dtFolderAll, "folderId=" + FolderId);
            int     num2 = 0;

            if (row2 != null)
            {
                num2 = (int)row2["ParentId"];
                if (FolderId == 0)
                {
                    StockDB.currentList = StockDB.dtList.DefaultView;
                }
                else if (num2 == 2)
                {
                    StockDB.currentList = new DataView(StockDB.dtList, "Exchange='" + row2["FolderName"] + "'", "", DataViewRowState.CurrentRows);
                }
                else
                {
                    DataRow[] rowArray1 = StockDB.GetDataRows(StockDB.dtFolderRel, "FolderId=" + FolderId);
#if (vs2005)
                    Hashtable hashtable1 = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
#else
                    Hashtable hashtable1 = new Hashtable(null, CaseInsensitiveComparer.Default);
#endif
                    DataRow[] rowArray2 = rowArray1;
                    for (int num3 = 0; num3 < rowArray2.Length; num3++)
                    {
                        DataRow row3 = rowArray2[num3];
                        hashtable1[row3[0]] = "1";
                    }
                    DataTable table1 = StockDB.dtList.Clone();
                    foreach (DataRow row4 in StockDB.dtList.Rows)
                    {
                        if (hashtable1[row4["Code"]] != null)
                        {
                            table1.Rows.Add(row4.ItemArray);
                        }
                    }
                    StockDB.currentList = table1.DefaultView;
                }
            }
            else
            {
                StockDB.currentList = StockDB.dtList.DefaultView;
            }
            return(StockDB.currentList);
        }