public string GetTemplateHtml(Int64 htmlTemplateId)
 {
     DripTempaleService dripTempaleService = new DripTempaleService();
     return dripTempaleService.GetDripTemplateHtmlParticularId(htmlTemplateId);
 }
        public void SenDripTemplate()
        {
            try
            {
                lblerror.Text = "Email schedular started on " + DateTime.Now;
                ClientBroadCastingService clientBroadCastingService = new ClientBroadCastingService();
                DripTempaleService dripTempaleService = new DripTempaleService();
                List<ClientCampaignModel> clientCampaign = new List<ClientCampaignModel>();
                ImageServices imageServices = new ImageServices();
                clientCampaign = GetClientLists();
                for (int i = 0; i < clientCampaign.Count; i++)
                {
                    var clientDetail = clientBroadCastingService.GetClientDetail(clientCampaign[i].ClientUserId).ToList();
                    var agentDetail = imageServices.GetAboutMe(clientCampaign[i].UserId).ToList();
                    if (clientCampaign[i].DateStamp.Value.Month == DateTime.Now.Month && clientCampaign[i].DateStamp.Value.Year == DateTime.Now.Year && clientCampaign[i].DateStamp.Value.Day == DateTime.Now.Day)
                    {
                        if (clientCampaign[i].Status == null)
                        {
                            var template = dripTempaleService.GetDripTemplateHtmlParticularId(clientCampaign[i].TemplateHtmlId);
                            var enote = dripTempaleService.GetParticularDripTemplates(clientCampaign[i].EnoteTemplateId);
                            template = template.Replace("enote header", enote.TemplateSubject);
                            template = template.Replace("enote description", enote.TemplateDescription);
                            template = template.Replace("agent name", agentDetail[0].FirstName + " " + agentDetail[0].LastName);
                            template = template.Replace("agent address", agentDetail[0].Address);
                            template = template.Replace("agent phone", agentDetail[0].Phone);
                            template = template.Replace("agent cell", agentDetail[0].Cell);
                            template = template.Replace("agent email", agentDetail[0].Email);
                            template = template.Replace("agent website", agentDetail[0].WebsiteName);
                            if (string.IsNullOrEmpty(agentDetail[0].AboutLogo))
                            {
                                template = template.Replace("aboutlogo", "http://myrealtyweb.com/DripTemplateHtml/photo.jpg");
                            }
                            else
                            {
                                template = template.Replace("aboutlogo", "http://myrealtyweb.com/Aboutmelogo/" + agentDetail[0].AboutLogo);
                            }
                            template = template.Replace("aboutlogo", "" + agentDetail[0].AboutLogo);
                            SendEmail(clientDetail[0].PrimaryEmail, agentDetail[0].FirstName + " " + agentDetail[0].LastName + "@myrealtyweb.com", enote.TemplateHeader, template);
                            lblMessage.Text = "Email has been sent to " + clientDetail[0].PrimaryEmail + " successfully on " + DateTime.Now;
                            dripTempaleService.UpdateDripStatus(clientCampaign[i].ClientCampaignId, 1);
                        }
                    }
                    else
                    {
                        lblMessage.Text = "No email sent right now calculated date is " + DateTime.Now;
                    }

                }
            }
            catch (Exception ex)
            {
                Helper hp = new Helper();
                hp.LogException(ex);
                lblMessage.Text = ex.Message;
            }
        }