Пример #1
0
 //删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     CheckBox cb;
     LabMS.BLL.PersonalProject personalproject = new LabMS.BLL.PersonalProject();
     ExtendBLL.PersonalProject project = new ExtendBLL.PersonalProject();
     try
     {
         for (int i = 0; i < gvPersonalProjectList.Rows.Count; i++)
         {
             cb = (CheckBox)gvPersonalProjectList.Rows[i].FindControl("ProjectCB");
             if (cb.Checked)
             {
                 string ProjectID = gvPersonalProjectList.DataKeys[i].Value.ToString();
                 personalproject.Delete(int.Parse(ProjectID));
                 project.DeleteConsumeByProjectID(int.Parse(ProjectID));
                 project.DeleteApplicantByProjectID(int.Parse(ProjectID));
             }
         }
         BindGridViewList(SearchString());
         LabMS.Common.JShelper.JSAlert(Page, "deleteSuccess", "删除成功!");
     }
     catch
     {
         LabMS.Common.JShelper.JSAlert(Page, "err", "删除失败!");
     }
 }
        protected void Button2_Click(object sender, EventArgs e)
        {
            string strAlert = "删除成功!";
            try
            {
                LabMS.BLL.PersonalProject project = new LabMS.BLL.PersonalProject();
                project.Delete(ProjectID);

                ExtendBLL.PersonalProject consume = new ExtendBLL.PersonalProject();
                consume.DeleteConsumeByProjectID(ProjectID);

                ExtendBLL.PersonalProject applicant = new ExtendBLL.PersonalProject();
                applicant.DeleteApplicantByProjectID(ProjectID);
            }
            catch (Exception ex)
            {
                lbErr.Text = ex.Message;
                lbErr.Visible = true;
                return;
            }

            Common.JShelper.JSAlertAndRedirect(Page, "success", strAlert, "ListPersonalProject.aspx");
        }