コード例 #1
0
ファイル: Search_Paper.aspx.cs プロジェクト: 15831944/C-12-
 //删除
 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("删除失败,请联系管理员!");
     }
 }
コード例 #2
0
ファイル: Update_Paper.aspx.cs プロジェクト: 15831944/C-12-
        //保存更新
        protected void AddWriter_Click(object sender, EventArgs e)
        {
            try
            {
                //if (tSubject.Text.Trim() == "")
                //{
                //    Alert.Show("题目不能为空!");
                //    return;
                //}
                //if (tPublicJournalName.Text.Trim() == "")
                //{
                //    Alert.Show("发表刊物不能为空!");
                //    return;
                //}
                //if (PaperPeople.Text.Trim() == "")
                //{
                //    Alert.Show("全部作者不能为空!");
                //    return;
                //}
                //if (FirstWriter.Text.Trim() == "")
                //{
                //    Alert.Show("第一作者不能为空!");
                //    return;
                //}
                if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)
                {
                    UpdateValue();
                    paper.PaperID = Convert.ToInt32(Session["PaperID"]);
                    paper.IsPass  = true;
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

                    case 0:
                        Alert.ShowInTop("文件名已经存在!");
                        return;

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        paper.AttachmentID = attachid;
                    }
                    else
                    {
                        if (papers.FindAttachment(Convert.ToInt32(Session["PaperID"])) != 0)
                        {
                            paper.AttachmentID = null;
                        }
                    }
                    papers.Update(paper);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功"));
                }
                else
                {
                    UpdateValue();
                    paper.IsPass = false;
                    int attachid = pm.UpLoadFile(fileupload).Attachid;
                    switch (attachid)
                    {
                    case -1:
                        Alert.ShowInTop("文件类型不符,请重新选择!");
                        return;

                    case 0:
                        Alert.ShowInTop("文件名已经存在!");
                        return;

                    case -2:
                        Alert.ShowInTop("文件不能大于150M");
                        return;
                    }
                    if (attachid != -3)
                    {
                        paper.AttachmentID = attachid;
                    }
                    else
                    {
                        paper.AttachmentID = null;
                    }
                    papers.Insert(paper);
                    string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName;
                    log.LoginName        = username;
                    log.OperationTime    = DateTime.Now;
                    log.LoginIP          = " ";
                    log.OperationContent = "Paper";
                    log.OperationType    = "更新";
                    log.OperationDataID  = Convert.ToInt32(Session["PaperID"]);
                    log.Remark           = (Convert.ToInt32(papers.FindByPaperNames(paper.Subject, Convert.ToInt32(Session["PaperID"])))).ToString();
                    op.Insert(log);
                    papers.UpdateIsPass(Convert.ToInt32(Session["PaperID"]), false);
                    PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!"));
                }
            }
            catch (Exception ex)
            {
                pm.SaveError(ex, this.Request);
            }
        }