示例#1
0
 //删除所选行数据
 protected void Delete_Click(object sender, EventArgs e)
 {
     BLHelper.BLLPatent           blpant  = new BLHelper.BLLPatent();
     BLHelper.BLLAttachment       blat    = new BLHelper.BLLAttachment();
     Common.Entities.OperationLog operate = new OperationLog();
     try
     {
         string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
         if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
         {
             for (int i = 0; i < pm.GridCount(Grid_Patent, CBoxSelect).Count(); i++)
             {
                 int    ss               = Convert.ToInt32(Grid_Patent.DataKeys[pm.GridCount(Grid_Patent, CBoxSelect)[i]][0].ToString());
                 int[]  attachid         = blpant.Delete(ss);
                 string path_Patent      = blat.FindPath(attachid[0]);
                 string path_Application = blat.FindPath(attachid[1]);
                 pm.DeleteFile(attachid[0], path_Patent);
                 pm.DeleteFile(attachid[1], path_Application);
             }
             InitData();
             btnSelect_All.Text = "全选";
             Alert.ShowInTop("删除数据成功!");
             Delete.Enabled = false;
         }
         else
         {
             for (int i = 0; i < pm.GridCount(Grid_Patent, CBoxSelect).Count(); i++)
             {
                 blpant.UpdateIsPass(Convert.ToInt32(Grid_Patent.DataKeys[pm.GridCount(Grid_Patent, CBoxSelect)[i]][0]), false);
                 operate.LoginName        = username;
                 operate.OperationTime    = DateTime.Now;
                 operate.LoginIP          = " ";
                 operate.OperationContent = "Patents";
                 operate.OperationType    = "删除";
                 operate.OperationDataID  = Convert.ToInt32(Grid_Patent.DataKeys[pm.GridCount(Grid_Patent, CBoxSelect)[i]][0]);
                 op.Insert(operate);
             }
             InitData();
             btnSelect_All.Text = "全选";
             Alert.ShowInTop("您的数据已提交,请等待确认!");
             Delete.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         pm.SaveError(ex, this.Request);
         Alert.ShowInTop("删除错误,请联系管理员!");
     }
 }