//返回插入操作日志对象 public Common.Entities.OperationLog InsertOperationLog() { //向操作日志表插入信息 Common.Entities.OperationLog operationLog = new Common.Entities.OperationLog(); operationLog.LoginIP = " "; operationLog.LoginName = Session["LoginName"].ToString(); operationLog.OperationType = "添加"; operationLog.OperationContent = "AcademicMeeting"; operationLog.OperationTime = DateTime.Now; return(operationLog); }
//保存 protected void btn_Save_Click(object sender, EventArgs e) { try { if (tb_MoneyNum.Text.Trim() == "") { Alert.ShowInTop("每项用途所用金额不能为空!"); tb_MoneyNum.Text = ""; return; } Common.Entities.Project project = pro.IsNullProject(tb_SourceWork.Text.Trim()); if (project == null) { tb_SourceWork.Text = ""; Alert.ShowInTop("无此项目,请检查输入!"); return; } else if (project.IsPass == false) { tb_SourceWork.Text = ""; Alert.ShowInTop("此项目正在审核中,请联系管理员!"); return; } double num = 0.0; if (!double.TryParse(tb_MoneyNum.Text.Trim(), out num)) { tb_MoneyNum.Reset(); Alert.ShowInTop("请输入数字!"); return; } if (dp_Time.SelectedDate == null) { Alert.ShowInTop("请选择日期!"); return; } Common.Entities.FundInformation fun = new Common.Entities.FundInformation(); Common.Entities.OperationLog op = new Common.Entities.OperationLog(); fun.BudgetDirector = tb_UserInfo.Text.Trim(); BLHelper.BLLUser user = new BLHelper.BLLUser(); string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; fun.EntryPerson = username; fun.EveItemUseMoney = tb_MoneyNum.Text.Trim(); fun.FundingPurposeSortName = ddl_FundingPurposeSortID.Text; fun.OperateType = "支出"; fun.ProjectID = project.ProjectID; fun.SecrecyLevel = Convert.ToInt32(DropDownListLevel.SelectedValue) + 1; fun.Time = dp_Time.SelectedDate; if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { fun.IsPass = true; fund.Insert(fun); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference() + Alert.GetShowInTopReference("保存成功!")); } else { fun.IsPass = false; fund.Insert(fun); op.LoginIP = " "; op.LoginName = Session["LoginName"].ToString(); op.OperationContent = "FundInformation"; op.OperationDataID = fun.FundInformationID; op.OperationTime = DateTime.Now; op.OperationType = "添加"; blop.Insert(op); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHidePostBackReference() + Alert.GetShowInTopReference("数据已经提交,请等待管理员确认!")); } } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); } }
//保存机构信息 protected void Save_Click(object sender, EventArgs e) { try { if (AgencyName2.Text.Trim() == "") { Alert.ShowInTop("机构名称不能为空!"); AgencyName2.Text = ""; return; } if (AgencyHeads2.Text.Trim() == "") { Alert.ShowInTop("机构负责人不能为空!"); AgencyHeads2.Text = ""; return; } if (FullTimeNumber2.Text.Trim() == "") { Alert.ShowInTop("专职人数不能为空!"); FullTimeNumber2.Text = ""; return; } Common.Entities.Agency ag = new Common.Entities.Agency(); Common.Entities.OperationLog op = new Common.Entities.OperationLog(); BLHelper.BLLOperationLog blop = new BLHelper.BLLOperationLog(); BLHelper.BLLUser user = new BLHelper.BLLUser(); string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; ag.AgencyName = AgencyName2.Text.ToString(); ag.ParentID = agen.SelectAgencyID(ParentID2.Text.ToString()); ag.SecrecyLevel = Convert.ToInt32(DroSecrecyLevel.SelectedIndex + 1); ag.AgencyHeads = AgencyHeads2.Text.ToString(); ag.Research = Research2.Text.ToString(); ag.AgencyNumber = DroAgencyNumber.SelectedText; ag.FullTimeNumbers = Convert.ToInt32(FullTimeNumber2.Text.ToString()); ag.PartTimeNumbers = Convert.ToInt32(PartTimeNumber2.Text.ToString()); ag.Area = Area2.Text.ToString(); ag.IsGlobal = ddl_glo.SelectedText.Trim(); ag.Location = Location2.Text.ToString(); ag.EntryPerson = username; if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { ag.IsPass = true; agen.Insert(ag); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("保存成功") + Alert.GetShowInTopReference("保存成功")); } else { ag.IsPass = false; agen.Insert(ag); op.LoginIP = ""; op.LoginName = Session["LoginName"].ToString(); op.OperationContent = "Agency"; op.OperationDataID = agen.SelectAgencyID(AgencyName2.Text.Trim().ToString()); op.OperationType = "添加"; op.OperationTime = DateTime.Now; blop.Insert(op); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHidePostBackReference() + Alert.GetShowInTopReference("您的操作已经提交,请等待管理员确认!")); } } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); } }
//保存增加会议信息 protected void btnSave_Click(object sender, EventArgs e) { try { NewcademicMeeting = ObjectAcademicMeeting(); if (Session["LoginName"].ToString() == "") { Response.Redirect("login.aspx"); Alert.Show("登录超时!"); } string MeetingName = txtMeetingName.Text; int MeetingID = BLLAM.FindMeetingID(MeetingName); if (MeetingID != 0) { //txtMeetingName.Text = ""; txtMeetingName.Reset(); Alert.ShowInTop("该学术会议名称已存在,请重新输入!"); return; } if (DatePicker_EndTime != null) { if (DatePicker_StratTime.SelectedDate > DatePicker_EndTime.SelectedDate) { Alert.ShowInTop("结束日期应该大于开始日期!"); return; } } if (txtMeetingName.Text.Trim() == "") { Alert.ShowInTop("会议名称不能为空!"); txtMeetingName.Reset(); return; } if (txtOrganizer.Text.Trim() == "") { Alert.ShowInTop("主办方不能为空!"); txtOrganizer.Reset(); return; } if (txtMeetingPlace.Text.Trim() == "") { Alert.ShowInTop("会议地点不能为空!"); txtMeetingPlace.Reset(); return; } //int attachId = publicMethod.UpLoad(filePath); //学术会议表对象 //Common.Entities.AcademicMeeting NewcademicMeeting = ObjectAcademicMeeting(); int AttachID = publicMethod.UpLoadFile(fileupload).Attachid; switch (AttachID) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; case -3: NewcademicMeeting.AttachmentID = null; break; //Alert.ShowInTop("请上传附件"); //return; default: NewcademicMeeting.AttachmentID = AttachID; break; } AttachID = publicMethod.UpLoadPhoto(photoupload); switch (AttachID) { case -1: Alert.ShowInTop("文件类型不符,请重新选择!"); return; case 0: Alert.ShowInTop("文件名已经存在!"); return; case -2: Alert.ShowInTop("文件不能大于150M"); return; case -3: NewcademicMeeting.PhotoID = null; break; //Alert.ShowInTop("请上传附件"); //return; default: NewcademicMeeting.PhotoID = AttachID; break; } //向学术会议表插入信息 BLLAM.Insert(NewcademicMeeting); //非管理员登陆需要向操作日志表中插入信息,等待管理员审核 if (Convert.ToInt32(Session["SecrecyLevel"]) != 5) { //操作日志表对象 Common.Entities.OperationLog operationLog = InsertOperationLog(); operationLog.OperationDataID = NewcademicMeeting.AcademicMeetingID; //向操作日志表中插入信息 BLLOL.Insert(operationLog); Alert.ShowInTop("您的数据已提交,请等待确认"); } else { Alert.ShowInTop("保存成功"); } PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHideRefreshReference()); } catch (Exception ex) { int AttactID = BLLAM.FindAttachmentID(NewcademicMeeting.AcademicMeetingID); string strPath; if (AttactID != 0) { strPath = BLLattachment.FindPath(AttactID); if (strPath != "") { //删除附件文件 publicMethod.DeleteFile(AttactID, strPath); //在附件表中删除附件数据 BLLattachment.Delete(AttactID); } } BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); Alert.ShowInTop("保存失败!"); // return; } }