示例#1
0
        public static void SendWidgetSnippetCode(Widget widget)
        {
            using (var message = new MailMessage())
            {
                message.To.Add(new MailAddress(widget.User.UserID));
                message.From    = new MailAddress(FromEmail, FromEmailTitle);
                message.Subject = "Widget Script";
                message.Body    = "Dear " + widget.User.Name + "!";
                message.Body   += "<br/>";
                message.Body   += "<p>Thank you for joining Talk to Leads Now and taking the first step in converting more leads from your website.</p>";
                message.Body   += "<p>Please go ahead and install it on your website.You just need to copy the follwing code (Javascript) and paste it at the end of your html page just before the '&lt;/Body&gt;' tag. </p>";
                message.Body   += "<p>Please do not hesitate to contact us if you need help in installing or using our widget. </p>";
                message.Body   += "<p>Widget Code: </p>";

                string snippetCode = CallmeController.GetSnippetCodeStatic(widget.ID.ToString());
                //string snippetCode = "script hello script";
                message.Body += "<textarea style='width:70%;height:100px;text-align:left;font-size:14px;background:#2f353a;color: white;border: #ff6600 2px solid;padding: 5px' readonly='true'>" + snippetCode + "</textarea> <br>";

                //string snippetCode = CallmeController.GetSnippetCodeStatic(widget.ID.ToString());
                //message.Body += "<p style='text-decoration:italic;font-size:14px;padding:20px;border: 1px solid orange'>" + snippetCode + "</p> <br>";

                message.Body += "<p>Widget Name: " + widget.WidgetName + "</p>";
                message.Body += "<p>Phone Number: " + widget.ConnectedTo + "</p>";
                message.Body += "<p>Domain Url: " + widget.DomainURL + "</p>";


                //message.Body += "<a target='_balnk' href='" + "http://www.talktoleadsnow.com/#/resetpassword/" + token + "'>" + "http://talktoleadsnow.com/#/resetpassword/" + token + "</a>";
                message.Body += "<p>Regards,</p>";
                message.Body += "<p>TalkToLeadsNow team.</p>";
                message.Body += "<a target='_balnk' href='http://www.talktoleadsnow.com'> <img width='200px' src='http://api.talktoleadsnow.com/api/style/images/talktoleadsnow-small.png'></a>";
                message.Body += "<hr height='1' style='height: 1px; border: 0 none; color: #D7DFE3; background-color: #D7DFE3; margin-top:1.5em; margin-bottom:1.5em;'>";

                message.Body += "<p style='color:gray'>" +
                                "This email was automatically generated on your request for your callback widget creation at TalkToLeadsNow. In case you didn't request that, please ignore this e-mail. Your information will be removed automatically from our database."
                                + "</p>";

                message.IsBodyHtml = true;

                using (var client = new SmtpClient("smtp.gmail.com"))
                {
                    client.Port        = 587;
                    client.Credentials = new NetworkCredential(FromEmail, EmailPassword);
                    client.EnableSsl   = true;
                    client.Send(message);
                }
            }
        }
示例#2
0
        public async Task <IEnumerable <WidgetDTO> > GetAllWidgetsForUser(string email)
        {
            try
            {
                AuthController.ValidateAndGetCurrentUserName(this.HttpContext.Request);

                email = email.Replace("'", "");

                List <Widget> widgetList = new List <Widget>();
                widgetList = await context.Widgets.Include(widget => widget.User)
                             .Where(widget => widget.UserID == email)
                             .OrderBy(widget => widget.CreationDateTime)
                             .ToListAsync();

                List <WidgetDTO> widgetDTOList = new List <WidgetDTO>();
                foreach (Widget widget in widgetList)
                {
                    WidgetDTO wgtDTO = new WidgetDTO(widget);

                    if (CallmeController.IsWidgetOutofSubscription(widget, context))
                    {
                        wgtDTO.Status = "Out of Subscription";
                    }
                    else if (await CallmeController.IsWidgetOutofCallAsync(widget, context))
                    {
                        wgtDTO.Status = "Out of Call";
                    }

                    widgetDTOList.Add(wgtDTO);
                }

                return(widgetDTOList);
            }catch (Exception ex)
            {
                throw ex;
            }
        }