protected void btnSave_Click(object sender, EventArgs e) { MeetingsBLL meetingbll = new MeetingsBLL(); string Opera = Request.QueryString["Opera"]; if (CheckValue()) { if (Opera == "Edit") { string MId = Request.QueryString["MId"]; Meetings meeting = meetingbll.GetMeetingInfo(MId); meeting.m_id = txtrank.Text; meeting.m_name = txtTitle.Text; meeting.pre_num = int.Parse(txtpnum.Text); meeting.max_num = int.Parse(txtmnum.Text); meeting.theme = txttheme.Text; meeting.begin_date = DateTime.Parse(txtbd.Text); meeting.end_date = DateTime.Parse(txted.Text); meeting.m_city = txtcity.Text; meeting.m_address = txtaddress.Text; meeting.h_name = txthotel.Text; if (meetingbll.UpdateMeeting(meeting) > 0) { Response.Write("<script>alert('修改成功!')</script>"); } else { Response.Write("<script>alert('修改失败!')</script>"); } } else { Meetings meeting = new Meetings(); meeting.m_id = txtrank.Text; meeting.m_name = txtTitle.Text; meeting.pre_num = int.Parse(txtpnum.Text); meeting.max_num = int.Parse(txtmnum.Text); meeting.theme = txttheme.Text; meeting.begin_date = DateTime.Parse(txtbd.Text); meeting.end_date = DateTime.Parse(txted.Text); meeting.m_city = txtcity.Text; meeting.m_address = txtaddress.Text; meeting.h_name = txthotel.Text; if (meetingbll.AddMeeting(meeting) > 0) { Response.Write("<script>alert('增加成功!')</script>"); } else { Response.Write("<script>alert('增加失败!')</script>"); } } } }
protected void btnSave_Click(object sender, EventArgs e) { MeetingsBLL meetingbll = new MeetingsBLL(); string Opera = Request.QueryString["Opera"]; if (CheckValue()) { if (Opera == "Add") { //新增会议 MeetingModel.Meeting meeting = new MeetingModel.Meeting(); //meeting.m_id = meetingbll.GetMeetingCount(); //meeting.m_id = meetingbll.max(m_id); meeting.m_name = TxtName.Text; meeting.theme = TxtTheme.Text; meeting.begin_time = DateTime.Parse(TxtStartTime.Text); meeting.end_time = DateTime.Parse(TxtEndTime.Text); meeting.m_city = TxtCity.Text; meeting.m_street = TxtStreet.Text; meeting.m_number = int.Parse(TxtNumber.Text); meeting.dept_id = TxtDept.Text; if (meetingbll.AddMeeting(meeting) > 0) { Response.Write("<script>alert('添加成功')</script>"); } else { Response.Write("<script>alert('添加失败')</script>"); } } else { //更改会议信息 int MId = int.Parse(Request.QueryString["MId"]); MeetingModel.Meeting meeting = meetingbll.GetMeetingInfo(MId); meeting.m_name = TxtName.Text; meeting.theme = TxtTheme.Text; meeting.begin_time = DateTime.Parse(TxtStartTime.Text); meeting.end_time = DateTime.Parse(TxtEndTime.Text); meeting.m_city = TxtCity.Text; meeting.m_street = TxtStreet.Text; meeting.m_number = int.Parse(TxtNumber.Text); meeting.dept_id = TxtDept.Text; if (meetingbll.UpdateMeeting(meeting) > 0) { Response.Write("<script>alert('修改成功')</script>"); } else { Response.Write("<script>alert('修改失败')</script>"); } } } }