Exemple #1
0
        public MATSER_INFO_Table_DAO buildDAO()
        {
            // bussiness logic here
            MATSER_INFO_Table_DAO insertDao = new MATSER_INFO_Table_DAO();

            insertDao.ITEM_CODE_              = this.Item_code_;
            insertDao.ITEM_NAME_              = this.Item_name_;
            insertDao.NOTIONAL_               = this.Notional_;
            insertDao.REMAIN_NOTIONAL_        = this.Remain_notional_;
            insertDao.CURRENCY_               = this.Currency_.CurrencyCode_;
            insertDao.TRADE_DATE_             = this.Trade_date_.ToString("yyyyMMdd");
            insertDao.MATURITY_DATE_          = this.Maturity_date_.ToString("yyyyMMdd");
            insertDao.COUNTERPARTY_           = this.Counterparty_;
            insertDao.EXPORT_ITEMCODE_        = this.Export_itemcode_;
            insertDao.TRADE_ID_               = this.Trade_id_;
            insertDao.TRADE_STATUS_           = this.Trade_status_;
            insertDao.INSTRUMENT_TYPE_        = this.Instrument_type_;
            insertDao.UNDERLYING_TYPE_        = this.Underlying_type_.UnderlyingComboCode_;
            insertDao.UNDERLYING_DETAIL_TYPE_ = this.Underlying_detail_type_;
            insertDao.CONTRACT_TYPE_          = this.Contract_type_.ContractComboCode_;
            insertDao.CONTRACT_SUBTYPE_       = this.Contract_subtype_.ContractSubComboCode_;
            insertDao.CONTRACT_DETAIL_TYPE_   = this.Contract_detail_type_;
            insertDao.BOOKING_TYPE_           = this.Booking_type_;

            return(insertDao);
        }
        public void select(DbConnection conn)
        {
            if (conn.State != ConnectionState.Open)
                conn.Open();

            DataTable tb = new DataTable();

            this.DAOList_ = new List<MATSER_INFO_Table_DAO>();

            DbCommand dbCommand = conn.CreateCommand();

            string selectQuery = MATSER_INFO_Table_DAOManager.SelectQuery_;



            //selectQuery = selectQuery.Replace("@KeyColumnValue@", this.KeyColumn_);

            dbCommand.CommandText = selectQuery;

            //DbDataAdapter dataAdapter = new DbDataAdapter(dbCommand, conn);
            DbDataAdapter dataAdapter = DataBaseConnectManager.CreateDataAdapter(dbCommand, conn);

            dataAdapter.Fill(tb);

            DataRow[] dr = tb.Select();
            int rowCount = dr.Length;

            foreach (DataRow item in dr)
            {
                MATSER_INFO_Table_DAO dao = new MATSER_INFO_Table_DAO();

                dao.ITEM_CODE_ = item[0].ToString();
                dao.ITEM_NAME_ = item[1].ToString();
                dao.NOTIONAL_ = item[2].ToString();
                dao.REMAIN_NOTIONAL_ = item[3].ToString();
                dao.CURRENCY_ = item[4].ToString();
                dao.TRADE_DATE_ = item[5].ToString();
                dao.MATURITY_DATE_ = item[6].ToString();
                dao.COUNTERPARTY_ = item[7].ToString();
                dao.EXPORT_ITEMCODE_ = item[8].ToString();
                dao.TRADE_ID_ = item[9].ToString();
                dao.TRADE_STATUS_ = item[10].ToString();
                dao.INSTRUMENT_TYPE_ = item[11].ToString();
                dao.UNDERLYING_TYPE_ = item[12].ToString();
                dao.UNDERLYING_DETAIL_TYPE_ = item[13].ToString();
                dao.CONTRACT_TYPE_ = item[14].ToString();
                dao.CONTRACT_SUBTYPE_ = item[15].ToString();
                dao.CONTRACT_DETAIL_TYPE_ = item[16].ToString();
                dao.BOOKING_TYPE_ = item[17].ToString();

                this.DAOList_.Add(dao);
            }



        }
        public void select(DbConnection conn)
        {
            if (conn.State != ConnectionState.Open)
            {
                conn.Open();
            }

            DataTable tb = new DataTable();

            this.DAOList_ = new List <MATSER_INFO_Table_DAO>();

            DbCommand dbCommand = conn.CreateCommand();

            string selectQuery = MATSER_INFO_Table_DAOManager.SelectQuery_;



            //selectQuery = selectQuery.Replace("@KeyColumnValue@", this.KeyColumn_);

            dbCommand.CommandText = selectQuery;

            //DbDataAdapter dataAdapter = new DbDataAdapter(dbCommand, conn);
            DbDataAdapter dataAdapter = DataBaseConnectManager.CreateDataAdapter(dbCommand, conn);

            dataAdapter.Fill(tb);

            DataRow[] dr       = tb.Select();
            int       rowCount = dr.Length;

            foreach (DataRow item in dr)
            {
                MATSER_INFO_Table_DAO dao = new MATSER_INFO_Table_DAO();

                dao.ITEM_CODE_              = item[0].ToString();
                dao.ITEM_NAME_              = item[1].ToString();
                dao.NOTIONAL_               = item[2].ToString();
                dao.REMAIN_NOTIONAL_        = item[3].ToString();
                dao.CURRENCY_               = item[4].ToString();
                dao.TRADE_DATE_             = item[5].ToString();
                dao.MATURITY_DATE_          = item[6].ToString();
                dao.COUNTERPARTY_           = item[7].ToString();
                dao.EXPORT_ITEMCODE_        = item[8].ToString();
                dao.TRADE_ID_               = item[9].ToString();
                dao.TRADE_STATUS_           = item[10].ToString();
                dao.INSTRUMENT_TYPE_        = item[11].ToString();
                dao.UNDERLYING_TYPE_        = item[12].ToString();
                dao.UNDERLYING_DETAIL_TYPE_ = item[13].ToString();
                dao.CONTRACT_TYPE_          = item[14].ToString();
                dao.CONTRACT_SUBTYPE_       = item[15].ToString();
                dao.CONTRACT_DETAIL_TYPE_   = item[16].ToString();
                dao.BOOKING_TYPE_           = item[17].ToString();

                this.DAOList_.Add(dao);
            }
        }
