Esempio n. 1
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         QUESTION rec = DALQUESTION.Get(Int32.Parse(Request.QueryString["ID"]));
         if (rec != null)
         {
             DALQUESTION.Delete(rec.ID);
         }
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ClosePage", "CloseModal(true);", true);
         NotificationAdd(NotificationType.success, "Kayıt Silindi.");
     }
     catch (Exception ex)
     {
         if (ex is SqlException)
         {
             if ((ex as SqlException).Number == 547)
             {
                 NotificationAdd(NotificationType.error, "Kayıt başka yerlerde kullanıdı.");
             }
         }
         else
         {
             throw ex;
         }
     }
 }
Esempio n. 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (ValidateItem())
     {
         QUESTION rec = new QUESTION();
         if (RECid > 0)
         {
             rec          = DALQUESTION.Get(RECid);
             rec.ISACTIVE = chkActive.Checked;
             rec.ANSWER   = Server.HtmlEncode(hdnDescription.Value);
             rec.TITLE    = txtQuestion.Text;
             DALQUESTION.Update(rec);
         }
         else
         {
             rec.SORT     = Convert.ToInt16(DALQUESTION.GetLastSort() + 1);
             rec.ISACTIVE = chkActive.Checked;
             rec.ANSWER   = Server.HtmlEncode(hdnDescription.Value);
             rec.TITLE    = txtQuestion.Text;
             DALQUESTION.Insert(rec);
         }
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ClosePage", "CloseModal(true);", true);
         btnDelete.Visible = false;
         btnCancel.Visible = false;
     }
 }
Esempio n. 3
0
        protected void rptrQuestion_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Down":
            {
                QUESTION self  = DALQUESTION.Get(Int32.Parse(e.CommandArgument.ToString()));
                QUESTION upper = DALQUESTION.GetBySort(self.SORT + 1);
                self.SORT++;
                upper.SORT--;
                DALQUESTION.Update(self);
                DALQUESTION.Update(upper);
                fillQuestion();
                break;
            }

            case "Up":
            {
                QUESTION self  = DALQUESTION.Get(Int32.Parse(e.CommandArgument.ToString()));
                QUESTION upper = DALQUESTION.GetBySort(self.SORT - 1);
                self.SORT--;
                upper.SORT++;
                DALQUESTION.Update(self);
                DALQUESTION.Update(upper);
                fillQuestion();
                break;
            }
            }
        }
Esempio n. 4
0
        protected void btnSendQuestion_Click(object sender, EventArgs e)
        {
            String name   = txtAskName.Text;
            String quest  = txtAskQuestion.Text;
            String name2  = txtName2.Text;
            String quest2 = txtQuestion2.Text;

            QUESTION q = new QUESTION();

            q.ANSWER   = name + name2 + " Kişisine Henüz Cevap Verilmedi";
            q.ISACTIVE = false;
            q.TITLE    = quest + quest2;
            q.SORT     = Convert.ToInt16(DALQUESTION.GetLastSort() + 1);
            DALQUESTION.Insert(q);
            Response.Redirect("/Mail");
        }
Esempio n. 5
0
        private void InitializePage()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["ID"]))
            {
                RECid = Convert.ToInt16(Request.QueryString["ID"]);
                QUESTION item = DALQUESTION.Get(RECid);
                if (item != null)
                {
                    hdnDescription.Value = Server.HtmlDecode(item.ANSWER);
                    txtQuestion.Text     = item.TITLE;
                    chkActive.Checked    = item.ISACTIVE;

                    btnDelete.Visible = true;
                    btnSave.Text      = "Güncelle";
                }
            }
        }
Esempio n. 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     rptrCategories.Bind(DALCategories.GetAll());
     rptLastPost.Bind(DALBlog.GetLastCount(3));
     rptQuestion.Bind(DALQUESTION.GetAll2().OrderBy(p => p.SORT));
 }
Esempio n. 7
0
 private void fillQuestion()
 {
     rptCountQuestion = DALQUESTION.GetCount();
     rptrQuestion.Bind(DALQUESTION.GetAll().OrderBy(p => p.SORT));
     lblCountImages.Text = "(" + rptCountQuestion.ToString() + ")";
 }