Beispiel #1
0
        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>");
                    }
                }
            }
        }
Beispiel #2
0
 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;
         }
     }
 }