/// <summary> /// GridView内生成事件时激发 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvRoomInfo_RowCommand(object sender, GridViewCommandEventArgs e) { string type = e.CommandName; //更新操作 if (type == "Up") { Response.Redirect("ApplicationMeeting.aspx?MID=" + e.CommandArgument); } else if (type == "Del") //查看详情 { Response.Redirect("ApplicationMeetingDetail.aspx?MID=" + e.CommandArgument); } else if (type == "De") //删除操作 { try { MeetingApplicationManager.DelMeetingApplication(Convert.ToInt32(e.CommandArgument)); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除会议成功!')</script>"); Bind(); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除会议失败!')'</script>"); return; } } }
private void Bind() { PagedDataSource pds = new PagedDataSource(); pds.DataSource = MeetingApplicationManager.SearchMeetingApplication(txtRoomName.Value, Convert.ToInt32(ddlDepartment.SelectedValue)); pds.AllowPaging = true; pds.PageSize = 5; pds.CurrentPageIndex = Pager1.PageIndex; Pager1.PageCount = pds.PageCount; Pager1.DataCount = pds.Count; gvRoomInfo.DataSourceID = null; gvRoomInfo.DataSource = pds; gvRoomInfo.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlDepartment.DataSourceID = null; ddlDepartment.DataSource = DepartmentManager.GetAllDepartment(); ddlDepartment.DataBind(); ddlRoomName.DataSourceID = null; ddlRoomName.DataSource = RoomInfoManager.GetAllRoomInfo(); ddlRoomName.DataBind(); //判断MID是否为空,不为空则是修改,为空则是添加会议申请 if (Request.QueryString["MID"] != null) { lblTitle.Text = "会议修改"; mid = Convert.ToInt32(Request.QueryString["MID"]); MeetingApplication mApplication = MeetingApplicationManager.GetMeetingApplicationById(mid); txtMeetTitle.Text = mApplication.MeetTitle; txtsummary.Text = mApplication.MeetingSummary; txtcompere.Text = mApplication.Compere; txtContent.Value = mApplication.MeetContent; txtbeginTime.Value = mApplication.BeginTime.ToShortDateString(); txtendTime.Value = mApplication.EndTime.ToShortDateString(); selectPerson.Items.Add(new ListItem(mApplication.WithinEnlistMan, mApplication.WithinEnlistMan)); //与会人员 ddlDepartment.SelectedValue = mApplication.DepartmentID.Id.ToString(); ddlInstancyDegree.SelectedItem.Text = mApplication.InstancyDegree; //紧急程度 ddlRoomName.SelectedItem.Text = ddlRoomName.Items.FindByText(mApplication.RoomInfo.RoomName).Text; txtMeetNumber.Value = mApplication.MeetNumber.ToString(); } else { lblTitle.Text = "新增会议"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["id"] != null) { id = Convert.ToInt32(Request.QueryString["id"]); MeetingApplication meeting = MeetingApplicationManager.GetMeetingApplicationById(id); txtRoomName.Value = meeting.MeetTitle; txtCompere.Text = meeting.Compere; txtMeetContent.Value = meeting.MeetContent; txtBeginTime.Value = meeting.BeginTime.ToString(); txtEndTime.Value = meeting.EndTime.ToString(); txtMeetNumber.Value = meeting.MeetNumber.ToString(); txtMeetType.Value = meeting.MeetType; txtMeetingSummary.Value = meeting.MeetingSummary; txtDepartment.Value = meeting.DepartmentID.Departmentname; txtMeetName.Value = meeting.RoomInfo.RoomName; txtWithinEnlistMan.Value = meeting.WithinEnlistMan; lblName.Text = meeting.ApplicationMan; } } }
/// <summary> /// 修改/添加会议申请 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { MeetingApplication meetApplication = new MeetingApplication(); meetApplication.RoomInfo.RID = Convert.ToInt32(ddlRoomName.SelectedValue); meetApplication.MeetTitle = txtMeetTitle.Text; meetApplication.MeetContent = Server.HtmlDecode(txtContent.Value); meetApplication.MeetingSummary = txtsummary.Text; meetApplication.MeetNumber = int.Parse(txtMeetNumber.Value); meetApplication.InstancyDegree = ddlInstancyDegree.SelectedItem.Text; meetApplication.MeetType = txtMeetTitle.Text; meetApplication.BeginTime = Convert.ToDateTime(txtbeginTime.Value + " " + sHours.Value + ":" + sSecond.Value); meetApplication.EndTime = Convert.ToDateTime(txtendTime.Value + " " + sHourse2.Value + ":" + sSecond2.Value); meetApplication.Compere = txtcompere.Text; meetApplication.DepartmentID.Id = Convert.ToInt32(ddlDepartment.SelectedValue); meetApplication.WithinEnlistMan = "admin"; //与会人员 meetApplication.ApplicationTime = DateTime.Now; meetApplication.State = "未召开"; meetApplication.RoomInfo.RID = Convert.ToInt32(ddlRoomName.SelectedValue); UserInfo user = Session["user"] as UserInfo; meetApplication.ApplicationMan = "admin";//申请人为当前登录用户 meetApplication.ApplicationTime = DateTime.Now; //为修改 if (mid > 0) { try { meetApplication.MID = mid; //调用方法更新会议申请单 MeetingApplicationManager.UpdateMeetintApplication(meetApplication); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('更新成功');window.location='ApplictionMeetingList.aspx'</script>"); } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('更新失败')", true); return; } } else //为添加会议申请及会场安排信息 { RoomArrage roomArrage = new RoomArrage(); roomArrage.BeginTime = Convert.ToDateTime(txtbeginTime.Value + " " + sHours.Value + ":" + sSecond.Value); //开始时间 roomArrage.EndTime = Convert.ToDateTime(txtendTime.Value + " " + sHourse2.Value + ":" + sSecond2.Value); //结束时间 roomArrage.ChargeMan = "admin"; //会议负责人 roomArrage.InstancyDegree = ddlInstancyDegree.SelectedItem.Text; roomArrage.MeetingType = txtMeetTitle.Text; //会议类型 roomArrage.RomeState = "占用中"; //会场状态 roomArrage.RoomName = ddlRoomName.SelectedItem.Text; //会场名称 roomArrage.Remark = txtContent.Value; try { //新增会议申请 MeetingApplicationManager.AddMeetingApplication(meetApplication); //新增会场安排信息 RoomArrageManager.AddRoomArrage(roomArrage); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('新增成功');window.location='ApplictionMeetingList.aspx'</script>"); } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('新增失败')", true); return; } } }
/// <summary> /// 添加审批记录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { Examine em = new Examine(); em.RequisitionID = Convert.ToInt32(txtApplicationId.Text); em.RequisitionType = txtType.Text; em.ExamineUID.UID = Convert.ToInt32(((UserInfo)Session["user"]).UID); em.ExamineIdea = this.txtCause.Text; em.EndTime = Convert.ToDateTime(txtTime.Value); em.IsApproved = rdoAccess.SelectedValue == "未过" ? "未过" : "通过"; //不管是否通过,都在审批记录表中添加一条审批记录 if (ExamineManager.AddExamine(em) > 0) { //判断审批是否通过, if (rdoAccess.SelectedValue == "通过") { if (txtType.Text == "会议申请") { try { MeetingApplication ma = MeetingApplicationManager.GetMeetingApplicationById(Convert.ToInt32(txtApplicationId.Text)); //获取所有与会人员, string applicationMan = ma.WithinEnlistMan; LeaveWord lw = new LeaveWord(); lw.MsgTitle = ma.MeetTitle; //会议标题 lw.MsgContent = ma.MeetContent; //会议内容 lw.MsgSendTime = Convert.ToDateTime(DateTime.Now.ToShortDateString()); //发送时间 lw.MsgState = "未读"; lw.MsgTypeId.Id = 1; //1代表会议申请 lw.SenderUser = user; //发送者 lw.MeetingBeginTime = ma.BeginTime; //开会时间 lw.MeetingAddr = ma.RoomInfo.RomeAddr; //会议地点 lw.ChargeMan = ma.Compere; //会议负责人 lw.MeetingType = ma.MeetType; //用“,”号分割与会人员 string[] array = applicationMan.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { int uid = UserInfoManager.GetLeaveIDByMName(array[i]); lw.ReceiverUser.UID = uid; int flag = LeaveWordManager.AddLeaveWord(lw); } //更新会议申请的状态 MeetingApplicationManager.ModifyMeetingState(Convert.ToInt32(txtApplicationId.Text), "已办"); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('已审核!');location.href='CheckNote.aspx'", true); } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核失败!');", true); return; } } else if (txtType.Text == "用车申请") { try { //更新用车申请状态 int flag = CarByapplyManager.UpadteByapplySate(Convert.ToInt32(txtApplicationId.Text), "已办"); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('已审核!');location.href='CheckNote.aspx'", true); } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核失败!');", true); return; } } } else //不通过,终结申请 { if (txtType.Text == "会议申请") { MeetingApplicationManager.ModifyMeetingState(Convert.ToInt32(txtApplicationId.Text), "终结"); } else if (txtType.Text == "用车申请") { //终结用车申请 int flag = CarByapplyManager.UpadteByapplySate(Convert.ToInt32(txtApplicationId.Text), "终结"); } Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('已终结!');window.location='Matter.aspx'</script>", true); } if (txtType.Text == "任务申请") //根据实际完成金额更新任务总体完成进度 { try { if (em.IsApproved == "通过") { TaskManager.UpdateTaskNowStatus(Convert.ToInt32(txtApplicationId.Text));//更新任务状态 //更新任务的完成比例 TaskManager.UpdateTaskFinshStatus(Convert.ToInt32(txtApplicationId.Text)); //更新申请单状态为通过 new RolePowerManager().UpdatePaddingStatus("已办", Convert.ToInt32(txtApplicationId.Text.Trim())); } else { //更新申请单状态为终结 new RolePowerManager().UpdatePaddingStatus("终结", Convert.ToInt32(txtApplicationId.Text.Trim())); } } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('更新任务状态失败!');", true); return; } } if (txtType.Text == "资源采购") { StockApplication stock = StockApplicationManager.Get((int)em.RequisitionID); if (em.IsApproved == "通过") { stock.IsExamine = "已办"; IList <ApplicationResourseInfo> items = ApplicationResourceManager.GetAllApplicationResource(2, stock.SAID); foreach (ApplicationResourseInfo item in items) { item.Resource.Number += item.Number; ResourceInfoManager.UpdateResourceInfo(item.Resource); } } else { stock.IsExamine = "终结"; } StockApplicationManager.Update(stock); } else if (txtType.Text == "资源借用") { BorrowApplication borrow = BorrowApplicationManager.Get((int)em.RequisitionID); if (em.IsApproved == "通过") { borrow.IsExamine = "已办"; IList <ApplicationResourseInfo> items = ApplicationResourceManager.GetAllApplicationResource(1, borrow.BAID); foreach (ApplicationResourseInfo item in items) { item.Resource.Number -= item.Number; ResourceInfoManager.UpdateResourceInfo(item.Resource); } } else { borrow.IsExamine = "终结"; } BorrowApplicationManager.Update(borrow); } Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('已审核!');location.href='CheckNote.aspx'", true); // Response.Redirect(""); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核失败!');", true); } }