Esempio n. 1
0
        private void cbConnection_SelectedIndexChanged(object sender, EventArgs e)
        {
            var config = (sender as ComboBox).SelectedItem as ConfigValue;

            if (config != null)
            {
                //using a hack to open the XML file instead of the connection.
                if (String.IsNullOrEmpty(config.EndpointAddress))
                {
                    if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
                    {
                        BusinessRules businessRules;

                        try
                        {
                            businessRules = MDSWrapper.BusinessRuleDeserialize(openFileDialog1.FileName);
                        }
                        catch (MDSManagerException exc)
                        {
                            MessageBox.Show(exc.Message);
                            return;
                        }
                        var dataSet = MDSDataUtils.NewBusinessRuleDataTable();
                        foreach (BusinessRule businessRule in businessRules.BusinessRulesMember)
                        {
                            MDSDataUtils.NewBRDataRow(dataSet, businessRule);
                        }
                        if ((sender as ComboBox) == cbConnection.ComboBox)
                        {
                            dgRules.DataSource = dataSet;
                        }
                        if ((sender as ComboBox) == cbConnection2.ComboBox)
                        {
                            businessRules2 = businessRules;

                            dgRules2.DataSource = dataSet;
                        }
                    }
                }
                else
                {
                    MDSWrapper.Configuration = config;
                    RefreshPermissionsList(sender);
                }
            }
        }