protected void btn_DownLoadContract_Click(object sender, EventArgs e) { try { int PactID = Convert.ToInt32(Request.QueryString["id"].ToString()); Pact = BLLPact.FindByPactID(PactID); if (Pact.AttachmentID != null && Pact.AttachmentID != 0) { int attachID = Convert.ToInt32(BLLPact.FindAttachmentID(PactID)); 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("附件下载失败!"); } }
//删除 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 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 = 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) { 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 DownLoad_Click(object sender, EventArgs e) { try { int AcademicID = Convert.ToInt32(Request.QueryString["id"].ToString()); int photoId = BLLAcademic.FindPhotoID(AcademicID); if (photoId != 0) { string srcPath = BLLAttachment.FindPath(photoId); if (srcPath != "") { publicMethod.DownloadPhoto(srcPath); } 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("附件下载失败!"); //return; } }
//删除 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()); 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) { 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("删除错误,请联系管理员!"); } }
//更新赋值 /* public void UpDateValue() * { * achieve.PactNum = txtPactNum.Text; * achieve.PactName = txtPactName.Text; * achieve.PactType = txtPactType.Text; * achieve.StartTime = DatePicker_StartTime.SelectedDate; * achieve.EndTime = DatePicker_EndTime.SelectedDate; * achieve.ProjectID = BLLProject.SelectProjectID(DropDownList_Project.SelectedText); * achieve.SecrecyLevel = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedIndex + 1); * achieve.ChargePerson = txtChargePerson.Text; * achieve.PactMoney = txtPactMoney.Text; * achieve.RealMoney = txtRealMoney.Text; * achieve.PactCompletion = txtPactCompletion.Text; * achieve.IsExistingFile = txtIsExistingFile.Text; * achieve.FileNum = txtFileNum.Text; * //achieve.EntryPerson = BLLPact.FindByPactID(Convert.ToInt32(Session["PactID"])).EntryPerson; * * }*/ //原版本 /*public void BindData() * { * //int ContractID = Convert.ToInt32(Request.QueryString["id"].ToString()); * int LibraryRecordID = Convert.ToInt32(Session["LibraryRecordID"]); * if (LibraryRecordID != 0) * { * libraryRecord = BLLLibraryRecord.FindByLibreryRecordID(LibraryRecordID); * txtPactNum.Text = BLLPact.FindByPactID(Convert.ToInt32(libraryRecord.ContractID)).PactNum; * txtBorrowPeople.Text = BLLUser.FindUserName(libraryRecord.UserInfoID); * DatePicker_BorrowTime.SelectedDate = libraryRecord.BorrowTime; * DatePicker_ReturnTime.SelectedDate = libraryRecord.ReturnTime; * } * }*/ protected void btnSave_Click(object sender, EventArgs e) { try { achieve.PactNum = txtPactNum.Text; achieve.PactName = txtPactName.Text; achieve.PactType = txtPactType.Text; achieve.StartTime = DatePicker_StartTime.SelectedDate; achieve.EndTime = DatePicker_EndTime.SelectedDate; achieve.ProjectID = BLLProject.SelectProjectID(DropDownList_Project.SelectedText); achieve.SecrecyLevel = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedIndex + 1); achieve.ChargePerson = txtChargePerson.Text; achieve.PactMoney = txtPactMoney.Text; achieve.RealMoney = txtRealMoney.Text; achieve.PactCompletion = txtPactCompletion.Text; achieve.IsExistingFile = txtIsExistingFile.Text; achieve.FileNum = txtFileNum.Text; string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; achieve.EntryPerson = username; achieve.SecrecyLevel = Convert.ToInt32(DropDownList_SecrecyLevel.SelectedIndex + 1); int AttachmentID = Convert.ToInt32(BLLPact.FindByPactID(Convert.ToInt32(Session["PactID"])).AttachmentID); string path = attachment.FindPath(AttachmentID); achieve.AttachmentID = AttachmentID; achieve.PactID = Convert.ToInt32(Session["PactID"]); achieve.IsPass = true; BLLPact.update(achieve);//插入文件表 PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功")); } catch (Exception ex) { pm.SaveError(ex, this.Request); } }
protected void photoupload_FileSelected(object sender, EventArgs e) { int AttachID = publicmethod.UpLoadPhoto(photoupload); switch (AttachID) { case -1: Alert.ShowInTop("照片类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("照片不能大于150M"); return; case -3: Session["AttachID"] = null; break; //Alert.ShowInTop("请上传附件"); //return; default: { Session["AttachID"] = AttachID; BLHelper.BLLAttachment att = new BLHelper.BLLAttachment(); Image_show.ImageUrl = att.FindPath(AttachID); break; } } }
//删除 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); } }
public void InitData() { int AcademicID = Convert.ToInt32(Request.QueryString["id"].ToString()); int photoId = Blluser.FindPhotoID(AcademicID); if (photoId != 0) { string srcPaths = BLLAttachments.FindPath(photoId); if (srcPaths != "") { Image_show.ImageUrl = srcPaths; } else { Image_show.ImageUrl = "../../images/blank.png"; } } else { Image_show.ImageUrl = "../../images/blank.png"; } }
//根据userID找到图片的路径显示在Image public void FindUrl() { try { int UserID = bllUser.FindByLoginName(Session["LoginName"].ToString(), Convert.ToInt32(Session["SecrecyLevel"])).FirstOrDefault().UserInfoID; int PhtosID = bllPhotos.FindPhotoID(UserID); if (PhtosID != 0) { string FindPath = bllAttachment.FindPath(bllPhotos.FindAttachmentID(PhtosID)); imgPhoto.ImageUrl = FindPath; } else { //imgPhoto.ImageUrl = @"C:\\Users\\MBC\\Desktop\\WDFramework\\WDFramework\\images\blank.png"; imgPhoto.ImageUrl = "~/images/blank.png"; } } catch (Exception ex) { pm.SaveError(ex, this.Request); } }
public void InitData() { //int photoId = BLLMonograph.FindFAttachmentID(MonographID); if (Request.QueryString["id"].ToString() != "") { int MonographID = Convert.ToInt32(Request.QueryString["id"].ToString()); if (MonographID != 0) { string srcPaths = BLLAttachments.FindPath(MonographID); if (srcPaths != "") { Image_show.ImageUrl = srcPaths; } else { Image_show.ImageUrl = "../../images/blank.png"; } } } else { Image_show.ImageUrl = "../../images/blank.png"; } }
//下载 protected void DownLoad_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(Request.QueryString["id"].ToString()); int attachId = file.FindAttachmentID(id); string srcPath = at.FindPath(attachId); pm.DownloadFile(srcPath); } catch (Exception ex) { PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference() + Alert.GetShowInTopReference("下载出错,请联系管理员!")); 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); } }
//更新 public void Update() { try { if (Session["LoginName"].ToString() == "") { Response.Redirect("login.aspx"); Alert.Show("登录超时!"); } UserInfo NewUser = new UserInfo(); NewUser.UserName = T_UserName.Text.Trim(); if (rbtnBoy.Checked == true) { NewUser.Sex = true; } else { NewUser.Sex = false; } NewUser.Nation = DropDownListNation.SelectedItem.Text; NewUser.Hometown = T_Hometown.Text.Trim(); if (DatePickerBirth.SelectedDate.HasValue) { NewUser.Birth = DatePickerBirth.SelectedDate; } NewUser.JobTitle = T_JobTitle.Text.Trim(); NewUser.AgencyID = bllAgency.SelectAgencyID(DropDownListAgencyP.SelectedText); NewUser.TeleNum = T_Telenum.Text.Trim(); NewUser.HomeNum = T_HomeTetlum.Text.Trim(); NewUser.OfficeNum = T_Officenum.Text.Trim(); NewUser.DocumentsNum = T_DocumentsNum.Text.Trim(); NewUser.DocumentsType = DropDownListDocumentsType.SelectedItem.Text; NewUser.PoliticalStatus = DropDownListPoliticalStatus.SelectedItem.Text; NewUser.Profile = TextAreaProfile.Text.Trim(); NewUser.Education = DropDownListEducation.SelectedItem.Text; NewUser.Degree = DropDownListDegree.SelectedItem.Text; NewUser.StaffType = DropDownListStaffType.SelectedItem.Text; NewUser.Specialty = T_Specilty.Text.Trim(); if (ISMarriage.Checked == true) { NewUser.Marriage = true; } else { NewUser.Marriage = false; } NewUser.Fax = T_Fax.Text.Trim(); NewUser.HomeAddress = T_HomeAddress.Text.Trim(); NewUser.PostalCode = T_PostalCode.Text.Trim(); NewUser.qqNum = T_QQnum.Text.Trim(); NewUser.Remark = T_Remark.Text.Trim(); NewUser.UnitName = T_UnitName.Text.Trim(); //NewUser.StaffType = T_StaffType.Text.Trim(); //NewUser.UserInfoBH = T_UserInfoBH.Text.Trim(); NewUser.LoginName = T_LoginName.Text.Trim(); //密码没有修改 NewUser.LoginPWD = bllUser.IsUser(bllUser.FindByUserID(Convert.ToInt32(Session["UserInfoID"]))).LoginPWD; NewUser.Email = T_Email.Text.Trim(); NewUser.TeleNum = T_Telenum.Text.Trim(); NewUser.AdministrativeLevelName = DropDownListAdmin.SelectedItem.Text; NewUser.Domicile = T_Domicile.Text.Trim(); NewUser.SubjectSortName = DropDownListSubjectSortP.SelectedItem.Text; if (DatePickerJobTitleTime.SelectedDate.HasValue) { NewUser.JobTitleTime = DatePickerJobTitleTime.SelectedDate; } if (DatePickerPoliticalStatusTime.SelectedDate.HasValue) { NewUser.PoliticalStatusTime = DatePickerPoliticalStatusTime.SelectedDate; } if (IsDoctorTeacher.Checked == true) { NewUser.IsDocdorTeacher = true; } else { NewUser.IsDocdorTeacher = false; } if (IsMasterTeacher.Checked == true) { NewUser.IsMasteTeacher = true; } else { NewUser.IsMasteTeacher = false; } if (DatePickerMasterTeacherTime.SelectedDate.HasValue) { NewUser.MasterTeacherTime = DatePickerMasterTeacherTime.SelectedDate; } if (DatePickerDoctorTeacherTime.SelectedDate.HasValue) { NewUser.DoctorTeacherTime = DatePickerDoctorTeacherTime.SelectedDate; } NewUser.SecrecyLevel = Convert.ToInt32(DropDownListSecrecyLevel.SelectedIndex + 1); NewUser.ResearchDirection = T_Reserch.Text.Trim(); NewUser.LastSchool = LastSchool.Text.Trim(); NewUser.EnterSchoolTime = DatePickerEnterSchoolTime.SelectedDate; //入校时间; NewUser.StudySource = DropDownListStudySource.SelectedItem.Text; //学缘 //照片 //int AttachmentID = bllUser.FindAttachmentID(Convert.ToInt32(Session["UserInfoID"])); int PhotoID = bllUser.FindPhotoID(Convert.ToInt32(Session["UserInfoID"])); string attachmentPath = BLLattachment.FindPath(PhotoID); string photoPath = BLLattachment.FindPath(PhotoID); if (Session["AttachID"] != null) { NewUser.PhotoID = int.Parse(Session["AttachID"].ToString()); } NewUser.EntryPerson = bllUser.Find(Convert.ToInt32(Session["UserInfoID"]), true).EntryPerson; if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { NewUser.IsPass = true; NewUser.UserInfoID = Convert.ToInt32(Session["UserInfoID"]); bllUser.Update(NewUser);//更新人员基本信息表 PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("人员基本信息修改完成!")); } else { NewUser.IsPass = false; bllUser.ChangePass(Convert.ToInt32(Session["UserInfoID"]), false); bllUser.Insert(NewUser);//插入人员基本信息表 //向操作日志表中插入 OperationLog operate = new OperationLog(); operate.LoginName = NewUser.EntryPerson; operate.LoginIP = ""; operate.OperationType = "更新"; operate.OperationContent = "UserInfo"; operate.OperationDataID = Convert.ToInt32(Session["UserInfoID"]); operate.OperationTime = System.DateTime.Now; operate.Remark = NewUser.UserInfoID.ToString(); bllOperate.Insert(operate); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("人员基本信息已提交审核!")); } } catch (Exception ex) { publicmethod.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 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(); }
public void BindData() { try { UserInfo user = bllUser.Find(Convert.ToInt32(Session["UserInfoID"]), true); T_UserName.Text = user.UserName; if (user.Sex == true) { rbtnBoy.Checked = true; } else { rbtnGril.Checked = true; } DropDownListNation.SelectedValue = user.Nation; T_Hometown.Text = user.Hometown; DatePickerBirth.SelectedDate = user.Birth; T_JobTitle.Text = user.JobTitle; DropDownListAgencyP.SelectedValue = bllAgency.FindAgenName(user.AgencyID); T_Telenum.Text = user.TeleNum; T_HomeTetlum.Text = user.HomeNum; T_Officenum.Text = user.OfficeNum; T_DocumentsNum.Text = user.DocumentsNum; DropDownListDocumentsType.SelectedValue = user.DocumentsType; DropDownListPoliticalStatus.SelectedValue = user.PoliticalStatus; ////NewUser.Profile = null; DropDownListEducation.SelectedValue = user.Education; DropDownListDegree.SelectedValue = user.Degree; DropDownListStaffType.SelectedValue = user.StaffType; T_Specilty.Text = user.Specialty; //图片加载 BLHelper.BLLAttachment att = new BLHelper.BLLAttachment(); Image_show.ImageUrl = att.FindPath(user.PhotoID); if (user.Marriage == true) { ISMarriage.Checked = true; } else { NotMarriage.Checked = true; } T_Fax.Text = user.Fax; T_HomeAddress.Text = user.HomeAddress; T_PostalCode.Text = user.PostalCode; T_QQnum.Text = user.qqNum; T_Remark.Text = user.Remark; T_UnitName.Text = user.UnitName; //T_StaffType.Text = user.StaffType; //T_UserInfoBH.Text = user.UserInfoBH; T_LoginName.Text = user.LoginName; T_Email.Text = user.Email; T_Telenum.Text = user.TeleNum; DropDownListAdmin.SelectedValue = user.AdministrativeLevelName; T_Domicile.Text = user.Domicile; DropDownListSubjectSortP.SelectedValue = user.SubjectSortName; DatePickerJobTitleTime.SelectedDate = user.JobTitleTime; TextAreaProfile.Text = user.Profile; DatePickerPoliticalStatusTime.SelectedDate = user.PoliticalStatusTime; if (user.IsDocdorTeacher == true) { IsDoctorTeacher.Checked = true; } else { NotDoctorTeacher.Checked = true; } if (user.IsMasteTeacher == true) { IsMasterTeacher.Checked = true; } else { NotMasterTeacher.Checked = true; } DatePickerMasterTeacherTime.SelectedDate = user.MasterTeacherTime; DatePickerDoctorTeacherTime.SelectedDate = user.DoctorTeacherTime; DropDownListSecrecyLevel.SelectedIndex = Convert.ToInt32(user.SecrecyLevel) - 1; T_Reserch.Text = user.ResearchDirection; LastSchool.Text = user.LastSchool; DatePickerEnterSchoolTime.SelectedDate = user.EnterSchoolTime; //入校时间; DropDownListStudySource.SelectedValue = user.StudySource; //学缘 } catch (Exception ex) { publicmethod.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); } }
//删除 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; } 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 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; } }
//添加 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 (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); } }
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); } }
//保存 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 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); } }