コード例 #1
0
        private void RecordHistory()
        {
            try
            {
                if (this.PresentationXML != null)
                {
                    if (this.PresentationXML.SelectSingleNode("Presentation/@PresentationClass").Value.ToLower() == "profile")
                    {
                        UserHistory uh = new UserHistory();
                        HistoryItem hi;
                        List<string> types = new List<string>();

                        foreach (XmlNode x in this.RDFData.SelectNodes("rdf:RDF/rdf:Description[1]/rdf:type/@rdf:resource", this.Namespaces))
                        {
                            if (this.RDFData.SelectSingleNode("rdf:RDF/rdf:Description[@rdf:about='" + x.Value + "']/rdfs:label", this.Namespaces) != null)
                            {
                                types.Add(this.RDFData.SelectSingleNode("rdf:RDF/rdf:Description[@rdf:about='" + x.Value + "']/rdfs:label", this.Namespaces).InnerText);
                            }
                            else
                            {
                                string[] s = x.Value.Split('/');
                                types.Add(s[s.Length - 1]);
                            }
                        }

                        if (this.RDFData.SelectSingleNode("rdf:RDF/rdf:Description/rdfs:label", this.Namespaces) != null)
                        {
                            hi = new HistoryItem(this.RDFData.SelectSingleNode("rdf:RDF/rdf:Description/rdfs:label", this.Namespaces).InnerText,
                                RDFData.SelectSingleNode("rdf:RDF/rdf:Description/@rdf:about", this.Namespaces).Value
                                , types);

                            uh.LoadItem(hi);
                        }

                    }
                }
            }
            catch (Exception ex)
            {
                Framework.Utilities.DebugLogging.Log(ex.Message + " " + ex.InnerException.Message);
            }
        }
コード例 #2
0
        public void LoadItem(HistoryItem historyitem)
        {
            List<HistoryItem> hi;

            if (HttpContext.Current.Session["HistoryList"] == null)
            {
                hi = new List<HistoryItem>();
                HttpContext.Current.Session["HistoryList"] = hi;
            }

            hi = (List<HistoryItem>)HttpContext.Current.Session["HistoryList"];

            if (hi.Exists(delegate(HistoryItem hiexists) { return hiexists.URI == historyitem.URI; }) == true)
            {
                HistoryItem hiremove;
                hiremove = hi.Find(delegate(HistoryItem hiremoveitem) { return hiremoveitem.URI == historyitem.URI; });
                hi.Remove(hiremove);
            }

            hi.Add(historyitem);
            HttpContext.Current.Session["HistoryList"] = hi;
        }