Exemple #1
0
    protected void btnUpDate_Click(object sender, EventArgs e)
    {
        dathangBLL       bs  = new dathangBLL();
        dathangdetailBLL bss = new dathangdetailBLL();
        string           id  = "";
        int  lengh           = 0;
        bool tf    = false;
        bool tff   = false;
        bool check = false;

        for (int i = 0; i <= rpDatHang.Items.Count - 1; i++)
        {
            CheckBox cbDell = rpDatHang.Items[i].FindControl("cbDell") as CheckBox;

            if (cbDell.Checked)
            {
                id   += cbDell.ToolTip + ",";
                check = true;
            }
        }
        lengh = id.Length;

        if (check == true)
        {
            string hid = id.Remove(lengh - 1);
            tff = bss.del(hid);
            tf  = bs.del(hid);
            if (tff == true && tf == true)
            {
                Response.Redirect("dathang.aspx?up=t");
            }
            else
            {
                lbError.Text = "<div class='error'> " +
                               " <div class='tl'></div><div class='tr'></div>"
                               + "<div class='desc'>"
                               + "	<p>Cập nhật thất bại!</p>"
                               + "</div>"
                               + "<div class='bl'></div><div class='br'></div>"
                               + "</div>";
            }
        }
    }