Exemple #4
0
        // 메모리에 어디까지 올릴건가
        // 지금은 그냥 db access함
        public void loadMasterInfo(string itemCode)
        {
            MATSER_INFO_Table_DAO mt_dao = new MATSER_INFO_Table_DAO();

            mt_dao.KeyColumn_ = itemCode;

            mt_dao.select(DataBaseConnectManager.ConnectionFactory("myDB"));

            try
            {
                this.setFromDAO(mt_dao);
            }
            catch (Exception)
            {
                OutputLogViewModel.addResult("favor not implemeted");
            }

            //DataTable tb = new DataTable();

            //using (SqlCeConnection connection = new SqlCeConnection(connectionStr_))
            //using (SqlCeCommand command = connection.CreateCommand())
            //{

            //    string itemCodeWrap = QueryStr.wrapComma(itemCode);

            //    command.CommandText = "SELECT TRADE_ID, ITEM_CODE , ITEM_NAME , NOTIONAL , TYPE, " +
            //                                " TRADE_DATE , MATURITY_DATE , COUNTERPARTY , EXPORT_ITEMCODE FROM MASTERINFORMATION WHERE ITEM_CODE =" + itemCodeWrap;


            //    connection.Open();
            //    SqlCeDataAdapter dataAdapter = new SqlCeDataAdapter(command.CommandText, connection);

            //    dataAdapter.Fill(tb);
            //}

            //DataRow[] resultRows = tb.Select();

            //string formatString = "yyyyMMdd";

            //foreach (DataRow item in resultRows)
            //{
            //    this.tradeID_ = item["TRADE_ID"].ToString();
            //    this.itemCode_ = item["ITEM_CODE"].ToString();
            //    this.name_ = item["ITEM_NAME"].ToString();
            //    this.notional_ = item["NOTIONAL"].ToString();
            //    this.type_ = item["TYPE"].ToString();
            //    this.tradeDate_ = DateTime.ParseExact(item["TRADE_DATE"].ToString(), formatString,null);
            //    this.maturityDate_ = DateTime.ParseExact(item["MATURITY_DATE"].ToString(), formatString, null);
            //    this.conterParty_ = item["COUNTERPARTY"].ToString();
            //    this.export_ItemCode_ = item["EXPORT_ITEMCODE"].ToString();
            //}

            this.dataContextRefersh();
        }
Exemple #5
0
        public static Excel_instrumentViewModel loadInstrumentVM(string itemCode)
        {
            MATSER_INFO_Table_DAO mt_dao = new MATSER_INFO_Table_DAO();

            mt_dao.ITEM_CODE_ = itemCode;

            mt_dao.select(DataBaseConnectManager.ConnectionFactory("myDB"));

            Excel_instrumentViewModel e_ivm =
                CodeClassificationGenerator.CreateInstrument(mt_dao.ITEM_CODE_);

            e_ivm.MasterInformationViewModel_.setFromDAO(mt_dao);

            return(e_ivm);
        }
