public ActionResult Salvar(string formSerialize)
        {
            var model = Deserialize<SendEmailModels>(formSerialize);

            var userAuth = FormsAuthenticationUtil.UserAuthenticated;

            if (userAuth != null)
            {
                using (var ws = new SendEmail())
                {
                    var email = new WS.SendEmail.Email
                                    {
                                        To = model.To,
                                        idClient = userAuth.IdCliente ?? 0,
                                        HtmlEmail = model.HtmlEmail
                                    };
                    var uri = Resources.Resource.GS_URL_Email;
                    if (uri != null)
                        email.FileList = new[] { string.Format("{0}/Areas/GS/Gallery/Background/{1}", uri, model.SelectedFile.Name) };

                    ws.SendEmailMarketing(Settings.AutenticationKeyEarningSystem, email);
                }
            }

            return Json(new JsonRequestResult { ResultType = JsonRequestResultType.Success, Message = Resources.Resource.GS_EmailMarketing_Success }, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 2
0
        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 };
        }