コード例 #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);
            }
        }
コード例 #2
0
        public static void ConvertToNew(string aFile)
        {
            CSecurityData lNewDoc = CSecurityData.CreateNew();
            XmlDocument   lOldDoc = new XmlDocument();

            lOldDoc.Load(aFile);
            XmlNode lRootNode = XmlTools.getXmlNodeByName("ReportSmartSecurity", lOldDoc);

            foreach (XmlNode iNode in lRootNode)
            {
                CSecurityNode iSecNode = CSecurityData.AddSecNode(
                    lNewDoc,
                    XmlTools.GetAttrib(iNode, "datasource"),
                    iNode.Name
                    );
                iSecNode.UserName = XmlTools.GetAttrib(iNode, "userid");
                iSecNode.Password = XmlTools.GetAttrib(iNode, "passwd");
            }
            lNewDoc.Save(aFile);
        }