public JsonRequestResult Envio(SendEmailModels model)
        {
            var userAuth = FormsAuthenticationUtil.UserAuthenticated;

            if (userAuth != null)
            {
                using (var ws = new SendEmail())
                {
                    var retorno = ws.SendEmailInvite(Settings.AutenticationKeyEarningSystem,
                                                        new Email
                                                        {
                                                            To = model.To,
                                                            idClient = userAuth.IdCliente.GetValueOrDefault(),
                                                            HtmlEmail = model.HtmlEmail
                                                        }, userAuth.IdCliente, Resources.Resource.GS_URL_Email).ToList();

                    return new JsonRequestResult { ResultType = JsonRequestResultType.Success, Message = MontaRetorno(retorno) };
                }
            }

            return new JsonRequestResult { ResultType = JsonRequestResultType.Success, Message = Resources.Resource.GS_Invite_SendEmailError };
        }
        private void AtualizarLista(ref List<ContactModel> itens, SendEmailModels model)
        {
            if (model != null && model.To != null && model.To.Any())
            {
                foreach (var item in itens)
                {
                    foreach (var i in model.To)
                    {
                        if (item != null && i.IdContato == item.IdContact)
                        {
                            item.Selecionado = i.Selecionado;
                        }
                    }
                }
            }

            SaveListInSession(itens);
        }
        public ActionResult LoadSendTo(string itens)
        {
            var model = new SendEmailModels();

            var allItens = GetListFromSession();
            if (allItens != null && allItens.Any())
            {
                AtualizarLista(ref allItens, Deserialize<SendEmailModels>(itens));

                model.To = allItens.Select(m => new ToModel
                                                    {
                                                        IdContato = m.IdContact ?? default(int),
                                                        NomeContato = m.Name,
                                                        EmailContato = m.Email,
                                                        Selecionado = m.Selecionado
                                                    }).Where(m => m.Selecionado).ToArray();
            }

            return PartialView("_SendTo", model);
        }
 /// <remarks/>
 public void GetSendEmailModelsAsync(string authenticationKey, SendEmailModels email, object userState) {
     if ((this.GetSendEmailModelsOperationCompleted == null)) {
         this.GetSendEmailModelsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetSendEmailModelsOperationCompleted);
     }
     this.InvokeAsync("GetSendEmailModels", new object[] {
                 authenticationKey,
                 email}, this.GetSendEmailModelsOperationCompleted, userState);
 }
 /// <remarks/>
 public void GetSendEmailModelsAsync(string authenticationKey, SendEmailModels email) {
     this.GetSendEmailModelsAsync(authenticationKey, email, null);
 }
 public void GetSendEmailModels(string authenticationKey, SendEmailModels email) {
     this.Invoke("GetSendEmailModels", new object[] {
                 authenticationKey,
                 email});
 }