Exemple #1
0
        public void PopulateConfig(bool isServer)
        {
            ConfigViewModelS     serverSourceModel = (ConfigViewModelS)ViewModelPtrs[(int)ViewType.SVRSRC];
            ConfigViewModelSDest serverDestModel   = (ConfigViewModelSDest)ViewModelPtrs[(int)ViewType.SVRDEST];
            ConfigViewModelU     userSourceModel   = (ConfigViewModelU)ViewModelPtrs[(int)ViewType.USRSRC];
            ConfigViewModelUDest userDestModel     = (ConfigViewModelUDest)ViewModelPtrs[(int)ViewType.USRDEST];
            OptionsViewModel     optionsModel      = (OptionsViewModel)ViewModelPtrs[(int)ViewType.OPTIONS];
            UsersViewModel       usersModel        = (UsersViewModel)ViewModelPtrs[(int)ViewType.USERS];

            m_config.SourceServer.Profile = "";
            if (isServer)
            {
                int sel = serverSourceModel.CurrentProfileSelection;
                if (sel != -1)
                {
                    if (serverSourceModel.ProfileList.Count > 0)
                    {
                        m_config.SourceServer.Profile = serverSourceModel.ProfileList[sel];
                    }
                }
                m_config.SourceServer.Hostname   = serverSourceModel.MailServerHostName;
                m_config.SourceServer.AdminID    = serverSourceModel.MailServerAdminID;
                m_config.SourceServer.AdminPwd   = serverSourceModel.MailServerAdminPwd;
                m_config.SourceServer.UseProfile = serverSourceModel.Isprofile;
                m_config.ZimbraServer.Hostname   = serverDestModel.ZimbraServerHostName;
                m_config.ZimbraServer.Port       = serverDestModel.ZimbraPort;
                m_config.ZimbraServer.AdminID    = serverDestModel.ZimbraAdmin;
                m_config.ZimbraServer.AdminPwd   = serverDestModel.ZimbraAdminPasswd;
                m_config.ZimbraServer.UseSSL     = serverDestModel.ZimbraSSL;

                // FBS bug 73500 -- 5/18/12
                if (usersModel.ZimbraDomain.Length == 0)
                {
                    if (usersModel.DomainsFilledIn)
                    {
                        m_config.UserProvision.DestinationDomain = usersModel.DomainList[usersModel.CurrentDomainSelection];
                    }
                    else
                    if (savedDomain != null)
                    {
                        if (savedDomain.Length > 0)
                        {
                            m_config.UserProvision.DestinationDomain = savedDomain;
                        }
                    }
                }
                else
                {
                    m_config.UserProvision.DestinationDomain = usersModel.ZimbraDomain;
                }
                //
            }
            else
            {
                int sel = userSourceModel.CurrentProfileSelection;
                if (sel != -1)
                {
                    if (userSourceModel.ProfileList.Count > 0)
                    {
                        m_config.SourceServer.Profile = userSourceModel.ProfileList[sel];
                    }
                }
                m_config.SourceServer.DataFile     = userSourceModel.PSTFile;
                m_config.SourceServer.UseProfile   = userSourceModel.Isprofile;
                m_config.ZimbraServer.Hostname     = userDestModel.ZimbraServerHostName;
                m_config.ZimbraServer.Port         = userDestModel.ZimbraPort;
                m_config.ZimbraServer.UserAccount  = userDestModel.ZimbraUser;
                m_config.ZimbraServer.UserPassword = userDestModel.ZimbraUserPasswd;
            }
            m_config.GeneralOptions.LogLevel                = optionsModel.LogLevel;
            m_config.GeneralOptions.Verbose                 = optionsModel.LoggingVerbose;
            m_config.GeneralOptions.MaxThreadCount          = optionsModel.MaxThreadCount;
            m_config.GeneralOptions.MaxErrorCount           = optionsModel.MaxErrorCount;
            m_config.ImportOptions.Mail                     = optionsModel.ImportMailOptions;
            m_config.ImportOptions.Calendar                 = optionsModel.ImportCalendarOptions;
            m_config.ImportOptions.Contacts                 = optionsModel.ImportContactOptions;
            m_config.ImportOptions.DeletedItems             = optionsModel.ImportDeletedItemOptions;
            m_config.ImportOptions.Junk                     = optionsModel.ImportJunkOptions;
            m_config.ImportOptions.Tasks                    = optionsModel.ImportTaskOptions;
            m_config.ImportOptions.Sent                     = optionsModel.ImportSentOptions;
            m_config.ImportOptions.Rules                    = optionsModel.ImportRuleOptions;
            m_config.ImportOptions.OOO                      = optionsModel.ImportOOOOptions;
            m_config.AdvancedImportOptions.IsOnOrAfter      = optionsModel.IsOnOrAfter;
            m_config.AdvancedImportOptions.MigrateOnOrAfter =
                (optionsModel.IsOnOrAfter) ? DateTime.Parse(optionsModel.MigrateONRAfter)
            : DateTime.Now.AddMonths(-3);
            m_config.AdvancedImportOptions.IsSkipPrevMigratedItems = optionsModel.IsSkipPrevMigratedItems;
            m_config.AdvancedImportOptions.IsMaxMessageSize        = optionsModel.IsMaxMessageSize;
            m_config.AdvancedImportOptions.MaxMessageSize          =
                (optionsModel.IsMaxMessageSize) ? optionsModel.MaxMessageSize
            : "";
            m_config.AdvancedImportOptions.DateFilterItem = optionsModel.DateFilterItem;

            m_config.AdvancedImportOptions.SpecialCharReplace = optionsModel.SpecialCharReplace;
            m_config.AdvancedImportOptions.CSVDelimiter       = optionsModel.CSVDelimiter;
            m_config.AdvancedImportOptions.LangID             = optionsModel.LangID;
            m_config.AdvancedImportOptions.IsPublicFolders    = optionsModel.IsPublicFolders;
            // deal with skip folders
            m_config.AdvancedImportOptions.IsSkipFolders = optionsModel.IsSkipFolders;
            if (optionsModel.IsSkipFolders)
            {
                if (optionsModel.FoldersToSkip != null)
                {
                    if (optionsModel.FoldersToSkip.Length > 0)
                    {
                        string[] nameTokens = optionsModel.FoldersToSkip.Split(',');
                        int      numToSkip  = nameTokens.Length;
                        if (m_config.AdvancedImportOptions.FoldersToSkip == null)
                        {
                            m_config.AdvancedImportOptions.FoldersToSkip = new Folder[numToSkip];
                        }
                        for (int i = 0; i < numToSkip; i++)
                        {
                            Folder folder = new Folder();
                            folder.FolderName = nameTokens.GetValue(i).ToString();
                            m_config.AdvancedImportOptions.FoldersToSkip[i] = folder;
                        }
                    }
                }
            }
            else
            {
                m_config.AdvancedImportOptions.FoldersToSkip = null;
            }
        }
