Beispiel #1
0
        public void SetAttributeProperties(PropertyGridEx.PropertyGridEx pg)
        {
            // Initialize the property grid for attributes.
            bool bReadOnly = true;

            if (pg.Dock == DockStyle.None)
            {
                bReadOnly = false;
            }

            pg.Item.Clear();

            bool dataReadOnly = true;

            if (string.IsNullOrEmpty(m_strPropertyName) || Global.SecurityOperations.CanModifyRawAttributeData(m_strPropertyName))
            {
                dataReadOnly = false;
            }

            pg.Item.Add("Attribute", "AttributeName" + RoadCare3.Properties.Settings.Default.ATTRIBUTE_DEFAULT.ToString(), bReadOnly, "1. Attribute Information", "Data Attribute.", true);

            pg.Item.Add("Native", true, bReadOnly, "3. Database Information", "Native should be set to true if the database is a native RoadCare database.", true);
            pg.Item[pg.Item.Count - 1].Choices = new CustomChoices(trueFalse, false);

            pg.Item.Add("Provider", RoadCare3.Properties.Settings.Default.LAST_DB_TYPE, true, "3. Database Information", "Database Type (MSSQL, ORACLE, MYSQL).", true);
            pg.Item[pg.Item.Count - 1].Choices = new CustomChoices(providers, false);

            pg.Item.Add("Integrated Security", true, true, "3. Database Information", "", true);

            pg.Item.Add("Type", RoadCare3.Properties.Settings.Default.TYPE_DEFAULT, bReadOnly, "1. Attribute Information", "STRING or NUMBER", true);
            pg.Item[pg.Item.Count - 1].Choices = new CustomChoices(types, false);

            pg.Item.Add("Ascending", true, dataReadOnly, "1. Attribute Information", "True if the number gets smaller with deterioration.", true);
            pg.Item[pg.Item.Count - 1].Choices = new CustomChoices(trueFalse, false);

            pg.Item.Add("Connection Type", RoadCare3.Properties.Settings.Default.CONNECTION_TYPE, true, "5. Oracle Database Information", "Oracle Basic or TNS connection type.", true);
            pg.Item[pg.Item.Count - 1].Choices = new CustomChoices(connType, false);

            pg.Item.Add("Server", RoadCare3.Properties.Settings.Default.LAST_DB_SERVER, true, "3. Database Information", "Name of server on which the attribute data resides.", true);
            pg.Item.Add("Database", RoadCare3.Properties.Settings.Default.LAST_DB.ToString(), true, "4. MSSQL Database Information", "Name of the database in which the attribute data resides.", true);
            pg.Item.Add("Network Alias", RoadCare3.Properties.Settings.Default.DBNETWORKALIAS, true, "5. Oracle Database Information", "Name of the Oracle Service", true);
            pg.Item.Add("SID", RoadCare3.Properties.Settings.Default.DBSID, true, "5. Oracle Database Information", "", true);
            pg.Item.Add("Port", RoadCare3.Properties.Settings.Default.DBPORT, true, "5. Oracle Database Information", "", true);
            pg.Item.Add("Login", RoadCare3.Properties.Settings.Default.LAST_LOGIN.ToString(), true, "3. Database Information", "User name.", true);
            pg.Item.Add("Password", RoadCare3.Properties.Settings.Default.LAST_PASSWORD.ToString(), true, "3. Database Information", "User password", true);
            pg.Item["Password"].IsPassword = true;

            pg.Item.Add("View", "", true, "6. View Statement", "Sql string for generating RoadCare specific views on the data server.", true);
            pg.Item[pg.Item.Count - 1].OnClick += this.CustomEventItem_OnClick;

            pg.Item.Add("Grouping", RoadCare3.Properties.Settings.Default.LAST_GROUP.ToString(), dataReadOnly, "1. Attribute Information", "Used to group attributes of similar types.", true);
            pg.Item.Add("Format", RoadCare3.Properties.Settings.Default.LAST_FORMAT.ToString(), dataReadOnly, "1. Attribute Information", "Determines how numeric data appears in the attribute view. (e.g. f1 = 1.0 f2 = 1.00 etc.)", true);
            pg.Item.Add("Maximum", RoadCare3.Properties.Settings.Default.LAST_MAXIMUM.ToString(), dataReadOnly, "1. Attribute Information", "Maximum allowed data value", true);
            pg.Item.Add("Minimum", RoadCare3.Properties.Settings.Default.LAST_MINIMUM.ToString(), dataReadOnly, "1. Attribute Information", "Minimum allowed data value", true);
            pg.Item.Add("Default_Value", RoadCare3.Properties.Settings.Default.LAST_DEFAULT.ToString(), dataReadOnly, "1. Attribute Information", "The default data value to use if no data is present.", true);
            pg.Item.Add("One", RoadCare3.Properties.Settings.Default.LAST_ONE.ToString(), dataReadOnly, "2. Levels", "Defined level breaks and coloring schemes.", true);
            pg.Item.Add("Two", RoadCare3.Properties.Settings.Default.LAST_TWO.ToString(), dataReadOnly, "2. Levels", "Defined level breaks and coloring schemes.", true);
            pg.Item.Add("Three", RoadCare3.Properties.Settings.Default.LAST_THREE.ToString(), dataReadOnly, "2. Levels", "Defined level breaks and coloring schemes.", true);
            pg.Item.Add("Four", RoadCare3.Properties.Settings.Default.LAST_FOUR.ToString(), dataReadOnly, "2. Levels", "Defined level breaks and coloring schemes.", true);
            pg.Item.Add("Five", RoadCare3.Properties.Settings.Default.LAST_FIVE.ToString(), dataReadOnly, "2. Levels", "Defined level breaks and coloring schemes.", true);

            SolutionExplorerTreeNode selectedNode = (SolutionExplorerTreeNode)FormManager.GetSolutionExplorer().GetTreeView().SelectedNode;

            pg.Item.Add("Network Definition Name", selectedNode.NetworkDefinition.NetDefName, true, "1. Attribute Information", "Network definition to which the attribute belongs.", true);
            m_pgProperties = pg;
        }
