Пример #1
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]);
 }
Пример #2
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);
        }
Пример #3
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));
 }
Пример #4
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);
        }