Esempio n. 1
0
 //删除
 protected void btn_Delete_Click(object sender, EventArgs e)
 {
     BLHelper.BLLPaper        paper = new BLHelper.BLLPaper();
     BLHelper.BLLAttachment   blat  = new BLHelper.BLLAttachment();
     BLHelper.BLLOperationLog op    = new BLHelper.BLLOperationLog();
     try
     {
         int count = pm.GridCount(Grid_Paper, CBoxSelect).Count();
         if (count <= 0)
         {
             Alert.ShowInTop("请至少选择一项!");
             return;
         }
         string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
         if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
         {
             for (int i = 0; i < pm.GridCount(Grid_Paper, CBoxSelect).Count(); i++)
             {
                 paper.Delete(Convert.ToInt32(Grid_Paper.DataKeys[pm.GridCount(Grid_Paper, CBoxSelect)[i]][0].ToString()));
             }
             InitData();
             Alert.ShowInTop("删除数据成功!");
             btn_Delete.Enabled = false;
         }
         else
         {
             Common.Entities.OperationLog operate = new OperationLog();
             for (int i = 0; i < pm.GridCount(Grid_Paper, CBoxSelect).Count(); i++)
             {
                 paper.UpdateIsPass(Convert.ToInt32(Grid_Paper.DataKeys[pm.GridCount(Grid_Paper, CBoxSelect)[i]][0]), false);
                 operate.LoginName        = username;
                 operate.OperationTime    = DateTime.Now;
                 operate.LoginIP          = " ";
                 operate.OperationContent = "Files";
                 operate.OperationType    = "删除";
                 operate.OperationDataID  = Convert.ToInt32(Grid_Paper.DataKeys[pm.GridCount(Grid_Paper, CBoxSelect)[i]][0]);
                 op.Insert(operate);
             }
             InitData();
             Alert.ShowInTop("您的数据已提交,请等待确认!");
         }
     }
     catch (Exception ex)
     {
         pm.SaveError(ex, this.Request);
         Alert.ShowInTop("删除失败,请联系管理员!");
     }
 }