Пример #1
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        try
        {
            string   del_list = hdfCheck.Value;
            string[] sp_list  = del_list.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < sp_list.Length; i++)
            {
                DataTable db = objTestimonial.GetDataByID(sp_list[i]);
                try
                {
                    bool kt = File.Exists(Server.MapPath("~/images/testimonial/" + db.Rows[0]["IMAGE"].ToString()));
                    if (kt)
                    {
                        File.Delete(Server.MapPath("~/images/testimonial/") + db.Rows[0]["IMAGE"].ToString());
                    }
                }
                catch (Exception)
                {
                    throw;
                }

                objTestimonial.Delete(int.Parse(sp_list[i]));
            }
            loadData();
        }
        catch (Exception ex)
        {
            divMessage.InnerHtml = O2S_Message.Error("Cảnh Báo", "Phát hiện lỗi! " + ex.Message);
        }
    }
Пример #2
0
    private void loadData()
    {
        DataTable db = objTestimonial.GetDataByID(Request.QueryString["ID"]);

        txtTitle.Text       = db.Rows[0]["NAME"].ToString();
        txtDescription.Text = db.Rows[0]["DESCRIPTION"].ToString();
        string statuts = db.Rows[0]["STATUS"].ToString();

        if (statuts == "1")
        {
            cbStatus.Checked = true;
        }
        else
        {
            cbStatus.Checked = false;
        }
        ten_anh = db.Rows[0]["IMAGE"].ToString();
        imgDescription.ImageUrl = "~/images/testimonial/" + ten_anh;
        txtIntro.Text           = db.Rows[0]["SUMMURY"].ToString();
    }