示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            HttpCookie hc = Request.Cookies["user"];
            string     user;

            if (hc == null || string.IsNullOrEmpty(user = MasterPage.UserName(hc)))
            {
                lbResult.Text = "ログインして下さい";
                return;
            }
            lstList.Items.Clear();
            DataDoc dc = DataDoc.Instance(Server);

            lock (dc)
            {
                Dictionary <string, object> dic = new Dictionary <string, object>();
                foreach (Answer aw in dc.Answers)
                {
                    if (aw.User == user && !dic.ContainsKey(aw.Title))
                    {
                        dic.Add(aw.Title, null);
                    }
                }
                foreach (Problem pb in dc.RProblems)
                {
                    if (!pb.Title.StartsWith("!") && !dic.ContainsKey(pb.Title))
                    {
                        lstList.Items.Add(pb.ToString());
                    }
                }
            }
        }