//删除 protected void Delete_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); int attachId = BllPaper.FindAttachment(id); string srcPath = BllAttachment.FindPath(attachId); if (attachId == 0 || srcPath == "") { Alert.Show("不存在相关文档"); } else { publicMethod.DeleteFile(attachId, srcPath); Common.Entities.Paper paper = BllPaper.FindAll(id); paper.AttachmentID = null; BllPaper.Update(paper); //Alert.Show("删除成功!"); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideReference() + Alert.GetShowInTopReference("删除成功!")); } } catch (Exception ex) { publicMethod.SaveError(ex, this.Request); } }
//保存更新 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); } }