public Ratings()
        {
            InitializeComponent();
            InitializeCustomComponents();
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(Rating.GetDefaultValue());
            tableUtility.CreateTable(RatingAgency.GetDefaultValue());
            ratingAgenciesRowIndex = 0;
            LoadRatingAgencies();
        }
        private void LoadFundTable()
        {
            FormUtility.GetBindingSource(dataGridFunds).Clear();
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(Currency.GetDefaultValue());
            tableUtility.CreateTable(Fund.GetDefaultValue());
            List <Fund> fundList = tableUtility.ConvertRangesToObjects <Fund>(tableUtility.ReadAllRows(Fund.GetDefaultValue()));

            foreach (Fund fund in fundList)
            {
                FormUtility.GetBindingSource(dataGridFunds).Add(fund);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Implementation of <see cref="IPassedObject{T}"/>
        ///
        /// Takes the newly created <see cref="DurationRecord"/>, persists it and adds it to the DataGridView.
        /// </summary>
        /// <param name="obj">Passed DurationRecord</param>
        public void OnSubmit(DurationRecord obj)
        {
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(DurationRecord.GetDefaultValue());
            tableUtility.InsertTableRow(obj);
            FormUtility.GetBindingSource(dataGridView).Add(obj);
        }
Esempio n. 4
0
        public Rule InvokeSubmission(RuleKind ruleKind)
        {
            Rule         rule         = new Rule(ruleKind, textBoxName.Text);
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(rule);
            tableUtility.InsertTableRow(rule);
            return(rule);
        }
Esempio n. 5
0
        public UserControlBanListCountries(BanList <Country> passedRule)
        {
            this.passedRule = passedRule;
            InitializeComponent();
            InitializeCustomComponents();
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(Country.GetDefaultValue());
            InitializePassedRule();
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        public UserControlAllowListAssets(AllowList passedRule = null)
        {
            this.passedRule = passedRule;
            InitializeComponent();
            InitializeCustomComponents();
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(Asset.GetDefaultValue());
            InitializePassedRule();
        }
Esempio n. 7
0
        private void AddCurrency(string currencyIsoCode)
        {
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(Currency.GetDefaultValue());
            Currency currency = new Currency
            {
                IsoCode = currencyIsoCode
            };

            tableUtility.InsertTableRow(currency);
            FormUtility.GetBindingSource(dataGridViewCurrencies).Add(currency);
        }
Esempio n. 8
0
        private void AddAssetClass(string assetClassName)
        {
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(AssetClass.GetDefaultValue());
            AssetClass assetClass = new AssetClass
            {
                Name = assetClassName
            };

            tableUtility.InsertTableRow(assetClass);
            FormUtility.GetBindingSource(dataGridViewAssetClasses).Add(assetClass);
        }
        private bool MergeAssetAllocation()
        {
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(AssetAllocationEntry.GetDefaultValue());
            CalcTotals();
            if (totalRow != 100 || totalCol != 100)
            {
                MessageBox.Show("Gesamttotal muss 100% sein.");
                return(false);
            }
            for (int col = 1; col < tableLayoutPanelAA.ColumnCount - 1; col++)
            {
                for (int row = 1; row < tableLayoutPanelAA.RowCount - 1; row++)
                {
                    FlowLayoutPanel panel = tableLayoutPanelAA.GetControlFromPosition(col, row) as FlowLayoutPanel;
                    double[]        assetAllocationRange = new double[3];

                    for (int i = 0; i < 3; i++)
                    {
                        bool parsingSuccessful = double.TryParse(panel.Controls[i].Text, out double value);
                        if (!parsingSuccessful)
                        {
                            value = 0;
                        }
                        assetAllocationRange[i] = value;
                    }

                    try
                    {
                        AssetAllocationEntry entry = panel.DataBindings[0].DataSource as AssetAllocationEntry;
                        tableUtility.MergeTableRow(entry);
                    }
                    catch (ArgumentOutOfRangeException)
                    {
                        AssetAllocationEntry assetAllocationEntry = new AssetAllocationEntry
                        {
                            AssetClass        = tableLayoutPanelAA.GetControlFromPosition(col, 0).DataBindings[0].DataSource as AssetClass,
                            Currency          = tableLayoutPanelAA.GetControlFromPosition(0, row).DataBindings[0].DataSource as Currency,
                            StrategicMinValue = assetAllocationRange[0],
                            StrategicOptValue = assetAllocationRange[1],
                            StrategicMaxValue = assetAllocationRange[2],
                            Fund = fund
                        };
                        tableUtility.InsertTableRow(assetAllocationEntry);
                    }
                }
            }
            return(true);
        }
        public void OnSubmit(List <string> passedValue = null, string reference = null)
        {
            TableUtility tableUtility = new TableUtility();

            switch (reference)
            {
            case "asset_kind":
                tableUtility.CreateTable(AssetKind.GetDefaultValue());
                AssetKind newAssetKind = new AssetKind(passedValue[0]);
                tableUtility.InsertTableRow(newAssetKind);
                FormUtility.GetBindingSource(dataGridView).Add(newAssetKind);
                break;

            case "asset_kind_edit":
                selectedAssetKind.Description = passedValue[0];
                tableUtility.MergeTableRow(selectedAssetKind);
                break;
            }
        }
        public Rule InvokeSubmission(RuleKind ruleKind)
        {
            if (passedRule != null)
            {
                passedRule.Name = ruleName.Text;
                BindingList <AssetKind> changedBanList = (BindingList <AssetKind>)FormUtility.GetBindingSource(dataGridView).List;
                passedRule.Banned = changedBanList.ToList();
                return(passedRule);
            }
            BanList <AssetKind> newBanList = new BanList <AssetKind>(RuleKind.RESTRICTED_INSTRUMENT_TYPE, ruleName.Text);

            foreach (DataGridViewRow row in dataGridView.Rows)
            {
                newBanList.Banned.Add(row.DataBoundItem as AssetKind);
            }
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(newBanList);
            tableUtility.InsertTableRow(newBanList);
            return(newBanList);
        }
        /// <summary>
        /// Implementation of <see cref="IRuleUserControl"/>
        /// </summary>
        /// <param name="ruleKind">Selected <see cref="RuleKind"/></param>
        /// <returns>Newly created rule, in that case an <see cref="AllowList"/></returns>
        public Rule InvokeSubmission(RuleKind ruleKind)
        {
            if (passedRule != null)
            {
                passedRule.Name = ruleName.Text;
                BindingList <Asset> changedAllowList = (BindingList <Asset>)FormUtility.GetBindingSource(dataGridView).List;
                passedRule.Allowed = changedAllowList.ToList();
                return(passedRule);
            }
            AllowList newAllowList = new AllowList(RuleKind.RULE_EXCEPTION, ruleName.Text);

            foreach (DataGridViewRow row in dataGridView.Rows)
            {
                newAllowList.Allowed.Add(row.DataBoundItem as Asset);
            }
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(newAllowList);
            tableUtility.InsertTableRow(newAllowList);
            return(newAllowList);
        }
        /// <summary>
        /// Implementation of <see cref="IRuleUserControl"/>. This method is called by the parent form
        /// for invoking the addition of a new rule.
        /// </summary>
        /// <param name="ruleKind"><see cref="RuleKind"/></param>
        /// <returns>New <see cref="Rule"/></returns>
        public Rule InvokeSubmission(RuleKind ruleKind)
        {
            bool parsingSuccessful = double.TryParse(textBoxValue.Text, out double value);

            if (!parsingSuccessful)
            {
                MessageBox.Show("Bitte eine gültige Zahl eingeben.");
                return(null);
            }
            if (passedRule != null)
            {
                passedRule.Name         = textBoxDescription.Text;
                passedRule.NumericValue = value;
                return(passedRule);
            }
            TableUtility tableUtility = new TableUtility();
            Rule         newRule      = new NumericRule(value, ruleKind, textBoxDescription.Text);

            tableUtility.CreateTable(newRule);
            tableUtility.InsertTableRow(newRule);
            return(newRule);
        }
        public Rule InvokeSubmission(RuleKind ruleKind)
        {
            bool parsingSuccessfulRatingClass  = double.TryParse(textBoxRatingClass.Text, out double ratingClass);
            bool parsingSuccessfulNumericValue = double.TryParse(textBoxNumericValue.Text, out double numericValue);

            if (!parsingSuccessfulNumericValue || !parsingSuccessfulRatingClass)
            {
                MessageBox.Show("Bitte eine gültige Zahl eingeben.");
                return(null);
            }
            if (passedRule != null)
            {
                passedRule.Name        = textBoxName.Text;
                passedRule.MaxRatio    = numericValue;
                passedRule.RatingClass = ratingClass;
                return(passedRule);
            }
            RatingQuoteRule newRatingQuoteRule = new RatingQuoteRule(ratingClass, numericValue, RuleKind.MAX_RATING_RATIO, textBoxName.Text);
            TableUtility    tableUtility       = new TableUtility();

            tableUtility.CreateTable(newRatingQuoteRule);
            tableUtility.InsertTableRow(newRatingQuoteRule);
            return(newRatingQuoteRule);
        }