Exemple #6
0
        public static void removeMasterInfo(string itemCode)
        {
            MATSER_INFO_Table_DAO mt_dao = new MATSER_INFO_Table_DAO();

            mt_dao.KeyColumn_ = itemCode;

            try
            {
                mt_dao.delete(DataBaseConnectManager.ConnectionFactory("myDB"));
            }
            catch (Exception)
            {
                throw;
            }
        }
        public static Excel_instrumentViewModel loadInstrumentVM(string itemCode)
        {
            MATSER_INFO_Table_DAO mt_dao = new MATSER_INFO_Table_DAO();

            mt_dao.ITEM_CODE_ = itemCode;

            mt_dao.select(DataBaseConnectManager.ConnectionFactory("myDB"));

            Excel_instrumentViewModel e_ivm =
                    CodeClassificationGenerator.CreateInstrument(mt_dao.ITEM_CODE_);

            e_ivm.MasterInformationViewModel_.setFromDAO(mt_dao);

            return e_ivm;
        }
        public static void removeMasterInfo(string itemCode)
        {
            MATSER_INFO_Table_DAO mt_dao = new MATSER_INFO_Table_DAO();

            mt_dao.KeyColumn_ = itemCode;

            try
            {
                mt_dao.delete(DataBaseConnectManager.ConnectionFactory("myDB"));
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #9
0
 public void setFromDAO(MATSER_INFO_Table_DAO dao)
 {
     // bussiness logic here
     this.item_code_              = dao.ITEM_CODE_;
     this.item_name_              = dao.ITEM_NAME_;
     this.notional_               = dao.NOTIONAL_;
     this.remain_notional_        = dao.REMAIN_NOTIONAL_;
     this.currency_               = CurrencyViewModel.CreateCurrencyComboViewModel(dao.CURRENCY_);
     this.Trade_date_             = DateTime.ParseExact(dao.TRADE_DATE_, "yyyyMMdd", null);
     this.Maturity_date_          = DateTime.ParseExact(dao.MATURITY_DATE_, "yyyyMMdd", null);
     this.counterparty_           = dao.COUNTERPARTY_;
     this.export_itemcode_        = dao.EXPORT_ITEMCODE_;
     this.trade_id_               = dao.TRADE_ID_;
     this.trade_status_           = dao.TRADE_STATUS_;
     this.instrument_type_        = dao.INSTRUMENT_TYPE_;
     this.underlying_type_        = UnderlyingComboViewModel.CreateContractComboViewModel(dao.UNDERLYING_TYPE_);
     this.underlying_detail_type_ = dao.UNDERLYING_DETAIL_TYPE_;
     this.contract_type_          = ContractComboViewModel.CreateContractComboViewModel(dao.CONTRACT_TYPE_);
     this.contract_subtype_       = ContractSubComboViewModel.CreateContractSubComboViewModel(dao.CONTRACT_SUBTYPE_);
     this.contract_detail_type_   = dao.CONTRACT_DETAIL_TYPE_;
     this.booking_type_           = dao.BOOKING_TYPE_;
 }
Exemple #10
0
        public void bookingMasterInfo()
        {
            MATSER_INFO_Table_DAO dao = this.buildDAO();

            dao.insert(DataBaseConnectManager.ConnectionFactory("myDB"));
        }
        // 메모리에 어디까지 올릴건가
        // 지금은 그냥 db access함
        public void loadMasterInfo(string itemCode)
        {
            MATSER_INFO_Table_DAO mt_dao = new MATSER_INFO_Table_DAO();

            mt_dao.KeyColumn_ = itemCode;

            mt_dao.select(DataBaseConnectManager.ConnectionFactory("myDB"));

            try
            {
                this.setFromDAO(mt_dao);
            }
            catch (Exception)
            {

                OutputLogViewModel.addResult("favor not implemeted");
            }
            
            //DataTable tb = new DataTable();

            //using (SqlCeConnection connection = new SqlCeConnection(connectionStr_))
            //using (SqlCeCommand command = connection.CreateCommand())
            //{

            //    string itemCodeWrap = QueryStr.wrapComma(itemCode);

            //    command.CommandText = "SELECT TRADE_ID, ITEM_CODE , ITEM_NAME , NOTIONAL , TYPE, " +
            //                                " TRADE_DATE , MATURITY_DATE , COUNTERPARTY , EXPORT_ITEMCODE FROM MASTERINFORMATION WHERE ITEM_CODE =" + itemCodeWrap;


            //    connection.Open();
            //    SqlCeDataAdapter dataAdapter = new SqlCeDataAdapter(command.CommandText, connection);

            //    dataAdapter.Fill(tb);
            //}

            //DataRow[] resultRows = tb.Select();

            //string formatString = "yyyyMMdd";

            //foreach (DataRow item in resultRows)
            //{
            //    this.tradeID_ = item["TRADE_ID"].ToString();
            //    this.itemCode_ = item["ITEM_CODE"].ToString();
            //    this.name_ = item["ITEM_NAME"].ToString();
            //    this.notional_ = item["NOTIONAL"].ToString();
            //    this.type_ = item["TYPE"].ToString();
            //    this.tradeDate_ = DateTime.ParseExact(item["TRADE_DATE"].ToString(), formatString,null);
            //    this.maturityDate_ = DateTime.ParseExact(item["MATURITY_DATE"].ToString(), formatString, null);
            //    this.conterParty_ = item["COUNTERPARTY"].ToString();
            //    this.export_ItemCode_ = item["EXPORT_ITEMCODE"].ToString();
            //}

            this.dataContextRefersh();

        }
        public MATSER_INFO_Table_DAO buildDAO()
        {
            // bussiness logic here
            MATSER_INFO_Table_DAO insertDao = new MATSER_INFO_Table_DAO();

            insertDao.ITEM_CODE_ = this.Item_code_;
            insertDao.ITEM_NAME_ = this.Item_name_;
            insertDao.NOTIONAL_ = this.Notional_;
            insertDao.REMAIN_NOTIONAL_ = this.Remain_notional_;
            insertDao.CURRENCY_ =  this.Currency_.CurrencyCode_;
            insertDao.TRADE_DATE_ = this.Trade_date_.ToString("yyyyMMdd");
            insertDao.MATURITY_DATE_ = this.Maturity_date_.ToString("yyyyMMdd");
            insertDao.COUNTERPARTY_ = this.Counterparty_;
            insertDao.EXPORT_ITEMCODE_ = this.Export_itemcode_;
            insertDao.TRADE_ID_ = this.Trade_id_;
            insertDao.TRADE_STATUS_ = this.Trade_status_;
            insertDao.INSTRUMENT_TYPE_ = this.Instrument_type_;
            insertDao.UNDERLYING_TYPE_ = this.Underlying_type_.UnderlyingComboCode_;
            insertDao.UNDERLYING_DETAIL_TYPE_ = this.Underlying_detail_type_;
            insertDao.CONTRACT_TYPE_ = this.Contract_type_.ContractComboCode_;
            insertDao.CONTRACT_SUBTYPE_ = this.Contract_subtype_.ContractSubComboCode_;
            insertDao.CONTRACT_DETAIL_TYPE_ = this.Contract_detail_type_;
            insertDao.BOOKING_TYPE_ = this.Booking_type_;

            return insertDao;
        }
 public void setFromDAO(MATSER_INFO_Table_DAO dao)
 {
     // bussiness logic here
     this.item_code_ = dao.ITEM_CODE_;
     this.item_name_ = dao.ITEM_NAME_;
     this.notional_ = dao.NOTIONAL_;
     this.remain_notional_ = dao.REMAIN_NOTIONAL_;
     this.currency_ = CurrencyViewModel.CreateCurrencyComboViewModel(dao.CURRENCY_);
     this.Trade_date_ = DateTime.ParseExact(dao.TRADE_DATE_, "yyyyMMdd", null);
     this.Maturity_date_ = DateTime.ParseExact(dao.MATURITY_DATE_, "yyyyMMdd", null);
     this.counterparty_ = dao.COUNTERPARTY_;
     this.export_itemcode_ = dao.EXPORT_ITEMCODE_;
     this.trade_id_ = dao.TRADE_ID_;
     this.trade_status_ = dao.TRADE_STATUS_;
     this.instrument_type_ = dao.INSTRUMENT_TYPE_;
     this.underlying_type_ = UnderlyingComboViewModel.CreateContractComboViewModel(dao.UNDERLYING_TYPE_);
     this.underlying_detail_type_ = dao.UNDERLYING_DETAIL_TYPE_;
     this.contract_type_ = ContractComboViewModel.CreateContractComboViewModel(dao.CONTRACT_TYPE_);
     this.contract_subtype_ = ContractSubComboViewModel.CreateContractSubComboViewModel(dao.CONTRACT_SUBTYPE_);
     this.contract_detail_type_ = dao.CONTRACT_DETAIL_TYPE_;
     this.booking_type_ = dao.BOOKING_TYPE_;
     
 }