Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserConfig UC = UserData.LoadPersonalData(Request.QueryString["U"], Request.QueryString["P"], -1);

            if (UC.Logged == LoggedStatus.no)
            {
                return;
            }

            RssFeed feed = new RssFeed();

            feed.Version  = RssVersion.RSS20;
            feed.Encoding = Encoding.UTF8;

            RssChannel rcActivities = new RssChannel();

            rcActivities.Title         = "Attivit di Oggi";
            rcActivities.Description   = "Attivit di Oggi";
            rcActivities.Link          = new Uri("http://crm.tustena.com");
            rcActivities.LastBuildDate = DateTime.Now;
            rcActivities.Docs          = "http://blogs.law.harvard.edu/tech/rss";
            rcActivities.Generator     = "Tustena CRM (RSS.NET)";

            RssChannel rcLostActivities = new RssChannel();

            rcLostActivities.Title         = "Attivit Scadute";
            rcLostActivities.Description   = "Attivit Scadute";
            rcLostActivities.Link          = new Uri("http://crm.tustena.com");
            rcLostActivities.LastBuildDate = DateTime.Now;
            rcLostActivities.Docs          = "http://blogs.law.harvard.edu/tech/rss";
            rcLostActivities.Generator     = "Tustena CRM (RSS.NET)";


            Today     today         = new Today(UC);
            DataTable activityToday = today.ActivityToday(false);

            if (activityToday.Rows.Count > 0)
            {
                foreach (DataRow dr in activityToday.Rows)
                {
                    RssItem item = new RssItem();

                    item.Title       = (dr["Subject"].ToString().Length > 0)?dr["Subject"].ToString():"N/a";
                    item.Description = dr["Description"].ToString();
                    item.PubDate     = (DateTime)dr["CreatedDate"];
                    rcActivities.Items.Add(item);
                }
                feed.Channels.Add(rcActivities);
            }

            DataTable lostActivity = today.LostActivity(false);

            if (lostActivity.Rows.Count > 0)
            {
                foreach (DataRow dr in lostActivity.Rows)
                {
                    RssItem item = new RssItem();
                    item.Title       = (dr["Subject"].ToString().Length > 0)?dr["Subject"].ToString():"N/a";
                    item.Description = dr["Description"].ToString();
                    item.PubDate     = (DateTime)dr["CreatedDate"];
                    rcLostActivities.Items.Add(item);
                }
                feed.Channels.Add(rcLostActivities);
            }

            Response.Clear();
            Response.ContentType = "text/xml";
            if (feed.Channels.Count > 0)
            {
                feed.Write(Response.OutputStream);
            }
        }