private void InitConnection()
        {
            var objConnection = ConnectionController.GetConnection(ConnectionId);

            // load from database
            Connection = objConnection;
        }
Esempio n. 2
0
        private void BindConnection()
        {
            Localization.LocalizeDataGrid(ref dgConnection, LocalResourceFile);

            var objConnectionList       = default(ArrayList);
            var objConnectionController = new ConnectionController();

            objConnectionList = objConnectionController.ListConnection(PortalId, false, false);

            // bind
            dgConnection.DataSource = objConnectionList;
            dgConnection.DataBind();
        }
        private string ExportConnection(PortalSettings portalSettings)
        {
            var ctrl = new ConnectionController();
            var al   = ctrl.ListConnection(Convert.ToInt32(portalSettings.PortalId), false, false);
            var info = default(ConnectionInfo);
            var s    = "<connections>";

            for (var i = 0; i <= al.Count - 1; i++)
            {
                info = (ConnectionInfo)(al[i]);
                s   += "<connection>";
                s   += "<id>" + XmlUtils.XMLEncode(info.ConnectionId.ToString()) + "</id>";
                s   += "<name>" + XmlUtils.XMLEncode(info.ConnectionName) + "</name>";
                s   += "<string>" + XmlUtils.XMLEncode(info.ConnectionString) + "</string>";
                s   += "</connection>";
            }
            s += "</connections>";

            return(s);
        }
        private int ImportConnection(string connectionName, string connectionString)
        {
            var portalSettings = (PortalSettings)(HttpContext.Current.Items["PortalSettings"]);

            var ctrl = new ConnectionController();

            // see if we can find the connection string and return the id
            var connections = ctrl.ListConnection(Convert.ToInt32(portalSettings.PortalId), false, false);

            foreach (ConnectionInfo info in connections)
            {
                if (info.ConnectionString == connectionString)
                {
                    return(info.ConnectionId);
                }
            }

            // we'll have to make a new one
            var connectionId = default(int);

            connectionId = ctrl.UpdateConnection(Convert.ToInt32(portalSettings.PortalId), -1, connectionName, connectionString);

            return(connectionId);
        }
        private void SaveConnection()
        {
            var objConnectionController = new ConnectionController();

            ConnectionId = objConnectionController.UpdateConnection(PortalId, ConnectionId, txtName.Text, txtConnectionString.Text);
        }
Esempio n. 6
0
        // connection
        private void DeleteConnection(int ConnectionId)
        {
            var objConnectionController = new ConnectionController();

            objConnectionController.DeleteConnection(ConnectionId);
        }
        protected void cmdQueryTest_Click(object sender, EventArgs e)
        {
            var msg     = "";
            var isValid = Convert.ToBoolean(Services.Data.Query.IsQueryValid(txtQuery.Text, ConnectionController.GetConnectionString(Convert.ToInt32(cpConnection.ConnectionId), ReportSetId), ref msg));

            lblQueryTestResults.Text     = msg;
            lblQueryTestResults.CssClass = "NormalGreen";
            if (!isValid)
            {
                lblQueryTestResults.CssClass = "NormalRed";
            }
        }
        protected void vldQuery_ServerValidate(Object source, ServerValidateEventArgs args)
        {
            var msg = "";

            args.IsValid          = Convert.ToBoolean(Services.Data.Query.IsQueryValid(txtQuery.Text, ConnectionController.GetConnectionString(Convert.ToInt32(cpConnection.ConnectionId), ReportSetId), ref msg));
            vldQuery.ErrorMessage = msg;
        }