Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            lbResult.Text = "";
            DataDoc dc = DataDoc.Instance(Server);

            lock (dc)
            {
                Comment cm = dc.GetComment((int?)Session["Comment"]);
                if (cm == null)
                {
                    lbResult.Text = "対象がありません";
                    return;
                }
                lbUser.Text    = cm.User;
                lbTime.Text    = cm.Time;
                lbComment.Text = cm.Contents;
                HttpCookie hc = Request.Cookies["user"];
                if (hc != null && cm.User == MasterPage.UserName(hc))
                {
                    btnDel.Visible = true;
                }
            }
        }
Esempio n. 2
0
        protected void btnShowAnswer_Click(object sender, EventArgs e)
        {
            DataDoc dc = DataDoc.Instance(Server);

            lock (dc)
            {
                Comment cm = dc.GetComment((int?)Session["Comment"]);
                if (cm != null)
                {
                    Session["Answer"] = cm.AnswerID;
                    Response.Redirect("ShowAnswer.aspx");
                }
            }
        }
Esempio n. 3
0
        protected void btnYes_Click(object sender, EventArgs e)
        {
            DataDoc dc = DataDoc.Instance(Server);

            lock (dc)
            {
                bool   bNotFound = true;
                string tgt       = (string)Session["DeleteTarget"];
                if (tgt == "Problem")
                {
                    Problem pb = dc.GetProblem((string)Session["Title"]);
                    if (pb != null)
                    {
                        bNotFound = false;
                        dc.Problems.Remove(pb);
                    }
                }
                else if (tgt == "Answer")
                {
                    Answer aw = dc.GetAnswer((int?)Session["Answer"]);
                    if (aw != null)
                    {
                        bNotFound = false;
                        dc.Answers.Remove(aw);
                    }
                }
                else if (tgt == "Comment")
                {
                    Comment cm = dc.GetComment((int?)Session["Comment"]);
                    if (cm != null)
                    {
                        bNotFound = false;
                        dc.Comments.Remove(cm);
                    }
                }
                if (bNotFound)
                {
                    lbResult.Text = "対象がありません";
                    return;
                }
                dc.Save(null);
            }
            lbResult.Text = "";
            btnNo_Click(null, null);
        }