public void Mailer(int FeedId)
        {
            ErrorExceptionHandler _handler = new ErrorExceptionHandler();

            _handler.Webservice_initialize("Web service initialized for subscribers");
            try
            {
                var path = Path.Combine(Server.MapPath("~/WebService"), "MailContent.html");

                string html            = File.ReadAllText(path);
                string Email_Subscribe = "";
                Feed   _feed           = new Feed();

                string connectionString = ConfigurationManager.ConnectionStrings[ConnectionName].ConnectionString;

                using (SqlConnection con = new SqlConnection(connectionString))
                {
                    con.Open();
                    SqlCommand cmd = new SqlCommand("select TOP 1 * from GS_FEED WHERE Rowstatus='A'  order by 1 desc", con);
                    cmd.CommandType = CommandType.Text;

                    SqlDataReader rdr = cmd.ExecuteReader();
                    while (rdr.Read())
                    {
                        _feed.ID          = (int)rdr["FeedID"];
                        _feed.Title       = rdr["Title"].ToString();
                        _feed.Description = rdr["Description"].ToString();
                        _feed.image       = rdr["Images"].ToString();
                        _feed.link        = rdr["link"].ToString();
                        _feed.CategoryID  = (int)rdr["Category_Id"];
                        _feed.Rowstatus   = Convert.ToChar(rdr["Rowstatus"]);
                    }
                }

                html = html.Replace("Title", _feed.Title);
                html = html.Replace("Description", _feed.Description);
                html = html.Replace("link", _feed.link);
                html = html.Replace("PicName", _feed.image);



                List <Subscribers> _Subscribers = GetSubscribers.ToList();

                for (int i = 0; i < _Subscribers.Count; i++)
                {
                    Email_Subscribe = _Subscribers[i].Email;
                    Sentmail(html, Email_Subscribe, _feed.Title);
                }

                JavaScriptSerializer js = new JavaScriptSerializer();
                Context.Response.Write(js.Serialize(_Subscribers));
            }

            catch (Exception ex)
            {
                string Module_name = "MailerWebservice";
                string Action      = "Get_All_Subscribers";
                _handler.ReportError(Module_name, ex.Message, Action);
            }
        }
Exemple #2
0
        private bool CheckSubscribes(Subscribe sub)
        {
            GetSubscribers subs = new GetSubscribers();


            foreach (string str in Ale.getSubscribers(subs))
            {
                Console.WriteLine(str);
            }

            return(true);
        }