示例#1
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         objAttachmentcls             = new AttachmentCls();
         objAttachmentcls.LibraryCode = Request.QueryString["LibCode"];
         DataTable dtLibCode = objAttachmentcls.GetLibraryCodeFromDataBase();
         if (dtLibCode.Rows.Count > 0)
         {
             ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Library Code already in used so it is not deleted');", true);
         }
         else
         {
             int res = objAttachmentcls.DeleteLibrary();
             if (res > 0)
             {
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Deleted Successfully');", true);
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Not Deleted');", true);
             }
         }
     }
     catch (Exception ex)
     {
         // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('DBID used somewhere');", true);
     }
 }