Ejemplo n.º 1
0
 private void Bind()
 {
     lvStoreFaqs.DataSource = StoreFaqRepository.GetStoreFaqsByParentId(0,
                                                                        ModuleSettingsProvider
                                                                        .GetSettingValue <bool>(
                                                                            "ActiveModerateStoreFaqs",
                                                                            _moduleStringId));
     lvStoreFaqs.DataBind();
 }
Ejemplo n.º 2
0
 protected void lvFaqsItemCommand(object sender, ListViewCommandEventArgs e)
 {
     switch (e.CommandName)
     {
     case "deleteFaq":
         int FaqId;
         if (Int32.TryParse(e.CommandArgument.ToString(), out FaqId))
         {
             StoreFaqRepository.DeleteStoreFaqsById(FaqId);
         }
         break;
     }
 }
Ejemplo n.º 3
0
        protected void btnClick(object sender, EventArgs e)
        {
            const string tpl     = "<div class=\"error-item\">{0}</div>";
            var          errList = new StringBuilder();

            int scope;
            var resultParse = int.TryParse(hfScope.Value, out scope);

            if (!resultParse)
            {
                errList.AppendFormat(tpl, GetLocalResourceObject("StoreFaqs_InvalidScope"));
            }

            if (string.IsNullOrEmpty(txtEmail.Text.Trim()))
            {
                errList.AppendFormat(tpl, GetLocalResourceObject("StoreFaqs_InvalidEmail"));
            }

            if (string.IsNullOrEmpty(txtFaqerName.Text.Trim()))
            {
                errList.AppendFormat(tpl, GetLocalResourceObject("StoreFaqs_InvalidName"));
            }

            if (string.IsNullOrEmpty(txtFaq.Text.Trim()))
            {
                errList.AppendFormat(tpl, GetLocalResourceObject("StoreFaqs_InvalidFaq"));
            }

            if (errList.Length > 0)
            {
                liError.InnerHtml = errList.ToString();
            }
            else
            {
                StoreFaqRepository.AddStoreFaq(new StoreFaq
                {
                    Moderated  = false,
                    Rate       = ShowRatio ? scope : 0,
                    ParentId   = 0,
                    FaqerEmail = HttpUtility.HtmlEncode(txtEmail.Text),
                    FaqerName  = HttpUtility.HtmlEncode(txtFaqerName.Text),
                    Faq        = HttpUtility.HtmlEncode(txtFaq.Text)
                });

                txtFaqerName.Text = "";
                txtEmail.Text     = "";
                txtFaq.Text       = "";
            }

            Response.Redirect(Request.RawUrl);
        }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(Request["id"]))
        {
            return;
        }
        if (!Int32.TryParse(Request["id"], out FaqId))
        {
            return;
        }

        if ((Faq = StoreFaqRepository.GetStoreFaq(FaqId)) == null)
        {
            return;
        }
    }
Ejemplo n.º 5
0
    protected void btnSaveClick(object sender, EventArgs e)
    {
        if (Faq == null)
        {
            return;
        }

        DateTime date = Faq.DateAdded;

        try
        {
            date = DateTime.ParseExact(txtDateAdded.Text, "yyyy.MM.dd HH:mm", CultureInfo.InvariantCulture);
        }
        catch (Exception ex)
        {
            lError.Visible = true;
            return;
        }


        Faq.DateAdded  = date;
        Faq.Moderated  = ckbModerated.Checked;
        Faq.Rate       = string.IsNullOrEmpty(rblRating.SelectedValue) ? 0 : Convert.ToInt32(rblRating.SelectedValue);
        Faq.Faq        = txtFaq.Text;
        Faq.FaqerEmail = txtEmail.Text;

        StoreFaqRepository.UpdateStoreFaq(Faq);

        var jScript = new StringBuilder();

        jScript.Append("<script type=\'text/javascript\' language=\'javascript\'> ");
        if (string.IsNullOrEmpty(string.Empty))
        {
            jScript.Append("window.opener.location.reload();");
        }
        else
        {
            jScript.Append("window.opener.location =" + string.Empty);
        }
        jScript.Append("self.close();");
        jScript.Append("</script>");
        Type csType = this.GetType();
        ClientScriptManager clScriptMng = this.ClientScript;

        clScriptMng.RegisterClientScriptBlock(csType, "Close_window", jScript.ToString());
    }
Ejemplo n.º 6
0
 private void LoadData()
 {
     lvFaqs.DataSource = StoreFaqRepository.GetStoreFaqs();
     lvFaqs.DataBind();
 }