Exemple #2
0
        public void PopulateConfigForSaving(bool isServer)
        // Called from from ViewModel Save() methods to populate m_config before serializing to disk
        {
            using (LogBlock logblock = Log.NotTracing()?null: new LogBlock(GetType() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name))
            {
                // Get ptr to each page from ViewModelPtrs
                ConfigViewModelS     serverSourceModel = (ConfigViewModelS)ViewModelPtrs[(int)ViewType.SVRSRC];
                ConfigViewModelSDest serverDestModel   = (ConfigViewModelSDest)ViewModelPtrs[(int)ViewType.SVRDEST];

                ConfigViewModelU     userSourceModel = (ConfigViewModelU)ViewModelPtrs[(int)ViewType.USRSRC];
                ConfigViewModelUDest userDestModel   = (ConfigViewModelUDest)ViewModelPtrs[(int)ViewType.USRDEST];

                OptionsViewModel  optionsModel  = (OptionsViewModel)ViewModelPtrs[(int)ViewType.OPTIONS];
                UsersViewModel    usersModel    = (UsersViewModel)ViewModelPtrs[(int)ViewType.USERS];
                ScheduleViewModel scheduleModel = (ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED];

                m_config.GeneralOptions.SchemaVersion = 1; // Schema version - increment if you change any of the options
                m_config.SourceServer.Profile         = "";

                if (isServer)
                {
                    // ==============================================================
                    // Server Migration
                    // ==============================================================
                    m_config.GeneralOptions.MigType = 1;

                    // ------------------------------
                    // SourceServer
                    // ------------------------------
                    int sel = serverSourceModel.CurrentProfileSelection;
                    if (sel != -1)
                    {
                        if (serverSourceModel.ProfileList.Count > 0)
                        {
                            m_config.SourceServer.Profile = serverSourceModel.ProfileList[sel];
                        }
                    }

                    m_config.SourceServer.Hostname   = serverSourceModel.MailServerHostName;
                    m_config.SourceServer.AdminID    = serverSourceModel.MailServerAdminID;
                    m_config.SourceServer.AdminPwd   = serverSourceModel.MailServerAdminPwd;
                    m_config.SourceServer.UseProfile = serverSourceModel.Isprofile;

                    // ------------------------------
                    // ZimbraServer (= dest server)
                    // ------------------------------
                    m_config.ZimbraServer.Hostname = serverDestModel.ZimbraServerHostName;
                    m_config.ZimbraServer.Port     = serverDestModel.ZimbraPort;
                    m_config.ZimbraServer.AdminID  = serverDestModel.ZimbraAdmin;
                    m_config.ZimbraServer.AdminPwd = serverDestModel.ZimbraAdminPasswd;
                    m_config.ZimbraServer.UseSSL   = serverDestModel.ZimbraSSL;


                    // ------------------------------
                    // UserProvision
                    // ------------------------------

                    // FBS bug 73500 -- 5/18/12
                    if (usersModel.ZimbraDomain.Length == 0)
                    {
                        if (usersModel.DomainsFilledIn)
                        {
                            m_config.UserProvision.DestinationDomain = usersModel.DomainList[usersModel.CurrentDomainSelection];
                            m_config.UserProvision.COS = scheduleModel.CosList[scheduleModel.CurrentCOSSelection].CosName;
                        }
                        else
                        if (savedDomain != null)
                        {
                            if (savedDomain.Length > 0)
                            {
                                m_config.UserProvision.DestinationDomain = savedDomain;
                            }
                        }
                    }
                    else
                    {
                        m_config.UserProvision.DestinationDomain = usersModel.ZimbraDomain;
                        m_config.UserProvision.COS = scheduleModel.COS;
                    }
                }
                else
                {
                    // ==============================================================
                    // User Migration (or ZD)
                    // ==============================================================
                    m_config.GeneralOptions.MigType = 2;

                    // ------------------------------
                    // SourceServer
                    // ------------------------------
                    int sel = userSourceModel.CurrentProfileSelection;
                    if (sel != -1)
                    {
                        if (userSourceModel.ProfileList.Count > 0)
                        {
                            m_config.SourceServer.Profile = userSourceModel.ProfileList[sel];
                        }
                    }

                    m_config.SourceServer.DataFile   = userSourceModel.PSTFile;
                    m_config.SourceServer.UseProfile = userSourceModel.Isprofile;

                    // ------------------------------
                    // ZimbraServer (= dest server)
                    // ------------------------------
                    m_config.ZimbraServer.Hostname     = userDestModel.ZimbraServerHostName;
                    m_config.ZimbraServer.Port         = userDestModel.ZimbraPort;
                    m_config.ZimbraServer.UserAccount  = userDestModel.ZimbraUser;
                    m_config.ZimbraServer.UserPassword = userDestModel.ZimbraUserPasswd;
                    m_config.ZimbraServer.UseSSL       = userDestModel.ZimbraSSL;
                }

                /*
                 * DCB - Where is the block for ZD settings?!
                 */


                // ==============================================================
                // Common to Server and User migration
                // ==============================================================


                // ------------------------------
                // GeneralOptions
                // ------------------------------
                m_config.GeneralOptions.LogLevel = Log.GlobalLogLevel.ToString();

                m_config.GeneralOptions.MaxThreadCount = optionsModel.MaxThreadCount;
                m_config.GeneralOptions.MaxErrorCount  = optionsModel.MaxErrorCount;

                // ------------------------------
                // ImportOptions
                // ------------------------------
                m_config.ImportOptions.Mail         = optionsModel.ImportMailOptions;
                m_config.ImportOptions.Calendar     = optionsModel.ImportCalendarOptions;
                m_config.ImportOptions.Contacts     = optionsModel.ImportContactOptions;
                m_config.ImportOptions.DeletedItems = optionsModel.ImportDeletedItemOptions;
                m_config.ImportOptions.Junk         = optionsModel.ImportJunkOptions;
                m_config.ImportOptions.Tasks        = optionsModel.ImportTaskOptions;
                m_config.ImportOptions.Sent         = optionsModel.ImportSentOptions;
                m_config.ImportOptions.Rules        = optionsModel.ImportRuleOptions;
                m_config.ImportOptions.OOO          = optionsModel.ImportOOOOptions;

                // ------------------------------
                // AdvancedImportOptions
                // ------------------------------
                m_config.AdvancedImportOptions.IsOnOrAfter      = optionsModel.IsOnOrAfter;
                m_config.AdvancedImportOptions.MigrateOnOrAfter = (optionsModel.IsOnOrAfter) ? DateTime.Parse(optionsModel.MigrateONRAfter) : DateTime.Now.AddMonths(-3);

                m_config.AdvancedImportOptions.IsSkipPrevMigratedItems = optionsModel.IsSkipPrevMigratedItems;

                m_config.AdvancedImportOptions.IsMaxMessageSize = optionsModel.IsMaxMessageSize;
                m_config.AdvancedImportOptions.MaxMessageSize   = (optionsModel.IsMaxMessageSize) ? optionsModel.MaxMessageSize : "";

                m_config.AdvancedImportOptions.DateFilterItem = optionsModel.DateFilterItem;

                m_config.AdvancedImportOptions.SpecialCharReplace = optionsModel.SpecialCharReplace;
                m_config.AdvancedImportOptions.CSVDelimiter       = optionsModel.CSVDelimiter;
                m_config.AdvancedImportOptions.IsPublicFolders    = optionsModel.IsPublicFolders;
                m_config.AdvancedImportOptions.IsZDesktop         = optionsModel.IsZDesktop;

                // Skipped folders
                m_config.AdvancedImportOptions.IsSkipFolders = optionsModel.IsSkipFolders;
                if (optionsModel.IsSkipFolders)
                {
                    if (optionsModel.FoldersToSkip != null)
                    {
                        if (optionsModel.FoldersToSkip.Length > 0)
                        {
                            string[] nameTokens = optionsModel.FoldersToSkip.Split(',');
                            int      numToSkip  = nameTokens.Length;
                            if (m_config.AdvancedImportOptions.FoldersToSkip == null)
                            {
                                m_config.AdvancedImportOptions.FoldersToSkip = new Folder[numToSkip];
                            }

                            for (int i = 0; i < numToSkip; i++)
                            {
                                Folder folder = new Folder();
                                folder.FolderName = nameTokens.GetValue(i).ToString();
                                m_config.AdvancedImportOptions.FoldersToSkip[i] = folder;
                            }
                        }
                    }
                }
                else
                {
                    m_config.AdvancedImportOptions.FoldersToSkip = null;
                }
            }
        }
        public void SetupViews(bool isBrowser)
        {
            m_isBrowser = isBrowser;
            BaseViewModel.isServer = true;          // because we start out with Server on -- wouldn't get set by command
            IsServerMigration = true;
            IsUserMigration = false;
            savedDomain = "";
            ZimbraValues.GetZimbraValues().ClientVersion = BuildNum;

            m_configViewModelS = new ConfigViewModelS();
            m_configViewModelS.Name = "ConfigViewModelS";
            m_configViewModelS.ViewTitle = "Source";
            m_configViewModelS.lb = lb;
            m_configViewModelS.isBrowser = isBrowser;
            m_configViewModelS.OutlookProfile = "";
            m_configViewModelS.MailServerHostName = "";
            m_configViewModelS.MailServerAdminID = "";
            m_configViewModelS.MailServerAdminPwd = "";

            m_configViewModelU = new ConfigViewModelU();
            m_configViewModelU.Name = "ConfigViewModelU";
            m_configViewModelU.ViewTitle = "Source";
            m_configViewModelU.lb = lb;
            m_configViewModelU.isBrowser = isBrowser;
            m_configViewModelU.OutlookProfile = "";
            m_configViewModelU.PSTFile = "";
            m_configViewModelU.OutlookProfile = "";

            m_configViewModelSDest = new ConfigViewModelSDest();
            m_configViewModelSDest.Name = "ConfigViewModelSDest";
            m_configViewModelSDest.ViewTitle = "Destination";
            m_configViewModelSDest.lb = lb;
            m_configViewModelSDest.isBrowser = isBrowser;
            m_configViewModelSDest.ZimbraServerHostName = "";
            m_configViewModelSDest.ZimbraPort = "";
            m_configViewModelSDest.ZimbraAdmin = "";
            m_configViewModelSDest.ZimbraAdminPasswd = "";
            m_configViewModelSDest.ZimbraSSL = true;

            m_configViewModelUDest = new ConfigViewModelUDest();
            m_configViewModelUDest.Name = "ConfigViewModelUDest";
            m_configViewModelUDest.ViewTitle = "Destination";
            m_configViewModelUDest.lb = lb;
            m_configViewModelUDest.isBrowser = isBrowser;
            m_configViewModelUDest.ZimbraServerHostName = "";
            m_configViewModelUDest.ZimbraPort = "";
            m_configViewModelUDest.ZimbraUser = "";
            m_configViewModelUDest.ZimbraUserPasswd = "";
            m_configViewModelUDest.ZimbraSSL = true;

            m_optionsViewModel = new OptionsViewModel();
            m_optionsViewModel.Name = "OptionsViewModel";
            m_optionsViewModel.ViewTitle = "Options";
            m_optionsViewModel.lb = lb;
            m_optionsViewModel.isBrowser = isBrowser;
            m_optionsViewModel.ImportMailOptions = true;
            m_optionsViewModel.ImportTaskOptions = true;
            m_optionsViewModel.ImportCalendarOptions = true;
            m_optionsViewModel.ImportContactOptions = true;
            m_optionsViewModel.ImportRuleOptions = true;
            m_optionsViewModel.ImportOOOOptions = true;
            m_optionsViewModel.ImportJunkOptions = false;
            m_optionsViewModel.ImportDeletedItemOptions = false;
            m_optionsViewModel.ImportSentOptions = false;
            m_optionsViewModel.LoggingVerbose = false;
            m_optionsViewModel.LogLevel = LogLevel.Info.ToString();
            m_optionsViewModel.MaxThreadCount = 0;
            m_optionsViewModel.MaxErrorCount = 0;
            m_optionsViewModel.OEnableRulesAndOOO = true;
            m_optionsViewModel.OEnableNext = true;
            m_optionsViewModel.MigrateONRAfter = (DateTime.Now.AddMonths(-3)).ToShortDateString();
            m_optionsViewModel.IsMaxMessageSize = false;
            m_optionsViewModel.IsSkipPrevMigratedItems = false;
            m_optionsViewModel.MaxMessageSize = "";
            m_optionsViewModel.IsSkipFolders = false;

            m_scheduleViewModel = new ScheduleViewModel();
            m_scheduleViewModel.Name = "Schedule";
            m_scheduleViewModel.ViewTitle = "Migrate";
            m_scheduleViewModel.lb = lb;
            m_scheduleViewModel.isBrowser = isBrowser;
            m_scheduleViewModel.COS = "default";
            m_scheduleViewModel.DefaultPWD = "";
            m_scheduleViewModel.ScheduleDate = DateTime.Now.ToShortDateString();
            m_scheduleViewModel.EnableProvGB = false;

            m_usersViewModel = new UsersViewModel("", "");
            m_usersViewModel.Name = "Users";
            m_usersViewModel.ViewTitle = "Users";
            m_usersViewModel.lb = lb;
            m_usersViewModel.ZimbraDomain = "";
            m_usersViewModel.isBrowser = isBrowser;
            m_usersViewModel.CurrentUserSelection = -1;
            m_usersViewModel.svm = m_scheduleViewModel;  // LDAP Browser needs to get to ScheduleView to set EnableMigrate

            m_resultsViewModel = new AccountResultsViewModel(m_scheduleViewModel, -1, 0, "", "", "",
            0, "", 0, 0, false);
            m_resultsViewModel.Name = "Results";
            m_resultsViewModel.ViewTitle = "Results";
            m_resultsViewModel.isBrowser = isBrowser;
            m_resultsViewModel.CurrentAccountSelection = -1;
            m_resultsViewModel.OpenLogFileEnabled = false;

            SetupViewModelPtrs();

            TheViews = new ObservableCollection<object>();
            TheViews.Add(this);
        }
        // Background thread stuff
        private void worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            eventArglist.Add(e);

            int num = (int)e.Argument;

            Log.info(" In Do work for threads for user number", num);
            MigrationAccount        MyAcct                  = new MigrationAccount();
            UsersViewModel          usersViewModel          = ((UsersViewModel)ViewModelPtrs[(int)ViewType.USERS]);
            AccountResultsViewModel accountResultsViewModel =
                ((AccountResultsViewModel)ViewModelPtrs[(int)ViewType.RESULTS]); // main one
            string accountname = accountResultsViewModel.AccountResultsList[num].AccountName;
            string accountid   = "";

            if (isServer)
            {
                accountname = accountname + "@" + usersViewModel.ZimbraDomain;
                accountid   = usersViewModel.UsersList[num].Username;

                int idx = accountid.IndexOf("@");

                if (idx != -1)                  // domain would be Exchange domain, not Zimbra domain
                {
                    accountid = accountid.Substring(0, idx);
                }
            }
            else
            {
                ConfigViewModelU sourceModel =
                    ((ConfigViewModelU)ViewModelPtrs[(int)ViewType.USRSRC]);
                ConfigViewModelUDest destModel =
                    ((ConfigViewModelUDest)ViewModelPtrs[(int)ViewType.USRDEST]);

                accountname = ZimbraValues.GetZimbraValues().AccountName;//accountname + "@" + destModel.ZimbraServerHostName;
                accountid   = (sourceModel.IspST) ? sourceModel.PSTFile :
                              sourceModel.ProfileList[sourceModel.CurrentProfileSelection];
            }
            MyAcct.AccountName = accountname;
            MyAcct.AccountID   = accountid;
            MyAcct.AccountNum  = num;
            MyAcct.OnChanged  += new MigrationObjectEventHandler(Acct_OnAcctChanged);

            MigrationFolder MyFolder = new MigrationFolder();

            MyFolder.AccountNum = num;
            MyFolder.OnChanged += new MigrationObjectEventHandler(Folder_OnChanged);

            MyAcct.migrationFolder = MyFolder;

            CSMigrationWrapper mw         = ((IntroViewModel)ViewModelPtrs[(int)ViewType.INTRO]).mw;
            MigrationOptions   importOpts = SetOptions();
            bool isVerbose     = ((OptionsViewModel)ViewModelPtrs[(int)ViewType.OPTIONS]).LoggingVerbose;
            bool doRulesAndOOO = ((OptionsViewModel)ViewModelPtrs[(int)ViewType.OPTIONS]).OEnableRulesAndOOO;


            if (isVerbose)
            {
                if (importOpts.VerboseOn < LogLevel.Debug)
                {
                    importOpts.VerboseOn = LogLevel.Debug;
                }
            }

            Log.info(" start migration for account ", MyAcct.AccountNum);

            //mw.StartMigration(MyAcct, importOpts, isServer, (isVerbose ? (LogLevel.Debug):(LogLevel.Info)), m_isPreview);
            mw.StartMigration(MyAcct, importOpts, isServer, importOpts.VerboseOn, m_isPreview, doRulesAndOOO);



            // special case to format last user progress message
            int count = accountResultsViewModel.AccountResultsList[num].UserResultsList.Count;

            if (count > 0)
            {
                if (!m_isPreview)
                {
                    string lastmsg      = accountResultsViewModel.AccountResultsList[num].UserResultsList[count - 1].UserProgressMsg;
                    int    len          = lastmsg.Length;
                    bool   isOOOorRules = ((MyFolder.FolderView == "OOO") || (MyFolder.FolderView == "All Rules"));
                    accountResultsViewModel.AccountResultsList[num].UserResultsList[count - 1].UserProgressMsg = FormatTheLastMsg(MyFolder, isOOOorRules);
                    accountResultsViewModel.AccountResultsList[num].PBValue = 100; // to make sure
                    if (accountResultsViewModel.AccountResultsList[num].CurrentItemNum != accountResultsViewModel.AccountResultsList[num].TotalItemsToMigrate)
                    {
                        FormatGlobalMsg(accountResultsViewModel.AccountResultsList[num]);
                    }
                }
                else
                { // For preview, take the "foldername (n items)" message we constructed, extract the n, and make "Total n"
                    string msg      = "";
                    string lastmsg  = accountResultsViewModel.AccountResultsList[num].PBMsgValue;
                    int    idxParen = lastmsg.IndexOf("(");
                    int    idxItems = lastmsg.IndexOf("items");
                    if ((idxParen != -1) && (idxItems != -1))
                    {
                        int    numLen = idxItems - idxParen - 2; // for the paren and the space
                        string numStr = lastmsg.Substring(idxParen + 1, numLen);
                        msg = "Total: " + numStr;
                        accountResultsViewModel.AccountResultsList[num].UserResultsList[count - 1].UserProgressMsg = (msg.Length > 0) ? msg : "";
                    }
                }
            }
            /////

            if (!m_isPreview)
            {
                int tnum = GetThreadNum(MyAcct.AccountNum);
                //Log.info(" in worker_RunWorkerCompleted  for ThreadNum : " + tnum);

                Log.info(" in DOWORK -- Migration completed for usernum: " + MyAcct.AccountNum + " and threadnum" + tnum);
                accountResultsViewModel.AccountResultsList[num].PBMsgValue      = "Migration complete";
                accountResultsViewModel.AccountResultsList[num].AcctProgressMsg = "Complete";
            }
            else
            {
                string msg = "Total items: {0}";
                accountResultsViewModel.AccountResultsList[num].PBMsgValue = String.Format(msg, accountResultsViewModel.AccountResultsList[num].TotalItemsToMigrate);
            }

            if (importOpts.IsMaintainenceMode)
            {
                accountResultsViewModel.AccountResultsList[num].PBMsgValue      = "Migration Incomplete";
                accountResultsViewModel.AccountResultsList[num].AcctProgressMsg = "InComplete";
            }
        }
