Exemple #1
0
        private EmailIdDTO GetAgentUsersContact(int bookingId)
        {
            UserAgentMapperMaster userAgentMapperMaster = new UserAgentMapperMaster();
            AgentUserMapperDTO    agentUserMapperDTO    = userAgentMapperMaster.GetAgentUserEmailIds(bookingId);
            EmailIdDTO            emailIdDTO            = null;

            if (agentUserMapperDTO != null && agentUserMapperDTO.UserList != null)
            {
                foreach (UserDTO user in agentUserMapperDTO.UserList)
                {
                    if (!String.IsNullOrEmpty(user.EmailId) && GF.ValidateEmailId(user.EmailId))
                    {
                        if (emailIdDTO == null)
                        {
                            emailIdDTO = new EmailIdDTO();
                        }
                        emailIdDTO.TOs += user.EmailId + ";";
                    }
                }
                if (!String.IsNullOrEmpty(agentUserMapperDTO.Agent.EmailId) && GF.ValidateEmailId(agentUserMapperDTO.Agent.EmailId))
                {
                    if (emailIdDTO == null)
                    {
                        emailIdDTO = new EmailIdDTO();
                    }
                    emailIdDTO.CCs = agentUserMapperDTO.Agent.EmailId + ";";
                }
            }
            return(emailIdDTO);
        }
    private void FillUsers()
    {
        UserAgentMapperMaster userAgentMapperMaster = new UserAgentMapperMaster();

        UserDTO[] userDto = userAgentMapperMaster.Getusers();
        ListItem  l;

        if (userDto != null && userDto.Length > 0)
        {
            for (int i = 0; i < userDto.Length; i++)
            {
                l = new ListItem(userDto[i].UserName, userDto[i].UserId.ToString());
                lstUsers.Items.Add(l);
            }
        }
    }
    protected void btnUnAssignAgent_Click(object sender, EventArgs e)
    {
        UserAgentMapperMaster userAgentMapperMaster;
        UserAgentMapperDTO    userAgentMapperDTO;

        if (!base.ValidateIfCommandAllowed(Request.Url.AbsoluteUri, ENums.PageCommand.Update))
        {
            return;
        }

        if (lstUsers.SelectedValue == null)
        {
            DisplayAlert("Please select user to assign agents.");
            return;
        }

        if (lstHookedAgents.GetSelectedIndices().Length == 0)
        {
            DisplayAlert("Please select unassigned agents to be assgined.");
            return;
        }

        try
        {
            userAgentMapperMaster = new UserAgentMapperMaster();
            userAgentMapperDTO    = MapHookedAgentsToObject();
            bool success = userAgentMapperMaster.Delete(userAgentMapperDTO);
            if (success)
            {
                DisplayAlert("Agent mapped successfully.");
            }
            else
            {
                DisplayAlert("Agent mapping failed.");
            }
            FillHookedAgents();
            FillUnhookedAgents();
        }
        catch (Exception exp)
        {
            DisplayAlert(exp.Message);
        }
    }
    private void FillHookedAgents()
    {
        UserAgentMapperMaster userAgentMapperMaster = new UserAgentMapperMaster();

        lstHookedAgents.Items.Clear();
        if (lstUsers.SelectedValue != null)
        {
            String             userId             = lstUsers.SelectedValue.ToString();
            UserAgentMapperDTO userAgentMapperDto = userAgentMapperMaster.GetHookedAgents(userId);
            ListItem           l;
            if (userAgentMapperDto != null && userAgentMapperDto.AgentList != null && userAgentMapperDto.AgentList.Count > 0)
            {
                for (int i = 0; i < userAgentMapperDto.AgentList.Count; i++)
                {
                    l = new ListItem(userAgentMapperDto.AgentList[i].AgentName, userAgentMapperDto.AgentList[i].AgentId.ToString());
                    lstHookedAgents.Items.Add(l);
                }
            }
        }
    }