Ejemplo n.º 1
0
        protected internal override void beforeShow()
        {
            cookieName = "ank" + pollId;
            voted      = Provider.Request.Cookies[cookieName] != null && Provider.Request.Cookies[cookieName].Value == "1";

            // bu requestte oylama yapıldıysa cevabı kaydedelim
            if (Provider.Request.Form["cevap"] != null && Provider.Request.Form["anketId"] != null && Provider.Request.Form["anketId"] == pollQuestionId.ToString())
            {
                PollAnswer cevap = (PollAnswer)Provider.Database.Read(typeof(PollAnswer), Convert.ToInt32(Provider.Request.Form["cevap"]));
                cevap.Hit++;
                cevap.Save();
                Provider.Response.Cookies.Add(new HttpCookie(cookieName, "1"));
                voted = true;
            }
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (pollAnswer.pollId == 0)
            {
                return;
            }
            if (pollAnswer.Id == 0)
            {
                pollAnswer.status = RecordStatus.Admin;
            }
            using (GmConnection conn = Global.CreateConnection())
            {
                pollAnswer.Save(conn);
            }
            lblResult.Text = string.Format("Data saved.");
//			WebUtils.Redirect(this, "Private/Users.aspx");
        }
        catch (Exception ex)
        {
            log.Exception(ex);
        }
    }