Exemple #1
0
    protected void lnkbDel_Click(object sender, EventArgs e)
    {
        LinkButton lnkbDel = (LinkButton)sender;

        if (ClassBLL.DeleteClass(Convert.ToInt32(lnkbDel.CommandArgument)) > 0)
        {
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除成功!');window.location.replace('ClassManage.aspx');</script>");
            return;
        }
        else
        {
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除失败!');</script>");
            return;
        }
    }
 //Function To Delete a Class
 public void deleteClass(long id)
 {
     try
     {
         string message = Cdal.DeleteClass(id);
         getClasses();
         lblError.Visible   = true;
         lblSuccess.Visible = false;
         lblError.Text      = message;
     }
     catch (Exception ex)
     {
         lblError.Visible   = true;
         lblSuccess.Visible = false;
         lblError.Text      = ex.ToString();
     }
 }
Exemple #3
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            #region 使用实体类在各层传递数据
            ClassBLL objClass1BLL = new ClassBLL();
            SchoolMolel objClassModel = new SchoolMolel();

            objClassModel.SchNum = txtClaNum.Text;

            if (objClass1BLL.DeleteClass(objClassModel) == true)
            {
                objClass1BLL.DeleteClass(objClassModel);
                MessageBox.Show("数据删除成功");

            }
            else
            {
                MessageBox.Show("数据删除失败");
            }
            #endregion

            ShowClass();
        }