예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string Opera = Request.QueryString["Opera"];
         if (Opera == "Edit")
         {
             String             HId   = Request.QueryString["HId"];
             MeetingModel.Hotel hotel = meetingbll.GetHotelInfo(HId);
             Txth_name.Text       = hotel.h_name;
             Txtstreet.Text       = hotel.h_street;
             Txtphone_number.Text = hotel.phone_number;
         }
     }
 }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            MeetingsBLL meetingbll = new MeetingsBLL();
            string      Opera      = Request.QueryString["Opera"];

            if (CheckValue())
            {
                if (Opera == "Add")
                {
                    //新增宾馆
                    MeetingModel.Hotel hotel = new MeetingModel.Hotel();
                    hotel.h_name       = Txth_name.Text;
                    hotel.h_street     = Txtstreet.Text;
                    hotel.phone_number = Txtphone_number.Text;
                    if (meetingbll.AddHotel(hotel) > 0)
                    {
                        Response.Write("<script>alert('添加成功')</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('添加失败')</script>");
                    }
                }
                else
                {
                    //更改宾馆信息
                    string             HId   = Request.QueryString["HId"];
                    MeetingModel.Hotel hotel = meetingbll.GetHotelInfo(HId);

                    hotel.h_name       = Txth_name.Text;
                    hotel.h_street     = Txtstreet.Text;
                    hotel.phone_number = Txtphone_number.Text;
                    if (meetingbll.UpdateHotel(hotel) > 0)
                    {
                        Response.Write("<script>alert('修改成功')</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('修改失败')</script>");
                    }
                }
            }
        }