예제 #1
0
        ///<returns>A bool indicating if the login credentials were correct or not.</returns>
        /// <param name="dataContext">Provides access to LINQ to SQL.</param>
        private bool AgentLogin(GrangeCallCenterDataClassesDataContext dataContext)
        {
            try
              {
            var gccAgent = (from agent in dataContext.Agents
                        where agent.userName == userNameTextBox.Text
                        select new GCCAgentWithCredentials
                        {
                          Password = agent.password,
                          UserName = agent.userName,
                          HireDate = agent.hireDate,
                          AgentName = agent.agentName
                        }).FirstOrDefault();

            if (gccAgent.Password != passwordTextBox.Text)
            {
              return false;
            }
            else
            {
              callCenterAgent = gccAgent;
              return true;
            }
              }
              catch (NullReferenceException)
              {
            return false;
              }
        }
예제 #2
0
 private bool AddAgent(string agentName, string userName, DateTime hireDate, string password)
 {
     var agentToInsert = new Agent();
       agentToInsert.userName = userName;
       agentToInsert.agentName = agentName;
       agentToInsert.hireDate = hireDate;
       agentToInsert.password = password;
       var adherence = new Adherence();
       adherence.agentName = agentToInsert.agentName;
       var aht = new AHT();
       aht.agentName = agentToInsert.agentName;
       var knowledgeCheck = new KnowledgeCheck();
       knowledgeCheck.agentName = agentToInsert.agentName;
       var qualityControl = new QualityControl();
       qualityControl.agentName = agentToInsert.agentName;
       qualityControl.recordID = RandomRecordId();
       qualityControl.qcRecordID = RandomQcRecordId();
       var dataContext = new GrangeCallCenterDataClassesDataContext();
       dataContext.Agents.InsertOnSubmit(agentToInsert);
       dataContext.Adherences.InsertOnSubmit(adherence);
       dataContext.AHTs.InsertOnSubmit(aht);
       dataContext.KnowledgeChecks.InsertOnSubmit(knowledgeCheck);
       dataContext.QualityControls.InsertOnSubmit(qualityControl);
       try
       {
     dataContext.SubmitChanges();
     return true;
       }
       catch (Exception exception)
       {
     Console.WriteLine("Error: {0}", exception.ToString());
     return false;
       }
 }
예제 #3
0
 // use this initializer when all agents are needed and we haven't pulled any agents
 // from the dataConext yet (ie for comparisons)
 public AgentDataFetcher()
 {
     dataContext = new GrangeCallCenterDataClassesDataContext();
     dataContext.ObjectTrackingEnabled = false;
       allAgents = dataContext.Agents.ToList();
       gccAgents = new List<GCCAgent>();
       foreach (var callCenterAgent in allAgents)
       {
     // Create GCCAgent objects from the agent data pulled from the database.
     // Leave adding values to GCCAHT, GCCAdherence, GCCQualityControl, GCCKnowledgeCheck
     // to the fetch methods.
     var gccAgent = new GCCAgent(callCenterAgent.agentName, callCenterAgent.hireDate);
     // put the GCCAgents in the gccAgents array
     gccAgents.Add(gccAgent);
       }
 }
예제 #4
0
        private void ManagerMainMenu_Load(object sender, EventArgs e)
        {
            SetNameLabel();
              SetDateLabel();
              listBoxToolTip.SetToolTip(agentListBox, "Press and hold down the Ctrl key to select multiple agents");

              dataContext = new GrangeCallCenterDataClassesDataContext();
              dataContext.ObjectTrackingEnabled = false;

              // get all of the agents from the database and put them in an array
              List<Agent> agents = dataContext.Agents.ToList();
              var gccAgents = new List<GCCAgent>();
              foreach (var callCenterAgent in agents)
              {
            // create GCCAgent objects from the agent data pulled from the database
            // only populate the properties that are needed
            var gccAgent = new GCCAgent(callCenterAgent.agentName, callCenterAgent.hireDate);
            // put the GCCAgents in the gccAgents array
            gccAgents.Add(gccAgent);
              }

              PopulateAgentNameComboBox(gccAgents);
        }
예제 #5
0
 // use this initializer when only a subset of the agents are needed
 // and we already have GCCAgents created from dataContext Agents (ie reporting)
 public AgentDataFetcher(List<GCCAgent> selectedAgents)
 {
     dataContext = new GrangeCallCenterDataClassesDataContext();
       gccAgents = selectedAgents;
 }
예제 #6
0
        private void DeleteUsersForm_Load(object sender, EventArgs e)
        {
            dataContext = new GrangeCallCenterDataClassesDataContext();
              dataContext.ObjectTrackingEnabled = true;

              // get all of the agents from the database and put them in an array
              List<Agent> agents = dataContext.Agents.ToList();
              var gccAgents = new List<GCCAgent>();
              foreach (var callCenterAgent in agents)
              {
            // create GCCAgent objects from the agent data pulled from the database
            // only populate the properties that are needed
            var gccAgent = new GCCAgent(callCenterAgent.agentName, callCenterAgent.hireDate);
            // put the GCCAgents in the gccAgents array
            gccAgents.Add(gccAgent);
              }

              PopulateAgentNameComboBox(gccAgents);
        }
예제 #7
0
 private void loginButton_Click(object sender, EventArgs e)
 {
     var dataContext = new GrangeCallCenterDataClassesDataContext();
       dataContext.ObjectTrackingEnabled = false;
       if (AgentLogin(dataContext))
       {
     ClearFieldsAndHide();
     var agentMainMenu = new AgentMainMenu();
     agentMainMenu.callCenterAgent = callCenterAgent;
     agentMainMenu.Show();
     loginAttempts = 0;
       }
       else if (ManagerLogin(dataContext))
       {
     ClearFieldsAndHide();
     var managerMainMenu = new ManagerMainMenu();
     managerMainMenu.callCenterManager = callCenterManager;
     managerMainMenu.Show();
     loginAttempts = 0;
       }
       else if (userNameTextBox.Text.Equals(ADMIN) && passwordTextBox.Text.Equals(ADMIN))
       {
     new AdministratorView().Show();
       }
       else
       {
     if (loginAttempts < 4)
     {
       DisplayLoginError(CREDENTIAL_ERROR, CAPTION);
       loginAttempts++;
     }
     else
     {
       DisplayLoginError(MAX_ATTEMPTS_EXCEEDED, CAPTION);
       Environment.Exit(1);
     }
       }
 }
예제 #8
0
        ///<returns>A bool indicating if the login credentials were correct or not.</returns>
        /// <param name="dataContext">Provides access to LINQ to SQL.</param>
        private bool ManagerLogin(GrangeCallCenterDataClassesDataContext dataContext)
        {
            try
              {
            var gccManager = (from manager in dataContext.Managers
                          where manager.managerUserName == userNameTextBox.Text
                          select new GCCManager
                          {
                            Password = manager.managerPassword,
                            ManagerUserName = manager.managerUserName
                          }).FirstOrDefault();

            if (gccManager.Password != passwordTextBox.Text)
            {
              return false;
            }
            else
            {
              callCenterManager = gccManager;
              return true;
            }
              }
              catch (NullReferenceException)
              {
            return false;
              }
        }