Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //init
            LoginedMember = (Member)Session["MEMBER"];
            dbManager     = (DBManager)Session["DBadmin"];

            int       ColCount = 4;
            TableRow  tr       = new TableRow();
            TableCell td       = new TableCell();

            tr.Cells.Add(td);
            List <string> TableNames = Theater.GetMemberNameToSting();

            //테이블 제목열
            //개선필요(isjeong 7. 27)
            for (int i = 0; i < ColCount; i++)
            {
                td = new TableCell();
                switch (i)
                {
                case 0:
                    td.Text = "ID";
                    break;

                case 1:
                    td.Text = "이름";
                    break;

                case 2:
                    td.Text = "나이";
                    break;

                case 3:
                    td.Text = "잔여포인트";
                    break;
                }

                tr.Cells.Add(td);
            }


            tr.BackColor = Color.FromName("#ccccff");
            Table1.Rows.Add(tr);

            //멤버 목록 호출
            string Command = "SELECT * FROM Member WHERE ID <> @id";

            List <Tuple <string, object> > Params = new List <Tuple <string, object> >();

            Params.Add(new Tuple <string, object>("@ID", "admin"));

            SqlDataReader         reader  = dbManager.GetDataList(Command, Params);
            List <dataSet.Member> Members = dataSet.Member.SqlDataReaderToMember(reader);

            foreach (var member in Members)
            {
                tr = new TableRow();
                td = new TableCell();

                //테이블의 열마다 체크박스를 추가하고 ID를 열의 ID와 매핑시킨다.
                CheckBox chkbox = new CheckBox();
                chkbox.ID = member.ID.ToString();
                td.Controls.Add(chkbox);

                tr.Cells.Add(td);
                // 루프를 돌면서 각 셀을 설정한다.
                for (int j = 0; j < ColCount; j++)
                {
                    td = new TableCell();
                    //임시
                    switch (j)
                    {
                    case 0:
                        td.Text = member.ID;
                        break;

                    case 1:
                        td.Text = member.Name;
                        break;

                    case 2:
                        td.Text = member.Age;
                        break;

                    case 3:
                        td.Text = member.Point;
                        break;
                    }

                    tr.Cells.Add(td);
                }

                tr.BackColor = Color.White;
                Table1.Rows.Add(tr);
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //init
            LoginedMember = (Member)Session["MEMBER"];
            dbManager     = (DBManager)Session["DBadmin"];

            int ColCount = 4;
            //Table 셋팅
            TableRow  tr = new TableRow();
            TableCell td = new TableCell();

            tr.Cells.Add(td);
            List <string> TableNames = Theater.GetMemberNameToSting();

            //테이블 제목열
            for (int i = 0; i < ColCount; i++)
            {
                td      = new TableCell();
                td.Text = TableNames[i];
                tr.Cells.Add(td);
            }
            tr.BackColor = Color.FromName("#ccccff");
            Table1.Rows.Add(tr);

            //기존 생성된 상영관 목록을 불러와 테이블에 입력한다.
            string Command = "SELECT * FROM Theater ORDER BY TheaterID ASC";

            SqlDataReader          reader   = dbManager.GetDataList(Command, new List <Tuple <string, object> >());
            List <dataSet.Theater> Theaters = dataSet.Theater.SqlDataReaderToMember(reader);

            foreach (var theater in Theaters)
            {
                tr = new TableRow();
                td = new TableCell();

                //테이블의 열마다 체크박스를 추가하고 ID를 열의 ID와 매핑시킨다.
                CheckBox chkbox = new CheckBox();
                chkbox.ID = theater.TheaterID.ToString();
                td.Controls.Add(chkbox);

                tr.Cells.Add(td);
                // 루프를 돌면서 각 셀을 설정한다.
                for (int j = 0; j < ColCount; j++)
                {
                    td = new TableCell();
                    //임시
                    switch (j)
                    {
                    case 0:
                        td.Text = theater.TheaterID;
                        break;

                    case 1:
                        td.Text = theater.Seatcount;
                        break;

                    case 2:
                        td.Text = theater.Seatrowcount;
                        break;

                    case 3:
                        td.Text = theater.Seatnumbercount;
                        break;
                    }

                    tr.Cells.Add(td);
                }

                tr.BackColor = Color.White;
                Table1.Rows.Add(tr);
            }
        }