Esempio n. 1
0
        public void AddOption(object obj)
        {
            bool correctOption;

            typeWarningLabel.Visibility  = Visibility.Hidden;
            priceWarningLabel.Visibility = Visibility.Hidden;
            dateWarningLabel.Visibility  = Visibility.Hidden;
            existWarningLabel.Visibility = Visibility.Hidden;

            correctOption = CheckButtons();
            correctOption = CheckPrice() && correctOption;
            correctOption = CheckDate() && correctOption;


            if (correctOption)
            {
                OptionContract.Type optionType;
                if (PutButton)
                {
                    optionType = OptionContract.Type.Put;
                }
                else
                {
                    optionType = OptionContract.Type.Call;
                }
                double   Strike   = Convert.ToDouble(priceTextbox);
                DateTime Maturity = (DateTime)maturityDate;

                OptionContract optionContract = new OptionContract(optionType, 1, Strike, Maturity);
                if (CheckExist(optionContract))
                {
                    dataReceiver.AddOptionToPricer(optionContract);
                }

                this.Close(obj);
            }
        }