protected void btnSave_Click2(object sender, EventArgs e) { MeetingsBLL meetingbll = new MeetingsBLL(); string Opera = Request.QueryString["Opera"]; if (CheckValue()) { if (Opera == "Add") { //新增与会人员 MeetingModel.attend attend = new MeetingModel.attend(); //int PARTICIPATORId = int.Parse(Request.QueryString["PARTICIPATORId"]); int MId = int.Parse(Request.QueryString["MId"]); //meeting.m_id = meetingbll.GetMeetingCount(); //meeting.m_id = meetingbll.max(m_id); attend.m_id = MId; attend.participator_id = int.Parse(TxtID.Text); //attend.m_id=int.Parse(TxtNumber.Text); attend.arrive_date = DateTime.Parse(TxtArriveTime.Text); attend.arrive_way = TxtArriveWay.Text; attend.leave_date = DateTime.Parse(TxtLeaveTime.Text); attend.leave_way = TxtLeaveWay.Text; attend.h_name = TxtHotelName.Text; attend.room_number = int.Parse(TxtRoomNumber.Text); if (meetingbll.AddAttend(attend) > 0) { Response.Write("<script>alert('添加成功')</script>"); } else { Response.Write("<script>alert('添加失败')</script>"); } } else { //更改与会人员信息 int PARTICIPATORId = int.Parse(Request.QueryString["PARTICIPATORId"]); int MId = int.Parse(Request.QueryString["MId"]); MeetingModel.attend attend = meetingbll.GetAttendInfo(PARTICIPATORId, MId); //attend.participator_id = int.Parse(TxtID.Text); //attend.m_id=int.Parse(TxtNumber.Text); attend.arrive_date = DateTime.Parse(TxtArriveTime.Text); attend.arrive_way = TxtArriveWay.Text; attend.leave_date = DateTime.Parse(TxtLeaveTime.Text); attend.leave_way = TxtLeaveWay.Text; attend.h_name = TxtHotelName.Text; attend.room_number = int.Parse(TxtRoomNumber.Text); if (meetingbll.UpdateAttend(attend) > 0) { Response.Write("<script>alert('修改成功')</script>"); } else { Response.Write("<script>alert('修改失败')</script>"); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["retu"] = Request.UrlReferrer.ToString(); string Opera = Request.QueryString["Opera"]; if (Opera == "Edit") { int PARTICIPATORId = int.Parse(Request.QueryString["PARTICIPATORId"]); int MId = int.Parse(Request.QueryString["MId"]); MeetingModel.attend attend = meetingbll.GetAttendInfo(PARTICIPATORId, MId); TxtID.Text = attend.participator_id.ToString(); //TxtNumber.Text =attend.m_id.ToString(); TxtArriveTime.Text = Convert.ToDateTime(attend.arrive_date).ToString("yyyy-MM-dd HH:MM:ss"); TxtArriveWay.Text = attend.arrive_way; TxtLeaveTime.Text = Convert.ToDateTime(attend.leave_date).ToString("yyyy-MM-dd HH:MM:ss"); TxtLeaveWay.Text = attend.leave_way; TxtHotelName.Text = attend.h_name; TxtRoomNumber.Text = attend.room_number.ToString(); } } }