public AccountResultsViewModel(ScheduleViewModel scheduleViewModel, int accountNum, int
        pbValue, string pbMsgValue, string userpbMsgValue, string accountName, int
        accountProgress, string acctProgressMsg, int numErrs, int numWarns, bool enableStop)
        {
            this.m_scheduleViewModel = scheduleViewModel;
            this.m_accountnum = accountNum;
            this.PBValue = pbValue;
            this.PBMsgValue = pbMsgValue;
            this.UserPBMsgValue = userpbMsgValue;
            this.AccountName = accountName;
            this.AccountProgress = accountProgress;
            this.AcctProgressMsg = acctProgressMsg;
            this.NumErrs = numErrs;
            this.NumWarns = numWarns;
            this.EnableStop = enableStop;

            this.CurrentItemNum = 0;
            this.TotalItemsToMigrate = 0;
            this.GlobalAcctProgressMsg = "";

            this.SelectedTab = "";
            this.m_AccountOnTab = -1;

            this.OpenLogFileCommand = new ActionCommand(this.OpenLogFile, () => true);
            this.StopCommand = new ActionCommand(this.Stop, () => true);
            this.ExitAppCommand = new ActionCommand(this.ExitApp, () => true);
        }
Example #2
0
        private void Add(object value)
        {
            using (LogBlock logblock = Log.NotTracing() ? null : new LogBlock(GetType() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name))
            {
                var name = value as string;

                UsersList.Add(new UsersViewModel("", ""));
                EnableNext = (UsersList.Count > 0);

                ScheduleViewModel scheduleViewModel = ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);

                scheduleViewModel.SchedList.Add(new SchedUser(name, false));
                scheduleViewModel.EnableMigrate = (scheduleViewModel.SchedList.Count > 0);
                scheduleViewModel.EnablePreview = scheduleViewModel.EnableMigrate;
            }
        }
