Пример #1
0
 public void DataGrid_Loaded(string id, string fn, string ln)
 {
     SelectedFirstName = fn;
     UsersList.Add(new UserModel {
         IDUser = id, NameUser = fn, PasswordUser = ln
     });
 }
Пример #2
0
        void WaitForConnections()
        {
            while (true)
            {
                if (_socket == null)
                {
                    return;
                }
                User user = new User
                {
                    ID       = this._clientIdCounter,
                    Username = "******"
                };
                try
                {
                    user.Socket = _socket.Accept();
                    user.Thread = new Thread(() => CoordinateMessages(user));

                    this._dispatcher.Invoke(new Action(() =>
                    {
                        UsersList.Add(user);
                    }), null);

                    user.Thread.Start();
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Coordinator : {ex.Message}", "Error");
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Retrieves list of Users objects from SqlCommand, after database query
        /// number of rows retrieved and returned depends upon the rows field value
        /// </summary>
        /// <param name="cmd">The command object to use for query</param>
        /// <param name="rows">Number of rows to process</param>
        /// <returns>A list of Users objects</returns>
        private UsersList GetList(SqlCommand cmd, long rows)
        {
            // Select multiple records
            SqlDataReader reader;
            long          result = SelectRecords(cmd, out reader);

            //Users list
            UsersList list = new UsersList();

            using ( reader )
            {
                // Read rows until end of result or number of rows specified is reached
                while (reader.Read() && rows-- != 0)
                {
                    Users usersObject = new Users();
                    FillObject(usersObject, reader);

                    list.Add(usersObject);
                }

                // Close the reader in order to receive output parameters
                // Output parameters are not available until reader is closed.
                reader.Close();
            }

            return(list);
        }
Пример #4
0
        public OperationStatistique()
        {
            this.UsersList = new ObservableCollection <statistique>();
            var x = from f in dcd.Filiere
                    join e in dcd.etudiant
                    on f.Id_filiere equals e.id_fil
                    group new { e, f } by new { f.Nom_filiere } into g
                select new { nomFil = g.Key.Nom_filiere, nbrEtu = g.Count() };

            var y = from f in dcd.Filiere
                    join e in dcd.etudiant
                    on f.Id_filiere equals e.id_fil into outerJoin
                    from j in outerJoin.DefaultIfEmpty()
                    where j.id_fil == null
                    select new { nomFil = f.Nom_filiere };

            foreach (var i in x)
            {
                statistique f = new statistique();
                f.NombreEtudiant = i.nbrEtu;
                f.NomFiliere     = i.nomFil;
                UsersList.Add(f);
            }

            foreach (var i in y)
            {
                statistique f = new statistique();
                f.NombreEtudiant = 0;
                f.NomFiliere     = i.nomFil;
                UsersList.Add(f);
            }
        }
Пример #5
0
        private void ObjectPicker()
        {
            using (LogBlock logblock = Log.NotTracing() ? null : new LogBlock(GetType() + "." + System.Reflection.MethodBase.GetCurrentMethod().Name))
            {
                EnablePopButtons = false;

                CSMigrationWrapper mw    = ((IntroViewModel)ViewModelPtrs[(int)ViewType.INTRO]).mw;
                string[]           users = mw.GetListFromObjectPicker();
                if (users != null)
                {
                    // FBS rewrite -- bug 71646 -- 3/26/12
                    for (int i = 0; i < users.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();
                        }

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

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

                        uvm.AddOPInfo(new ObjectPickerInfo(displayname, givenname, sn, zfp));
                        UsersList.Add(uvm);

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

                        scheduleViewModel.SchedList.Add(new SchedUser(Username, false));
                        scheduleViewModel.EnableMigrate = (scheduleViewModel.SchedList.Count > 0);
                        scheduleViewModel.EnablePreview = scheduleViewModel.EnableMigrate;
                        EnableNext = (UsersList.Count > 0);
                    }
                }
                EnablePopButtons = true;
            }
        }
        public UsersViewModel()
        {
            this.UsersList = new ObservableCollection <UserProfile>();

            DateTime date = DateTime.Today;

            UsersList.Add(new UserProfile {
                TimeStamp = date.AddHours(0.5), NoOfUsers = 1000
            });
            UsersList.Add(new UserProfile {
                TimeStamp = date.AddHours(1), NoOfUsers = 5000
            });
            UsersList.Add(new UserProfile {
                TimeStamp = date.AddHours(1.5), NoOfUsers = 3000
            });
            UsersList.Add(new UserProfile {
                TimeStamp = date.AddHours(2), NoOfUsers = 4000
            });
            UsersList.Add(new UserProfile {
                TimeStamp = date.AddHours(2.5), NoOfUsers = 2000
            });
            UsersList.Add(new UserProfile {
                TimeStamp = date.AddHours(3), NoOfUsers = 1000
            });
        }
Пример #7
0
        private void StartReadingUsersServer()
        {
            var cts = new CancellationTokenSource();

            UsersList.Clear();
            _ = m_chatService.Users()
                .ForEachAsync((x) => UsersList.Add($" {x.Name}"), cts.Token);

            App.Current.Exit += (_, __) => cts.Cancel();
        }
Пример #8
0
        private async Task FillUsersList()
        {
            var existingUsers = await _userService.GetExistingUsers();

            UsersList.Clear();
            foreach (var user in existingUsers)
            {
                UsersList.Add(user);
            }
        }
Пример #9
0
        public MainWindow()
        {
            InitializeComponent();
            User2DataContext DBUsers = new User2DataContext();
            List <Users>     l       = DBUsers.GetListOfUsers().ToList();

            foreach (Users u in l)
            {
                UsersList.Add(u);
            }
            DataContext = this;
        }
Пример #10
0
        User(string name, string userName)
        {
            Guard.Against.NullOrEmpty(name, nameof(name));
            Guard.Against.NullOrEmpty(userName, nameof(userName));

            Id        = Guid.NewGuid();
            Name      = name;
            UserName  = userName;
            CreatedAt = DateTimeOffset.UtcNow;

            UsersList.Add(this);
        }
Пример #11
0
        public void Add()
        {
            User NewUser = new User();

            NewUser.FirstName    = FirstName;
            NewUser.LastName     = LastName;
            NewUser.Email        = Email;
            NewUser.Tel          = Tel;
            NewUser.Handtekening = Handtekening;
            UsersList.Add(NewUser);
            Save();
        }
Пример #12
0
 private void SaveSelected(object obj)
 {
     if (_selectedUser.Id == Guid.Empty)
     {
         _userService.Add(_selectedUser);
         UsersList.Add(_selectedUser);
     }
     else
     {
         _userService.Update(_selectedUser);
     }
 }
Пример #13
0
        // Users Config Dialog

        private void AddUser(object args)
        {
            var u = new UserViewModel(new UserModel("", 0));

            var  dialog = new AddUserDialog(u);
            bool?result = dialog.ShowDialog();

            if (!((result == null) || (!result.Value)))
            {
                UsersList.Add(u);
                _model.UsersList.Add(u.GetModel());
            }
        }
Пример #14
0
        private void Add(object value)
        {
            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;
        }
Пример #15
0
        public void DataGrid_Loaded()
        {
            DBClass.openConnection();

            DBClass.sql             = "select * from users";
            DBClass.cmd.CommandType = CommandType.Text;
            DBClass.cmd.CommandText = DBClass.sql;

            DBClass.da = new SqlDataAdapter(DBClass.cmd);
            DBClass.dt = new DataTable();
            DBClass.da.Fill(DBClass.dt);

            // wyciągamy dane
            i = 0;
            int j = 0;

            //Console.WriteLine("Przy bazie" + DBClass.dt);
            UsersList.Clear();
            UsersAttributes usersAttributesInstance;

            using (SqlDataReader reader = DBClass.cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    for (j = 0; j <= reader.FieldCount - 1; j++) // Looping throw colums
                    {
                        data[j] = reader.GetValue(j).ToString();
                    }
                    if (data[0] != "0")
                    {
                        UsersList.Add(new UserModel
                        {
                            IDUser        = (data[0]),
                            NameUser      = data[1],
                            PasswordUser  = data[2],
                            TypeUser      = ((UsersAttributes)(Int32.Parse(data[3]))).ToString(),
                            FirstNameUser = data[4],
                            LastNameUser  = data[5]
                        });
                    }
                    usersAttributesTemp[i] = Int32.Parse(data[3]);
                    Console.WriteLine("userAtributes in Loaded " + (usersAttributesTemp[i]) + "data - " + data[3]);
                    i++;
                    //Console.WriteLine("FirstNameUser" + reader["FirstNameUser"].ToString());
                }
            }
            selectedFirstName = "Adrian";
            DBClass.closeConnection();
        }
Пример #16
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;
            }
        }
