示例#1
0
        public void Photo()
        {
            if (Request.QueryString["id"] != null)
            {
                if (Session["User"] != null || Session["Org"] != null)
                {
                    CQGJEntities CQGJ = new CQGJEntities();
                    int id = int.Parse(Request.QueryString["id"].ToString());

                    var user = (from u in CQGJ.User
                                where u.UserID == id
                                select u).FirstOrDefault();
                    Response.ContentType = "image/*";
                    //"image/jpeg","image/gif"...
                    Response.BinaryWrite((byte[])user.Photo);
                }
            }
            else
            {
                if (Session["User"] != null)
                {
                    User user = (User)Session["User"];
                    Response.ContentType = "image/*";
                    //"image/jpeg","image/gif"...
                    Response.BinaryWrite((byte[])user.Photo);
                }
            }
        }
示例#2
0
        public void SetFlashPic()
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(System.AppDomain.CurrentDomain.BaseDirectory + "/content/bcastr.xml");

            XmlNodeList nodeList = xmlDoc.SelectSingleNode("bcaster").ChildNodes;
            XmlNode xmldocSelect = xmlDoc.SelectSingleNode("bcaster");
            XmlNode Father = xmlDoc.SelectSingleNode("bcaster");
            Father.RemoveAll();

            CQGJEntities cqgje = new CQGJEntities();
            var qurrey = from n in cqgje.News where n.Content.Contains("<img ") select n;
            List<News> newslisttemp = new List<News>();
            if (qurrey != null)
            {
                newslisttemp = qurrey.ToList();
                List<News> newslisttemp2 = qurrey.ToList();
                for (int j = 0; j < qurrey.Count(); ++j)
                {

                    string str = GetImageSRC(newslisttemp2[j].Content);
                    if (str.Contains("http://"))
                    {
                        if (!str.Contains(Request.Url.Host))
                        {
                            newslisttemp.Remove(newslisttemp2[j]);
                        }
                    }
                }
                List<News> newslist = newslisttemp;
                for (int i = 0; i < newslist.Count; ++i)
                {
                    try
                    {
                        string strContent = newslist[i].Content;
                        string strImgSRC = GetImageSRC(strContent);
                        string strURL = "/article/" + newslist[i].NewsID.ToString();
                        string strTitle = newslist[i].Title;
                        if (strTitle.Length > 18)
                        {
                            strTitle = strTitle.Substring(0, 18) + "...";
                        }
                        XmlElement el = xmlDoc.CreateElement("item");
                        el.SetAttribute("item_url", strImgSRC);
                        el.SetAttribute("link", strURL);
                        el.SetAttribute("itemtitle", strTitle);
                        xmldocSelect.AppendChild(el);
                    }
                    catch
                    {
                    }
                }
                xmlDoc.Save(System.AppDomain.CurrentDomain.BaseDirectory + "/content/bcastr.xml");
            }
        }