//删除所选行数据 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("删除错误,请联系管理员!"); } }
//删除 protected void Delete_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); int attachId = BLLScienceReprot.FindAttachmentid(id); string srcPath = BLLAttachment.FindPath(attachId); if (attachId == 0 || srcPath == "") { Alert.Show("该学术报告不存在相关文档"); } else { publicMethod.DeleteFile(attachId, srcPath); int ReportID = Convert.ToInt32(Request.QueryString["id"].ToString()); Common.Entities.ScienceReport scienceReport = BLLScienceReprot.FindByReportID(ReportID); //scienceReport.AccessoryID = null; BLLScienceReprot.UpdateAttachment(ReportID); //Alert.Show("删除成功!"); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideReference() + Alert.GetShowInTopReference("删除成功!")); } } catch (Exception ex) { publicMethod.SaveError(ex, this.Request); } }
//删除 protected void Delete_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); int attachId = un.FindAttachmentID(id); string srcPath = at.FindPath(attachId); if (attachId == 0 || srcPath == "") { Alert.Show("该考察信息不存在相关文档"); } else { pm.DeleteFile(attachId, srcPath); Common.Entities.UnitInspect uni = un.FindInspectInfo(id, true); uni.AccessoryID = null; un.Update(uni); //Alert.Show("删除成功!"); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideReference() + Alert.GetShowInTopReference("删除成功!")); } } catch (Exception ex) { pm.SaveError(ex, this.Request); } }
//删除 protected void Delete_Click(object sender, EventArgs e) { try { if (Request.QueryString["id"].ToString() != "") { int MonographID = Convert.ToInt32(Request.QueryString["id"].ToString()); string srcPath = BLLAttachments.FindPath(MonographID); if (MonographID == 0 || srcPath == "") { Alert.Show("数据错误!"); } else { publicMethods.DeleteFile(MonographID, srcPath); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideReference() + Alert.GetShowInTopReference("删除成功!")); } } else { Alert.Show("数据错误!"); } } catch (Exception ex) { publicMethods.SaveError(ex, this.Request); } }
//删除 protected void Delete_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); projectFile = bllProjectFile.FindByProjectFileId(id); int attachId = projectFile.AttachmentID; string srcPath = bllAttachment.FindPath(attachId); if (attachId == 0 || srcPath == "") { Alert.Show("该项目不存在相关文档"); } else { publicMethod.DeleteFile(attachId, srcPath); projectFile.AttachmentID = 0; bllProjectFile.Update(projectFile); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideReference() + Alert.GetShowInTopReference("删除成功!")); } } catch (Exception ex) { publicMethod.SaveError(ex, this.Request); } }
//删除 protected void Delete_Click(object sender, EventArgs e) { try { int ProjectID = Convert.ToInt32(Request.QueryString["id"].ToString()); int attachId = bllProject.FindBudget(ProjectID); string srcPath = bllAttachment.FindPath(attachId); if (attachId == 0 || srcPath == "") { Alert.Show("该项目不存在相关文档"); } else { publicmethod.DeleteFile(attachId, srcPath); Common.Entities.Project project = bllProject.FindProject(ProjectID, Convert.ToInt32(Session["SecrecyLevel"])).FirstOrDefault(); project.BudgetAttachment = null; bllProject.Update(project); Alert.Show("删除成功!"); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideReference() + Alert.GetShowInTopReference("删除成功!")); } } catch (Exception ex) { publicmethod.SaveError(ex, this.Request); } }
//删除 protected void Delete_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); int[] attachId = pa.FindAttachmentID(id); string srcPath = at.FindPath(attachId[0]); if (attachId[0] == 0 || srcPath == "") { Alert.Show("该专利不存在相关文档"); } else { pm.DeleteFile(attachId[0], srcPath); Common.Entities.Patent pat = pa.FindAll(id).FirstOrDefault(); pat.Attachment_Patent = null; pa.Update(pat); //Alert.Show("删除成功!"); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideReference() + Alert.GetShowInTopReference("删除成功!")); } } catch (Exception ex) { pm.SaveError(ex, this.Request); } }
//删除 protected void Delete_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); int attachId = mo.FindFAttachmentID(id); string srcPath = at.FindPath(attachId); if (attachId == 0 || srcPath == "") { Alert.Show("该专著不存在封面资料"); } else { pm.DeleteFile(attachId, srcPath); Common.Entities.Monograph mon = mo.FindAll(id); mon.BAttachmentID = null; mo.Update(mon); //Alert.Show("删除成功!"); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideReference() + Alert.GetShowInTopReference("删除成功!")); } } catch (Exception ex) { pm.SaveError(ex, this.Request); } }
//删除 protected void Delete_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); int photoId = BLLAcademic.FindPhotoID(id); string srcPath = BLLAttachment.FindPath(photoId); if (photoId == 0 || srcPath == "") { Alert.Show("该学术会议不存在会议照片"); } else { publicMethod.DeleteFile(photoId, srcPath); int MeetingID = Convert.ToInt32(Request.QueryString["id"].ToString()); Common.Entities.AcademicMeeting meeting = BLLAcademic.FindByAcademicMeetingID(MeetingID, true); meeting.AttachmentID = null; BLLAcademic.UpdateAttachment(MeetingID); //Alert.Show("删除成功!"); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideReference() + Alert.GetShowInTopReference("删除成功!")); } } catch (Exception ex) { publicMethod.SaveError(ex, this.Request); } }
//删除 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 Delete_Click(object sender, EventArgs e) { FineUI.LinkButton lb = (FineUI.LinkButton)sender; try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); int attachId = ach.FindAttachment(id); Common.Entities.Achievement model = ach.Findmodel(id); switch (lb.ID) { case "Delete": attachId = model.AttachmentID == null ? 0 : model.AttachmentID.Value; break; case "DelOpinionPage": attachId = model.OpinionPage == null ? 0 : model.OpinionPage.Value; break; case "DelMemberPage": attachId = model.MemberPage == null ? 0 : model.MemberPage.Value; break; case "DelSealPage": attachId = model.SealPage == null ? 0 : model.SealPage.Value; break; } string srcPath = at.FindPath(attachId); if (attachId == 0 || srcPath == "") { Alert.Show("该成果不存在相关文档"); } else { pm.DeleteFile(attachId, srcPath); Common.Entities.Achievement caa = ach.FindAll(id); caa.AttachmentID = null; ach.Update(caa); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideReference() + Alert.GetShowInTopReference("删除成功!")); } } catch (Exception ex) { pm.SaveError(ex, this.Request); } }
//删除 protected void btnDelete_Click(object sender, EventArgs e) { try { string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { for (int i = 0; i < pm.GridCount(Grid_UnitInspect, CBoxSelect).Count(); i++) { int attachid = inspect.Delete(Convert.ToInt32(Grid_UnitInspect.DataKeys[pm.GridCount(Grid_UnitInspect, CBoxSelect)[i]][0].ToString())); string path = at.FindPath(attachid); if (path != "") { pm.DeleteFile(attachid, path); } } InitData(); Alert.ShowInTop("删除数据成功!"); btnSelect_All.Text = "全选"; } else { for (int i = 0; i < pm.GridCount(Grid_UnitInspect, CBoxSelect).Count(); i++) { inspect.ChangePass(Convert.ToInt32(Grid_UnitInspect.DataKeys[pm.GridCount(Grid_UnitInspect, CBoxSelect)[i]][0]), false); operate.LoginName = username; operate.OperationTime = DateTime.Now; operate.LoginIP = " "; operate.OperationContent = "UnitInspect"; operate.OperationType = "删除"; operate.OperationDataID = Convert.ToInt32(Grid_UnitInspect.DataKeys[pm.GridCount(Grid_UnitInspect, CBoxSelect)[i]][0]); op.Insert(operate); } InitData(); Alert.ShowInTop("您的数据已提交,请等待确认!"); btnSelect_All.Text = "全选"; } } catch (Exception ex) { pm.SaveError(ex, this.Request); } }
//删除 protected void Delete_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); int photoId = Blluser.FindPhotoID(id); string srcPath = BLLAttachments.FindPath(photoId); if (photoId == 0 || srcPath == "") { Alert.Show("该人员信息不存在人员照片"); } else { publicMethods.DeleteFile(photoId, srcPath); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideReference() + Alert.GetShowInTopReference("删除成功!")); } } catch (Exception ex) { publicMethods.SaveError(ex, this.Request); } }
//删除选中的单位讲学信息 protected void btnDelete_Click(object sender, EventArgs e) { try { List <int> selections = new List <int>(); for (int i = 0; i < Grid_NAReporting.RecordCount; i++) { if (CBoxSelect.GetCheckedState(i)) { selections.Add(i); } } if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { for (int i = 0; i < selections.Count(); i++) { int NAReportingID = Convert.ToInt32(Grid_NAReporting.DataKeys[selections[i]][0].ToString()); Common.Entities.NewAcademicReporting newacademicreporting = BLLNAR.FindByNAReportingID(NAReportingID); if (newacademicreporting.AttachmentID != null) { if (BllAttachment.SelectAttachmentName(Convert.ToInt32(newacademicreporting.AttachmentID)) != "") { //删除附件文件 string path = BllAttachment.FindPath(Convert.ToInt32(newacademicreporting.AttachmentID)); if (path != "") { publicMethod.DeleteFile(Convert.ToInt32(newacademicreporting.AttachmentID), path); //删除附件表中的数据 BllAttachment.Delete(Convert.ToInt32(newacademicreporting.AttachmentID));//删除成功返回true } } } //删除单位讲学信息 BLLNAR.Delete(NAReportingID);//删除成功返回true } Grid_NAReporting.PageIndex = 0; Grid_NAReporting.PageSize = 20; btnDelete.Enabled = false; BindData(); btnSelect_All.Text = "全选"; Alert.ShowInTop("删除数据成功!"); } else { for (int i = 0; i < selections.Count(); i++) { //BLLNAR.ChangePass(Convert.ToInt32(Grid_NAReporting.DataKeys[selections[i]][0]), false); operate.LoginName = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName; operate.OperationTime = DateTime.Now; operate.LoginIP = " "; operate.OperationContent = "NewAcademicReporting"; operate.OperationType = "删除"; operate.OperationDataID = Convert.ToInt32(Grid_NAReporting.DataKeys[selections[i]][0]); BLLOP.Insert(operate); } Grid_NAReporting.PageIndex = 0; Grid_NAReporting.PageSize = 20; //DropDownList_Agency.SelectedValue = "0"; btnDelete.Enabled = false; BindData(); btnSelect_All.Text = "全选"; Alert.ShowInTop("操作已经提交,请等待管理员确认!"); } } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); } }
//删除 protected void btnDeleteReport_Click(object sender, EventArgs e) { try { int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(Grid_ReportInfo.RecordCount / this.Grid_ReportInfo.PageSize)); if (Grid_ReportInfo.PageIndex == Pages) { m = (Grid_ReportInfo.RecordCount - this.Grid_ReportInfo.PageSize * Grid_ReportInfo.PageIndex); } else { m = this.Grid_ReportInfo.PageSize; } List <int> selections = new List <int>(); for (int i = 0; i < m; i++) { if (CBoxSelect_Report.GetCheckedState(i)) { selections.Add(i); } } if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { for (int i = 0; i < selections.Count(); i++) { int?attachid = BLLReport.Delete(Convert.ToInt32(Grid_ReportInfo.DataKeys[selections[i]][0].ToString())); if (attachid != 0 && attachid != null) {//删除附件 //在附件表中删除学术报告附件 BLLAttachment.Delete(Convert.ToInt32(attachid)); //删除附件文件 string path = BLLAttachment.FindPath(Convert.ToInt32(attachid)); if (path != "") { publicMethod.DeleteFile(Convert.ToInt32(attachid), path); } } } Grid_ReportInfo.PageIndex = 0; Grid_ReportInfo.PageSize = 20; btnDeleteReport.Enabled = false; DropDownList_Agency.SelectedValue = "0"; BindReport(); Alert.ShowInTop("删除成功!"); } else { for (int i = 0; i < selections.Count(); i++) { BLLReport.ChangePass(Convert.ToInt32(Grid_ReportInfo.DataKeys[selections[i]][0]), false); //向操作日志表插入信息 Common.Entities.OperationLog operationLog = new Common.Entities.OperationLog(); operationLog.LoginIP = " "; operationLog.LoginName = Session["LoginName"].ToString(); operationLog.OperationType = "删除"; operationLog.OperationContent = "ScienceReport"; operationLog.OperationTime = DateTime.Now; operationLog.OperationDataID = Convert.ToInt32(Grid_ReportInfo.DataKeys[selections[i]][0]); BLLOP.Insert(operationLog); } btnDeleteReport.Enabled = false; DropDownList_Agency.SelectedValue = "0"; Grid_ReportInfo.PageIndex = 0; Grid_ReportInfo.PageSize = 20; BindReport(); Alert.ShowInTop("您的数据已提交,请等待确认!"); } } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); return; } }
//更新保存 protected void Save_Click(object sender, EventArgs e) { try { //if (tPatentName.Text.Trim() == "") //{ // Alert.Show("专利名称不能为空!"); // return; //} //if (tPatentNumber.Text.Trim() == "") //{ // Alert.Show("专利号不能为空!"); // return; //} //if (tGivenUnit.Text.Trim() == "") //{ // Alert.Show("授予机构不能为空!"); // return; //} //if (tState.Text.Trim() == "") //{ // Alert.Show("状态不能为空!"); // return; //} //if (PatentPeople.Text.Trim() == "") //{ // Alert.Show("发明人不能为空!"); // return; //} //if (FirstPeople.Text.Trim() == "") //{ // Alert.Show("第一发明人不能为空!"); // return; //} //if (tAccreditTime.SelectedDate < tApplicationTime.SelectedDate) //{ // Alert.ShowInTop("授权时间不能小于申请时间!"); // return; //} List <string> list = new List <string>(); string unit = ""; list.Add(tPatentDepartment1.Text.ToString()); list.Add(tPatentDepartment2.Text.ToString()); list.Add(tPatentDepartment3.Text.ToString()); List <string> newlist = new List <string>(); for (int i = 0; i < 3; i++) { if (!string.IsNullOrEmpty(list[i].ToString())) { newlist.Add(list[i].ToString()); } } if (newlist.Count != 0) { for (int j = 0; j < newlist.Count; j++) { unit += newlist[j].ToString(); if (j == newlist.Count() - 1) { break; } unit += ","; } pat.PatentDepartment = unit; } else { pat.PatentDepartment = null; } //lby ↓ int[] AttachmentID = patent.FindAttachmentID(Convert.ToInt32(Session["PatentID"])); UpdateValue(); if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)//如果等于5级 { string path_Patent, path_Application; if (AttachmentID != null) { path_Patent = at.FindPath(AttachmentID[0]); path_Application = at.FindPath(AttachmentID[1]); } else { path_Patent = null; path_Application = null; } pat.IsPass = true; pat.PatentID = Convert.ToInt32(Session["PatentID"]); //lby ↓ int attachid = pm.UpLoadFile(PatentFile).Attachid; if (attachid != -3)//上传控件是否有值 { switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } pat.Attachment_Patent = attachid;//附件为新插入的附件ID pm.DeleteFile(AttachmentID[0], path_Patent); } else //上传控件没有值 { if (AttachmentID != null && AttachmentID[0] != 0) { pat.Attachment_Patent = AttachmentID[0]; } } attachid = pm.UpLoadFile(ApplicationFile).Attachid; if (attachid != -3)//上传控件是否有值 { switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } pat.Attachment_Application = attachid;//附件为新插入的附件ID pm.DeleteFile(AttachmentID[1], path_Application); } else //上传控件没有值 { if (AttachmentID != null && AttachmentID[1] != 0) { pat.Attachment_Application = AttachmentID[1]; } } patent.Update(pat);//更新 PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("更新成功!")); } else//小于5级 { string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; operate.LoginName = username; operate.OperationTime = DateTime.Now; operate.LoginIP = " "; operate.OperationContent = "Patent"; operate.OperationType = "更新"; pat.IsPass = false; //lby ↓ int attachid = pm.UpLoadFile(PatentFile).Attachid; if (attachid != -3)//上传控件是否有值 { switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } pat.Attachment_Patent = attachid;//附件为新插入的附件ID } else//上传控件没有值 { if (AttachmentID[0] != 0)//原来有附件 { pat.Attachment_Patent = AttachmentID[0]; } } attachid = pm.UpLoadFile(ApplicationFile).Attachid; if (attachid != -3)//上传控件是否有值 { switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } pat.Attachment_Application = attachid;//附件为新插入的附件ID } else//上传控件没有值 { if (AttachmentID[1] != 0)//原来有附件 { pat.Attachment_Application = AttachmentID[1]; } } patent.Insert(pat);//插入 operate.OperationDataID = Convert.ToInt32(Session["PatentID"]); operate.Remark = pat.PatentID.ToString(); op.Insert(operate);//将成果更新插入操作表 patent.UpdateIsPass(Convert.ToInt32(Session["PatentID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("数据已缓存,正在等待审核!")); } } catch (Exception ex) { //lby ↓ if (pat.Attachment_Patent != null && pat.Attachment_Application != null) { int[] attachid = { pat.Attachment_Patent.Value, pat.Attachment_Application.Value }; string path_Patent = at.FindPath(attachid[0]); string path_Application = at.FindPath(attachid[1]); pm.DeleteFile(attachid[0], path_Patent); pm.DeleteFile(attachid[1], path_Application); } pm.SaveError(ex, this.Request); } }
//删除 protected void btnDelete_Click(object sender, EventArgs e) { List <int> selections = new List <int>(); for (int i = 0; i < Grid_Pact.RecordCount; i++) { if (BoxSelect_Pact.GetCheckedState(i)) { selections.Add(i); } } if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { for (int i = 0; i < selections.Count(); i++) { int PactID = Convert.ToInt32(Grid_Pact.DataKeys[selections[i]][0].ToString()); //删除资料附件 int AttactID = BLLPact.FindAttachmentID(PactID); string strPath; if (AttactID != 0) { strPath = BLLAttachment.FindPath(AttactID); if (strPath != "") { //在附件表中删除附件数据 BLLAttachment.Delete(AttactID); //删除附件文件 publicMethod.DeleteFile(AttactID, strPath); } } //删除该合同的借阅记录 List <int> listRecordID = BLLLibraryRecord.FindLibraryID(PactID, "合同"); if (listRecordID != null) { for (int j = 0; j < listRecordID.Count(); j++) { BLLLibraryRecord.Delete(listRecordID[j]); } } //合同表删除 BLLPact.Delete(Convert.ToInt32(Grid_Pact.DataKeys[selections[i]][0].ToString())); } Alert.ShowInTop("删除数据成功!"); btnSelect_All.Text = "全选"; } else { for (int i = 0; i < selections.Count(); i++) { BLLPact.UpdateIsPass(Convert.ToInt32(Grid_Pact.DataKeys[selections[i]][0]), false); //将借阅记录表中与该资料有关的数据置为false List <int> listRecordID = BLLLibraryRecord.FindLibraryID(Convert.ToInt32(Grid_Pact.DataKeys[selections[i]][0]), "合同"); for (int j = 0; j < listRecordID.Count(); i++) { BLLLibraryRecord.UpdateIsPass(listRecordID[j], false); } operate.LoginName = Session["LoginName"].ToString(); operate.OperationTime = DateTime.Now; operate.LoginIP = " "; operate.OperationContent = "Pact"; operate.OperationType = "删除"; operate.OperationDataID = Convert.ToInt32(Grid_Pact.DataKeys[selections[i]][0]); op.Insert(operate); } Alert.ShowInTop("操作已经提交,请等待管理员确认!"); btnSelect_All.Text = "全选"; } btnDelete.Enabled = false; Grid_Pact.PageIndex = 0; Grid_Pact.PageSize = 20; BindData(); }
//保存 protected void Save_Click(object sender, EventArgs e) { try { if (tAchievementName.Text.Trim() == "") { Alert.Show("成果名称不能为空!"); return; } if (tAppraisalUnit.Text.Trim() == "") { Alert.Show("鉴定组织部门不能为空!"); return; } if (tApRemarkRank.Text.Trim() == "") { Alert.Show("鉴定评语级别不能为空!"); return; } if (tApprovalNum.Text.Trim() == "") { Alert.Show("鉴定批文号不能为空!"); return; } if (ProjectInNum.Text.Trim() == "") { Alert.Show("项目内部编号不能为空!"); return; } if (ProjectPeople.Text.Trim() == "") { Alert.Show("成员不能为空!"); return; } if (FirstFinishedPeople.Text.Trim() == "") { Alert.Show("成果第一完成人不能为空!"); return; } BLHelper.BLLAgency agency = new BLHelper.BLLAgency(); achs.AchievementName = tAchievementName.Text.Trim(); achs.AgencyID = agency.SelectAgencyID(DropDownListAgency.SelectedText.Trim()); achs.ProjectName = tProjectID.Text.Trim(); achs.AppraisalTime = dAppraisalTime.SelectedDate; achs.AppraisalUnit = tAppraisalUnit.Text.Trim(); achs.ApRemarkRank = tApRemarkRank.Text.Trim(); achs.ApprovalNum = tApprovalNum.Text.Trim(); achs.ProjectInNum = ProjectInNum.Text.Trim(); //项目分类编号 achs.ProjectPeople = ProjectPeople.Text.Trim(); //成员 achs.FirstFinishedPeople = FirstFinishedPeople.Text.Trim(); //成果第一完成人 // achs.ProjectRank = DropDownListProjectRank.SelectedText;//鉴定级别 achs.ProjectLevel = DropDownListProjectLevel.SelectedText; //鉴定水平 achs.ProjectForm = DropDownListProjectForm.SelectedText; //鉴定形式 achs.SecrecyLevel = Convert.ToInt32(dSecrecyLevel.SelectedIndex + 1); achs.EntryPerson = achieve.Findmodel(Convert.ToInt32(Session["AchievementID"])).EntryPerson; int AttachmentID = achieve.FindAttachment(Convert.ToInt32(Session["AchievementID"])); int OpinionPage = achieve.FindAttachment(Convert.ToInt32(Session["AchievementID"])); int MemberPage = achieve.FindAttachment(Convert.ToInt32(Session["AchievementID"])); int SealPage = achieve.FindAttachment(Convert.ToInt32(Session["AchievementID"])); if (Convert.ToInt32(Session["SecrecyLevel"]) == 5)//如果等于5级 { achs.IsPass = true; achs.AchievementID = Convert.ToInt32(Session["AchievementID"]); string path = at.FindPath(AttachmentID); int attachid = pm.UpLoadFile(fileupload).Attachid; if (attachid != -3)//上传控件是否有值 { switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } achs.AttachmentID = attachid; //成果表的附件为新插入的附件ID achieve.Update(achs); //更新 pm.DeleteFile(AttachmentID, path); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } else //上传空间没有值 { if (AttachmentID != 0) { achs.AttachmentID = AttachmentID; } achieve.Update(achs);//更新成果表 PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } string path1 = at.FindPath(OpinionPage); int opinion = pm.UpLoadFile(OpinionPage1).Attachid; if (opinion != -3)//上传控件是否有值 { switch (opinion) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } achs.OpinionPage = opinion; achieve.Update(achs);//更新 pm.DeleteFile(OpinionPage, path1); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } else //上传空间没有值 { if (OpinionPage != 0) { achs.OpinionPage = OpinionPage; } achieve.Update(achs);//更新成果表 PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } string path2 = at.FindPath(MemberPage); int member = pm.UpLoadFile(MemberPage1).Attachid; if (member != -3)//上传控件是否有值 { switch (member) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } achs.MemberPage = member; //成果表的附件为新插入的附件ID achieve.Update(achs); //更新 pm.DeleteFile(MemberPage, path2); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } else //上传空间没有值 { if (MemberPage != 0) { achs.MemberPage = MemberPage; } achieve.Update(achs);//更新成果表 PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } string path3 = at.FindPath(SealPage); int seal = pm.UpLoadFile(SealPage1).Attachid; if (seal != -3)//上传控件是否有值 { switch (seal) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } achs.SealPage = seal; //成果表的附件为新插入的附件ID achieve.Update(achs); //更新 pm.DeleteFile(SealPage, path3); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } else //上传空间没有值 { if (SealPage != 0) { achs.SealPage = SealPage; } achieve.Update(achs);//更新成果表 PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } } else//小于5级 { string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; log.LoginName = username; log.OperationTime = DateTime.Now; log.LoginIP = " "; log.OperationContent = "Achievement"; log.OperationType = "更新"; achs.IsPass = false; int attachid = pm.UpLoadFile(fileupload).Attachid; if (attachid != -3)//上传控件是否有值 { switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } achs.AttachmentID = attachid; //成果表的附件为新插入的附件ID achieve.Insert(achs); //插入成果表 log.OperationDataID = Convert.ToInt32(Session["AchievementID"]); log.Remark = achs.AchievementID.ToString(); op.Insert(log);//将成果更新插入操作表 achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } else//上传控件没有值 { if (AttachmentID != 0)//原来有附件 { achs.AttachmentID = AttachmentID; } achieve.Insert(achs); log.OperationDataID = Convert.ToInt32(Session["AchievementID"]); log.Remark = achs.AchievementID.ToString(); op.Insert(log); achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } int opinion = pm.UpLoadFile(OpinionPage1).Attachid; if (opinion != -3)//上传控件是否有值 { switch (opinion) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } achs.OpinionPage = opinion; achieve.Insert(achs);//插入成果表 log.OperationDataID = Convert.ToInt32(Session["AchievementID"]); log.Remark = achs.AchievementID.ToString(); op.Insert(log);//将成果更新插入操作表 achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } else//上传控件没有值 { if (OpinionPage != 0)//原来有附件 { achs.OpinionPage = OpinionPage; } achieve.Insert(achs); log.OperationDataID = Convert.ToInt32(Session["AchievementID"]); log.Remark = achs.AchievementID.ToString(); op.Insert(log); achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } int member = pm.UpLoadFile(MemberPage1).Attachid; if (member != -3)//上传控件是否有值 { switch (member) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } achs.MemberPage = member; achieve.Insert(achs);//插入成果表 log.OperationDataID = Convert.ToInt32(Session["AchievementID"]); log.Remark = achs.AchievementID.ToString(); op.Insert(log);//将成果更新插入操作表 achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } else//上传控件没有值 { if (MemberPage != 0)//原来有附件 { achs.MemberPage = MemberPage; } achieve.Insert(achs); log.OperationDataID = Convert.ToInt32(Session["AchievementID"]); log.Remark = achs.AchievementID.ToString(); op.Insert(log); achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } int seal = pm.UpLoadFile(SealPage1).Attachid; if (seal != -3)//上传控件是否有值 { switch (seal) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } achs.SealPage = seal; achieve.Insert(achs);//插入成果表 log.OperationDataID = Convert.ToInt32(Session["AchievementID"]); log.Remark = achs.AchievementID.ToString(); op.Insert(log);//将成果更新插入操作表 achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } else//上传控件没有值 { if (SealPage != 0)//原来有附件 { achs.SealPage = SealPage; } achieve.Insert(achs); log.OperationDataID = Convert.ToInt32(Session["AchievementID"]); log.Remark = achs.AchievementID.ToString(); op.Insert(log); achieve.UpdateIsPass(Convert.ToInt32(Session["AchievementID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } } } catch (Exception ex) { int attachid = Convert.ToInt32(achs.AttachmentID); string path = at.FindPath(attachid); pm.DeleteFile(attachid, path); pm.SaveError(ex, this.Request); } }
//保存 protected void btnSave_Click(object sender, EventArgs e) { try { //lby↓ int AttachmentID = BLLPlatform.FindAttachmentID(Convert.ToInt32(Session["PlatformID"])); string path = at.FindPath(AttachmentID); Common.Entities.Platform platform = new Common.Entities.Platform(); string PlatformName = BLLPlatform.FindByPlatformID(Convert.ToInt32(Session["PlatformID"])).PlatformName;//原平台名称 if (txtPlatformName.Text.Trim() == "") { Alert.ShowInTop("平台名称不能为空!"); txtPlatformName.Reset(); return; } //新更新的数据是否与原数据的平台名称相同 if (txtPlatformName.Text.Trim() != PlatformName)//不同 { if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()) == null) { platform.PlatformName = txtPlatformName.Text.Trim(); } else { if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == false) { Alert.ShowInTop("该平台名称正在审核中,请等待!"); txtPlatformName.Text = ""; return; } if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == true) { Alert.ShowInTop("平台名称已存在!"); txtPlatformName.Text = ""; return; } } } else//相同 { if (txtPlatformName.Text.Trim() == PlatformName)//新更新的数据与原数据的平台名称相同 { platform.PlatformName = txtPlatformName.Text.Trim(); } else { if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == false) { Alert.ShowInTop("该平台名称正在审核中,请等待!"); txtPlatformName.Text = ""; return; } if (BLLPlatform.FindByPlatformName(txtPlatformName.Text.Trim()).IsPass == true) { Alert.ShowInTop("平台名称已存在!"); txtPlatformName.Text = ""; return; } } } // platform.PlatformName = txtPlatformName.Text.Trim(); platform.PlatformRank = DropDownListPlatformRank.SelectedText; platform.AgreeUnit = DropDownListAgreeUnit.SelectedText; platform.AgreeTime = DatePicker_AgreeTime.SelectedDate; platform.PlatformType = DropDownListPlatformType.SelectedText; platform.SecrecyLevel = DropDownList_SecrecyLevel.SelectedIndex + 1; platform.EntryPerson = BLLPlatform.FindByPlatformID(Convert.ToInt32(Session["PlatformID"])).EntryPerson; //lby↓ platform.PlatformManagement = txtPlatformManagement.Text.Trim(); platform.AgreeNumber = txtAgreeNumber.Text.Trim(); platform.AgreeExpenditure = txtAgreeExpenditure.Text.Trim(); platform.PlatformPrincipal = txtPlatformPrincipal.Text.Trim(); platform.PlatformMember = txtPlatformMember.Text.Trim(); //向操作日志表中 if (Convert.ToInt32(Session["SecrecyLevel"]) != 5) { platform.IsPass = false; operationLog.LoginIP = " "; operationLog.LoginName = platform.EntryPerson; operationLog.OperationType = "更新"; operationLog.OperationContent = "Platform"; operationLog.OperationTime = DateTime.Now; //operationLog.OperationDataID = Convert.ToInt32(Session["PlatformID"]); //operationLog.Remark = platform.PlatformID.ToString(); //PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已提交审核!")); //lby↓ int attachid = pm.UpLoadFile(fileupload).Attachid; if (attachid != -3)//有值 { switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } platform.AttachmentID = attachid;//附件为新插入的附件ID } else//上传控件没有值 { if (AttachmentID != 0)//原来有附件 { platform.AttachmentID = AttachmentID; } } BLLPlatform.insert(platform);//插入 operationLog.OperationDataID = Convert.ToInt32(Session["PlatformID"]); operationLog.Remark = platform.PlatformID.ToString(); BLLOp.Insert(operationLog);//将成果更新插入操作表 BLLPlatform.UpdateIsPass(Convert.ToInt32(Session["PlatformID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已提交,正在等待审核!")); } else { platform.IsPass = true; platform.PlatformID = Convert.ToInt32(Session["PlatformID"]); //lby↓ int attachid = pm.UpLoadFile(fileupload).Attachid; if (attachid != -3)//上传控件是否有值 { switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } platform.AttachmentID = attachid;//附件为新插入的附件ID pm.DeleteFile(AttachmentID, path); } else //上传空间没有值 { if (AttachmentID != 0) { platform.AttachmentID = AttachmentID; } } BLLPlatform.Update(platform);//5级直接更新平台表 PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("平台信息已更新完成!")); } } catch (Exception ex) { pm.SaveError(ex, this.Request); } }
//保存 protected void Save_Click(object sender, EventArgs e) { try { if (tPatentName.Text.Trim() == "") { Alert.Show("专利名称不能为空!"); return; } if (tPatentNumber.Text.Trim() == "") { Alert.Show("专利号不能为空!"); return; } if (tGivenUnit.Text.Trim() == "") { Alert.Show("授予机构不能为空!"); return; } if (tState.Text.Trim() == "") { Alert.Show("状态不能为空!"); return; } if (PatentPeople.Text.Trim() == "") { Alert.Show("全部发明人不能为空!"); return; } if (FirstPeople.Text.Trim() == "") { Alert.Show("第一发明人不能为空!"); return; } if (tAccreditTime.SelectedDate < tApplicationTime.SelectedDate) { Alert.ShowInTop("授权时间不能小于申请时间!"); return; } string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; pa.EntryPerson = username; //pa.Member = PatentMember.Text.Trim(); List <string> list = new List <string>(); string unit = ""; list.Add(tPatentDepartment1.Text.ToString()); list.Add(tPatentDepartment2.Text.ToString()); list.Add(tPatentDepartment3.Text.ToString()); List <string> newlist = new List <string>(); for (int i = 0; i < 3; i++) { if (!string.IsNullOrEmpty(list[i].ToString())) { newlist.Add(list[i].ToString()); } } if (newlist.Count != 0) { for (int j = 0; j < newlist.Count; j++) { unit += newlist[j].ToString(); if (j == newlist.Count() - 1) { break; } unit += ","; } pa.PatentDepartment = unit; } else { pa.PatentDepartment = null; } if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { InsertValue(); pa.IsPass = true; //lby ↓ int attachid = pm.UpLoadFile(PatentFile).Attachid; switch (attachid) { case -1: Alert.ShowInTop("专利证书文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("专利证书文件名已经存在!"); return; case -2: Alert.ShowInTop("专利证书文件不能大于150M"); return; } if (attachid != -3) { pa.Attachment_Patent = attachid; } else { pa.Attachment_Patent = null; } attachid = pm.UpLoadFile(ApplicationFile).Attachid; switch (attachid) { case -1: Alert.ShowInTop("申请书文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("申请书文件名已经存在!"); return; case -2: Alert.ShowInTop("申请书文件不能大于150M"); return; } if (attachid != -3) { pa.Attachment_Application = attachid; } else { pa.Attachment_Application = null; } if (tAchievement.SelectedItem != null) { pa.AchievementID = tAchievement.SelectedItem.Text; } else { pa.AchievementID = tAchievement.Text; } patent.Insert(pa); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } else { InsertValue(); pa.IsPass = false; //lby ↓ int attachid = pm.UpLoadFile(PatentFile).Attachid; switch (attachid) { case -1: Alert.ShowInTop("专利证书文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("专利证书文件名已经存在!"); return; case -2: Alert.ShowInTop("专利证书文件不能大于150M"); return; } if (attachid != -3) { pa.Attachment_Patent = attachid; } else { pa.Attachment_Patent = null; } attachid = pm.UpLoadFile(ApplicationFile).Attachid; switch (attachid) { case -1: Alert.ShowInTop("申请书文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("申请书文件名已经存在!"); return; case -2: Alert.ShowInTop("申请书文件不能大于150M"); return; } if (attachid != -3) { pa.Attachment_Application = attachid; } else { pa.Attachment_Application = null; } patent.Insert(pa); operate.LoginName = username; operate.OperationTime = DateTime.Now; operate.LoginIP = " "; operate.OperationContent = "Patent"; operate.OperationType = "添加"; operate.OperationDataID = pa.PatentID; op.Insert(operate); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } } catch (Exception ex) { //lby ↓ if (pa.Attachment_Patent != null && pa.Attachment_Application != null) { int[] attachid = { pa.Attachment_Patent.Value, pa.Attachment_Application.Value }; string path_Patent = at.FindPath(attachid[0]); string path_Application = at.FindPath(attachid[1]); pm.DeleteFile(attachid[0], path_Patent); pm.DeleteFile(attachid[1], path_Application); } pm.SaveError(ex, this.Request); } }
//添加 protected void Save_Click(object sender, EventArgs e) { try { if (tAchievementName.Text.Trim() == "") { Alert.Show("成果名称不能为空!"); return; } if (tAppraisalUnit.Text.Trim() == "") { Alert.Show("鉴定组织部门不能为空!"); return; } if (tApRemarkRank.Text.Trim() == "") { Alert.Show("成果登记号不能为空!"); return; } if (tApprovalNum.Text.Trim() == "") { Alert.Show("证书文号不能为空!"); return; } if (ProjectInNum.Text.Trim() == "") { Alert.Show("项目内部编号不能为空!"); return; } if (FirstFinishedPeople.Text.Trim() == "") { Alert.Show("成果第一完成人不能为空!"); return; } if (ProjectPeople.Text.Trim() == "") { Alert.Show("成员不能为空!"); return; } BLHelper.BLLAgency agency = new BLHelper.BLLAgency(); ach.AchievementName = tAchievementName.Text.Trim(); ach.AgencyID = agency.SelectAgencyID(DropDownListAgency.SelectedText); ach.ProjectName = tProjectID.Text.Trim(); ach.AppraisalTime = dAppraisalTime.SelectedDate; ach.AppraisalUnit = tAppraisalUnit.Text.Trim(); ach.ApRemarkRank = tApRemarkRank.Text.Trim(); ach.ApprovalNum = tApprovalNum.Text.Trim(); ach.ProjectInNum = ProjectInNum.Text.Trim(); //项目分类编号 ach.ProjectPeople = ProjectPeople.Text.Trim(); //成员 ach.FirstFinishedPeople = FirstFinishedPeople.Text.Trim(); //成果第一完成人 //ach.ProjectRank = DropDownListProjectRank.SelectedText;//鉴定级别 ach.ProjectLevel = DropDownListProjectLevel.SelectedText; //鉴定水平 ach.ProjectForm = DropDownListProjectForm.SelectedText; //鉴定形式 ach.SecrecyLevel = Convert.ToInt32(dSecrecyLevel.SelectedIndex + 1); string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; ach.EntryPerson = username; if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { 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) { ach.AttachmentID = attachid; } else { ach.AttachmentID = null; } int opinion = pm.UpLoadFile(OpinionPage).Attachid; switch (opinion) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } if (opinion != -3) { ach.OpinionPage = opinion; } else { ach.OpinionPage = null; } int member = pm.UpLoadFile(MemberPage).Attachid; switch (member) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } if (member != -3) { ach.MemberPage = member; } else { ach.MemberPage = null; } int seal = pm.UpLoadFile(SealPage).Attachid; switch (seal) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } if (seal != -3) { ach.SealPage = seal; } else { ach.SealPage = null; } ach.IsPass = true; achieve.Insert(ach); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } else { 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) { ach.AttachmentID = attachid; } else { ach.AttachmentID = null; } int opinion = pm.UpLoadFile(OpinionPage).Attachid; switch (opinion) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } if (opinion != -3) { ach.OpinionPage = opinion; } else { ach.OpinionPage = null; } int member = pm.UpLoadFile(MemberPage).Attachid; switch (member) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } if (member != -3) { ach.MemberPage = member; } else { ach.MemberPage = null; } int seal = pm.UpLoadFile(SealPage).Attachid; switch (seal) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } if (seal != -3) { ach.SealPage = seal; } else { ach.SealPage = null; } ach.IsPass = false; achieve.Insert(ach); log.LoginName = username; log.OperationTime = DateTime.Now; log.LoginIP = " "; log.OperationContent = "Achievement"; log.OperationType = "添加"; log.OperationDataID = ach.AchievementID; op.Insert(log); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } } catch (Exception ex) { int attachid = Convert.ToInt32(ach.AttachmentID); string path = at.FindPath(attachid); pm.DeleteFile(attachid, path); pm.SaveError(ex, this.Request); } }
//保存 protected void Save_Click(object sender, EventArgs e) { try { if (tMonographName.Text.Trim() == "") { Alert.Show("著作名称不能为空!"); return; } if (MoPeople.Text.Trim() == "") { Alert.Show("著作人不能为空!"); return; } if (TFirstWriter.Text.Trim() == null) { Alert.Show("第一作者不能为空!"); return; } string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; mon.EntryPerson = username; if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { InsertValue(); mon.IsPass = true; if (Session["FAttachmentID"] != null) { mon.FAttachmentID = Convert.ToInt32(Session["FAttachmentID"].ToString()); } if (Session["BAttachmentID"] != null) { mon.BAttachmentID = Convert.ToInt32(Session["BAttachmentID"].ToString()); } mo.Insert(mon); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功")); } else { InsertValue(); mon.IsPass = false; if (Session["FAttachmentID"] != null) { mon.FAttachmentID = Convert.ToInt32(Session["FAttachmentID"].ToString()); } if (Session["BAttachmentID"] != null) { mon.BAttachmentID = Convert.ToInt32(Session["BAttachmentID"].ToString()); } mo.Insert(mon); log.LoginName = username; log.OperationTime = DateTime.Now; log.LoginIP = " "; log.OperationContent = "Monograph"; log.OperationType = "添加"; log.OperationDataID = mon.MonographID; op.Insert(log); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } } catch (Exception ex) { int attachidb = Convert.ToInt32(mon.BAttachmentID); int attachidf = Convert.ToInt32(mon.FAttachmentID); string pathb = at.FindPath(attachidb); string pathf = at.FindPath(attachidf); pm.DeleteFile(attachidb, pathb); pm.DeleteFile(attachidf, pathf); pm.SaveError(ex, this.Request); } }
//保存 protected void btnSave_Click(object sender, EventArgs e) { try { if (txtLecturesName.Text.Trim() == "") { Alert.ShowInTop("姓名不能为空!"); txtLecturesName.Reset(); return; } if (txtWorkPlace.Text.Trim() == "") { Alert.ShowInTop("工作单位不能为空!"); txtWorkPlace.Reset(); return; } //原单位讲学对象 unitLectures = BLLUL.FindByUnitLecturesID(Convert.ToInt32(Session["UnitLecturesID"])); //单位讲学表对象 NewUnitLectures.LecturesName = txtLecturesName.Text; NewUnitLectures.AgencyID = BLLAgency.SelectAgencyID(DropDownList_Agency.SelectedText); NewUnitLectures.UReportName = txtUReportName.Text; NewUnitLectures.LecturesTime = Convert.ToDateTime(DatePikerLecturesTime.Text); NewUnitLectures.WorkUnit = txtWorkPlace.Text; NewUnitLectures.listenerNumber = Convert.ToInt32(txtlistenerNumber.Text); NewUnitLectures.SecrecyLevel = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedValue); NewUnitLectures.LecturesPlace = txtLecturesPlace.Text; NewUnitLectures.WorkTitle = txtjobtitle.Text; NewUnitLectures.Identity = txtIDCard.Text; NewUnitLectures.Telephone = txtTel.Text; NewUnitLectures.Remark = Remark.Text; NewUnitLectures.EntryPerson = unitLectures.EntryPerson; //用户等级为5级可直接通过 if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { NewUnitLectures.IsPass = true; } else { NewUnitLectures.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; case -3: NewUnitLectures.AttachmentID = unitLectures.AttachmentID; break; default: NewUnitLectures.AttachmentID = AttachID; break; } if (Convert.ToInt32(Session["SecrecyLevel"]) != 5) { //操作日志表对象 Common.Entities.OperationLog operationLog = InsertOperationLog(); operationLog.OperationDataID = Convert.ToInt32(Session["UnitLecturesID"]); NewUnitLectures.EntryPerson = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName; NewUnitLectures.IsPass = false; unitLectures.IsPass = false; BLLUL.Insert(NewUnitLectures); //向单位讲学表插入信息 operationLog.Remark = NewUnitLectures.UnitLecturesID.ToString(); BLLOL.Insert(operationLog); //向操作日志表插入信息 Alert.ShowInTop("操数据已经提交,等待管理员确认!"); } else { NewUnitLectures.UnitLecturesID = Convert.ToInt32(Session["UnitLecturesID"]); BLLUL.Update(NewUnitLectures); Alert.ShowInTop("保存成功!"); } PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference()); } catch (Exception ex) { //删除附件文件 string path = BLLattachment.FindPath(Convert.ToInt32(unitLectures.AttachmentID)); if (path != "") { pm.DeleteFile(Convert.ToInt32(unitLectures.AttachmentID), path); //删除附件表中的数据 BLLattachment.Delete(Convert.ToInt32(unitLectures.AttachmentID));//删除成功返回true } //BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); } }
//保存资料信息 protected void btnSave_Click(object sender, EventArgs e) { try { if (Session["LoginName"].ToString() == "") { Response.Redirect("login.aspx"); Alert.Show("登录超时!"); } if (txtContractHeadLine.Text.Trim() == "") { Alert.ShowInTop("资料题目不能为空!"); txtContractHeadLine.Reset(); return; } if (txtContractAuthors.Text.Trim() == "") { Alert.ShowInTop("资料保存人不能为空!"); txtContractAuthors.Reset(); return; } if (txtContractOriginal.Text.Trim() == "") { Alert.ShowInTop("原始文件保存人不能为空 ! "); txtContractOriginal.Reset(); return; } NewContract.ContractAuthors = txtContractAuthors.Text; NewContract.ContractHeadLine = txtContractHeadLine.Text; NewContract.ContractOriginal = txtContractOriginal.Text; NewContract.EntryPerson = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName; NewContract.SecrecyLevel = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedValue); //上传附件 int AttachID = pm.UpLoadFile(fileupload).Attachid; switch (AttachID) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; case -3: NewContract.AttachmentID = null; break; //Alert.ShowInTop("请上传附件"); //return; default: NewContract.AttachmentID = AttachID; break; } if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { NewContract.IsPass = true; //向资料表中插入数据 BLLcontract.Insert(NewContract); Alert.ShowInTop("保存成功"); } else { NewContract.IsPass = false; //向资料表中插入数据 BLLcontract.Insert(NewContract); //向操作日志表中插入信息 operationLog.LoginIP = " "; operationLog.LoginName = Session["LoginName"].ToString(); operationLog.OperationType = "添加"; operationLog.OperationContent = "Contract"; operationLog.OperationTime = DateTime.Now; operationLog.OperationDataID = NewContract.ContractID; //向操作日志表中插入数据 BLLOL.Insert(operationLog); Alert.ShowInTop("您的数据已提交,请等待确认"); } PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference()); } catch (Exception ex) { int ContractID = NewContract.ContractID; //删除资料附件 int AttactID = BLLcontract.FindAttachmentID(ContractID); string strPath; if (AttactID != 0) { strPath = BLLattachment.FindPath(AttactID); if (strPath != "") { //删除附件文件 pm.DeleteFile(AttactID, strPath); //在附件表中删除附件数据 BLLattachment.Delete(AttactID); } } //BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); } }
public void BindData() { try { List <Common.Entities.Project> list = bllProject.FindProject(Convert.ToInt32(Session["ProjectID"]), Convert.ToInt32(Session["SecrecyLevel"])); Common.Entities.Project project = list.FirstOrDefault(); ProjectName2.Text = project.ProjectName; DropDownListAgencyP.SelectedValue = bllAgency.FindAgenName(project.AgencyID); AcceptUnit2.Text = project.AcceptUnit; SourceUnit2.Text = project.SourceUnit; DropDownListProjectSortName.SelectedValue = project.ProjectSortName; if (project.ProjectSortName.Length > 2) { switch (project.ProjectSortName.Substring(0, 2)) { case "一类": DropDownListProjectSortName.Items.Clear(); List <BasicCode> list1 = bllBasicCode.FindALLName("项目等级(一类)"); for (int i = 0; i < list1.Count(); i++) { DropDownListProjectSortName.Items.Add(list1[i].CategoryContent.ToString(), list1[i].CategoryContent.ToString()); } DropDownListProjectSortName.SelectedIndex = 0; break; case "二类": DropDownListProjectSortName.Items.Clear(); List <BasicCode> list2 = bllBasicCode.FindALLName("项目等级(二类)"); for (int i = 0; i < list2.Count(); i++) { DropDownListProjectSortName.Items.Add(list2[i].CategoryContent.ToString(), list2[i].CategoryContent.ToString()); } DropDownListProjectSortName.SelectedIndex = 0; break; case "三类": DropDownListProjectSortName.Items.Clear(); List <BasicCode> list3 = bllBasicCode.FindALLName("项目等级(三类)"); for (int i = 0; i < list3.Count(); i++) { DropDownListProjectSortName.Items.Add(list3[i].CategoryContent.ToString(), list3[i].CategoryContent.ToString()); } DropDownListProjectSortName.SelectedIndex = 0; break; } DropDownListProjectSort.SelectedValue = project.ProjectSortName.Substring(0, 2); } else { DropDownListProjectSort.SelectedValue = ""; } DropDownListState.SelectedValue = project.ProjectState; ApprovedMoney2.Text = project.ApprovedMoney; GetMoney2.Text = project.GetMoney; DropDownListCooperationForms.SelectedValue = project.CooperationForms;// CooperationForms2.Text = project.CooperationForms; DropDownListProjectLevel.SelectedIndex = Convert.ToInt32(project.SecrecyLevel) - 1; ProjectHeads2.Text = project.ProjectHeads; DatePickerStartTime.SelectedDate = project.StartTime; DatePickerEndTime.SelectedDate = project.EndTime; DatePickerExpectEndTime.SelectedDate = project.ExpectEndTime; DropDownListExpecteResults.SelectedValue = project.ExpecteResults;//ExpecteResults2.Text=project.ExpecteResults; GivenMoneyUnits2.Text = project.GivenMoneyUnits; DropDownListNature.SelectedValue = project.ProjectNature; Remark2.Text = project.Remark; ManageMoney.Text = project.ManageMoney.ToString(); PactNum2.Text = project.PactNum; TaskNum2.Text = project.TaskNum; DropDownListSecrecyLevel.SelectedIndex = Convert.ToInt32(project.SecrecyLevel - 1); ProjectManager.Text = project.ProjectManager; //项目负责人(前三) ProjectInNum.Text = project.ProjectInNum; //项目内部编号(科技处) ProjectMember.Text = project.ProjectMember; //项目成员 } catch (Exception ex) { publicmethod.DeleteFile(Convert.ToInt32(aproject.BenefitAttachment), bllAttachment.FindPath(Convert.ToInt32(aproject.BenefitAttachment))); publicmethod.DeleteFile(Convert.ToInt32(aproject.BudgetAttachment), bllAttachment.FindPath(Convert.ToInt32(aproject.BudgetAttachment))); publicmethod.SaveError(ex, this.Request); } }
//上传照片 public void UploadPhotos() { try { int UserID = bllUser.FindByLoginName(Session["LoginName"].ToString(), Convert.ToInt32(Session["SecrecyLevel"])).FirstOrDefault().UserInfoID; Session["PhotoID"] = bllPhotos.FindPhotoID(UserID); if (bllPhotos.FindPhotoID(UserID) == 0)//判断是否有照片,是添加还是更新 { //先进行附件判断 int AttachID = pm.UpLoadPhoto(filePhoto); switch (AttachID) { case 0: Alert.ShowInTop("无效的文件类型!"); return; case -1: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于5M"); return; case -3: Alert.ShowInTop("没有选择照片!"); return; } photo.AttachmentID = AttachID; photo.UserInfoID = UserID; photo.SecrecyLevel = Convert.ToInt32(Session["SecrecyLevel"]); photo.EntryPerson = bllUser.FindByLoginName(Session["LoginName"].ToString()).UserName; if (Convert.ToInt32(Session["SecrecyLevel"]) < 5) { photo.IsPass = false; bllPhotos.Insert(photo);//插入照片表 log.LoginName = bllUser.FindByLoginName(Session["LoginName"].ToString()).UserName; log.OperationTime = DateTime.Now; log.LoginIP = " "; log.OperationType = "添加"; log.OperationContent = "Photos"; log.OperationDataID = photo.PhotosID; log.Remark = ""; bllOperate.Insert(log);//插入操作日志表 Alert.ShowInTop("照片已上传,等待管理员审核!"); filePhoto.Reset(); } else { photo.IsPass = true; bllPhotos.Insert(photo);//插入照片表 //显示照片 string FindPath = bllAttachment.FindPath(bllPhotos.FindAttachmentID(photo.PhotosID)); imgPhoto.ImageUrl = FindPath; Alert.ShowInTop("照片上传成功!"); filePhoto.Reset(); } } else//更新 { //先进行附件判断 int AttachID = pm.UpLoadPhoto(filePhoto); switch (AttachID) { case 0: Alert.ShowInTop("无效的文件类型!"); return; case -1: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于5M"); return; case -3: Alert.ShowInTop("没有选择照片!"); return; } if (Convert.ToInt32(Session["SecrecyLevel"]) < 5) { //bllPhotos.UpdateIsPass(Convert.ToInt32(Session["PhotoID"]), false);//原照片状态为false photo.AttachmentID = AttachID; photo.UserInfoID = UserID; photo.SecrecyLevel = Convert.ToInt32(Session["SecrecyLevel"]); photo.EntryPerson = bllPhotos.find(Convert.ToInt32(Session["PhotoID"])).EntryPerson; photo.IsPass = false; bllPhotos.Insert(photo);//插入照片表 log.LoginName = bllPhotos.find(Convert.ToInt32(Session["PhotoID"])).EntryPerson; log.OperationTime = DateTime.Now; log.LoginIP = " "; log.OperationType = "更新"; log.OperationContent = "Photos"; log.OperationDataID = Convert.ToInt32(Session["PhotoID"]); //原照片ID log.Remark = photo.PhotosID.ToString(); bllOperate.Insert(log); //插入操作日志表 Alert.ShowInTop("照片已上传,等待管理员审核!"); filePhoto.Reset(); } else { int AttanchmentID = bllPhotos.FindAttachmentID(Convert.ToInt32(Session["PhotoID"])); string path = bllAttachment.FindPath(AttanchmentID); pm.DeleteFile(AttanchmentID, path); photo.PhotosID = Convert.ToInt32(Session["PhotoID"]); photo.AttachmentID = AttachID; photo.UserInfoID = bllUser.FindByLoginName(Session["LoginName"].ToString(), Convert.ToInt32(Session["SecrecyLevel"])).FirstOrDefault().UserInfoID; photo.SecrecyLevel = Convert.ToInt32(Session["SecrecyLevel"]); photo.EntryPerson = Session["LoginName"].ToString(); photo.IsPass = true; bllPhotos.Update(photo);//更新照片表 //显示照片 string FindPath = bllAttachment.FindPath(bllPhotos.FindAttachmentID(photo.PhotosID)); imgPhoto.ImageUrl = FindPath; Alert.ShowInTop("照片修改成功!"); filePhoto.Reset(); } } } catch (Exception ex) { pm.DeleteFile(Convert.ToInt32(photo.AttachmentID), bllAttachment.FindPath(Convert.ToInt32(photo.AttachmentID))); pm.SaveError(ex, this.Request); } }
//保存更改 protected void Save_Click(object sender, EventArgs e) { try { if (tInspectName.Text.Trim() == "") { Alert.Show("姓名不能为空!"); return; } if (tWorkPlace.Text.Trim() == "") { Alert.Show("工作单位不能不空!"); return; } if (tVisitContent.Text.Trim() == "") { Alert.Show("参观内容不能为空!"); return; } BLHelper.BLLAgency agency = new BLHelper.BLLAgency(); ins.EntryPerson = inspect.Findmodel(Convert.ToInt32(Session["InspectID"])).EntryPerson; ins.InspectName = tInspectName.Text.Trim(); ins.VisitContent = tVisitContent.Text.Trim(); ins.InspectTime = dInspectTime.SelectedDate; ins.WorkPlace = tWorkPlace.Text.Trim(); ins.SecrecyLevel = Convert.ToInt32(dSecrecyLevel.SelectedIndex + 1); ins.AgencyID = agency.SelectAgencyID(DropDownListAgency.SelectedText); ins.Duty = tDuty.Text.Trim(); int AttachmentID = inspect.FindAttachmentID(Convert.ToInt32(Session["InspectID"])); string path = attachment.FindPath(AttachmentID); string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { ins.IsPass = true; ins.UnitInspectID = Convert.ToInt32(Session["InspectID"]); int Attachment = pm.UpLoadFile(fileupload).Attachid; if (Attachment != -3) { switch (Attachment) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } ins.AccessoryID = Attachment; inspect.Update(ins); pm.DeleteFile(AttachmentID, path); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } else { if (AttachmentID != 0) { ins.AccessoryID = AttachmentID; } inspect.Update(ins); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } } else { log.LoginName = username; log.OperationTime = DateTime.Now; log.LoginIP = " "; log.OperationContent = "UnitInspect"; log.OperationType = "更新"; ins.IsPass = false; int Attachment = pm.UpLoadFile(fileupload).Attachid; if (Attachment != -3) { switch (Attachment) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } ins.AccessoryID = Attachment; inspect.Insert(ins); log.OperationDataID = Convert.ToInt32(Session["InspectID"]); log.Remark = ins.UnitInspectID.ToString(); op.Insert(log); inspect.ChangePass(Convert.ToInt32(Session["InspectID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } else { if (AttachmentID != 0) { ins.AccessoryID = AttachmentID; } inspect.Insert(ins); log.OperationDataID = Convert.ToInt32(Session["InspectID"]); log.Remark = ins.UnitInspectID.ToString(); op.Insert(log); inspect.ChangePass(Convert.ToInt32(Session["InspectID"]), false); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } } } catch (Exception ex) { int attachid = Convert.ToInt32(ins.AccessoryID); string path = attachment.FindPath(attachid); pm.DeleteFile(attachid, path); pm.SaveError(ex, this.Request); } }
//保存 protected void Save_Click(object sender, EventArgs e) { try { if (tAchievement.Text.Trim() == "") { Alert.Show("成果名称不能为空!"); return; } if (tApplyUnit.Text.Trim() == "") { Alert.Show("应用单位不能为空!"); return; } if (tUse.Text.Trim() == "") { Alert.Show("用途不能为空!"); return; } if (dEndTime.SelectedDate < dStartTime.SelectedDate) { Alert.ShowInTop("结束时间不能小于开始时间!"); return; } string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; app.EntryPerson = username; int attachid = pm.UpLoadFile(fileupload).Attachid; if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { InsertValue(); switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } if (attachid != -3) { app.AttachmentID = attachid; } else { app.AttachmentID = null; } app.IsPass = true; apply.Insert(app); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } else { InsertValue(); switch (attachid) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; } if (attachid != -3) { app.AttachmentID = attachid; } else { app.AttachmentID = null; } app.IsPass = false; apply.Insert(app); log.LoginName = username; log.OperationTime = DateTime.Now; log.LoginIP = " "; log.OperationContent = "AchivementApply"; log.OperationType = "添加"; log.OperationDataID = app.AchivementApplyID; op.Insert(log); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("您的数据已提交,请等待确认!")); } } catch (Exception ex) { int attachid = Convert.ToInt32(app.AttachmentID); string path = at.FindPath(attachid); pm.DeleteFile(attachid, path); pm.SaveError(ex, this.Request); } }
//保存 protected void Save_Click(object sender, EventArgs e) { try { if (txtReportPeople.Text.Trim() == "") { Alert.ShowInTop("姓名不能为空!"); txtReportPeople.Reset(); return; } if (txtReportUnit.Text.Trim() == "") { Alert.ShowInTop("报告人单位不能为空!"); txtReportUnit.Reset(); return; } if (txtReportName.Text.Trim() == "") { Alert.ShowInTop("学术报告名称不能为空!"); txtReportName.Reset(); return; } if (txtReportPlace.Text.Trim() == "") { Alert.ShowInTop("报告地点不能为空!"); txtReportPlace.Reset(); return; } if (DatePikerReportTime.Text == "") { Alert.ShowInTop("报告时间不能为空!"); DatePikerReportTime.Reset(); return; } if (txtPeopleCount.Text.Trim() == "") { Alert.ShowInTop("参与人数不能为空!"); txtPeopleCount.Reset(); return; } newacademicreporting = BLLNAR.FindByNAReportingID(Convert.ToInt32(Session["NewAcademicReporting"])); Newnareporting.ReportTime = Convert.ToDateTime(DatePikerReportTime.Text); Newnareporting.PeopleCount = Convert.ToInt32(txtPeopleCount.Text.Trim()); Newnareporting.SecrecyLevel = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedValue); Newnareporting.Remark = Remark.Text; Newnareporting.ReportPeople = txtReportPeople.Text; Newnareporting.JobName = txtJobName.Text; Newnareporting.JobMission = txtJobMission.Text; Newnareporting.ReportUnit = txtReportUnit.Text; Newnareporting.Report = txtReport.Text; Newnareporting.ReportTele = txtReportTele.Text; Newnareporting.AcademicTitle = txtAcademicTitle.Text; Newnareporting.ReportName = txtReportName.Text; Newnareporting.ReportPlace = txtReportPlace.Text; Newnareporting.ApplyFund = txtApplyFund.Text; Newnareporting.Organizers = txtOrganizers.Text; Newnareporting.Coorganizer = txtCoorganizer.Text; Newnareporting.ReportType = txtReportType.Text; Newnareporting.MajorPeople = txtMajorPeople.Text; Newnareporting.EntryPerson = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName; //用户等级为5级可直接通过 if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { Newnareporting.IsPass = true; } else { Newnareporting.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; case -3: Newnareporting.AttachmentID = null; break; //Alert.ShowInTop("请上传附件"); //return; default: Newnareporting.AttachmentID = AttachID; break; } if (Convert.ToInt32(Session["SecrecyLevel"]) != 5) { //操作日志表对象 Common.Entities.OperationLog operationLog = InsertOperationLog(); operationLog.OperationDataID = Convert.ToInt32(Session["NewAcademicReportingID"]); Newnareporting.EntryPerson = BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName; Newnareporting.IsPass = false; newacademicreporting.IsPass = false; BLLNAR.Insert(Newnareporting); operationLog.Remark = Newnareporting.NewAcademicReportingID.ToString(); BLLOL.Insert(operationLog); Alert.ShowInTop("您的数据已提交,请等待确认"); } else { Newnareporting.NewAcademicReportingID = Convert.ToInt32(Session["NewAcademicReportingID"]); BLLNAR.Update(Newnareporting); Alert.ShowInTop("保存成功"); } PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference()); } catch (Exception ex) { //删除附件文件 string path = BLLattachment.FindPath(Convert.ToInt32(newacademicreporting.AttachmentID)); if (path != "") { pm.DeleteFile(Convert.ToInt32(newacademicreporting.AttachmentID), path); //删除附件表中的数据 BLLattachment.Delete(Convert.ToInt32(newacademicreporting.AttachmentID));//删除成功返回true } //BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); } //PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); }
//删除获奖信息 protected void btnDelete_Click(object sender, EventArgs e) { //如果为超级管理员操作则直接删除,否则将IsPass置为false 向管理员发送删除信息 try { int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(Grid_Award.RecordCount / this.Grid_Award.PageSize)); if (Grid_Award.PageIndex == Pages) { m = (Grid_Award.RecordCount - this.Grid_Award.PageSize * Grid_Award.PageIndex); } else { m = this.Grid_Award.PageSize; } List <int> selections = new List <int>(); for (int i = 0; i < m; i++) { if (CBoxSelect.GetCheckedState(i)) { selections.Add(i); } } if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { for (int i = 0; i < selections.Count(); i++) { int AcademicMeetingID = Convert.ToInt32(Grid_Award.DataKeys[selections[i]][0].ToString()); //删除获奖附件文件->删除附件表中的信息->删除学术会议信息 int AttactID = award.FindAttachmentID(AcademicMeetingID); string strPath; if (AttactID != 0) { strPath = BLLAttachment.FindPath(AttactID); if (strPath != "") { //删除附件文件 pm.DeleteFile(AttactID, strPath); //在附件表中删除附件数据 BLLAttachment.Delete(AttactID); } } //删除获奖信息 award.Delete(Convert.ToInt32(Grid_Award.DataKeys[selections[i]][0].ToString())); } Alert.ShowInTop("删除成功!"); btnSelect_All.Text = "全选"; } else { //录入人(非管理员)操作 for (int i = 0; i < selections.Count(); i++) { award.UpdateIsPass(Convert.ToInt32(Grid_Award.DataKeys[selections[i]][0]), false); //BLLUser.FindByLoginName(Session["LoginName"].ToString()).UserName operate.LoginName = Session["LoginName"].ToString(); operate.OperationTime = DateTime.Now; operate.LoginIP = " "; operate.OperationContent = "Award"; operate.OperationType = "删除"; operate.OperationDataID = Convert.ToInt32(Grid_Award.DataKeys[selections[i]][0]); op.Insert(operate); //BindData(); Alert.ShowInTop("操作已经提交,请等待管理员确认!"); } } Grid_Award.PageIndex = 0; Grid_Award.PageSize = 20; btnDelete.Enabled = false; InitData(); btnSelect_All.Text = "全选"; } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); return; } }