protected void btnSave_Click(object sender, EventArgs e) { AgendaBLL agendabll = new AgendaBLL(); string Opera = Request.QueryString["Opera"]; if (CheckValue()) { if (Opera == "Add") { //新增日程 MeetingModel.agenda agenda = new MeetingModel.agenda(); MID3 = int.Parse(Request.QueryString["MID2"]); agenda.m_id = MID3; agenda.starttime = DateTime.Parse(txtStarttime.Text); agenda.endtime = DateTime.Parse(txtEndtime.Text); agenda.detail = txtDetail.Text; if (agendabll.AddAgenda(agenda) > 0) { Response.Write("<script>alert('添加成功')</script>"); } else { Response.Write("<script>alert('添加失败')</script>"); } } else { //更改日程信息 int agendanumber = int.Parse(Request.QueryString["agendanumber"]); MeetingModel.agenda agenda = agendabll.GetAgendaInfo(agendanumber); //MID3 = int.Parse(Request.QueryString["MID2"]); //agenda.m_id = MID3; agenda.starttime = DateTime.Parse(txtStarttime.Text); agenda.endtime = DateTime.Parse(txtEndtime.Text); agenda.detail = txtDetail.Text; if (agendabll.UpdateAgenda(agenda) > 0) { Response.Write("<script>alert('修改成功')</script>"); } else { Response.Write("<script>alert('修改失败')</script>"); } } } }
public void Page_Load(object sender, EventArgs e) { //MID3 = int.Parse(Request.QueryString["MID2"]); if (!IsPostBack) { string Opera = Request.QueryString["Opera"]; if (Opera == "Edit") { int agendanumber = int.Parse(Request.QueryString["agendanumber"]); MID3 = int.Parse(Request.QueryString["MID2"]); MeetingModel.agenda agenda = agendabll.GetAgendaInfo(agendanumber); //MID3 = agenda.m_id; txtStarttime.Text = Convert.ToDateTime(agenda.starttime).ToString("yyyy-MM-dd HH:MM:ss"); txtEndtime.Text = Convert.ToDateTime(agenda.endtime).ToString("yyyy-MM-dd HH:MM:ss"); txtDetail.Text = agenda.detail;; } else { MID3 = int.Parse(Request.QueryString["MID2"]); } } }