示例#1
0
        } // end of CreateUserSession

        /// <summary>
        /// Creates a Admin Session
        /// </summary>
        private void CreateAdminSession()
        {
            // create and initialize admin session object
            cqAdminSession = CQWrapper.CreateAdminSession();
            Logger.WritePerf(LogSource.CQ, "Connecting to CQ Admin Session");
            CQWrapper.AdminLogon(cqAdminSession, m_user, m_pwd, m_dbSet, m_configFile);
            Logger.WritePerf(LogSource.CQ, "Connected to CQ Admin Session");
            OAdUser cqUser = CQWrapper.GetUser(cqAdminSession, m_user);

            try
            {
                if (!CQWrapper.IsSuperUser(cqUser))
                {
                    string errMsg = UtilityMethods.Format(CQResource.CQ_NO_ADMIN_RIGHT,
                                                          CurConResource.Analysis,
                                                          m_configFile);
                    Logger.Write(LogSource.CQ, TraceLevel.Error, errMsg);
                    ConverterMain.MigrationReport.WriteIssue(String.Empty,
                                                             errMsg, string.Empty /* no item */, null, "Config", ReportIssueType.Critical);

                    throw new ConverterException(errMsg);
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                string errMsg = UtilityMethods.Format(CQResource.CQ_NO_ADMIN_RIGHT, m_configFile);
                Logger.WriteException(LogSource.CQ, ex);
                Logger.Write(LogSource.CQ, TraceLevel.Error, errMsg);
                ConverterMain.MigrationReport.WriteIssue(String.Empty, errMsg, string.Empty /* no item */,
                                                         null, "Config", ReportIssueType.Critical);

                throw new ConverterException(errMsg);
            }
        } // end of CreateAdminSession