Esempio n. 1
0
        /// <summary>
        /// 읽은 목록 처리
        /// </summary>
        private void prcPastItem(clsFeed objFeed, string user_id)
        {
            System.Data.DataSet pastItem_DS = new System.Data.DataSet();

            string itemURL;
            int    i;
            int    j;

            pastItem_DS = selectPastItem(objFeed.siteTitle, objFeed.siteURL, user_id, objFeed[objFeed.Count - 1].Item_date);

            if (objCmnDB.validateDS(pastItem_DS))
            {
                for (i = 0; i < pastItem_DS.Tables[0].Rows.Count; i++)
                {
                    for (j = 0; j < objFeed.Count; j++)
                    {
                        itemURL = pastItem_DS.Tables[0].Rows[i][0].ToString();

                        if (itemURL.Equals(objFeed[j].Item_url))
                        {
                            objFeed[j].isRead = true;
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        //관심항목 select ds ---> objfeed
        public clsFeed TOobjFeed(System.Data.DataSet DS)
        {
            string   idx   = "";
            string   title = "";
            string   url   = "";
            string   desc  = "";
            DateTime date  = new DateTime();

            int i;

            libCommon.clsUtil objUtil = new libCommon.clsUtil();
            clsFeed           objFeed = new clsFeed();


            if (DS.Tables[0].Rows.Count > 0)
            {
                for (i = 0; i < DS.Tables[0].Rows.Count; i++)
                {
                    idx   = DS.Tables[0].Rows[i][0].ToString();
                    title = DS.Tables[0].Rows[i][1].ToString();
                    url   = DS.Tables[0].Rows[i][2].ToString();
                    desc  = DS.Tables[0].Rows[i][3].ToString();
                    date  = Convert.ToDateTime(DS.Tables[0].Rows[i][4]);

                    objFeed.addFeed(idx, title, url, desc, date, true, false);
                }
            }

            return(objFeed);
        }
Esempio n. 3
0
        /// <summary>
        /// 사용자의 모든 피드 리스트
        /// </summary>
        public clsFeed showAllFeed(string user_id)
        {
            System.Data.DataSet RSSsite_DS  = new System.Data.DataSet();
            clsFeed             objFeed     = new clsFeed();
            clsFeed             objFeed_tmp = new clsFeed();
            string URL;
            string RSS_idx;
            int    i;
            int    j;

            RSSsite_DS = selectRSSsite(user_id);

            if (objCmnDB.validateDS(RSSsite_DS))
            {
                for (i = 0; i < RSSsite_DS.Tables[0].Rows.Count; i++)
                {
                    RSS_idx     = RSSsite_DS.Tables[0].Rows[i][0].ToString();
                    URL         = RSSsite_DS.Tables[0].Rows[i][2].ToString();
                    objFeed_tmp = getRSSfeed(RSS_idx, URL, user_id);
                    for (j = 0; j < objFeed_tmp.Count; j++)
                    {
                        objFeed.addFeed(objFeed_tmp[j]);
                    }
                }
            }

            return(objFeed);
        }
Esempio n. 4
0
        /// <summary>
        /// 관심 항목 처리
        /// </summary>
        private void prcFavorItem(clsFeed objFeed, string user_id)
        {
            System.Data.DataSet favorItem_DS = new System.Data.DataSet();

            string itemURL;
            int    i;
            int    j;

            favorItem_DS = selectFavorItem(user_id);

            if (objCmnDB.validateDS(favorItem_DS))
            {
                for (i = 0; i < favorItem_DS.Tables[0].Rows.Count; i++)
                {
                    for (j = 0; j < objFeed.Count; j++)
                    {
                        itemURL = favorItem_DS.Tables[0].Rows[i][2].ToString();

                        if (itemURL.Equals(objFeed[j].Item_url))
                        {
                            objFeed[j].isFavor = true;
                        }
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 읽지 않은 아이템
        /// </summary>
        public clsFeed UnreadItems()
        {
            clsFeed objReturn_Feed = new clsFeed();

            int i;

            for (i = 0; i < this.Count; i++)
            {
                if (!this[i].isRead)
                {
                    objReturn_Feed.addFeed(this[i]);
                }
            }
            return(objReturn_Feed);
        }
Esempio n. 6
0
        /// <summary>
        /// 관심 항목 설정된 아이템
        /// </summary>
        public clsFeed FavorItems()
        {
            clsFeed objReturn_Feed = new clsFeed();

            int i;

            for (i = 0; i < this.Count; i++)
            {
                if (this[i].isFavor)
                {
                    objReturn_Feed.addFeed(this[i]);
                }
            }

            return(objReturn_Feed);
        }
Esempio n. 7
0
        /// <summary>
        /// RSS_idx에 해당하는 아이템
        /// </summary>
        public clsFeed extractItems(string RSS_idx)
        {
            clsFeed objReturn_Feed = new clsFeed();

            int i;

            for (i = 0; i < this.Count; i++)
            {
                if (this[i].RSS_idx.Equals(RSS_idx))
                {
                    objReturn_Feed.addFeed(this[i]);
                }
            }

            return(objReturn_Feed);
        }
Esempio n. 8
0
        /// <summary>
        /// 사용자의 관심항목 피드 리스트
        /// </summary>
        public clsFeed showFavorFeed(string user_id)
        {
            System.Data.DataSet DS      = new System.Data.DataSet();
            clsFeed             objFeed = new clsFeed();

            string   idx;
            string   title;
            string   url;
            string   desc;
            bool     isRead;
            DateTime date = new DateTime();

            int i;

            DS = selectFavorItem(user_id);

            if (objCmnDB.validateDS(DS))
            {
                for (i = 0; i < DS.Tables[0].Rows.Count; i++)
                {
                    idx   = DS.Tables[0].Rows[i][0].ToString();
                    title = DS.Tables[0].Rows[i][1].ToString();
                    url   = DS.Tables[0].Rows[i][2].ToString();
                    desc  = DS.Tables[0].Rows[i][3].ToString();
                    date  = Convert.ToDateTime(DS.Tables[0].Rows[i][4]);
                    if (DS.Tables[0].Rows[i]["Read"].ToString().Equals("AA"))
                    {
                        isRead = true;
                    }
                    else
                    {
                        isRead = false;
                    }
                    objFeed.addFeed(idx, title, url, desc, date, true, isRead);
                }

                prcPastItem(objFeed, user_id);
            }

            return(objFeed);
        }
Esempio n. 9
0
        //left
        // 읽지 않은 아이템 수 추가 by 이현석(2011-07-27)
        public string DS2Left(System.Data.DataSet DS, string user_id, clsFeed objFeed)
        {
            clsRSS        objRSS     = new clsRSS();
            StringBuilder strBuilder = new StringBuilder();

            string idx;

            int i;

            if (objCmnDB.validateDS(DS))
            {
                //전체 항목
                strBuilder.Append("     <ul>");
                //전체 항목 인자값 넣어주기
                strBuilder.Append("         <a href='javascript:go_AllList();' >");
                strBuilder.Append("             <span id='AllList' name='AllList' class='MenuName'>");
                strBuilder.Append("전체항목(" + objFeed.UnreadItems().Count + ")");
                strBuilder.Append("             </span>");
                strBuilder.Append("         </a>");

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

                //관심항목
                strBuilder.Append("     <ul>");
                //관심항목 인자값 넣어주기
                strBuilder.Append("         <a href='javascript:go_FavorPage();' >");
                strBuilder.Append("             <span id='selectFavorItem' name='selectFavorItem' class='MenuName'>");

                strBuilder.Append("관심항목(" + objFeed.FavorItems().UnreadItems().Count + ")");
                strBuilder.Append("             </span>");
                strBuilder.Append("         </a>");
                strBuilder.Append("     </ul>");

                //구독 LIST 출력
                for (i = 0; i < DS.Tables[0].Rows.Count; i++)
                {
                    strBuilder.Append("     <ul>");
                    strBuilder.Append("         <a href=\"javascript:go_ListPage('" + DS.Tables[0].Rows[i][1].ToString() + "', '" + DS.Tables[0].Rows[i][2].ToString() + "');\">");
                    strBuilder.Append("             <span id='List" + DS.Tables[0].Rows[i][2].ToString() + "' name='List" + DS.Tables[0].Rows[i][2].ToString() + "' class='MenuName'>");

                    idx = DS.Tables[0].Rows[i][2].ToString();

                    strBuilder.Append("   " + DS.Tables[0].Rows[i][0] + "(" + objFeed.extractItems(idx).UnreadItems().Count + ")");
                    strBuilder.Append("             </span>");
                    strBuilder.Append("         </a>");
                    strBuilder.Append("     </ul>");
                }

                //구독관리(rss002.aspx)
                strBuilder.Append("     <ul>");
                //관심항목 인자값 넣어주기
                strBuilder.Append("         <a href='../RSS/RSS002.aspx' >");
                strBuilder.Append("             <span id='manage' name='manage' class='MenuName'>");
                strBuilder.Append("구독관리");
                strBuilder.Append("             </span>");
                strBuilder.Append("         </a>");
                strBuilder.Append("     </ul>");
            }

            return(strBuilder.ToString());
        }
Esempio n. 10
0
        // 추가 by 이현석(2011-07-27)
        public string LeftMenuString(System.Web.SessionState.HttpSessionState Session, clsFeed objFeed)
        {
            System.Data.SqlClient.SqlConnection dbCon;
            System.Data.DataSet siteList_DS = new System.Data.DataSet();

            string menu_state = "";

            string login_user_name = (string)Session["user_name"];
            string login_comp_name = (string)Session["comp_name"];
            string login_part_name = (string)Session["part_name"];

            libRSSreader.clsLeft objLeft = new libRSSreader.clsLeft();

            //로그인 했을때
            if ((string)Session["user_id"] != "Not login")
            {
                dbCon       = objDB.GetConnection();
                siteList_DS = objLeft.LeftMenu(dbCon, (string)Session["user_id"]);
                dbCon.Close();

                menu_state = objLeft.DS2Left(siteList_DS, (string)Session["user_id"], objFeed);
            }
            else
            {
                menu_state = "<a href='javascript:gologin();'>프로그램</a>";
            }

            return(menu_state);
        }
Esempio n. 11
0
        public string DS2Table(clsFeed objFeed, string user_id, int moreCnt)
        {
            int i;
            int j;
            int k = 2;
            //int moreCnt = 15;

            string   title;
            string   url;
            string   desc;
            DateTime date;
            bool     favor;
            bool     read;

            StringBuilder strBuilder = new StringBuilder();

            if (objFeed.Count == 0)
            {
                return("피드가 없습니다.");
            }

            /*
             * strBuilder.AppendLine("<table>");
             * strBuilder.AppendLine("    <colgroup>");
             * strBuilder.AppendLine("        <col style='width:30px;' />");
             * strBuilder.AppendLine("        <col style='width:190px;' />");
             * strBuilder.AppendLine("        <col style='width:190px;' />");
             * strBuilder.AppendLine("        <col style='width:190px;' />");
             * strBuilder.AppendLine("    </colgroup>");
             * strBuilder.AppendLine("    <tbody>");
             */

            if (objFeed.Count <= moreCnt)
            {
                moreCnt = objFeed.Count;
            }

            if (objFeed.Count >= moreCnt)
            {
                for (j = 0; j < moreCnt; j++)
                //기존의 것
                //for (j = 0; j < objFeed.Count; j++)
                {
                    title = objFeed[j].Item_title.ToString();
                    url   = objFeed[j].Item_url.ToString();
                    desc  = objFeed[j].Item_desc.ToString();
                    //desc = objUtil.ToJavascript(desc);
                    date  = objFeed[j].Item_date;
                    favor = objFeed[j].isFavor;
                    read  = objFeed[j].isRead;

                    //strBuilder.AppendLine("        <input type='hidden' id='desc" + j + "' name='desc" + j + "' value='" + desc + "'/>");

                    //제목줄
                    if (read == true)
                    {
                        strBuilder.AppendLine("        <div class='read'>");
                    }
                    else
                    {
                        strBuilder.AppendLine("        <div>");
                    }
                    strBuilder.AppendLine("        <div id='titleDiv'>");

                    if (favor == true)
                    {
                        strBuilder.AppendLine("            <input type=checkbox name='check' value='' checked='checked'  onfocus=\"javascript:favorite('" + title + "', '" + url + "', '" + j + "', '" + date + "', '" + user_id + "');\"/>");
                    }
                    else
                    {
                        strBuilder.AppendLine("            <input type=checkbox name='check' value='' onfocus=\"javascript:favorite('" + title + "', '" + url + "', '" + j + "', '" + date + "', '" + user_id + "');\"/>");
                    }

                    strBuilder.AppendLine("         <a class='title' href=\"javascript:toggle('" + j + "');\" >");
                    strBuilder.AppendLine(title);
                    strBuilder.AppendLine("             <span class='date'>");
                    strBuilder.AppendLine(date.ToString());
                    strBuilder.AppendLine("             </span>");
                    strBuilder.AppendLine("         </a>");
                    strBuilder.AppendLine("     </div>");

                    //date &desc(내부에 table이 있음)
                    strBuilder.AppendLine("     <div id='descDisplay" + j + "' name='descDisplay" + j + "' class='desc' style='display:none'>");
                    strBuilder.AppendLine("         <a href=\"javascript:PastItem('" + url + "', '" + date + "');\">");
                    strBuilder.AppendLine("<span class='more'>more</span>");
                    strBuilder.AppendLine("         </a>");
                    strBuilder.AppendLine("<span id='desc" + j + "'>");
                    strBuilder.AppendLine(desc);
                    strBuilder.AppendLine("</span>");
                    strBuilder.AppendLine("     </div>");


                    strBuilder.AppendLine("</div>");
                }
            }

            if (moreCnt < objFeed.Count)
            {
                moreCnt += 10;
                strBuilder.AppendLine("</br>");
                strBuilder.AppendLine("<div id='more10' name='more10'>");
                strBuilder.AppendLine("         <a class='more10' href=\"javascript:selectMore10('" + moreCnt + "');\">");
                //strBuilder.AppendLine("<span class='fontColor'>(10)</span>항목 더보기&nbsp;&gt;&nbsp;&gt;");
                strBuilder.AppendLine("항목 더보기&nbsp;&gt;&nbsp;&gt;");
                strBuilder.AppendLine("         </a>");
                strBuilder.AppendLine("</div>");
            }

            return(strBuilder.ToString());
        }
Esempio n. 12
0
        /// <summary>
        /// RSS정보 읽어와서 파싱
        /// </summary>
        public clsFeed getRSSfeed(string RSS_idx, string URL, string user_id)
        {
            clsFeed objFeed = new clsFeed();

            Create_XML_Reader(URL);

            if (reader == null)
            {
                return(new clsFeed());
            }

            string   title = "";
            string   link  = "";
            string   desc  = "";
            DateTime date  = new DateTime();

            try
            {
                if (MoveCursor(XmlNodeType.Element, "channel"))
                {
                    if (MoveCursor(XmlNodeType.Element, "title"))
                    {
                        objFeed.siteTitle = reader.ReadElementString();
                        objFeed.siteURL   = URL;
                    }
                }

                while (MoveCursor(XmlNodeType.Element, "item"))
                {
                    if (MoveCursor(XmlNodeType.Element, "title"))
                    {
                        title = reader.ReadString();
                    }

                    if (MoveCursor(XmlNodeType.Element, "link"))
                    {
                        link = reader.ReadString();
                    }

                    if (MoveCursor(XmlNodeType.Element, "description"))
                    {
                        desc = reader.ReadString();
                    }

                    if (MoveCursor(XmlNodeType.Element, "pubDate"))
                    {
                        date = Convert.ToDateTime(reader.ReadString());
                    }

                    objFeed.addFeed(RSS_idx, title, link, desc, date, false, false);
                }
            }
            catch (Exception ex)
            {
                objUtil.writeLog("ERR PARSING XML : " + URL);
                return(new clsFeed());
            }

            prcFavorItem(objFeed, user_id);
            prcPastItem(objFeed, user_id);

            return(objFeed);
        }