Esempio n. 1
0
        private void Init_schemaTable_dic()
        {
            if (this.schemaTable_dic != null)
            {
                return;
            }

            this.schemaTable_dic = new Dictionary <string, HashSet <string> >(StringComparer.OrdinalIgnoreCase);

            DB_select selt   = new DB_select(TableSchema.Get_cmdTP());
            DB_reader reader = null;

            try { reader = new DB_reader(selt, this); }
            catch (Exception ex)
            {
                Console.WriteLine("hssDB error 1: " + ex.ToString());
                return;
            }

            while (reader.Read())
            {
                TableSchema ts = new TableSchema();
                ts.Init_from_reader(reader);

                if (!this.schemaTable_dic.ContainsKey(ts.TABLE_SCHEMA))
                {
                    HashSet <string> table_hs = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                    this.schemaTable_dic[ts.TABLE_SCHEMA] = table_hs;
                }
                this.schemaTable_dic[ts.TABLE_SCHEMA].Add(ts.TABLE_NAME);
            }
            reader.Close();
        }
Esempio n. 2
0
        internal void Init_from_reader(DB_reader reader)
        {
            if (reader == null || reader.IsClosed)
            {
                return;
            }

            this.TABLE_SCHEMA = reader.GetString("TABLE_SCHEMA");
            this.TABLE_NAME   = reader.GetString("TABLE_NAME");
        }
        internal void Init_from_reader(HssUtility.SQLserver.DB_reader reader)
        {
            if (reader == null || reader.IsClosed)
            {
                return;
            }

            this.pk_ID = reader.GetInt("DTCModelMappingID");
            reader.GetString("Country", this.Country);                             /*Optional 2*/
            reader.GetString("Issue", this.Issue);                                 /*Optional 3*/
            reader.GetInt("RecordYear", this.RecordYear);                          /*Optional 4*/
            reader.GetString("IncomeEvent", this.IncomeEvent);                     /*Optional 5*/
            reader.GetInt("ModelNumber", this.ModelNumber);
            reader.GetDateTime("ADRRecordDate", this.ADRRecordDate);               /*Optional 7*/
            reader.GetDateTime("ORDPayDate", this.ORDPayDate);                     /*Optional 8*/
            reader.GetInt("SecurityTypeID", this.SecurityTypeID);                  /*Optional 9*/
            reader.GetDateTime("ADRRecordDate_End", this.ADRRecordDate_End);       /*Optional 10*/
            reader.GetBool("AtSourceSumFromDetails", this.AtSourceSumFromDetails); /*Optional 11*/

            this.SyncWithDB();
        }
        /// <summary>
        /// Initialize object from DB
        /// </summary>
        public bool Init_from_DB()
        {
            if (this.DTCModelMappingID < 0)
            {
                return(false);
            }

            HssUtility.SQLserver.DB_select db_sel = new HssUtility.SQLserver.DB_select(DTCPositionModelNumber_Mapping.Get_cmdTP());
            db_sel.tableName = "DTCPositionModelNumber_Mapping";
            HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("DTCModelMappingID", HssUtility.General.RelationalOperator.Equals, this.DTCModelMappingID);
            db_sel.SetCondition(rela);

            bool res_flag = false;

            HssUtility.SQLserver.DB_reader reader = new HssUtility.SQLserver.DB_reader(db_sel, Utility.Get_DRWIN_hDB());
            if (reader.Read())
            {
                this.Init_from_reader(reader);
                res_flag = true;
            }
            reader.Close();
            return(res_flag);
        }