private void btnImportRecords_Click(object sender, System.EventArgs e)
        {
            try
            {
                Nav1.Feedback.Text = String.Empty;
                //Validate delimiting character not blank
                if (delimitingCharacter == String.Empty)
                {
                    Nav1.Feedback.Text = SharedSupport.GetLocalizedString("AdminImport_ChooseDelimitingChar");
                    return;
                }

                System.Data.DataSet dsuser = SharedSupport.ParseDelimitedFile(uploadedFilePath, delimitingCharacter);
                //Grab the column order from the drop downs and put into string array

                int[] columns = new int[6];

                if (!cboLastName.SelectedIndex.Equals(0) && !cboLastName.SelectedIndex.Equals(-1))
                {
                    if (!checkMultipleColumn(columns, cboLastName.SelectedIndex))
                    {
                        columns[0] = cboLastName.SelectedIndex;
                    }
                    else
                    {
                        throw new ApplicationException(SharedSupport.GetLocalizedString("AdminImport_ColumnOnce"));
                    }
                }
                else
                {
                    //throw required field error.
                    throw new ApplicationException(SharedSupport.GetLocalizedString("AdminImport_MissingLastName"));
                }
                if (!cboFirstName.SelectedIndex.Equals(0) && !cboFirstName.SelectedIndex.Equals(-1))
                {
                    if (!checkMultipleColumn(columns, cboFirstName.SelectedIndex))
                    {
                        columns[1] = cboFirstName.SelectedIndex;
                    }
                    else
                    {
                        throw new ApplicationException(SharedSupport.GetLocalizedString("AdminImport_ColumnOnce"));
                    }
                }
                else
                {
                    //throw required field error.
                    throw new ApplicationException(SharedSupport.GetLocalizedString("AdminImport_MissingFirstName"));
                }
                if (!cboMiddleName.SelectedIndex.Equals(0) && !cboMiddleName.SelectedIndex.Equals(-1))
                {
                    if (!checkMultipleColumn(columns, cboMiddleName.SelectedIndex))
                    {
                        columns[2] = cboMiddleName.SelectedIndex;
                    }
                    else
                    {
                        throw new ApplicationException(SharedSupport.GetLocalizedString("AdminImport_ColumnOnce"));
                    }
                }
                else
                {
                    columns[2] = -1;
                }
                if (!cboEmailAddress.SelectedIndex.Equals(0) && !cboEmailAddress.SelectedIndex.Equals(-1))
                {
                    if (!checkMultipleColumn(columns, cboEmailAddress.SelectedIndex))
                    {
                        columns[3] = cboEmailAddress.SelectedIndex;
                    }
                    else
                    {
                        throw new ApplicationException(SharedSupport.GetLocalizedString("AdminImport_ColumnOnce"));
                    }
                }
                else
                {
                    //throw required field error.
                    throw new ApplicationException(SharedSupport.GetLocalizedString("AdminImport_MissingEmail"));
                }
                if (!cboUniversityID.SelectedIndex.Equals(0) && !cboUniversityID.SelectedIndex.Equals(-1))
                {
                    if (!checkMultipleColumn(columns, cboUniversityID.SelectedIndex))
                    {
                        columns[4] = cboUniversityID.SelectedIndex;
                    }
                    else
                    {
                        throw new ApplicationException(SharedSupport.GetLocalizedString("AdminImport_ColumnOnce"));
                    }
                }
                else
                {
                    //throw required field error.
                    throw new ApplicationException(SharedSupport.GetLocalizedString("AdminImport_MissingID"));
                }
                if (!cboUserName.SelectedIndex.Equals(0) && !cboUserName.SelectedIndex.Equals(-1))
                {
                    if (!checkMultipleColumn(columns, cboUserName.SelectedIndex))
                    {
                        columns[5] = cboUserName.SelectedIndex;
                    }
                    else
                    {
                        throw new ApplicationException(SharedSupport.GetLocalizedString("AdminImport_ColumnOnce"));
                    }
                }
                else
                {
                    //throw required field error.
                    throw new ApplicationException(SharedSupport.GetLocalizedString("AdminImport_MissingUserName"));
                }

                //Make sure that each column is only choosen once.
                //Grab the userId from the cookie
                int    UserID        = SharedSupport.GetUserIdentity();
                int    importErrors  = 0;
                int    importSuccess = 0;
                string importID      = System.Guid.NewGuid().ToString();
                for (int i = 0; i < dsuser.Tables[0].Rows.Count; i++)
                {
                    try
                    {
                        string userName = dsuser.Tables[0].Rows[i][columns[5] - 1].ToString();
                        // Does the user already exist?
                        UserM userByName = UserM.LoadByUserName(userName);
                        if (userByName.IsValid)
                        {
                            throw new Exception(SharedSupport.GetLocalizedString("User_UserNameMustBeUnique"));
                        }
                        UserM user = new UserM();
                        user.LastName  = dsuser.Tables[0].Rows[i][columns[0] - 1].ToString();
                        user.FirstName = dsuser.Tables[0].Rows[i][columns[1] - 1].ToString();
                        if (!columns[2].Equals(-1))
                        {
                            user.MiddleName = dsuser.Tables[0].Rows[i][columns[2] - 1].ToString();
                        }
                        user.EmailAddress      = dsuser.Tables[0].Rows[i][columns[3] - 1].ToString();
                        user.UniversityID      = dsuser.Tables[0].Rows[i][columns[4] - 1].ToString();
                        user.UserName          = userName;
                        user.LastUpdatedUserID = UserID;
                        user.LastUpdatedDate   = DateTime.Now;
                        user.ChangedPassword   = false;
                        // create but do not mail out password.
                        user.Create(false);
                        if (!user.IsInCourse(courseId))
                        {
                            user.ImportToCourse(courseId, importID);
                        }
                        importSuccess++;
                    }
                    catch
                    {
                        importErrors++;
                    }
                }

                //Delete imported file
                System.IO.File.Delete(uploadedFilePath);
                //Redirect to Results page.
                Response.Redirect("Results.aspx?CourseID=" + courseId.ToString() + "&ImportID=" + importID + "&Success=" + importSuccess + "&Errors=" + importErrors + "&Expected=" + dsuser.Tables[0].Rows.Count, false);
            }
            catch (Exception ex)
            {
                Nav1.Feedback.Text = SharedSupport.GetLocalizedString("AdminImport_GenericError");
            }
        }