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>"); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string Opera = Request.QueryString["Opera"]; if (Opera == "Edit") { int MId = int.Parse(Request.QueryString["MId"]); MeetingModel.Meeting meeting = meetingbll.GetMeetingInfo(MId); TxtName.Text = meeting.m_name; TxtTheme.Text = meeting.theme; TxtStartTime.Text = meeting.begin_time.ToString("yyyy-MM-dd HH:MM:ss"); TxtEndTime.Text = Convert.ToDateTime(meeting.end_time).ToString("yyyy-MM-dd HH:MM:ss"); TxtCity.Text = meeting.m_city; TxtStreet.Text = meeting.m_street; TxtNumber.Text = meeting.m_number.ToString(); TxtDept.Text = meeting.dept_id; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string Opera = Request.QueryString["Oprea"]; if (Opera == "Edit") { string MId = Request.QueryString["MId"]; Meetings meeting = meetingbll.GetMeetingInfo(MId); txtrank.Text = meeting.m_id.ToString(); txtTitle.Text = meeting.m_name; txtpnum.Text = meeting.pre_num.ToString(); txtmnum.Text = meeting.max_num.ToString(); txttheme.Text = meeting.theme; txtbd.Text = meeting.begin_date.ToString("yyyy-MM-dd"); txted.Text = meeting.end_date.ToString(); txtcity.Text = meeting.m_city; txtaddress.Text = meeting.m_address; txthotel.Text = meeting.h_name; } } }