Exemple #5
0
        public void SetupViews(bool isBrowser)
        {
            m_isBrowser            = isBrowser;
            BaseViewModel.isServer = true;      // because we start out with Server on -- wouldn't get set by command
            IsServerMigration      = true;
            IsUserMigration        = false;
            savedDomain            = "";
            ZimbraValues.GetZimbraValues().ClientVersion = BuildNum;

            m_configViewModelS                    = new ConfigViewModelS();
            m_configViewModelS.Name               = "ConfigViewModelS";
            m_configViewModelS.ViewTitle          = "Source";
            m_configViewModelS.lb                 = lb;
            m_configViewModelS.isBrowser          = isBrowser;
            m_configViewModelS.OutlookProfile     = "";
            m_configViewModelS.MailServerHostName = "";
            m_configViewModelS.MailServerAdminID  = "";
            m_configViewModelS.MailServerAdminPwd = "";

            m_configViewModelU                = new ConfigViewModelU();
            m_configViewModelU.Name           = "ConfigViewModelU";
            m_configViewModelU.ViewTitle      = "Source";
            m_configViewModelU.lb             = lb;
            m_configViewModelU.isBrowser      = isBrowser;
            m_configViewModelU.OutlookProfile = "";
            m_configViewModelU.PSTFile        = "";
            m_configViewModelU.OutlookProfile = "";

            m_configViewModelSDest                      = new ConfigViewModelSDest();
            m_configViewModelSDest.Name                 = "ConfigViewModelSDest";
            m_configViewModelSDest.ViewTitle            = "Destination";
            m_configViewModelSDest.lb                   = lb;
            m_configViewModelSDest.isBrowser            = isBrowser;
            m_configViewModelSDest.ZimbraServerHostName = "";
            m_configViewModelSDest.ZimbraPort           = "";
            m_configViewModelSDest.ZimbraAdmin          = "";
            m_configViewModelSDest.ZimbraAdminPasswd    = "";
            m_configViewModelSDest.ZimbraSSL            = true;

            m_configViewModelUDest                      = new ConfigViewModelUDest();
            m_configViewModelUDest.Name                 = "ConfigViewModelUDest";
            m_configViewModelUDest.ViewTitle            = "Destination";
            m_configViewModelUDest.lb                   = lb;
            m_configViewModelUDest.isBrowser            = isBrowser;
            m_configViewModelUDest.ZimbraServerHostName = "";
            m_configViewModelUDest.ZimbraPort           = "";
            m_configViewModelUDest.ZimbraUser           = "";
            m_configViewModelUDest.ZimbraUserPasswd     = "";
            m_configViewModelUDest.ZimbraSSL            = true;

            m_optionsViewModel                          = new OptionsViewModel();
            m_optionsViewModel.Name                     = "OptionsViewModel";
            m_optionsViewModel.ViewTitle                = "Options";
            m_optionsViewModel.lb                       = lb;
            m_optionsViewModel.isBrowser                = isBrowser;
            m_optionsViewModel.ImportMailOptions        = true;
            m_optionsViewModel.ImportTaskOptions        = true;
            m_optionsViewModel.ImportCalendarOptions    = true;
            m_optionsViewModel.ImportContactOptions     = true;
            m_optionsViewModel.ImportRuleOptions        = true;
            m_optionsViewModel.ImportOOOOptions         = true;
            m_optionsViewModel.ImportJunkOptions        = false;
            m_optionsViewModel.ImportDeletedItemOptions = false;
            m_optionsViewModel.ImportSentOptions        = false;
            m_optionsViewModel.LoggingVerbose           = false;
            m_optionsViewModel.LogLevel                 = LogLevel.Info.ToString();
            m_optionsViewModel.MaxThreadCount           = 0;
            m_optionsViewModel.MaxErrorCount            = 0;
            m_optionsViewModel.OEnableRulesAndOOO       = true;
            m_optionsViewModel.OEnableNext              = true;
            m_optionsViewModel.MigrateONRAfter          = (DateTime.Now.AddMonths(-3)).ToShortDateString();
            m_optionsViewModel.IsMaxMessageSize         = false;
            m_optionsViewModel.IsSkipPrevMigratedItems  = false;
            m_optionsViewModel.MaxMessageSize           = "";
            m_optionsViewModel.IsSkipFolders            = false;

            m_scheduleViewModel              = new ScheduleViewModel();
            m_scheduleViewModel.Name         = "Schedule";
            m_scheduleViewModel.ViewTitle    = "Migrate";
            m_scheduleViewModel.lb           = lb;
            m_scheduleViewModel.isBrowser    = isBrowser;
            m_scheduleViewModel.COS          = "default";
            m_scheduleViewModel.DefaultPWD   = "";
            m_scheduleViewModel.ScheduleDate = DateTime.Now.ToShortDateString();
            m_scheduleViewModel.EnableProvGB = false;

            m_usersViewModel                      = new UsersViewModel("", "");
            m_usersViewModel.Name                 = "Users";
            m_usersViewModel.ViewTitle            = "Users";
            m_usersViewModel.lb                   = lb;
            m_usersViewModel.ZimbraDomain         = "";
            m_usersViewModel.isBrowser            = isBrowser;
            m_usersViewModel.CurrentUserSelection = -1;
            m_usersViewModel.svm                  = m_scheduleViewModel; // LDAP Browser needs to get to ScheduleView to set EnableMigrate

            m_resultsViewModel = new AccountResultsViewModel(m_scheduleViewModel, -1, 0, "", "", "",
                                                             0, "", 0, 0, false);
            m_resultsViewModel.Name      = "Results";
            m_resultsViewModel.ViewTitle = "Results";
            m_resultsViewModel.isBrowser = isBrowser;
            m_resultsViewModel.CurrentAccountSelection = -1;
            m_resultsViewModel.OpenLogFileEnabled      = false;

            SetupViewModelPtrs();

            TheViews = new ObservableCollection <object>();
            TheViews.Add(this);
        }
