ONCLICK_BulkUploadPersonnel(object sender, EventArgs e)
        {
            Dictionary <string, bool> DOESEXISTbyEid = new Dictionary <string, bool>();
            Dictionary <string, int>  DICTbusrole    = new Dictionary <string, int>();

            IBusRoleOwner ENGINEbrown = new IBusRoleOwner(HELPERS.NewOdbcConn());
            IBusRole      ENGINEbr    = new IBusRole(HELPERS.NewOdbcConn());


            if (this.FileUpload_PersonnelMappings.HasFile)
            {
                string pathTempFolder = System.IO.Path.GetTempPath();
                string pathTempFile   = System.IO.Path.GetTempFileName();
                FileUpload_PersonnelMappings.SaveAs(pathTempFile);
                DataTable dt = HELPERS.LoadCsv(pathTempFolder,
                                               System.IO.Path.GetFileName(pathTempFile));
                if (dt != null)
                {
                    if (dt.Columns.Count < 3)
                    {
                        throw new Exception("The uploaded CSV file does not have at least 3 columns.");
                    }


                    Queue RETmsgs = new Queue();

                    IEnumerator <System.Data.DataRow> x =
                        (IEnumerator <System.Data.DataRow>)dt.Rows.GetEnumerator();

                    int recordseq = 0;
                    int okCount   = 0;
                    while (x.MoveNext())
                    {
                        recordseq++;

                        string rolename = x.Current[0].ToString().Trim();
                        string rank     = x.Current[1].ToString().Trim();
                        string eid      = x.Current[2].ToString().Trim().ToUpper();


                        switch (rank)
                        {
                        case "Primary Owner":
                            rank = "OWNprim";
                            break;

                        case "Delegate Owner":
                            rank = "OWNdele";
                            break;

                        case "Primary Approver":
                            rank = "appr";
                            break;

                        case "Delegate Approver":
                            rank = "delegate";
                            break;

                        default:
                            RETmsgs.Enqueue("REC#" + recordseq.ToString() + ": line ignored due to unknown rank name: " + rank);
                            continue;
                        }


                        if (recordseq == 1)
                        {
                            // Upon seeing at least one row in the CSV, erase the entire personnel mapping table!
                            HELPERS.DestroyAllBusroleToPersonnelMappings();
                        }

                        if (DOESEXISTbyEid.ContainsKey(eid) == false)
                        {
                            HELPERS.FindUser(HELPERS.NewOdbcConn(), eid, eid, true);
                            DOESEXISTbyEid.Add(eid, true);
                        }


                        int IDrole = -1;
                        if (DICTbusrole.ContainsKey(rolename))
                        {
                            IDrole = DICTbusrole[rolename];
                        }
                        else
                        {
                            try
                            {
                                IDrole = HELPERS.FindBusRoleByName(rolename);
                                DICTbusrole.Add(rolename, IDrole);
                            }
                            catch (Exception)
                            {
                            }
                        }


                        if (IDrole < 0)
                        {
                            RETmsgs.Enqueue("REC#" + recordseq.ToString() + ": line ignored due to unknown role: " + rolename);
                            continue;
                        }


                        try
                        {
                            ENGINEbrown.NewBusRoleOwner(eid, "", rank, IDrole);
                            okCount++;
                        }
                        catch (Exception ee)
                        {
                            RETmsgs.Enqueue("REC#" + recordseq.ToString() + ": " + ee.Message);
                        }
                    }

                    RETmsgs.Enqueue("------------------");
                    RETmsgs.Enqueue("Number of records processed successfully: " + okCount.ToString());
                    if (RETmsgs.Count > 0)
                    {
                        string strMsgs = "";
                        foreach (object objMsg in RETmsgs.ToArray())
                        {
                            strMsgs += "\n" + objMsg.ToString();
                        }
                        TXTimportEngineMessages.Text  = strMsgs;
                        DIVimportFeeback.Visible      = true;
                        PANELcond_AbortUpload.Visible = false;
                        PANELcond_AllowUpload.Visible = false;
                    }
                }
            }
        }