Beispiel #2
0
        private object CustomEventItem_OnClick(object sender, EventArgs e)
        {
            // open an instance the connect form so the user
            // can define a new connection
            String server              = "";
            String database            = "";
            String userName            = "";
            String password            = "";
            String attributeName       = "";
            String providerName        = "";
            bool   bIntegratedSecurity = true;
            string serviceName         = "";
            string SID  = "";
            string port = "";

            if (m_pgProperties.Item["Server"] != null)
            {
                server = m_pgProperties.Item["Server"].Value.ToString();
            }
            if (m_pgProperties.Item["Database"] != null)
            {
                database = m_pgProperties.Item["Database"].Value.ToString();
            }
            if (m_pgProperties.Item["Login"] != null)
            {
                userName = m_pgProperties.Item["Login"].Value.ToString();
            }
            if (m_pgProperties.Item["Password"] != null)
            {
                password = m_pgProperties.Item["Password"].Value.ToString();
            }
            if (m_pgProperties.Item["Attribute"] != null)
            {
                attributeName = m_pgProperties.Item["Attribute"].Value.ToString();
            }
            if (m_pgProperties.Item["Provider"] != null)
            {
                providerName = m_pgProperties.Item["Provider"].Value.ToString();
            }
            if (m_pgProperties.Item["Integrated Security"] != null)
            {
                bIntegratedSecurity = Convert.ToBoolean(m_pgProperties.Item["Integrated Security"].Value.ToString());
            }
            if (m_pgProperties.Item["Service Name"] != null)
            {
                serviceName = m_pgProperties.Item["Service Name"].Value.ToString();
            }
            if (m_pgProperties.Item["SID"] != null)
            {
                SID = m_pgProperties.Item["SID"].Value.ToString();
            }
            if (m_pgProperties.Item["Port"] != null)
            {
                port = m_pgProperties.Item["Port"].Value.ToString();
            }
            frmConnect f = new frmConnect(server, database, bIntegratedSecurity, SID, serviceName, port, userName, password, providerName, attributeName);

            if (f.ShowDialog() == DialogResult.OK)
            {
                f.Close();
                SolutionExplorerTreeNode selectedNode = (SolutionExplorerTreeNode)FormManager.GetSolutionExplorer().GetTreeView().SelectedNode;
                NetworkDefinition        currNetDef   = selectedNode.NetworkDefinition;
                frmDataDisplay           SQLDataView  = new frmDataDisplay(server, database, userName, password, attributeName, providerName, currNetDef.NetDefName);
                if (SQLDataView.ShowDialog() == DialogResult.OK)
                {
                    String view = SQLDataView.View;
                    viewSelectStatement = SQLDataView.ViewSelectStatement;
                    SQLDataView.Close();
                    return(viewSelectStatement);
                }
            }
            return("");
        }