Exemple #6
0
        public void SetupViews(bool isBrowser)
        {
            using (LogBlock logblock = Log.NotTracing()?null: new LogBlock(GetType() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name))
            {
                m_isBrowser = isBrowser;

                BaseViewModel.isServer = true;      // because we start out with Server on -- wouldn't get set by command

                rbServerMigration = true;
                rbUserMigration   = false;

                savedDomain = "";
                ZimbraValues.GetZimbraValues().ClientVersion = BuildNum;

                // ------------------------------------------------------------
                // Source pages
                // ------------------------------------------------------------

                // Server mig version
                m_configViewModelS                    = new ConfigViewModelS();
                m_configViewModelS.Name               = "ConfigViewModelS";
                m_configViewModelS.ViewTitle          = "Source";
                m_configViewModelS.lb                 = lb;
                m_configViewModelS.isBrowser          = isBrowser;
                m_configViewModelS.OutlookProfile     = "";
                m_configViewModelS.MailServerHostName = "";
                m_configViewModelS.MailServerAdminID  = "";
                m_configViewModelS.MailServerAdminPwd = "";

                // User mig version
                m_configViewModelU                = new ConfigViewModelU();
                m_configViewModelU.Name           = "ConfigViewModelU";
                m_configViewModelU.ViewTitle      = "Source";
                m_configViewModelU.lb             = lb;
                m_configViewModelU.isBrowser      = isBrowser;
                m_configViewModelU.OutlookProfile = "";
                m_configViewModelU.PSTFile        = "";
                m_configViewModelU.OutlookProfile = "";

                // ZD mig version
                m_configViewModelZU                = new ConfigViewModelZU();
                m_configViewModelZU.Name           = "ConfigViewModelZU";
                m_configViewModelZU.ViewTitle      = "Source";
                m_configViewModelZU.lb             = lb;
                m_configViewModelZU.isBrowser      = isBrowser;
                m_configViewModelZU.OutlookProfile = "";
                m_configViewModelZU.PSTFile        = "";
                m_configViewModelZU.OutlookProfile = "";


                // ------------------------------------------------------------
                // Destination pages
                // ------------------------------------------------------------

                // Server mig version
                m_configViewModelSDest                      = new ConfigViewModelSDest();
                m_configViewModelSDest.Name                 = "ConfigViewModelSDest";
                m_configViewModelSDest.ViewTitle            = "Destination";
                m_configViewModelSDest.lb                   = lb;
                m_configViewModelSDest.isBrowser            = isBrowser;
                m_configViewModelSDest.ZimbraServerHostName = "";
                m_configViewModelSDest.ZimbraPort           = "";
                m_configViewModelSDest.ZimbraAdmin          = "";
                m_configViewModelSDest.ZimbraAdminPasswd    = "";
                m_configViewModelSDest.ZimbraSSL            = true;

                // User mig version
                m_configViewModelUDest                      = new ConfigViewModelUDest();
                m_configViewModelUDest.Name                 = "ConfigViewModelUDest";
                m_configViewModelUDest.ViewTitle            = "Destination";
                m_configViewModelUDest.lb                   = lb;
                m_configViewModelUDest.isBrowser            = isBrowser;
                m_configViewModelUDest.ZimbraServerHostName = "";
                m_configViewModelUDest.ZimbraPort           = "";
                m_configViewModelUDest.ZimbraUser           = "";
                m_configViewModelUDest.ZimbraUserPasswd     = "";
                m_configViewModelUDest.ZimbraSSL            = true;

                // ZD mig version
                // (No dest page for ZD)

                // ------------------------------------------------------------
                // Option page
                // ------------------------------------------------------------
                m_optionsViewModel                          = new OptionsViewModel();
                m_optionsViewModel.Name                     = "OptionsViewModel";
                m_optionsViewModel.ViewTitle                = "Options";
                m_optionsViewModel.lb                       = lb;
                m_optionsViewModel.isBrowser                = isBrowser;
                m_optionsViewModel.ImportMailOptions        = true;
                m_optionsViewModel.ImportTaskOptions        = true;
                m_optionsViewModel.ImportCalendarOptions    = true;
                m_optionsViewModel.ImportContactOptions     = true;
                m_optionsViewModel.ImportRuleOptions        = true;
                m_optionsViewModel.ImportOOOOptions         = true;
                m_optionsViewModel.ImportJunkOptions        = false;
                m_optionsViewModel.ImportDeletedItemOptions = false;
                m_optionsViewModel.ImportSentOptions        = false;

                m_optionsViewModel.MaxThreadCount          = 0;
                m_optionsViewModel.MaxErrorCount           = 0;
                m_optionsViewModel.OEnableRulesAndOOO      = true;
                m_optionsViewModel.OEnablePF               = true;
                m_optionsViewModel.OEnableNext             = true;
                m_optionsViewModel.MigrateONRAfter         = (DateTime.Now.AddMonths(-3)).ToShortDateString();
                m_optionsViewModel.IsMaxMessageSize        = false;
                m_optionsViewModel.IsSkipPrevMigratedItems = false;
                m_optionsViewModel.MaxMessageSize          = "";
                m_optionsViewModel.IsSkipFolders           = false;

                // ------------------------------------------------------------
                // Scedule page
                // ------------------------------------------------------------
                m_scheduleViewModel              = new ScheduleViewModel();
                m_scheduleViewModel.Name         = "Schedule";
                m_scheduleViewModel.ViewTitle    = "Migrate";
                m_scheduleViewModel.lb           = lb;
                m_scheduleViewModel.isBrowser    = isBrowser;
                m_scheduleViewModel.COS          = "default";
                m_scheduleViewModel.DefaultPWD   = "";
                m_scheduleViewModel.ScheduleDate = DateTime.Now.ToShortDateString();
                m_scheduleViewModel.EnableProvGB = false;

                // ------------------------------------------------------------
                // Users page
                // ------------------------------------------------------------
                m_usersViewModel                      = new UsersViewModel("", "");
                m_usersViewModel.Name                 = "Users";
                m_usersViewModel.ViewTitle            = "Users";
                m_usersViewModel.lb                   = lb;
                m_usersViewModel.ZimbraDomain         = "";
                m_usersViewModel.isBrowser            = isBrowser;
                m_usersViewModel.CurrentUserSelection = -1;
                m_usersViewModel.svm                  = m_scheduleViewModel;    // LDAP Browser needs to get to ScheduleView to set EnableMigrate

                // ------------------------------------------------------------
                // Public folders page
                // ------------------------------------------------------------
                m_publicfoldersViewModel              = new PublicfoldersViewModel("", "");
                m_publicfoldersViewModel.Name         = "PublicFolders";
                m_publicfoldersViewModel.ViewTitle    = "Public Folders";
                m_publicfoldersViewModel.lb           = lb;
                m_publicfoldersViewModel.ZimbraDomain = "";
                m_publicfoldersViewModel.isBrowser    = isBrowser;
                m_publicfoldersViewModel.svm          = m_scheduleViewModel;    // LDAP Browser needs to get to ScheduleView to set EnableMigrate

                // ------------------------------------------------------------
                // Results page
                // ------------------------------------------------------------
                m_resultsViewModel           = new AccountResultsViewModel(m_scheduleViewModel, -1, "", false);
                m_resultsViewModel.Name      = "Results";
                m_resultsViewModel.ViewTitle = "Results";
                m_resultsViewModel.isBrowser = isBrowser;
                m_resultsViewModel.CurrentAccountSelection = -1;
                m_resultsViewModel.OpenLogFileEnabled      = false;

                SetupViewModelPtrs();

                TheViews = new ObservableCollection <object>();
                TheViews.Add(this);
            }
        }