示例#1
0
        public void SetTable(string tableName, string schema, hssDB hDB)
        {
            if (hDB == null || !hDB.Connected)
            {
                MessageBox.Show("AutoCreatClass error 0: No DB connection");
                return;
            }

            this.col_list.Clear();
            this.tableName = tableName;
            if (string.IsNullOrEmpty(this.className))
            {
                this.className = tableName;
            }
            this.schema = schema;

            DB_select     selt  = new DB_select(ColumnSchema.Get_cmdTP());
            SQL_relation  rela1 = new SQL_relation("TABLE_NAME", RelationalOperator.Equals, tableName);
            SQL_relation  rela2 = new SQL_relation("TABLE_SCHEMA", RelationalOperator.Equals, schema);
            SQL_condition cond  = new SQL_condition(new SQL_condition(rela1), ConditionalOperator.And, new SQL_condition(rela2));

            selt.SetCondition(cond);

            DB_reader reader = new DB_reader(selt, hDB);

            while (reader.Read())
            {
                ColumnSchema cs = new ColumnSchema();
                cs.Init_from_reader(reader);
                this.col_list.Add(cs);
            }
            reader.Close();

            this.col_list.Sort((a, b) => (a.ORDINAL_POSITION - b.ORDINAL_POSITION));
        }
示例#2
0
文件: Utility.cs 项目: huangss0/GTS0
        public static hssDB Get_EDI_hDB()
        {
            if (Utility.EDI_hDB == null || !Utility.EDI_hDB.Connected)
            {
                if (string.IsNullOrEmpty(Utility.EDI_connString))
                {
                    return(null);
                }
                Utility.EDI_hDB = new hssDB(Utility.EDI_connString);
            }

            return(Utility.EDI_hDB);
        }
示例#3
0
        private void HssEntityFramework_button_Click(object sender, EventArgs e)
        {
            HssEntityFramework hef = new HssEntityFramework();

            hssDB  hDB          = null;
            string hDB_funcName = "hDB";
            bool   build_in_DB  = this.hef_BiD_checkBox.Checked;

            if (this.DB_comboBox.Text.Equals("DRWIN", StringComparison.OrdinalIgnoreCase))
            {
                hDB = Utility.Get_DRWIN_hDB();
                if (build_in_DB)
                {
                    hDB_funcName = "Utility.Get_DRWIN_hDB()";
                }
            }
            else if (this.DB_comboBox.Text.Equals("XBRL", StringComparison.OrdinalIgnoreCase))
            {
                hDB = Utility.Get_XBRL_hDB();
                if (build_in_DB)
                {
                    hDB_funcName = "Utility.Get_XBRL_hDB()";
                }
            }
            else if (this.DB_comboBox.Text.Equals("ESP2", StringComparison.OrdinalIgnoreCase))
            {
                hDB = Utility.Get_ESP2_hDB();
                if (build_in_DB)
                {
                    hDB_funcName = "Utility.Get_ESP2_hDB()";
                }
            }
            else if (this.DB_comboBox.Text.Equals("EDI", StringComparison.OrdinalIgnoreCase))
            {
                hDB = Utility.Get_EDI_hDB();
                if (build_in_DB)
                {
                    hDB_funcName = "Utility.Get_EDI_hDB()";
                }
            }

            hef.SetTable(this.hef_tn_textBox.Text, this.hef_sn_textBox.Text, hDB);
            hef.className      = this.hef_cn_textBox.Text;
            hef.hDB_name       = hDB_funcName;
            hef.builtInDB_flag = build_in_DB;

            ViewDataForm vdf = new ViewDataForm();

            vdf.Set_notePad_dataSource(hef.Run());
            vdf.Show();
        }
示例#4
0
文件: Position.cs 项目: huangss0/GTS0
        public bool SaveToDB()
        {
            hssDB hDB = Utility.Get_DRWIN_hDB();

            if (hDB == null)
            {
                return(false);
            }

            DB_insert dbIns = this.Get_DBinsert();

            dbIns.DBname = hDB.DBname;
            int count = dbIns.SaveToDB(hDB);

            return(count > 0);
        }
示例#5
0
        public static Dividend GetDividend_dvdID(string dvdID, DividendTable_option tableOpt)
        {
            hssDB hDB = Utility.Get_DRWIN_hDB();

            DB_select selt = new DB_select(Dividend.Get_cmdTP());

            selt.tableName = tableOpt.ToString();

            SQL_relation rela = new SQL_relation("DividendID", RelationalOperator.Equals, dvdID);

            selt.SetCondition(rela);

            Dividend  dvd    = null;
            DB_reader reader = new DB_reader(selt, hDB);

            if (reader.Read())
            {
                dvd = new Dividend();
                dvd.Init_from_reader(reader);
            }
            reader.Close();

            return(dvd);
        }