Пример #17
0
        // Public

        public AppViewModel()
        {
            EventsManager.SetMainWindowCancelEventHandler(MainWindowOnClosing);

            // commands

            ExitCommand         = new RelayCommand(CloseApplication);
            SaveConfigCommand   = new RelayCommand(o => SaveConfig(ConfigConsts.ConfigPath));
            ExportConfigCommand = new RelayCommand(o => ExportConfig());

            ShowOpenUserDialogCommand    = new RelayCommand(ShowOpenUserDialog);
            CloseUserCommand             = new RelayCommand(CloseCurrentUser, CanCloseCurrentUser);
            ShowUsersConfigDialogCommand = new RelayCommand(ShowUsersConfigDialog, CanOpenUsersConfig);

            OpenUserCommand = new RelayCommand(OpenUser, o => SelectedOpenUserDialog != null);

            AddUserCommand    = new RelayCommand(AddUser);
            RemoveUserCommand = new RelayCommand(RemoveUser, o => SelectedUsersConfigDialog != null);
            EditUserCommand   = new RelayCommand(ShowEditUserDialog, o => o != null);

            // configuration

            var config = new XmlDocument();

            try
            {
                config.Load(ConfigConsts.ConfigPath);
                _model.LoadUsersFromXml(config);
            }
            catch (Exception ex)
            {
                if (ex is BadXmlException || ex is XmlException ||
                    ex is ArgumentNullException || ex is System.IO.IOException)
                {
                    MessageBox.Show("Error loading configuration.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
                else
                {
                    throw;
                }
            }

            foreach (UserModel user in _model.UsersList)
            {
                UsersList.Add(new UserViewModel(user));
            }
        }
Пример #18
0
 public void StartServer()
 {
     if (this.IsServerActive)
     {
         return;
     }
     _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     _socket.Bind(_ipEndPoint);
     _socket.Listen(5);
     _thread = new Thread(new ThreadStart(WaitForConnections));
     _thread.Start();
     UsersList.Add(new User()
     {
         ID = 0, Username = this.Username
     });
     this.IsServerActive = true;
 }
Пример #19
0
        private void NewMessagesReceived(string message)
        {
            App.Current.Dispatcher.Invoke(() =>
            {
                if (message.Contains("New User"))
                {
                    string[] newUser = message.Split(':');
                    UsersList.Add(newUser[1]);
                }
                else
                {
                    ChatMessages.Add(new ChatHistoryVM(message, DateTime.Now));
                }

                //UsersList.Add(new UserVM(message, new ChatHistoryVM(message)));
            });
        }
        public async Task Init()
        {
            try
            {
                UsersList.Clear();
                var users = await _usersService.Get <IList <UserDto> >();

                foreach (var item in users)
                {
                    UsersList.Add(item);
                }
            }
            catch
            {
                throw;
            }
        }
Пример #21
0
        private async void SaveUser(object userObj)
        {
            UsersViewModel userS = userObj as UsersViewModel;

            if ((userS != null) && userS.isValid())
            {
                bool         postRes = false;
                UsersService us      = new UsersService();
                postRes = await us.PostUserAsync(userS.user);//us.PostUserSync(userS.user);

                if (postRes)
                {
                    UsersList.Add(userS);
                }
            }
            Back();
        }
Пример #22
0
        /// <summary>
        /// Добавление нового пользователя в список
        /// </summary>
        /// <param name="userid">Идентификатор пользователя</param>
        /// <param name="nick">Ник</param>
        private void AddUser(long userid, string nick)
        {
            bool result = CheckUser(userid);

            if (result)
            {
                Users users = new Users()
                {
                    Id        = IdUserGenerator(),
                    UserId    = userid,
                    Nick      = nick,
                    DateAdded = DateTime.Now
                };

                UsersList.Add(users);
                SerializeData.SaveItems(UsersList, Path.Users);
            }
        }
        public async Task Filter(string Username)
        {
            try
            {
                var userSearch = await _usersService.Get <IList <UserDto> >(new UserSearchRequest
                {
                    UserName = Username
                });

                UsersList.Clear();

                foreach (var item in userSearch)
                {
                    UsersList.Add(item);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #24
0
        //Admin commands
        #region Users commands
        public static string GET_ALL_USERS()
        {
            try
            {
                conn.Open();
                //utworzenie zapytania do bazy o pozycję użytkownika
                MySqlCommand command = conn.CreateCommand();
                command.CommandType = System.Data.CommandType.Text;
                command.CommandText = "SELECT * FROM users";

                //sprawdzenie, czy baza zwróciła cokolwiek
                object result = command.ExecuteScalar();
                //jeśli zwróciła
                if (result != null)
                {
                    var reader = command.ExecuteReader();
                    reader.Read();
                    while (reader.Read())
                    {
                        UsersList.Add(new User(reader));
                    }
                    return("projects-loaded");
                }
                //jeśli nie zwróciła - brak klientów w bazie
                else
                {
                    return("no-projects");
                }
            }
            //obsługa błędu połączenia z bazą
            catch (MySqlException)
            {
                return("no-connection");
            }
            finally
            {
                conn.Close();
            }
        }
Пример #25
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;
            };
        }
Пример #26
0
 private void AddUser(Account account)
 {
     UsersList.Add(account);
 }
 public void AddPerson(Person person)
 {
     Application.Current.Dispatcher.Invoke((Action) delegate { UsersList.Add(person); });
     SaveChanges();
 }
Пример #28
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;
        }
Пример #29
0
 //task og async
 public async Task AddUserAsync(User user)
 {
     UsersList.Add(user);
     await DbService.AddObjectAsync(user);
 }
Пример #30
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);
                }
            }
        }