コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                try
                {
                    lb_err.Text = "";
                    CY.HotelBooking.Core.Business.Manager manager = new CY.HotelBooking.Core.Business.Manager();
                    List<CY.HotelBooking.Core.Business.Manager> listManager = manager.GetAllList() as List<CY.HotelBooking.Core.Business.Manager>;
                    ddl_Manager.DataSource = listManager;
                    ddl_Manager.DataTextField = "RealName";
                    ddl_Manager.DataValueField = "Code";

                    ddl_Manager.DataBind();
                    ddl_Manager.Items.Insert(0, new ListItem("全部", ""));
                    ddl_Manager.Items.Insert(ddl_Manager.Items.Count, new ListItem("已删除", "已删除"));
                    Bind();
                }
                catch (Exception ex)
                {
                    lb_err.Text = ex.Message;
                }

            }
        }
コード例 #2
0
 private void Bind()
 {
     CY.HotelBooking.Core.Business.Manager manager;
     IList<CY.HotelBooking.Core.Business.Manager> list;
     if (textSearch.Text.Trim() == string.Empty)
     {
         manager = new CY.HotelBooking.Core.Business.Manager();
         list = manager.GetAllList();
     }
     else
     {
         manager=new CY.HotelBooking.Core.Business.Manager();
         string name = textSearch.Text.Trim();
         list =manager.GetSearchByName(name);
     }
     gvManager.DataSource = list;
     gvManager.DataBind();
 }