コード例 #1
0
    private void createGuestTable()
    {
        List <Guest> guestList = bl.getGuestList(Session["UserName"].ToString());

        DataTable dt = new DataTable();

        dt.Columns.AddRange(new DataColumn[4]
        {
            new DataColumn("id", typeof(int)),
            new DataColumn("First_Name", typeof(string)),
            new DataColumn("Last_Name", typeof(string)),
            new DataColumn("Phone", typeof(string))
        });


        if (guestList.Count > 0)
        {
            int i = 1;

            foreach (Guest guest in guestList)
            {
                if (guest.GroupName.Equals(groupList[selectedIndex].Name))
                {
                    dt.Rows.Add(i++, guest.FirstName, guest.LastName, guest.Phone);
                }
            }
        }
        else
        {
            Gruop_List_Guest_Massege_LBL.Text = "No Groups To Show!";
        }
        Groups_To_Guest_GridView.DataSource = dt;
        Groups_To_Guest_GridView.DataBind();
    }
コード例 #2
0
ファイル: GuestList.aspx.cs プロジェクト: shaipeer/Eventer
    protected void Page_Load(object sender, EventArgs e)
    {
        //LOGIN and EVENT SELECT check
        if (Session["UserName"] == null)
        {
            Response.Redirect("MainPage.aspx");
        }
        else if (Session["EventId"] == null)
        {
            Response.Redirect("EventList.aspx");
        }

        Session["ShowSelectedEvent"] = "true";

        bl               = new EventerBL();
        guestList        = bl.generateEventGuestList(Session["UserName"].ToString(), Convert.ToInt32(Session["EventId"].ToString()));
        allUserGuestList = bl.getGuestList(Session["UserName"].ToString());
        if (!this.IsPostBack)
        {
            refreshGroupDropDownList();
            refreshExistGuestDropDownList();

            DataTable dt = new DataTable();
            dt.Columns.AddRange(new DataColumn[5]
            {
                new DataColumn("id", typeof(int)),
                new DataColumn("first_name", typeof(string)),
                new DataColumn("last_name", typeof(string)),
                new DataColumn("phone", typeof(string)),
                new DataColumn("group", typeof(string))
            });


            if (guestList.Count > 0)
            {
                int i = 1;
                foreach (Guest guestFromList in guestList)
                {
                    dt.Rows.Add(i++, guestFromList.FirstName, guestFromList.LastName, guestFromList.Phone, guestFromList.GroupName);
                }
            }
            else
            {
                No_Guest_LBL.Text = "No Guests To Show!";
            }
            Guest_list_GridView.DataSource = dt;
            Guest_list_GridView.DataBind();
        }
    }