Exemplo n.º 1
0
        public static Excel_instrumentViewModel CreateInstrument(string itemCode)
        {
            string[] sp = itemCode.Split('_');

            string typeNum = sp[1];

            if (typeNum == "700")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_hifiveViewModel();
                return(e_ivm);
            }
            else if (typeNum == "333")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_fixedBondViewModel();
                return(e_ivm);
            }
            else if (typeNum == "340")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_structuredBondViewModel();
                return(e_ivm);
            }
            else if (typeNum == "444")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_compositeOptionViewModel();
                return(e_ivm);
            }
            else if (typeNum == "450")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_multiAssetCompositeOptionViewModel();
                return(e_ivm);
            }
            else if (typeNum == "600")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_structuredSwapViewModel();
                return(e_ivm);
            }
            else if (typeNum == "700")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_hifiveViewModel();
                return(e_ivm);
            }

            else
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_generalViewModel();
                return(e_ivm);
            }
        }
        //private void loadBookItemList()
        //{ 
        //    // selected book

        //    // load item in book

        //    BookViewModel bvm = new BookViewModel();

        //    //bvm.addTestInstrumentLoad();

        //    this.instrumentListListView_.ItemsSource = bvm.InstrumentList_;
        //}

        //private void TreeViewItem_Selected(object sender, RoutedEventArgs e)
        //{

        //}

        #region MenuEvent

        private void menuBookingItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = e.Source as MenuItem;

            switch (mi.Name.ToUpper())
            {
                case "FIXEDBOND":
                { //do something;
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_fixedBondViewModel(true);
                    this.menuBooking(e_instVM);
                    break;
                }

                case "IRS":
                { //do something;
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_irsViewModel(true);
                    this.menuBooking(e_instVM);
                    break;
                }

                case "CRS":
                { //do something;
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_crsViewModel(true);
                    this.menuBooking(e_instVM);
                    break;
                }

                case "CDS":
                { //do something;
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_cdsViewModel(true);
                    this.menuBooking(e_instVM);
                    break;
                }

                case "TWO":
                { //do something else
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_hifiveViewModel(true);
                    this.menuBooking(e_instVM);
                    break;
                }

                case "HIFIVE":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_hifiveViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }

                case "STEPDOWN2":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_stepDownKICustomViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }

                case "COMPOSITEOPTION":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_compositeOptionViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }
                case "MULTIASSETCOMPOSITEOPTION":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_multiAssetCompositeOptionViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }
                case "GENERAL":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_generalViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }
                case "VANILLAFLOATINGBOND":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_vanillaFloatingBondViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }
                case "FXFORWARD":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_fxForwardViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }
                case "FXSWAP":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_fxSwapViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }
                case "FXEXCHANGE":
                { //something else again
                    Excel_instrumentViewModel e_instVM = new Excel_instrument_fxSpotViewModel(true);

                    this.menuBooking(e_instVM);
                    break;
                }

            }

            
        }
        //private void loadBookItemList()
        //{
        //    // selected book

        //    // load item in book

        //    BookViewModel bvm = new BookViewModel();

        //    //bvm.addTestInstrumentLoad();

        //    this.instrumentListListView_.ItemsSource = bvm.InstrumentList_;
        //}

        //private void TreeViewItem_Selected(object sender, RoutedEventArgs e)
        //{

        //}

        #region MenuEvent

        private void menuBookingItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = e.Source as MenuItem;

            switch (mi.Name.ToUpper())
            {
            case "FIXEDBOND":
            {     //do something;
                Excel_instrumentViewModel e_instVM = new Excel_instrument_fixedBondViewModel(true);
                this.menuBooking(e_instVM);
                break;
            }

            case "IRS":
            {     //do something;
                Excel_instrumentViewModel e_instVM = new Excel_instrument_irsViewModel(true);
                this.menuBooking(e_instVM);
                break;
            }

            case "CRS":
            {     //do something;
                Excel_instrumentViewModel e_instVM = new Excel_instrument_crsViewModel(true);
                this.menuBooking(e_instVM);
                break;
            }

            case "CDS":
            {     //do something;
                Excel_instrumentViewModel e_instVM = new Excel_instrument_cdsViewModel(true);
                this.menuBooking(e_instVM);
                break;
            }

            case "TWO":
            {     //do something else
                Excel_instrumentViewModel e_instVM = new Excel_instrument_hifiveViewModel(true);
                this.menuBooking(e_instVM);
                break;
            }

            case "HIFIVE":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_hifiveViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "STEPDOWN2":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_stepDownKICustomViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "COMPOSITEOPTION":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_compositeOptionViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "MULTIASSETCOMPOSITEOPTION":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_multiAssetCompositeOptionViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "GENERAL":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_generalViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "VANILLAFLOATINGBOND":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_vanillaFloatingBondViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "FXFORWARD":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_fxForwardViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "FXSWAP":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_fxSwapViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }

            case "FXEXCHANGE":
            {     //something else again
                Excel_instrumentViewModel e_instVM = new Excel_instrument_fxSpotViewModel(true);

                this.menuBooking(e_instVM);
                break;
            }
            }
        }
        public static Excel_instrumentViewModel CreateInstrument(string itemCode)
        {
            string[] sp = itemCode.Split('_');

            string typeNum = sp[1];

            if (typeNum == "700")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_hifiveViewModel();
                return e_ivm;
            }
            else if (typeNum == "333")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_fixedBondViewModel();
                return e_ivm;
            }
            else if (typeNum == "340")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_structuredBondViewModel();
                return e_ivm;
            }
            else if (typeNum == "444")  
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_compositeOptionViewModel();
                return e_ivm;
            }
            else if (typeNum == "450")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_multiAssetCompositeOptionViewModel();
                return e_ivm;
            
            }
            else if (typeNum == "600")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_structuredSwapViewModel();
                return e_ivm;
            }
            else if (typeNum == "700")
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_hifiveViewModel();
                return e_ivm;
            }

            else
            {
                Excel_instrumentViewModel e_ivm = new Excel_instrument_generalViewModel();
                return e_ivm;
            }

        }