Exemplo n.º 1
0
    protected void SaveText(object sender, EventArgs e)
    {
        conn.Open();

        if (cmstrDefualts.CheckQueryString("status", out status))
        {
            dv.RowFilter = "PageStatus=" + status;
        }
        for (int i = 0; i < EditTextRepeater.Items.Count; i++)
        {
            int myid = 0;
            int.TryParse(((HiddenField)EditTextRepeater.Items[i].FindControl("MyIdHiddenField")).Value.ToString(), out myid);
            dv[i]["myText"] = ((ASP.controls_cmstrtextboxcontrol_ascx)EditTextRepeater.Items[i].FindControl("GeneralMyTextBox")).Text;
            string myText  = ((ASP.controls_cmstrtextboxcontrol_ascx)EditTextRepeater.Items[i].FindControl("GeneralMyTextBox")).Text.Replace("'", "''");
            string newpass = ((ASP.controls_cmstrtextboxcontrol_ascx)EditTextRepeater.Items[i].FindControl("GeneralMyTextBox")).GetValuepass.Replace("'", "''");
            // string myText = ((ASP.controls_cmstrtextboxcontrol_ascx)((LinkButton)sender).Parent.FindControl("GeneralMyTextBox")).Text.Replace("'","''");
            // myText = ((ASP.controls_cmstrtextboxcontrol_ascx)((LinkButton)sender).Parent.FindControl("GeneralMyTextBox")).DataFieldValue.Replace("'", "''");
            // dv[i]["myText"] = myText;
            string sql = String.Format("Update langtext2 Set `{2}`='{0}' Where LangTextID={1} ", myText, myid, myLang);

            MySqlCommand cmd = new MySqlCommand(sql, conn);
            cmd.ExecuteNonQuery();
        }
        conn.Close();

        Languages.PageNames.Clear();
        Languages.TextPages.Clear();
        Languages.sendMagLangs.Clear();

        EditTextRepeater.DataSource = dv;
        EditTextRepeater.DataBind();
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        GoBack.NavigateUrl = "ManageSiteGenText.aspx?sitelang=" + Request.QueryString["sitelang"] + "&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"];
        if (cmstrDefualts.CheckQueryString("status", out status))
        {
            GoBack.NavigateUrl = "ManageSiteGenText.aspx?sitelang=" + Request.QueryString["sitelang"] + "&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&status=";
        }
        if (Request.QueryString["sitelang"] != null && int.TryParse(Request.QueryString["sitelang"], out myLang))
        {
            if (Request.QueryString["page"] != null)
            {
                int.TryParse(Request.QueryString["page"], out pageid);
            }
            string pagequery = pageid == 0 ? "" : " AND langtext2.PageID=" + pageid;

            String           sql       = String.Format("Select langtext2.PageID as mypage, LangTextID, `{1}` as myText,TextType,PageStatus,TextComment,TextName,pagename From langtext2 left join pages2 On pages2.pageid=langtext2.PageID  where 1=1 {0}  order by PageStatus", pagequery, myLang);
            MySqlDataAdapter MyAdapter = new MySqlDataAdapter(sql, conn);
            MyAdapter.Fill(ds, "lang");
            dv = ds.Tables["lang"].DefaultView;
            if (!IsPostBack)
            {
                if (cmstrDefualts.CheckQueryString("status", out status))
                {
                    dv.RowFilter = "PageStatus=" + status;
                }
                EditTextRepeater.DataSource = dv;
                EditTextRepeater.DataBind();
                string[] myvalues = { "PageStatus", "mypage" };
                if (dv.Count > 0)
                {
                    pageHeader.Text = dv[0]["pagename"].ToString();
                }
                dv.RowFilter = "PageStatus>0";
                DataTable mytable = dv.ToTable(true, myvalues);
                StatusRepeater.DataSource = mytable;
                StatusRepeater.DataBind();
            }
        }
        else
        {
            Response.Redirect("../");
        }
    }