Example #3
0
        private void Next()
        {
            bool mmsError = false;

            if (IsMaxMessageSize)
            {
                if (MaxMessageSize.Length == 0)
                {
                    mmsError = true;
                }
                else
                {
                    try
                    {
                        int msf = Int32.Parse(MaxMessageSize);
                    }
                    catch (Exception)
                    {
                        mmsError = true;
                    }
                }
                if (mmsError)
                {
                    MessageBox.Show("Please enter an integer value for maximum message size", "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }
            if (isServer)
            {
                lb.SelectedIndex = 4;
            }
            else
            {
                ConfigViewModelUDest configViewModelUDest =
                    ((ConfigViewModelUDest)ViewModelPtrs[(int)ViewType.USRDEST]);
                UsersViewModel usersViewModel =
                    ((UsersViewModel)ViewModelPtrs[(int)ViewType.USERS]);
                ScheduleViewModel scheduleViewModel =
                    ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);
                string name = configViewModelUDest.ZimbraUser;

                usersViewModel.UsersList.Add(new UsersViewModel(name, ""));
                scheduleViewModel.DoMigrate(false);
            }
        }
Example #4
0
        private void Remove()
        {
            OptionsViewModel ovm = ((OptionsViewModel)ViewModelPtrs[(int)ViewType.OPTIONS]);

            ovm.IsSkipFolders = true;

            folderstoskip += UsersBKList[CurrentFolderSelection].MappedName.ToString();
            folderstoskip += ",";

            ovm.FoldersToSkip = folderstoskip;
            UsersBKList.RemoveAt(CurrentFolderSelection);
            EnableNext = (UsersBKList.Count > 0);

            ScheduleViewModel scheduleViewModel = ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);

            scheduleViewModel.EnableMigrate = (scheduleViewModel.SchedList.Count > 0);
            scheduleViewModel.EnablePreview = scheduleViewModel.EnableMigrate;
        }
Example #5
0
        private void Next()
        {
            if (!ValidateUsersList(true))
            {
                return;
            }

            ZimbraAPI zimbraAPI = new ZimbraAPI(isServer);

            if (ZimbraValues.zimbraValues.AuthToken.Length == 0)
            {
                MessageBox.Show("You must log on to the Zimbra server", "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            SaveDomain();

            PublicfoldersViewModel publicfoldersViewModel = ((PublicfoldersViewModel)ViewModelPtrs[(int)ViewType.PUBFLDS]);
            ScheduleViewModel      scheduleViewModel      = ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);

            scheduleViewModel.EnableProvGB = false;

            string acctName = ZimbraAccountName + '@' + ZimbraDomain;

            if (zimbraAPI.GetAccount(acctName) == 0)
            {
                UsersList[0].IsProvisioned = true;
                {
                    SchedUser schd = new SchedUser(ZimbraAccountName, true);
                    scheduleViewModel.SchedList.Add(schd);
                    //scheduleViewModel.SchedList[0].isProvisioned = true;
                }
                scheduleViewModel.SchedfolderList[0].isProvisioned = true; // get (SchedList) in schedule view model will set again
            }
            else
            if (zimbraAPI.LastError.IndexOf("no such account") != -1)
            {
                UsersList[0].IsProvisioned = false; // get (SchedList) in schedule view model will set again
                scheduleViewModel.SchedList[0].isProvisioned       = false;
                scheduleViewModel.SchedfolderList[0].isProvisioned = false;
                if (!scheduleViewModel.EnableProvGB)
                {
                    scheduleViewModel.EnableProvGB = true;
                }
            }
            else
            {
                MessageBox.Show(string.Format("Error accessing account {0}: {1}", acctName, zimbraAPI.LastError), "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            //Logic to get the index of defaulf COS from CosList.
            for (int i = 0; i < scheduleViewModel.CosList.Count; i++)
            {
                if (scheduleViewModel.CosList[i].CosName == "default")
                {
                    ZimbraValues.GetZimbraValues().DefaultCosIndex = i;
                    break;
                }
            }

            foreach (DomainInfo domaininfo in ZimbraValues.GetZimbraValues().ZimbraDomains)
            {
                if (domaininfo.DomainName == publicfoldersViewModel.DomainList[publicfoldersViewModel.CurrentDomainSelection])
                {
                    if (domaininfo.zimbraDomainDefaultCOSId != "")
                    {
                        for (int i = 0; i < scheduleViewModel.CosList.Count; i++)
                        {
                            if (domaininfo.zimbraDomainDefaultCOSId == scheduleViewModel.CosList[i].CosID)
                            {
                                scheduleViewModel.CurrentCOSSelection = i;
                                break;
                            }
                        }
                    }
                    else
                    {
                        scheduleViewModel.CurrentCOSSelection = ZimbraValues.GetZimbraValues().DefaultCosIndex;
                    }
                    break;
                }
            }
            lb.SelectedIndex = 6;
        }
Example #6
0
        private void Next()
        {
            if ((this.ZimbraServerHostName.Length == 0) || (this.ZimbraPort.Length == 0))
            {
                MessageBox.Show("Please fill in the host name and port", "Zimbra Migration",
                                MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            ZimbraAPI zimbraAPI = new ZimbraAPI(true);
            int       stat      = -1;

            try
            {
                stat = zimbraAPI.Logon(this.ZimbraServerHostName, this.ZimbraPort, this.ZimbraAdmin,
                                       this.ZimbraAdminPasswd, this.ZimbraSSL, true);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Logon", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (stat == 0)
            {
                string authToken = ZimbraValues.GetZimbraValues().AuthToken;

                if (authToken.Length > 0)
                {
                    UsersViewModel usersViewModel =
                        ((UsersViewModel)ViewModelPtrs[(int)ViewType.USERS]);
                    ScheduleViewModel scheduleViewModel =
                        ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);

                    string currentDomain = (usersViewModel.DomainInfoList.Count > 0) ?
                                           usersViewModel.DomainInfoList[usersViewModel.CurrentDomainSelection].DomainName : "";

                    usersViewModel.DomainInfoList.Clear();
                    usersViewModel.DomainList.Clear();
                    scheduleViewModel.CosList.Clear();

                    zimbraAPI.GetAllDomains();

                    foreach (DomainInfo domaininfo in ZimbraValues.GetZimbraValues().ZimbraDomains)
                    {
                        string dName = domaininfo.DomainName;
                        usersViewModel.DomainInfoList.Add(new DomainInfo(domaininfo.DomainName, domaininfo.DomainID, domaininfo.zimbraDomainDefaultCOSId));
                        usersViewModel.DomainList.Add(dName);

                        if (dName == currentDomain)
                        {
                            usersViewModel.CurrentDomainSelection = usersViewModel.DomainInfoList.Count;
                        }
                    }

                    usersViewModel.DomainsFilledIn = true;

                    zimbraAPI.GetAllCos();

                    foreach (CosInfo cosinfo in ZimbraValues.GetZimbraValues().COSes)
                    {
                        scheduleViewModel.CosList.Add(new CosInfo(cosinfo.CosName, cosinfo.CosID));
                    }
                    lb.SelectedIndex = 3;
                }
            }
            else
            {
                MessageBox.Show(string.Format("Logon Unsuccessful: {0}", zimbraAPI.LastError),
                                "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Example #7
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);
        }
Example #8
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;
                }
            }
        }
Example #9
0
        private void UserMap()
        {
            ScheduleViewModel scheduleViewModel =
                ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);
            bool bCSV = false;

            Microsoft.Win32.OpenFileDialog fDialog = new Microsoft.Win32.OpenFileDialog();
            fDialog.Filter          = "User Map Files|*.xml;*.csv";
            fDialog.CheckFileExists = true;
            fDialog.Multiselect     = false;
            if (fDialog.ShowDialog() == true)
            {
                int lastDot = fDialog.FileName.LastIndexOf(".");

                if (lastDot != -1)
                {
                    string substr = fDialog.FileName.Substring(lastDot, 4);

                    if (substr == ".csv")
                    {
                        bCSV = true;

                        /*try
                        * {
                        *  string names = File.ReadAllText(fDialog.FileName);
                        *  string[] nameTokens = names.Split(',');
                        *  foreach (string name in nameTokens)
                        *  {
                        *      UsersList.Add(name);
                        *      scheduleViewModel.SchedList.Add(name);
                        *  }
                        * }
                        * catch (IOException ex)
                        * {
                        *  MessageBox.Show(ex.Message, "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        * }*/
                        List <string[]> parsedData = new List <string[]>();
                        try
                        {
                            if (File.Exists(fDialog.FileName))
                            {
                                using (StreamReader readFile = new StreamReader(fDialog.FileName)) {
                                    string line;

                                    string[] row;
                                    while ((line = readFile.ReadLine()) != null)
                                    {
                                        row = line.Split(',');
                                        parsedData.Add(row);
                                    }
                                    readFile.Close();
                                }
                            }
                            else
                            {
                                MessageBox.Show(
                                    "There is no user information stored.Please enter some user info",
                                    "Zimbra Migration", MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                            }
                        }
                        catch (Exception e)
                        {
                            string message = e.Message;
                        }
                        // for (int i = 1; i < parsedData.Count; i++)
                        {
                            string[] strres = new string[parsedData.Count];

                            Users tempuser = new Users();

                            try
                            {
                                for (int j = 0; j < parsedData.Count; j++)
                                {
                                    bool bFoundSharp = false;
                                    strres = parsedData[j];
                                    int num = strres.Count();
                                    for (int k = 0; k < num; k++)
                                    {
                                        if (strres[k].Contains("#"))
                                        {
                                            bFoundSharp = true;
                                            break;
                                        }
                                    }
                                    if (!bFoundSharp) // FBS bug 71933 -- 3/21/12
                                    {
                                        tempuser.UserName   = strres[0];
                                        tempuser.MappedName = strres[1];

                                        tempuser.ChangePWD = Convert.ToBoolean(strres[2]);
                                        // tempuser.PWDdefault = strres[3];
                                        // string result = tempuser.UserName + "," + tempuser.MappedName +"," + tempuser.ChangePWD + "," + tempuser.PWDdefault;
                                        string result = tempuser.Username + "," + tempuser.MappedName;

                                        Username   = strres[0];
                                        MappedName = strres[1];
                                        UsersViewModel uvm = new UsersViewModel(Username, MappedName);
                                        uvm.MustChangePassword = tempuser.ChangePWD;
                                        UsersList.Add(uvm);
                                        scheduleViewModel.SchedList.Add(new SchedUser(Username, false));
                                    }
                                }
                            }
                            catch (Exception)
                            {
                                MessageBox.Show("Incorrect .csv file format", "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
                                return;
                            }

                            EnableNext = (UsersList.Count > 0);
                        }
                        scheduleViewModel.EnableMigrate = (scheduleViewModel.SchedList.Count > 0);
                        scheduleViewModel.EnablePreview = scheduleViewModel.EnableMigrate;

                        // /
                        // Domain information is stored in the xml and not in  the usermap.
                        // will have to revisit

                        System.Xml.Serialization.XmlSerializer reader =
                            new System.Xml.Serialization.XmlSerializer(typeof(Config));
                        if (File.Exists(scheduleViewModel.GetConfigFile()))
                        {
                            System.IO.StreamReader fileRead = new System.IO.StreamReader(
                                scheduleViewModel.GetConfigFile());

                            Config Z11 = new Config();

                            Z11 = (Config)reader.Deserialize(fileRead);
                            fileRead.Close();
                            ZimbraDomain = Z11.UserProvision.DestinationDomain;
                            if (DomainList.Count > 0)
                            {
                                CurrentDomainSelection = (ZimbraDomain == null) ? 0 :
                                                         DomainList.IndexOf(ZimbraDomain);
                            }

                            else
                            {
                                DomainList.Add(ZimbraDomain);
                            }
                        }
                        scheduleViewModel.SetUsermapFile(fDialog.FileName);
                    }
                }
                if (!bCSV)
                {
                    MessageBox.Show("Only CSV files are supported", "Zimbra Migration",
                                    MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
        }
Example #10
0
        private void SaveCSV()
        {
            if (!ValidateUsersList(true))
            {
                return;
            }

            ScheduleViewModel scheduleViewModel =
                ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);

            System.Xml.Serialization.XmlSerializer reader =
                new System.Xml.Serialization.XmlSerializer(typeof(Config));
            if (File.Exists(scheduleViewModel.GetConfigFile()))
            {
                System.IO.StreamReader fileRead = new System.IO.StreamReader(
                    scheduleViewModel.GetConfigFile());

                Config Z11 = new Config();

                Z11 = (Config)reader.Deserialize(fileRead);
                fileRead.Close();

                CSVDelimiter = Z11.AdvancedImportOptions.CSVDelimiter;
            }
            List <Users> ListofUsers = new List <Users>();

            for (int i = 0; i < UsersList.Count; i++)
            {
                if (CSVDelimiter == null)
                {
                    CSVDelimiter = ",";
                }
                string users = UsersList[i].Username + CSVDelimiter /*','*/ + UsersList[i].MappedName;

//            string[] nameTokens = users.Split(',');
                string[] nameTokens = users.Split(CSVDelimiter.ToCharArray());

                Users tempUser = new Users();

                tempUser.UserName   = nameTokens.GetValue(0).ToString();
                tempUser.MappedName = nameTokens.GetValue(1).ToString();
                if (nameTokens.Length > 2)
                {
                    tempUser.ChangePWD = Convert.ToBoolean(nameTokens.GetValue(2).ToString());
                }
                else
                {
                    tempUser.ChangePWD = false;
                }

                // tempUser.PWDdefault = nameTokens.GetValue(3).ToString();

                ListofUsers.Add(tempUser);
            }

            //string resultcsv = Users.ToCsv<Users>(",", ListofUsers);
            string resultcsv = Users.ToCsv <Users>(CSVDelimiter, ListofUsers);

            Microsoft.Win32.SaveFileDialog fDialog = new Microsoft.Win32.SaveFileDialog();
            fDialog.Filter = "User Map Files|*.csv";

            // fDialog.CheckFileExists = true;
            // fDialog.Multiselect = false;

            /*ScheduleViewModel scheduleViewModel =
             *  ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);*/

            if (fDialog.ShowDialog() == true)
            {
                string filename = fDialog.FileName;

                // +".csv";
                System.IO.File.WriteAllText(filename, resultcsv);
                scheduleViewModel.SetUsermapFile(filename);
            }
            // /Domain information gets stored in the xml
            // ///will have to revisit.
            SaveDomain();
        }
Example #11
0
        private void Next()
        {
            using (LogBlock logblock = Log.NotTracing()?null: new LogBlock(GetType() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name))
            {
                if (!ValidateUsersList(true))
                {
                    return;
                }

                ZimbraAPI zimbraAPI = new ZimbraAPI(isServer);
                if (ZimbraValues.zimbraValues.AuthToken.Length == 0)
                {
                    MessageBox.Show("You must log on to the Zimbra server", "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                SaveDomain();

                UsersViewModel    usersViewModel    = ((UsersViewModel)ViewModelPtrs[(int)ViewType.USERS]);
                ScheduleViewModel scheduleViewModel = ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);

                scheduleViewModel.EnableProvGB = false;
                for (int i = 0; i < UsersList.Count; i++)
                {
                    string userName = (UsersList[i].MappedName.Length > 0) ? UsersList[i].MappedName : UsersList[i].Username;
                    string acctName = userName + '@' + ZimbraDomain;

                    if (zimbraAPI.GetAccount(acctName, true) == 0)
                    {
                        UsersList[i].IsProvisioned = true;
                        scheduleViewModel.SchedList[i].isProvisioned = true; // get (SchedList) in schedule view model will set again
                    }
                    else
                    if (zimbraAPI.LastError.IndexOf("no such account") != -1)
                    {
                        UsersList[i].IsProvisioned = false; // get (SchedList) in schedule view model will set again
                        scheduleViewModel.SchedList[i].isProvisioned = false;
                        if (!scheduleViewModel.EnableProvGB)
                        {
                            scheduleViewModel.EnableProvGB = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show(string.Format("Error accessing account {0}: {1}", acctName, zimbraAPI.LastError), "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }

                //Logic to get the index of defaulf COS from CosList.
                for (int i = 0; i < scheduleViewModel.CosList.Count; i++)
                {
                    if (scheduleViewModel.CosList[i].CosName == "default")
                    {
                        ZimbraValues.GetZimbraValues().DefaultCosIndex = i;
                        break;
                    }
                }

                foreach (DomainInfo domaininfo in ZimbraValues.GetZimbraValues().ZimbraDomains)
                {
                    if (domaininfo.DomainName == usersViewModel.DomainList[usersViewModel.CurrentDomainSelection])
                    {
                        if (domaininfo.zimbraDomainDefaultCOSId != "")
                        {
                            for (int i = 0; i < scheduleViewModel.CosList.Count; i++)
                            {
                                if (domaininfo.zimbraDomainDefaultCOSId == scheduleViewModel.CosList[i].CosID)
                                {
                                    scheduleViewModel.CurrentCOSSelection = i;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            scheduleViewModel.CurrentCOSSelection = ZimbraValues.GetZimbraValues().DefaultCosIndex;
                        }

                        break;
                    }
                }

                OptionsViewModel OViewModel = ((OptionsViewModel)ViewModelPtrs[(int)ViewType.OPTIONS]);

                if (OViewModel.IsPublicFolders)
                {
                    lb.SelectedIndex = 5;
                }
                else
                {
                    lb.SelectedIndex = 6;
                }
            }
        }
Example #12
0
        private void PublicFolders()
        {
            EnablePopButtons = false;

            CSMigrationWrapper mw   = ((IntroViewModel)ViewModelPtrs[(int)ViewType.INTRO]).mw;
            MigrationAccount   Acct = new MigrationAccount();

            /* string userName = (UsersList[0].MappedName.Length > 0) ? UsersList[0].MappedName :
             *      UsersList[0].Username;
             * string acctName = userName + '@' + this.ZimbraDomain;
             * Acct.AccountName = acctName;
             * Acct.ProfileName = acctName;*/
            ConfigViewModelS eparams =
                ((ConfigViewModelS)ViewModelPtrs[(int)ViewType.SVRSRC]);

            Acct.ProfileName = eparams.OutlookProfile;

            if (ZimbraAccountName == null)
            {
                MessageBox.Show("Please specify a zimbra account name", "Zimbra Migration", MessageBoxButton.OK,
                                MessageBoxImage.Warning);
                EnableNext = false;
                return;
            }


            string acctName = ZimbraAccountName + '@' + this.ZimbraDomain;

            Acct.AccountName = acctName;
            //Acct.ProfileName = acctName;



            string[] folders = mw.GetPublicFolders(Acct, LogLevel.Trace);



            if (folders != null)
            {
                // FBS rewrite -- bug 71646 -- 3/26/12
                UsersViewModel userm;
                userm = new UsersViewModel(ZimbraAccountName, ZimbraAccountName);

                for (int i = 0; i < folders.Length; i++)
                {
                    /*string[] tokens = users[i].Split('~');
                     * if (tokens.Length < 5)
                     * {
                     *  MessageBox.Show("Object picker returned insufficient data", "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
                     *  EnablePopButtons = true;
                     *  return;
                     * }*/
                    string uname = "", displayname = "", givenname = "", sn = "", zfp = "";

                    /* for (int j = 0; j < tokens.Length; j += 5)
                     * {
                     *   uname = tokens.GetValue(j).ToString();
                     *   displayname = tokens.GetValue(j + 1).ToString();
                     *   givenname = tokens.GetValue(j + 2).ToString();
                     *   sn = tokens.GetValue(j + 3).ToString();
                     *   zfp = tokens.GetValue(j + 4).ToString();
                     * }*/
                    uname       = folders.GetValue(i).ToString();
                    displayname = folders.GetValue(i).ToString();
                    givenname   = folders.GetValue(i).ToString();
                    sn          = folders.GetValue(i).ToString();
                    zfp         = folders.GetValue(i).ToString();

                    /*if (uname.IndexOf("@") != -1)
                     * {
                     *  uname = uname.Substring(0, uname.IndexOf("@"));
                     * }*/

                    PublicfoldersViewModel uvm;


                    if (uname.CompareTo(displayname) == 0)
                    {
                        uvm = new PublicfoldersViewModel(displayname, uname);
                    }
                    else
                    {
                        uvm = new PublicfoldersViewModel(uname, uname);
                    }



                    //uvm.AddOPInfo(new ObjectPickerInfo(displayname, givenname, sn, zfp));
                    uvm.ZimbraAccountName = ZimbraAccountName;
                    UsersBKList.Add(uvm);

                    UsersList.Add(userm);


                    ScheduleViewModel scheduleViewModel =
                        ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);


                    PlusEnabled = false;
                    //Username = ZimbraAccountName;
                    scheduleViewModel.SchedList.Add(new SchedUser(ZimbraAccountName, false));
                    scheduleViewModel.SchedfolderList.Add(new SchedUser(ZimbraAccountName, false));
                    scheduleViewModel.EnableMigrate = (scheduleViewModel.SchedfolderList.Count > 0);
                    scheduleViewModel.EnablePreview = scheduleViewModel.EnableMigrate;
                    EnableNext = (UsersList.Count > 0);
                }
                UsersViewModel usersViewModel =
                    ((UsersViewModel)ViewModelPtrs[(int)ViewType.USERS]);

                usersViewModel.ZimbraDomain = this.ZimbraDomain;

                usersViewModel.UsersList.Add(userm);
            }
            EnablePopButtons = true;
        }
Example #13
0
        private void Next()
        {
            if (!ValidateUsersList(true))
            {
                return;
            }
            ZimbraAPI zimbraAPI = new ZimbraAPI(isServer);

            if (ZimbraValues.zimbraValues.AuthToken.Length == 0)
            {
                MessageBox.Show("You must log on to the Zimbra server", "Zimbra Migration",
                                MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            SaveDomain();

            PublicfoldersViewModel publicfoldersViewModel =
                ((PublicfoldersViewModel)ViewModelPtrs[(int)ViewType.PUBFLDS]);
            ScheduleViewModel scheduleViewModel =
                ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);

            scheduleViewModel.EnableProvGB = false;



            /* for (int i = 0; i < UsersBKList.Count; i++)
             * {
             *   OptionsViewModel ovm = ((OptionsViewModel)ViewModelPtrs[(int)ViewType.OPTIONS]);
             *   ovm.IsSkipFolders = true;
             *   m_config.AdvancedImportOptions.FoldersToSkip = new Folder[UsersBKList.Count];
             *   string folderstoskip = "";
             *   for (i = 0; i < UsersBKList.Count; i++)
             *   {
             *       Folder tempUser = new Folder();
             *       tempUser.FolderName = UsersBKList[i].MappedName.ToString();
             *       folderstoskip += UsersBKList[i].MappedName.ToString();
             *       folderstoskip += ",";
             *       m_config.AdvancedImportOptions.FoldersToSkip.SetValue(tempUser, i);
             *
             *       m_config.AdvancedImportOptions.IsSkipFolders = true;
             *   }
             *   ovm.FoldersToSkip = folderstoskip;
             * }*/

            /* for (int i = 0; i < UsersList.Count; i++)
             * {
             *   string userName = (UsersList[i].MappedName.Length > 0) ? UsersList[i].MappedName :
             *       UsersList[i].Username;
             *   string acctName = userName + '@' + ZimbraDomain;
             *
             *   if (zimbraAPI.GetAccount(acctName) == 0)
             *   {
             *       UsersList[i].IsProvisioned = true;
             *       scheduleViewModel.SchedList[i].isProvisioned = true;    // get (SchedList) in schedule view model will set again
             *   }
             *   else if (zimbraAPI.LastError.IndexOf("no such account") != -1)
             *   {
             *       UsersList[i].IsProvisioned = false;     // get (SchedList) in schedule view model will set again
             *       scheduleViewModel.SchedList[i].isProvisioned = false;
             *       if (!scheduleViewModel.EnableProvGB)
             *       {
             *           scheduleViewModel.EnableProvGB = true;
             *       }
             *   }
             *   else
             *   {
             *       MessageBox.Show(string.Format("Error accessing account {0}: {1}", acctName,
             *           zimbraAPI.LastError), "Zimbra Migration", MessageBoxButton.OK,
             *           MessageBoxImage.Error);
             *   }
             * }*/
            string acctName = ZimbraAccountName + '@' + ZimbraDomain;

            if (zimbraAPI.GetAccount(acctName) == 0)
            {
                UsersList[0].IsProvisioned = true;
                {
                    SchedUser schd = new SchedUser(ZimbraAccountName, true);
                    scheduleViewModel.SchedList.Add(schd);
                    //scheduleViewModel.SchedList[0].isProvisioned = true;
                }
                scheduleViewModel.SchedfolderList[0].isProvisioned = true; // get (SchedList) in schedule view model will set again
            }
            else if (zimbraAPI.LastError.IndexOf("no such account") != -1)
            {
                UsersList[0].IsProvisioned = false; // get (SchedList) in schedule view model will set again
                scheduleViewModel.SchedList[0].isProvisioned       = false;
                scheduleViewModel.SchedfolderList[0].isProvisioned = false;
                if (!scheduleViewModel.EnableProvGB)
                {
                    scheduleViewModel.EnableProvGB = true;
                }
            }
            else
            {
                MessageBox.Show(string.Format("Error accessing account {0}: {1}", acctName,
                                              zimbraAPI.LastError), "Zimbra Migration", MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
            //Logic to get the index of defaulf COS from CosList.
            for (int i = 0; i < scheduleViewModel.CosList.Count; i++)
            {
                if (scheduleViewModel.CosList[i].CosName == "default")
                {
                    ZimbraValues.GetZimbraValues().DefaultCosIndex = i;
                    break;
                }
            }

            foreach (DomainInfo domaininfo in ZimbraValues.GetZimbraValues().ZimbraDomains)
            {
                if (domaininfo.DomainName == publicfoldersViewModel.DomainList[publicfoldersViewModel.CurrentDomainSelection])
                {
                    if (domaininfo.zimbraDomainDefaultCOSId != "")
                    {
                        for (int i = 0; i < scheduleViewModel.CosList.Count; i++)
                        {
                            if (domaininfo.zimbraDomainDefaultCOSId == scheduleViewModel.CosList[i].CosID)
                            {
                                scheduleViewModel.CurrentCOSSelection = i;
                                break;
                            }
                        }
                    }
                    else
                    {
                        scheduleViewModel.CurrentCOSSelection = ZimbraValues.GetZimbraValues().DefaultCosIndex;
                    }
                    break;
                }
            }
            lb.SelectedIndex = 6;
        }
Example #14
0
        private void PublicFolders()
        {
            CSMigrationWrapper mw   = ((IntroViewModel)ViewModelPtrs[(int)ViewType.INTRO]).mw;
            MigrationAccount   Acct = new MigrationAccount();

            ConfigViewModelS eparams = ((ConfigViewModelS)ViewModelPtrs[(int)ViewType.SVRSRC]);

            Acct.ProfileName = eparams.OutlookProfile;

            // ----------------------------------------------------
            // User must enter target zimbra account first
            // ----------------------------------------------------
            if (ZimbraAccountName == null)
            {
                MessageBox.Show("Please specify a zimbra account name", "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Warning);
                EnableNext = false;
                return;
            }

            string acctName = ZimbraAccountName + '@' + this.ZimbraDomain;

            Acct.AccountName = acctName;

            // ----------------------------------------------------
            // Get PFs from C++ layer - takes extended time
            // ----------------------------------------------------
            Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; // Set hourglass
            try
            {
                string[] folders = mw.GetPublicFolders(Acct);
                if (folders != null)
                {
                    // FBS rewrite -- bug 71646 -- 3/26/12
                    UsersViewModel userm;
                    userm = new UsersViewModel(ZimbraAccountName, ZimbraAccountName);

                    for (int i = 0; i < folders.Length; i++)
                    {
                        string uname = "", displayname = "", givenname = "", sn = "", zfp = "";
                        uname       = folders.GetValue(i).ToString();
                        displayname = folders.GetValue(i).ToString();
                        givenname   = folders.GetValue(i).ToString();
                        sn          = folders.GetValue(i).ToString();
                        zfp         = folders.GetValue(i).ToString();

                        PublicfoldersViewModel uvm;
                        if (uname.CompareTo(displayname) == 0)
                        {
                            uvm = new PublicfoldersViewModel(displayname, uname);
                        }
                        else
                        {
                            uvm = new PublicfoldersViewModel(uname, uname);
                        }

                        uvm.ZimbraAccountName = ZimbraAccountName;

                        UsersBKList.Add(uvm);

                        UsersList.Add(userm);

                        ScheduleViewModel scheduleViewModel = ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);

                        PlusEnabled = false;
                        //Username = ZimbraAccountName;
                        scheduleViewModel.SchedList.Add(new SchedUser(ZimbraAccountName, false));
                        scheduleViewModel.SchedfolderList.Add(new SchedUser(ZimbraAccountName, false));
                        scheduleViewModel.EnableMigrate = (scheduleViewModel.SchedfolderList.Count > 0);
                        scheduleViewModel.EnablePreview = scheduleViewModel.EnableMigrate;
                        EnableNext = (UsersList.Count > 0);
                    }
                    UsersViewModel usersViewModel = ((UsersViewModel)ViewModelPtrs[(int)ViewType.USERS]);

                    usersViewModel.ZimbraDomain = this.ZimbraDomain;

                    usersViewModel.UsersList.Add(userm);
                }
            }
            finally
            {
                Mouse.OverrideCursor = null;
            };
        }
Example #15
0
        private void Next()
        {
            using (LogBlock logblock = Log.NotTracing() ? null : new LogBlock(GetType() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name))
            {
                if ((this.ZimbraServerHostName.Length == 0) || (this.ZimbraPort.Length == 0))
                {
                    MessageBox.Show("Please fill in the host name and port", "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                Log.info("ZimbraHostName: " + this.ZimbraServerHostName + "  ZimbraPort: " + this.ZimbraPort);
                Log.info("ZimbraAdmin: " + this.ZimbraAdmin + "  SSL: " + this.ZimbraSSL);

                ZimbraAPI zimbraAPI = new ZimbraAPI(true);
                int       stat      = -1;
                try
                {
                    stat = zimbraAPI.Logon(this.ZimbraServerHostName, this.ZimbraPort, this.ZimbraAdmin, this.ZimbraAdminPasswd, this.ZimbraSSL, true);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Logon", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                if (stat == 0)
                {
                    string authToken = ZimbraValues.GetZimbraValues().AuthToken;
                    if (authToken.Length > 0)
                    {
                        UsersViewModel         usersViewModel         = ((UsersViewModel)ViewModelPtrs[(int)ViewType.USERS]);
                        ScheduleViewModel      scheduleViewModel      = ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);
                        PublicfoldersViewModel publicfoldersViewModel = ((PublicfoldersViewModel)ViewModelPtrs[(int)ViewType.PUBFLDS]);


                        string currentDomain = (usersViewModel.DomainInfoList.Count > 0) ? usersViewModel.DomainInfoList[usersViewModel.CurrentDomainSelection].DomainName : "";
                        currentDomain = (publicfoldersViewModel.DomainInfoList.Count > 0) ? publicfoldersViewModel.DomainInfoList[publicfoldersViewModel.CurrentDomainSelection].DomainName : "";

                        usersViewModel.DomainInfoList.Clear();
                        usersViewModel.DomainList.Clear();
                        publicfoldersViewModel.DomainInfoList.Clear();
                        publicfoldersViewModel.DomainList.Clear();
                        scheduleViewModel.CosList.Clear();

                        // ----------------------------------------------
                        // Get domains
                        // ----------------------------------------------
                        zimbraAPI.GetAllDomains();
                        foreach (DomainInfo domaininfo in ZimbraValues.GetZimbraValues().ZimbraDomains)
                        {
                            string dName = domaininfo.DomainName;
                            usersViewModel.DomainInfoList.Add(new DomainInfo(domaininfo.DomainName, domaininfo.DomainID, domaininfo.zimbraDomainDefaultCOSId));
                            usersViewModel.DomainList.Add(dName);

                            publicfoldersViewModel.DomainInfoList.Add(new DomainInfo(domaininfo.DomainName, domaininfo.DomainID, domaininfo.zimbraDomainDefaultCOSId));
                            publicfoldersViewModel.DomainList.Add(dName);

                            if (dName == currentDomain)
                            {
                                usersViewModel.CurrentDomainSelection         = usersViewModel.DomainInfoList.Count;
                                publicfoldersViewModel.CurrentDomainSelection = publicfoldersViewModel.DomainInfoList.Count;
                            }
                        }

                        usersViewModel.DomainsFilledIn         = true;
                        publicfoldersViewModel.DomainsFilledIn = true;

                        // ----------------------------------------------
                        // Get COS
                        // ----------------------------------------------
                        zimbraAPI.GetAllCos();
                        foreach (CosInfo cosinfo in ZimbraValues.GetZimbraValues().COSes)
                        {
                            scheduleViewModel.CosList.Add(new CosInfo(cosinfo.CosName, cosinfo.CosID));
                        }
                        lb.SelectedIndex = 3;
                    }
                }
                else
                {
                    MessageBox.Show(string.Format("Logon Unsuccessful: {0}", zimbraAPI.LastError), "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Example #16
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);
        }
Example #17
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];
            ScheduleViewModel    scheduleModel     = (ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED];

            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];
                        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
            {
                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;

            m_config.AdvancedImportOptions.IsZDesktop = optionsModel.IsZDesktop;
            // 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;
            }
        }
Example #18
0
        private void Next()
        {
            if ((this.ZimbraServerHostName.Length == 0) || (this.ZimbraPort.Length == 0))
            {
                MessageBox.Show("Please fill in the host name and port", "Zimbra Migration",
                                MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            ZimbraAPI zimbraAPI = new ZimbraAPI(true);
            int       stat      = -1;

            try
            {
                stat = zimbraAPI.Logon(this.ZimbraServerHostName, this.ZimbraPort, this.ZimbraAdmin,
                                       this.ZimbraAdminPasswd, this.ZimbraSSL, true);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Logon", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (stat == 0)
            {
                string authToken = ZimbraValues.GetZimbraValues().AuthToken;

                if (authToken.Length > 0)
                {
                    UsersViewModel usersViewModel =
                        ((UsersViewModel)ViewModelPtrs[(int)ViewType.USERS]);
                    ScheduleViewModel scheduleViewModel =
                        ((ScheduleViewModel)ViewModelPtrs[(int)ViewType.SCHED]);
                    string currentDomain = (usersViewModel.DomainList.Count > 0) ?
                                           usersViewModel.DomainList[usersViewModel.CurrentDomainSelection] : "";

                    usersViewModel.DomainList.Clear();
                    scheduleViewModel.CosList.Clear();
                    zimbraAPI.GetAllDomains();
                    for (int i = 0; i < ZimbraValues.GetZimbraValues().Domains.Count; i++)
                    {
                        string s = ZimbraValues.GetZimbraValues().Domains[i];

                        usersViewModel.DomainList.Add(s);
                        // if we've loaded a config file where the domain was specified, then set it as selected
                        if (currentDomain != null)
                        {
                            if (currentDomain.Length > 0)
                            {
                                if (s == currentDomain)
                                {
                                    usersViewModel.CurrentDomainSelection = i;
                                }
                                usersViewModel.DomainsFilledIn = true;
                            }
                        }
                    }
                    zimbraAPI.GetAllCos();
                    foreach (CosInfo cosinfo in ZimbraValues.GetZimbraValues().COSes)
                    {
                        scheduleViewModel.CosList.Add(new CosInfo(cosinfo.CosName, cosinfo.CosID));
                    }
                    lb.SelectedIndex = 3;
                }
            }
            else
            {
                MessageBox.Show(string.Format("Logon Unsuccessful: {0}", zimbraAPI.LastError),
                                "Zimbra Migration", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Example #19
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);
            }
        }