コード例 #1
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();

            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) == 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);
                }
            }
            lb.SelectedIndex = 5;
        }
コード例 #2
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;
        }
コード例 #3
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;
                }
            }
        }
コード例 #4
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;
        }