Example #1
0
        /// <summary>
        /// Returns true, if connection logon accepted by user, owtherwise false.
        /// If user requires the authentication info also stored
        /// </summary>
        /// <param name="aConnectionInfo">The connection info</param>
        /// <returns>True if dialog accepted, false if not</returns>
        protected bool ShowAuthDialog(string aConnectionName, InternalConnectionInfo aConnectionInfo)
        {
            dlgSetupLogin.ConnectionName = aConnectionName;

            if (dlgSetupLogin.ShowDialog() == DialogResult.OK)
            {
                if (dlgSetupLogin.Authenticate)
                {
                    aConnectionInfo.SetLogon(dlgSetupLogin.UserName, dlgSetupLogin.Password);
                }

                switch (dlgSetupLogin.SaveMode)
                {
                case TLogonInfoSave.lisSaveForDataSource:
                    if (dlgSetupLogin.Authenticate)
                    {
                        CSecurityData.AddSecNode(
                            RsViewEngine.RSSecurity,
                            dlgSetupLogin.ConnectionName,
                            "DatasourceSecurity",
                            dlgSetupLogin.UserName,
                            dlgSetupLogin.Password
                            );
                        RsViewEngine.SaveSecurity();
                    }
                    break;

                case TLogonInfoSave.lisSaveForReport:
                    if (dlgSetupLogin.Authenticate)
                    {
                        CSecurityData.AddSecNode(
                            RsViewEngine.RSSecurity,
                            dlgSetupLogin.ConnectionName,
                            "report",
                            dlgSetupLogin.UserName,
                            dlgSetupLogin.Password,
                            _RptFile
                            );
                        RsViewEngine.SaveSecurity();
                    }
                    break;
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// Returns true, if connection logon accepted by user, owtherwise false.
        /// If user requires the authentication info also stored
        /// </summary>
        /// <param name="aConnectionInfo">The connection info</param>
        /// <returns>True if dialog accepted, false if not</returns>
        protected bool ShowAuthDialog(string aConnectionName, InternalConnectionInfo aConnectionInfo)
        {
            dlgSetupLogin.ConnectionName = aConnectionName;

            if (dlgSetupLogin.ShowDialog() == DialogResult.OK)
            {

                if (dlgSetupLogin.Authenticate)
                    aConnectionInfo.SetLogon(dlgSetupLogin.UserName, dlgSetupLogin.Password);

                switch (dlgSetupLogin.SaveMode)
                {
                    case TLogonInfoSave.lisSaveForDataSource:
                        if (dlgSetupLogin.Authenticate)
                        {
                            CSecurityData.AddSecNode(
                                        RsViewEngine.RSSecurity,
                                        dlgSetupLogin.ConnectionName,
                                        "DatasourceSecurity",
                                        dlgSetupLogin.UserName,
                                        dlgSetupLogin.Password
                                    );
                            RsViewEngine.SaveSecurity();
                        }
                        break;
                    case TLogonInfoSave.lisSaveForReport:
                        if (dlgSetupLogin.Authenticate)
                        {
                            CSecurityData.AddSecNode(
                                        RsViewEngine.RSSecurity,
                                        dlgSetupLogin.ConnectionName,
                                        "report",
                                        dlgSetupLogin.UserName,
                                        dlgSetupLogin.Password,
                                        _RptFile
                                    );
                            RsViewEngine.SaveSecurity();
                        }
                        break;
                }

                return true;

            }
            else
                return false;
        }