public override void Action()
        {
            WebContext.CreateHttpContext();

            MembersManager mMgr = new MembersManager();
            Downloads      dMgr = new Downloads();

            DataView members = mMgr.GetMembers("").DefaultView;



            string protocol   = WebContext.Protocol;
            string serverName = WebContext.ServerName;
            string root       = WebContext.Root;

            foreach (DataRowView drv in members)
            {
                DataView downloads = dMgr.GetDownloadsByNetwork((int)drv["MemberId"], DateTime.Now.AddDays(-7)).DefaultView;

                if (downloads.Count > 0)
                {
                    StringBuilder str = new StringBuilder();

                    str.Append("<ul>");

                    foreach (DataRowView dr in downloads)
                    {
                        str.Append(string.Format("<li><a href=\"{0}://{1}{2}/DownloadHandler.ashx?FileId={3}\" />{4}</a></li>",
                                                 protocol, /*serverName*/ "66.162.120.92" /* this ip is used only for licensing website */, root, dr["DownloadId"], dr["Title"]));
                    }

                    str.Append("</ul>");

                    try
                    {
                        Mail m = new Mail("Weekly Downloads");

                        m.Data = new NameValueCollection();
                        m.Data["Downloads"] = str.ToString();
                        m.To = (string)drv["Email"];

                        m.Send();
                    }
                    catch
                    {
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static void TimeoutUser(string key, object v, System.Web.Caching.CacheItemRemovedReason r)
        {
            //   return;
            if (r == CacheItemRemovedReason.Removed ||
                r == CacheItemRemovedReason.DependencyChanged ||
                r == CacheItemRemovedReason.Expired)
            {
                string userId = v.ToString();

                WebContext.CreateHttpContext();

                try
                {
                    MembersManager.UpdateOnlineStatus(Int32.Parse(userId), false);
                }
                catch (Exception Ex)
                {
                    throw (Ex);
                }
            }
        }
Exemplo n.º 3
0
        public override void Action()
        {
            WebContext.CreateHttpContext();

            MemberLoginActivity mlMgr = new MemberLoginActivity();

            DataView members = mlMgr.GetMembersActivity(string.Format("LoggedInDate >='{0}'", DateTime.Now.AddDays(-7)));

            members.Sort = "MemberId Asc, LoggedInDate Desc";

            Mail m = new Mail("Login Activity");

            int    MemberID = -1;
            bool   _bound   = false;
            string emailTo  = "";

            StringBuilder str = new StringBuilder("<table><tr><th>Ip Address</th><th>Login Date</th></tr>");

            foreach (DataRowView drv in members)
            {
                if (!_bound)
                {
                    MemberID = (int)drv["MemberId"];
                    _bound   = true;
                }

                if ((int)drv["MemberId"] != MemberID)
                {
                    str.Append("</table>");
                    try
                    {
                        m.Data           = new NameValueCollection();
                        m.Data["Result"] = str.ToString();
                        m.To             = emailTo;
                        m.Send();
                    }
                    catch
                    {
                    }

                    MemberID = (int)drv["MemberId"];
                    str      = new StringBuilder("<table><tr><th>Ip Address</th><th>Login Date</th></tr>");
                    str.Append(string.Format("<tr><td>{0}</td><td>{1}</td></tr>", drv["IpAddress"], drv["LoggedInDate"]));
                    emailTo = (string)drv["Email"];
                }
                else
                {
                    str.Append(string.Format("<tr><td>{0}</td><td>{1}</td></tr>", drv["IpAddress"], drv["LoggedInDate"]));
                    emailTo = (string)drv["Email"];
                }
            }

            str.Append("</table>");
            try
            {
                m.Data           = new NameValueCollection();
                m.Data["Result"] = str.ToString();
                m.To             = emailTo;
                m.Send();
            }
            catch
            {
            }
        }