protected void DownFile_Click(object sender, EventArgs e) { try { int NAReportingID = Convert.ToInt32(Request.QueryString["id"].ToString()); newacademicreporting = BLLNAR.FindByNAReportingID(NAReportingID); if (newacademicreporting.AttachmentID != null && newacademicreporting.AttachmentID != 0) { int attachID = Convert.ToInt32(BLLNAR.FindAttachmentID(NAReportingID)); string path = BLLAttachment.FindPath(attachID); if (path != "") { publicMethod.DownloadFile(path); } else { Alert.ShowInTop("无附件可下载!"); } } else { Alert.ShowInTop("无附件可下载!"); } } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHidePostBackReference() + Alert.GetShowInTopReference("附件下载失败,请与管理员联系!")); //Alert.ShowInTop("附件下载失败!"); } }
public void BindData() { int NAReportingID = Convert.ToInt32(Request.QueryString["id"].ToString()); newacademicreporting = BLLNAR.FindByNAReportingID(NAReportingID); ReportPeople.Text = newacademicreporting.ReportPeople; ReportUnit.Text = newacademicreporting.ReportUnit; ReportName.Text = newacademicreporting.ReportName; DateTime?date = newacademicreporting.ReportTime; ReportTime.Text = date.Value.Year + "-" + date.Value.Month + "-" + date.Value.Day; ReportPlace.Text = newacademicreporting.ReportPlace; PeopleCount.Text = Convert.ToString(newacademicreporting.PeopleCount); }
//初始化 public void InitData() { try { if (Session["NewAcademicReportingID"].ToString() != "") { // Oldnewacademicreporting = BLLUL.FindBynewacademicreportingID(Convert.ToInt32(Session["newacademicreportingID"])); newacademicreporting = BLLNAR.FindByNAReportingID(Convert.ToInt32(Session["newacademicreportingID"])); DatePikerReportTime.Text = newacademicreporting.ReportTime.Value.Year + "-" + newacademicreporting.ReportTime.Value.Month + "-" + newacademicreporting.ReportTime.Value.Day; DropDownList_SecrecyLevel.SelectedValue = newacademicreporting.SecrecyLevel.ToString(); txtPeopleCount.Text = Convert.ToString(newacademicreporting.PeopleCount); txtRemark.Text = newacademicreporting.Remark; txtReportPeople.Text = newacademicreporting.ReportPeople; txtJobName.Text = newacademicreporting.JobName; txtJobMission.Text = newacademicreporting.JobMission; txtReportUnit.Text = newacademicreporting.ReportUnit; txtReport.Text = newacademicreporting.Report; txtReportTele.Text = newacademicreporting.ReportTele; txtAcademicTitle.Text = newacademicreporting.AcademicTitle; txtReportName.Text = newacademicreporting.ReportName; txtReportPlace.Text = newacademicreporting.ReportPlace; txtApplyFund.Text = newacademicreporting.ApplyFund; txtOrganizers.Text = newacademicreporting.Organizers; txtCoorganizer.Text = newacademicreporting.Coorganizer; txtReportType.Text = newacademicreporting.ReportType; txtMajorPeople.Text = newacademicreporting.MajorPeople; } else { return; } } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); 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) { 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); } }