コード例 #1
0
        public void SetTable()
        {
            String Command;
            List <Tuple <string, object> > Params = new List <Tuple <string, object> >();

            //TODO: 영화관 좌석상태를 표시하기위해 이미 예약된 좌석정보를 가져오도록합니다.
            //      기예약된 좌석은 enable = false, checked = true;로 설정하여 사용자가 예약할수 없도록 합니다.
            //      영화관ID와 시작시간이 같은 좌석들을 Row->number 각각 오름차순 순으로 받아옵니다.
            Command = "Select * From Seat Where TheaterID = @TheaterID AND Playtime = @Playtime Order by Seatrow, Seatnumber";
            Params.Add(new Tuple <string, object>("@TheaterID", SelectedTheater));
            Params.Add(new Tuple <string, object>("@Playtime", SelectedPlayDate));
            SqlDataReader reader = dbManager.GetDataList(Command, Params);
            List <Seat>   Seats  = Seat.SqlDataReaderToSeat(reader);

            if (Seats == null || Seats.Count == 0)
            {
                return;
            }
            Params.Clear();
            //TODO: 사용자가 영화 셋팅을 다하고 예약인원을 설정하였으면
            //      영화관 관람좌석테이블을 생성합니다. 모두 체크박스로 넣어주도록 합니다.
            //      이미 예약된 좌석은 체크 표시로 하고 미예약은 언체크로 표시합니다.

            TableRow  tr     = null;
            TableCell td     = null;
            String    preRow = "";

            foreach (Seat seat in Seats)
            {
                //Row열이 바뀌면 테이블에 Row를 생성.
                if (preRow != seat.Seatrow)
                {
                    if (tr != null)
                    {
                        Table1.Rows.Add(tr);
                    }
                    tr     = new TableRow();
                    preRow = seat.Seatrow;
                }

                td = new TableCell();
                CheckBox chkbox = new CheckBox();
                chkbox.ID = seat.Seatrow + "열" + seat.Seatnumber + "번";
                if (seat.Isbooked == "True")
                {
                    chkbox.Enabled = false;
                    chkbox.Checked = true;
                }
                td.Controls.Add(chkbox);
                tr.Cells.Add(td);
            }
            if (tr != null)
            {
                Table1.Rows.Add(tr);
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LoginedMember = (Member)Session["MEMBER"];
            if (LoginedMember == null)
            {
                Common.ShowMessage(this, @"잘못된 접근입니다.");
                Response.Redirect("Main.aspx");
            }
            dbManager = (DBManager)Session["DBAdmin"];
            //상영중인 영화를 이미지 객체애 매칭합니다.


            string[] filePaths = Directory.GetFiles(HttpRuntime.AppDomainAppPath + "MoviePoster");
            if (filePaths != null)
            {
                //3개의 이미지만 등록한다. 어떤 이미지를 등록할지에 대한 로직은 추후에.(미완성)
                foreach (string path in filePaths)
                {
                    String FileName = Path.GetFileName(path);
                    if (Image1.ImageUrl == "")
                    {
                        Image1.ImageUrl = Constant.MoviePosterPath + FileName;
                    }
                    else if (Image2.ImageUrl == "")
                    {
                        Image2.ImageUrl = Constant.MoviePosterPath + FileName;
                    }
                    else
                    {
                        Image3.ImageUrl = Constant.MoviePosterPath + FileName;
                    }
                }
            }

            LabelName.Text = LoginedMember.Name;
            //테이블 내용을 채우기 전에 포인트 사용내역을 받아온다.
            //string Command = "SELECT * FROM ( SELECT top 1 * FROM Point WHERE ID=@id ORDER BY Occuredatetime DESC)";
            string Command = "Select top 1 * from Point where ID=@id order by Occuredatetime desc";
            List <Tuple <string, object> > Params = new List <Tuple <string, object> >();

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

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

            if (points.Count == 0)
            {
                LabelPoint.Text = "0";
            }
            else
            {
                LabelPoint.Text = points[0].Remainvalue;
            }
            //LabelPoint.Text = LoginedMember.Point;
        }
コード例 #3
0
        //로그인 클릭
        protected void BTN_LOGIN_Click(object sender, EventArgs e)
        {
            //ID, Pass 항목 비어있으면 리턴
            if (string.IsNullOrEmpty(TXT_ID.Text) || string.IsNullOrEmpty(TXT_Pass.Text))
            {
                Common.ShowMessage(this, @"ID, Pass를 입력하세요.");
                return;
            }
            //DBManager가 페이지로드에서 셋팅이 안되어 있을 경우.
            if (dbManager == null)
            {
                return;
            }
            //DB 매니저 객체 생성후 DB에서 검증후 로그인 결과창 도시.
            if (dbManager.dbConnection != null)
            {
                String Command = "SELECT * FROM Member WHERE ID=@ID AND Pass=@pass";
                List <Tuple <string, object> > Params = new List <Tuple <string, object> >();
                Params.Add(new Tuple <string, object>("@ID", TXT_ID.Text));
                Params.Add(new Tuple <string, object>("@Pass", TXT_Pass.Text));

                //보낸 명령에 대한 리더 객체를 얻는다.
                SqlDataReader Reader = dbManager.GetDataList(Command, Params);
                //리더 객체에 맞는 데이터 셋을 입혀 멤버객체를 받는다.
                List <Member> Members = Member.SqlDataReaderToMember(Reader);
                if (Members.Count == 1)
                {
                    //TODO : Member에 대한 정보를 LoginMember.aspx로 넘기고 세션 설정해야함.
                    Session["MEMBER"] = Members[0];

                    //관리자는 관리자 페이지 호출
                    if (Members[0].ID.Trim().ToLower() == "admin")
                    {
                        Response.Redirect(string.Format("LoginAdmin.aspx"));
                    }
                    else
                    {
                        Response.Redirect(string.Format("LoginMember.aspx"));
                    }
                }
                else
                {
                    Common.ShowMessage(this, @"ID, Pass의 입력을 확인하세요.");
                    return;
                }
            }
        }
コード例 #4
0
        //영화관 추가
        protected void Button_NewTheater_Click(object sender, EventArgs e)
        {
            if (TextBox_Row.Text == string.Empty ||
                TextBox_Number.Text == string.Empty)
            {
                //TODO : 열, 번호값이 맞는지 확인
                return;
            }

            //상영관 ID를 받기위해 현재 상영관 ID중 가장 큰 값을 받아온다.
            string Command = "Select top 1 * from Theater order by LEN(TheaterID), TheaterID desc";
            //보낸 명령에 대한 리더 객체를 얻는다.
            SqlDataReader Reader = dbManager.GetDataList(Command, new List <Tuple <string, object> >());
            //리더 객체에 맞는 데이터 셋을 입혀 멤버객체를 받는다.
            List <Theater> Members      = Theater.SqlDataReaderToMember(Reader);
            int            NewTheaterID = 0;

            if (Members.Count == 1)
            {
                //상영관 ID는 기존 ID중 가장 큰 ID + 1
                NewTheaterID = Convert.ToInt32(Members[0].TheaterID) + 1;
            }
            //상영관 추가 코드
            Command = "insert into Theater(TheaterID, Seatcount, Seatrowcount, Seatnumbercount)" +
                      "values(@TheaterID, @Seatcount, @Seatrowcount, @Seatnumbercount)";
            //아스키 코드값을 이용하여 열의 갯수를 숫자로 변환하고 열당 좌석수 만큼 곱하여 총 좌석수를 지정한다.
            //(int)(Convert.ToChar(TextBox_Row.Text.ToUpper()) - 64);//이전버전
            int Int_row        = Common.AlphabetToNumber(TextBox_Row.Text);
            int SeatCountByRow = Convert.ToInt32(TextBox_Number.Text);

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

            Params.Add(new Tuple <string, object>("@TheaterID", NewTheaterID));
            Params.Add(new Tuple <string, object>("@Seatcount", Int_row * SeatCountByRow));
            Params.Add(new Tuple <string, object>("@Seatrowcount", TextBox_Row.Text.ToUpper()));
            Params.Add(new Tuple <string, object>("@Seatnumbercount", SeatCountByRow));

            if (dbManager.DoCommand(Command, Params))
            {
                Page.Response.Redirect(Page.Request.Url.ToString(), true);
            }
        }
コード例 #5
0
 //계정확인
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (dbManager == null)
     {
         return;
     }
     if (dbManager.dbConnection != null)
     {
         string Command = "Select Top 1 * From Member Where ID = @ID";
         List <Tuple <string, object> > Params = new List <Tuple <string, object> >();
         Params.Add(new Tuple <string, object>("@ID", TXT_ID.Text.Trim()));
         SqlDataReader         reader  = dbManager.GetDataList(Command, Params);
         List <dataSet.Member> Members = dataSet.Member.SqlDataReaderToMember(reader);
         if (Members.Count == 0)
         {
             Common.ShowMessage(this, @"아이디 확인 완료.");
             ViewState["IDChecked"] = true;
         }
         else
         {
             Common.ShowMessage(this, @"중복아이디.");
         }
     }
 }
コード例 #6
0
        //새로운 영화 등록
        protected void Button_New_Click(object sender, EventArgs e)
        {
            //TODO List:
            // 1. 새로운 영화의 ID를 지정하기위해 이전 영화의 MaxID 호출
            // 2. 영화등록
            // 3. 상영관의 좌석수를 얻기위해 값을 받아온다.
            // 4. 영화스케줄 등록
            // 5. 영화 스케쥴당 좌석 생성
            // 6. 이전화면으로 이동
            string command          = "Select Top 1 * From Movie Order by MovieID DESC";
            String NewMovieID       = "-1";
            String Seatcount        = "0";
            String TheaterID        = "0"; //상영관 ID
            String TheaterMaxRow    = "0"; //상영관 최대 열
            String TheaterMaxNumber = "0"; //상영관 최대 행

            #region 1. 새로운 영화의 ID를 지정하기위해 이전 영화의 MaxID 호출
            SqlDataReader reader = dbManager.GetDataList(command, new List <Tuple <string, object> >());
            List <Movie>  movies = Movie.SqlDataReaderToMember(reader);
            if (movies.Count == 0)
            {
                NewMovieID = "0";
            }
            else if (movies.Count == 1)
            {
                //가장 큰 ID에 +1 해준값이 새로운 영화의 ID
                NewMovieID = (Convert.ToInt32(movies[0].MovieID.Trim(' ')) + 1).ToString();
            }
            else
            {
                //영화 아이디 불러오기 실패
                return;
            }
            #endregion
            #region 2. 영화등록
            command = "insert into Movie(MovieID, Moviename, Playstartdatetime, Playenddatetime, Runningtime, Viewingclass, Movieposter)" +
                      "values(@MovieID, @Moviename, @Playstartdatetime, @Playenddatetime, @Runningtime, @Viewingclass, @Movieposter)";
            List <Tuple <string, object> > Params = new List <Tuple <string, object> >();
            Params.Add(new Tuple <string, object>("@MovieID", NewMovieID));
            Params.Add(new Tuple <string, object>("@Moviename", TextBox_Name.Text));
            Params.Add(new Tuple <string, object>("@Playstartdatetime", TextBox_StartMovie.Text));
            Params.Add(new Tuple <string, object>("@Playenddatetime", TextBox_endMovie.Text));
            Params.Add(new Tuple <string, object>("@Runningtime", TextBox_RunningTIme.Text));
            Params.Add(new Tuple <string, object>("@Viewingclass", TextBox_ViewingClass.Text));
            if (this.FileUpload1.HasFile)
            {
                this.FileUpload1.SaveAs(HttpRuntime.AppDomainAppPath + "MoviePoster\\"
                                        + NewMovieID.Trim() + "_" + TextBox_Name.Text.Trim() + "." + FileUpload1.FileName.Split('.')[1]);
                //this.FileUpload1.SaveAs(Constant.MoviePosterPath + NewMovieID.Trim() + "_" + TextBox_Name.Text.Trim() + "." + FileUpload1.FileName.Split('.')[1]);
            }

            Params.Add(new Tuple <string, object>("@Movieposter", NewMovieID.Trim() + "_" + TextBox_Name.Text.Trim() + "." + FileUpload1.FileName.Split('.')[1]));
            if (!dbManager.DoCommand(command, Params))
            {
                Console.WriteLine("영화 추가 에러");
                return;
            }
            #endregion
            #region 3. 상영관의 좌석수를 얻기위해 값을 받아온다.
            Params.Clear();
            TheaterID = Request[this.TextBox_TheaterNumber.UniqueID].Trim();
            command   = "Select * From Theater Where TheaterID = @TheaterID";
            Params.Add(new Tuple <string, object>("@TheaterID", TheaterID));
            reader = dbManager.GetDataList(command, Params);
            List <Theater> Theaters = Theater.SqlDataReaderToMember(reader);
            if (Theaters.Count != 1)
            {
                Console.WriteLine("같은 아이디의 극장이 여러개");
                return;
            }
            Seatcount        = Theaters[0].Seatcount;
            TheaterMaxRow    = Theaters[0].Seatrowcount;
            TheaterMaxNumber = Theaters[0].Seatnumbercount;
            #endregion
            #region 4. 영화스케줄 등록
            Params.Clear();
            string[] stringSeparators = new string[] { "\r\n" };
            string[] playtimes        = TextBox_MoviePlayList.Text.Split(stringSeparators, StringSplitOptions.None);

            foreach (string playtime in playtimes)
            {
                command = "insert into Movieschedule(MovieID, TheaterID, Playtime, Seatbooked, Seatremained)" +
                          "values(@MovieID, @TheaterID, @Playtime, @Seatbooked, @Seatremained)";
                if (playtime == "")
                {
                    continue;
                }
                Params.Add(new Tuple <string, object>("@MovieID", NewMovieID));
                Params.Add(new Tuple <string, object>("@TheaterID", TheaterID));
                Params.Add(new Tuple <string, object>("@Seatbooked", "0"));
                Params.Add(new Tuple <string, object>("@Seatremained", Seatcount));
                Params.Add(new Tuple <string, object>("@Playtime", playtime.ToString()));

                //영화스케쥴 생성에 성공하였으니 5번:영화관스케쥴당좌석을 생성한다.
                if (dbManager.DoCommand(command, Params))
                {
                    #region 5. 영화 스케쥴당 좌석 생성
                    command = "insert into Seat(TheaterID, Seatrow, Seatnumber, Isbooked, Playtime)" +
                              "values(@TheaterID, @Seatrow, @Seatnumber, @Isbooked, @Playtime)";
                    //A = 1, B = 2 ..... Z = 26
                    int I_TheaterMaxRow    = Common.AlphabetToNumber(TheaterMaxRow);
                    int I_TheaterMaxNumber = Convert.ToInt32(TheaterMaxNumber);
                    for (int Seatrow = 1; Seatrow <= I_TheaterMaxRow; Seatrow++)                 //좌석 열수만큼
                    {
                        for (int Seatnumber = 1; Seatnumber <= I_TheaterMaxNumber; Seatnumber++) //열당 좌석수만큼
                        {
                            Params.Clear();
                            Params.Add(new Tuple <string, object>("@TheaterID", TheaterID));
                            Params.Add(new Tuple <string, object>("@Seatrow", Common.NumberToAlphabet(Seatrow)));
                            Params.Add(new Tuple <string, object>("@Seatnumber", Seatnumber));
                            Params.Add(new Tuple <string, object>("@Isbooked", "false"));
                            Params.Add(new Tuple <string, object>("@Playtime", playtime.ToString()));
                            dbManager.DoCommand(command, Params);
                        }
                    }

                    #endregion
                }
                Params.Clear();
            }
            #endregion
            #region 6. 이전화면으로 이동
            Response.Redirect(string.Format("MovieList.aspx"));
            #endregion
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //init
            LoginedMember = (Member)Session["MEMBER"];
            dbManager     = (DBManager)Session["DBadmin"];

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

            tr.Cells.Add(td);

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

                case 1:
                    td.Text = "상영시작일";
                    break;

                case 2:
                    td.Text = "상영종료일";
                    break;

                case 3:
                    td.Text = "상영관";
                    break;

                case 4:
                    td.Text = "관람등급";
                    break;
                }
                tr.Cells.Add(td);
            }

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

            //영화 목록 호출
            string Command = "SELECT * FROM Movie";

            SqlDataReader reader = dbManager.GetDataList(Command, new List <Tuple <string, object> >());
            List <Movie>  Movies = Movie.SqlDataReaderToMember(reader);

            foreach (var Movie in Movies)
            {
                tr = new TableRow();
                td = new TableCell();

                //테이블의 열마다 체크박스를 추가하고 ID를 열의 ID와 매핑시킨다.
                CheckBox chkbox = new CheckBox();
                chkbox.ID = Movie.MovieID.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 = Movie.MovieID;
                        break;

                    case 1:
                        td.Text = Movie.Moviename;
                        break;

                    case 2:
                        td.Text = Movie.Playstartdatetime;
                        break;

                    case 3:
                        td.Text = Movie.Playenddatetime;
                        break;

                    case 4:
                        td.Text = Movie.Viewingclass;
                        break;
                    }

                    tr.Cells.Add(td);
                }

                tr.BackColor = Color.White;
                Table1.Rows.Add(tr);
            }
        }
コード例 #8
0
        //페이지로드
        protected void Page_Load(object sender, EventArgs e)
        {
            SelectedTheater = DropDownList_Theater.SelectedValue.Trim();

            LoginedMember = (Member)Session["MEMBER"];
            dbManager     = (DBManager)Session["DBAdmin"];

            //사용자가 아무 영화를 클릭하지 않은 초기화 상태라면
            if (DropDownList_MovieName.SelectedValue == "")
            {
                String        Command = "Select * From Movie";
                SqlDataReader reader  = dbManager.GetDataList(Command, new List <Tuple <string, object> >());
                List <Movie>  Movies  = Movie.SqlDataReaderToMember(reader);

                DropDownList_MovieName.DataTextField  = "Moviename";
                DropDownList_MovieName.DataValueField = "MovieID";
                DropDownList_MovieName.DataSource     = Movies;
                DropDownList_MovieName.DataBind();
            }
            //영화를 선택하였으니 해당 영화에 맞는 시간을 보여줌.
            else
            {
                SelectedMovieID = DropDownList_MovieName.SelectedValue.Trim();
                String Command = "Select * From Movieschedule Where MovieID = @MovieID";
                List <Tuple <string, object> > Params = new List <Tuple <string, object> >();
                Params.Add(new Tuple <string, object>("@MovieID", SelectedMovieID));

                SqlDataReader        reader    = dbManager.GetDataList(Command, Params);
                List <Movieschedule> PlayTimes = Movieschedule.SqlDataReaderToMember(reader);

                DropDownList_PlayDate.DataTextField  = "Playtime";
                DropDownList_PlayDate.DataValueField = "Playtime";
                DropDownList_PlayDate.DataSource     = PlayTimes;
                DropDownList_PlayDate.DataBind();
                Params.Clear();
                //상영관을 선택하지 않았음.
                if (DropDownList_PlayDate.SelectedValue == "")
                {
                    ;
                }
                //상영관을 선택하였으면 관이랑 남은 좌석수 표시
                else
                {
                    SelectedPlayDate = DropDownList_PlayDate.SelectedValue.Trim();

                    DropDownList_Theater.DataTextField  = "RemaindSeatMent";
                    DropDownList_Theater.DataValueField = "TheaterID";
                    DropDownList_Theater.DataSource     = PlayTimes;
                    DropDownList_Theater.DataBind();
                    Params.Clear();

                    if (TextBox_TicketCount.Text != "")
                    {
                        remainTicket = Convert.ToInt32(TextBox_TicketCount.Text);
                    }
                    if (remainTicket != 0)
                    {
                        if (SelectedMovieID == "" || SelectedPlayDate == "" || SelectedTheater == "")
                        {
                            return;
                        }
                        SetTable();
                    }
                }
            }
        }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LoginedMember = (Member)Session["MEMBER"];
            dbManager     = (DBManager)Session["DBadmin"];

            //쿠키로 이전페이지에서 입력받은 날짜를 받는다.
            string start = Request.Cookies["Start"].Value;
            string end   = Request.Cookies["End"].Value;

            /* 가용가능 사용관 지정방법
             * 1. 각 영화의 시간을 검색해서 겹치는 영화를 뽑아낸다.
             * 2. 겹치는 영화가 설정된 상영관을 전체 상영관 목록에서 제거한다.
             */
            #region 사용가능 상영관 추출
            string Command = "SELECT * FROM Movie WHERE Playstartdatetime <= @end AND Playenddatetime >= @start";

            List <Tuple <string, object> > Params = new List <Tuple <string, object> >();
            Params.Add(new Tuple <string, object>("@start", start));
            Params.Add(new Tuple <string, object>("@end", end));
            SqlDataReader reader = dbManager.GetDataList(Command, Params);

            List <Movie>   Movies       = Movie.SqlDataReaderToMember(reader);
            List <Theater> AbleTheaters = new List <Theater>();
            // DEBUG : 시간 겹치는 영화만 나오는지 확인해
            if (Movies.Count == 0)
            {
                //기간이 겹치는 영화가 없으므로 모든 상영관을 테이블로 도시한다.
                Command      = "SELECT * FROM Theater";
                reader       = dbManager.GetDataList(Command, new List <Tuple <string, object> >());
                AbleTheaters = Theater.SqlDataReaderToMember(reader);
            }
            else
            {
                //기간이 겹치는 영화들이 있다.
                //1.영화 스케쥴에 사용되고있는 상영관 리스트를 추출

                //명령어 셋팅
                Command = "SELECT * FROM Movieschedule WHERE MovieID IN (";
                int i = 1;
                foreach (var movie in Movies)
                {
                    if (Movies.Count != i)
                    {
                        Command += "@movieID" + Convert.ToString(i) + ", ";
                    }
                    else
                    {
                        Command += "@movieID" + Convert.ToString(i);
                    }
                    i++;
                }
                Command += ")";
                //명령어에 해당하는 변수 설정.
                Params = new List <Tuple <string, object> >();
                i      = 1;
                foreach (var movie in Movies)
                {
                    //DB에서 값 가져올때 공백이 생겨서 공백 제거를합니다.
                    Movies[i - 1].MovieID = Movies[i - 1].MovieID.Trim(' ');
                    Params.Add(new Tuple <string, object>("@movieID" + Convert.ToString(i), Movies[i - 1].MovieID));
                    i++;
                }
                reader = dbManager.GetDataList(Command, Params);
                //뽑아온 곳은 영화 스케쥴 테이블인데 영화관 객체에 넣으면 안되기때문에 영화관 ID만 받아서 리스트로 생성한다.
                List <string> DisAbleTheaters = new List <string>();
                DisAbleTheaters = Theater.OlnyTheaterID(reader);

                //2. 1.에서 뽑은 상영관을 전체 상영관에서 제거한다.
                Command = "SELECT * FROM Theater WHERE TheaterID NOT IN (";
                i       = 1;
                foreach (var Theater in DisAbleTheaters)
                {
                    if (DisAbleTheaters.Count != i)
                    {
                        Command += "@TheaterID" + Convert.ToString(i) + ", ";
                    }
                    else
                    {
                        Command += "@TheaterID" + Convert.ToString(i);
                    }
                    i++;
                }
                Command += ")";
                Params   = new List <Tuple <string, object> >();

                //사용불가능한 상영관이 없으면 전체 상영관을 불러오는 코드를 수행하고
                //그렇지 않다면 전체 상영관에서 사용불가능한 상영관을 제거한 사용가능상영관을 불러온다.
                if (DisAbleTheaters.Count == 0)
                {
                    Command = "SELECT * FROM Theater";

                    reader       = dbManager.GetDataList(Command, new List <Tuple <string, object> >());
                    AbleTheaters = Theater.SqlDataReaderToMember(reader);
                }
                else
                {
                    for (int j = 1; j <= DisAbleTheaters.Count; j++)
                    {
                        //DB에서 값 가져올때 공백이 생겨서 공백 제거를합니다.
                        DisAbleTheaters[j - 1] = DisAbleTheaters[j - 1].Trim(' ');
                        Params.Add(new Tuple <string, object>("@TheaterID" + Convert.ToString(j), DisAbleTheaters[j - 1]));
                    }
                    reader       = dbManager.GetDataList(Command, Params);
                    AbleTheaters = Theater.SqlDataReaderToMember(reader);
                }
            }
            #endregion
            // AbleTheaters 에 값이 들어있고 라디오버튼과 상영관명으로 이루어진 테이블을 셋팅한다.
            #region 테이블 셋팅
            int       ColCount = 2;
            TableRow  tr       = new TableRow();
            TableCell td       = new TableCell();
            tr.Cells.Add(td);

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

                case 1:
                    td.Text = "상영관 인원수";
                    break;
                }
                tr.Cells.Add(td);
            }

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


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

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

                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;
                    }

                    tr.Cells.Add(td);
                }

                tr.BackColor = Color.White;
                Table1.Rows.Add(tr);
            }
            #endregion
        }
コード例 #10
0
        //페이지로드
        protected void Page_Load(object sender, EventArgs e)
        {
            //세션 로드
            LoginedMember = (Member)Session["MEMBER"];
            dbManager     = (DBManager)Session["DBAdmin"];

            //preSelectedValue input
            SelectedMovieID  = DropDownList_MovieName.SelectedValue.Trim();
            SelectedPlayDate = DropDownList_PlayDate.SelectedValue.Trim();
            SelectedTheater  = DropDownList_Theater.SelectedValue.Trim();

            //사용자가 아무 영화를 클릭하지 않은 초기화 상태라면
            if (DropDownList_MovieName.SelectedValue == "" || DropDownList_MovieName.SelectedValue == NotSelected)
            {
                String        Command = "Select * From Movie";
                SqlDataReader reader  = dbManager.GetDataList(Command, new List <Tuple <string, object> >());
                List <Movie>  Movies  = Movie.SqlDataReaderToMember(reader);

                Movie notSelectValue = new Movie();
                notSelectValue.Moviename = NotSelected;
                notSelectValue.MovieID   = NotSelected;
                Movies.Add(notSelectValue);

                DropDownList_MovieName.DataTextField  = "Moviename";
                DropDownList_MovieName.DataValueField = "MovieID";
                DropDownList_MovieName.DataSource     = Movies;
                DropDownList_MovieName.DataBind();
                DropDownList_MovieName.SelectedValue = NotSelected;
            }
            //영화를 선택하였으니 해당 영화에 맞는 시간을 보여줌.
            else
            {
                SelectedMovieID = DropDownList_MovieName.SelectedValue.Trim();

                string Command = "Select * From Movieschedule Where MovieID = @MovieID";
                List <Tuple <string, object> > Params = new List <Tuple <string, object> >();
                Params.Add(new Tuple <string, object>("@MovieID", SelectedMovieID));

                SqlDataReader        reader    = dbManager.GetDataList(Command, Params);
                List <Movieschedule> PlayTimes = Movieschedule.SqlDataReaderToMember(reader);

                Movieschedule notSelectValue = new Movieschedule();
                notSelectValue.Playtime = NotSelected;
                PlayTimes.Add(notSelectValue);

                //상영날짜 선택하지 않았음.
                if (SelectedPlayDate == "" || SelectedPlayDate == NotSelected)
                {
                    DropDownList_PlayDate.DataTextField  = "Playtime";
                    DropDownList_PlayDate.DataValueField = "Playtime";
                    DropDownList_PlayDate.DataSource     = PlayTimes;
                    DropDownList_PlayDate.DataBind();

                    DropDownList_PlayDate.SelectedValue = NotSelected;
                    Params.Clear();
                }
                //상영날짜를 선택하였으면 관이랑 남은 좌석수 표시
                else
                {
                    //날짜별 영화관중에서 선택한 날짜의 영화관만 도시한다.
                    List <Movieschedule> PlayTheaters = new List <Movieschedule>();
                    foreach (Movieschedule playTime in PlayTimes)
                    {
                        if (playTime.Playtime == SelectedPlayDate)
                        {
                            PlayTheaters.Add(playTime);
                        }
                    }

                    DropDownList_Theater.DataTextField  = "RemaindSeatMent";
                    DropDownList_Theater.DataValueField = "TheaterID";
                    if (PlayTheaters.Count == 0)
                    {
                        ;
                    }
                    else
                    {
                        DropDownList_Theater.DataSource = PlayTheaters;
                    }
                    DropDownList_Theater.DataBind();

                    Params.Clear();

                    //예약인원이 정해져있는 상태이면서 예약내용이 모두 null값이 아닐경우 좌석배치표를 생성한다.
                    if (TextBox_TicketCount.Text != "")
                    {
                        remainTicket = Convert.ToInt32(TextBox_TicketCount.Text);
                    }
                    if (remainTicket != 0)
                    {
                        if (SelectedMovieID == "" || SelectedPlayDate == "" || SelectedTheater == "" ||
                            SelectedMovieID == NotSelected || SelectedPlayDate == NotSelected || SelectedTheater == NotSelected)
                        {
                            return;
                        }
                        SetTable();
                    }
                }
            }
        }
コード例 #11
0
        //예매취소
        protected void Button2_Click(object sender, EventArgs e)
        {
            //TODO : Movie Schedule의 RemianSeat 반환
            //       Seat에서 예약상태 변경
            //       예약 내용 제거
            //       환불

            int    refundCount = 0;
            string RefundID    = "";
            string Command     = "";
            List <Tuple <string, object> > Params = new List <Tuple <string, object> >();
            SqlDataReader reader;

            foreach (TableRow tr in Table1.Rows)
            {
                try
                {
                    //Table의 제일 첫번째 열은 제목 열이므로 체크박스 컨트롤이 없다.
                    if (tr.Cells[0].Controls.Count < 1)
                    {
                        continue;
                    }
                    CheckBox chkbox = (CheckBox)tr.Cells[0].Controls[0];
                    if (chkbox.Checked)
                    {
                        //추후 환불금액을 측정하기위해 환불 좌석수 카운트.
                        refundCount++;

                        #region 예약 내용 Get
                        Command = "Select * From Booking Where ID = @ID AND MovieID = @MovieID AND TheaterID = @TheaterID AND " +
                                  "Playdatetime = @Playdatetime AND Seatrow = @Seatrow AND Seatnumber = @Seatnumber";
                        string[] keys = chkbox.ToolTip.Split('_');
                        RefundID = keys[0];
                        String PlayTime = DateTime.ParseExact(keys[3], "yyyy-MM-dd tt h:mm:ss", null).ToString("yyyy-MM-dd HH:mm:ss");
                        Params.Add(new Tuple <string, object>("@ID", keys[0]));
                        Params.Add(new Tuple <string, object>("@MovieID", keys[1]));
                        Params.Add(new Tuple <string, object>("@TheaterID", keys[2]));
                        Params.Add(new Tuple <string, object>("@Playdatetime", PlayTime));
                        Params.Add(new Tuple <string, object>("@Seatrow", keys[4]));
                        Params.Add(new Tuple <string, object>("@Seatnumber", keys[5]));

                        reader = dbManager.GetDataList(Command, Params);
                        List <Bookinginfo> BookingInfo = Bookinginfo.SqlDataReaderToBooking(reader);
                        if (BookingInfo == null || BookingInfo.Count != 1)
                        {
                            Common.ShowMessage(this, @"예매삭제 실패. 관리자에게 문의하세요.");
                            return;
                        }
                        Params.Clear();
                        #endregion
                        #region MovieSchedule 테이블에서 RemainSeat 반환
                        //
                        //   Update example
                        //   Command = Command = "Update Seat Set Isbooked = @Isbooked " +
                        //   "Where TheaterID = @TheaterID AND Seatrow = @Seatrow AND Seatnumber = @Seatnumber AND Playtime = @Playtime";
                        Command = "Update Movieschedule Set Seatremained = Seatremained+1" +
                                  "Where MovieID = @MovieID AND TheaterID = @TheaterID AND Playtime = @Playtime";

                        Params.Add(new Tuple <string, object>("@MovieID", BookingInfo[0].MovieID));
                        Params.Add(new Tuple <string, object>("@TheaterID", BookingInfo[0].TheaterID));
                        Params.Add(new Tuple <string, object>("@Playtime", PlayTime));
                        dbManager.DoCommand(Command, Params);
                        Params.Clear();
                        #endregion

                        #region Seat테이블에서 Seat 반환
                        Command = "Update Seat Set Isbooked = 0" +
                                  "Where TheaterID = @TheaterID AND Playtime = @Playtime AND Seatrow = @Seatrow AND Seatnumber = @Seatnumber ";
                        Params.Add(new Tuple <string, object>("@TheaterID", BookingInfo[0].TheaterID));
                        Params.Add(new Tuple <string, object>("@Playtime", PlayTime));
                        Params.Add(new Tuple <string, object>("@Seatrow", BookingInfo[0].Seatrow));
                        Params.Add(new Tuple <string, object>("@Seatnumber", BookingInfo[0].Seatnumber));
                        dbManager.DoCommand(Command, Params);
                        Params.Clear();
                        #endregion

                        #region 예약 내용 제거
                        // Delete Example
                        // string Command = "DELETE FROM Member where ID=@id";
                        Command = "Delete From Booking Where ID = @ID AND MovieID = @MovieID AND TheaterID = @TheaterID AND " +
                                  "Playdatetime = @Playdatetime AND Seatrow = @Seatrow AND Seatnumber = @Seatnumber";
                        Params.Add(new Tuple <string, object>("@ID", keys[0]));
                        Params.Add(new Tuple <string, object>("@MovieID", keys[1]));
                        Params.Add(new Tuple <string, object>("@TheaterID", keys[2]));
                        Params.Add(new Tuple <string, object>("@Playdatetime", PlayTime));
                        Params.Add(new Tuple <string, object>("@Seatrow", keys[4]));
                        Params.Add(new Tuple <string, object>("@Seatnumber", keys[5]));
                        dbManager.DoCommand(Command, Params);
                        Params.Clear();
                        #endregion
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Data);
                    return;
                }
            }
            #region 환불
            if (refundCount != 0)
            {
                Command = "SELECT * FROM Point WHERE ID=@id ORDER BY Occuredatetime DESC";
                Params.Add(new Tuple <string, object>("@id", RefundID));
                reader = dbManager.GetDataList(Command, Params);
                List <dataSet.Point> points = dataSet.Point.SqlDataReaderToMember(reader);
                Params.Clear();

                Command = "Insert into Point(ID, Occuredatetime, Usedvalue, Rechargedvalue, Remainvalue)" +
                          "values(@ID, @Occuredatetime, @Usedvalue, @Rechargedvalue, @Remainvalue)";
                Params.Add(new Tuple <string, object>("@ID", RefundID));
                Params.Add(new Tuple <string, object>("@Occuredatetime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));
                Params.Add(new Tuple <string, object>("@Usedvalue", 0));
                Params.Add(new Tuple <string, object>("@Rechargedvalue", 0));
                Params.Add(new Tuple <string, object>("@Remainvalue", Convert.ToInt32(points[0].Remainvalue) + (refundCount * Constant.MoviePrice)));
                dbManager.DoCommand(Command, Params);
            }
            #endregion

            Page.Response.Redirect(Page.Request.Url.ToString(), true);
        }
コード例 #12
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);
            }
        }
コード例 #13
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);

            //테이블 제목열
            //개선필요(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)
            {
                Command = "Select * From Point Where ID = @ID ORDER BY Occuredatetime ASC";
                Params.Clear();
                Params.Add(new Tuple <string, object>("@ID", member.ID.Trim()));
                reader = dbManager.GetDataList(Command, Params);
                List <dataSet.Point> Point = dataSet.Point.SqlDataReaderToMember(reader);

                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:
                        //null exception 처리
                        if (Point != null && Point.Count > 0)
                        {
                            td.Text = Point[0].Remainvalue;
                        }
                        else
                        {
                            td.Text = "0";
                        }
                        break;
                    }

                    tr.Cells.Add(td);
                }

                tr.BackColor = Color.White;
                Table1.Rows.Add(tr);
            }
        }
コード例 #14
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);
            }
        }
コード例 #15
0
        //페이지로드
        protected void Page_Load(object sender, EventArgs e)
        {
            LoginedMember = (Member)Session["MEMBER"];
            dbManager     = (DBManager)Session["DBAdmin"];
            int       ColCount = 6;
            TableRow  tr       = new TableRow();
            TableCell td       = new TableCell();

            tr.Cells.Add(td);

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

                case 1:
                    td.Text = "영화명";
                    break;

                case 2:
                    td.Text = "상영관";
                    break;

                case 3:
                    td.Text = "좌석열";
                    break;

                case 4:
                    td.Text = "좌석번호";
                    break;

                case 5:
                    td.Text = "관람등급";
                    break;
                }
                tr.Cells.Add(td);
            }

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

            //영화 목록 호출
            string Command = "SELECT * FROM Booking Where ID = @ID";
            List <Tuple <string, object> > Params = new List <Tuple <string, object> >();

            Params.Add(new Tuple <string, object>("@ID", LoginedMember.ID));
            SqlDataReader      reader   = dbManager.GetDataList(Command, Params);
            List <Bookinginfo> Bookings = Bookinginfo.SqlDataReaderToBooking(reader);

            int ID_i = 0;

            foreach (var booking in Bookings)
            {
                tr = new TableRow();
                td = new TableCell();

                //테이블의 열마다 체크박스를 추가하고 ID를 열의 ID와 매핑시킨다.
                CheckBox chkbox = new CheckBox();
                //BookingID가 복합키라서... 설계 오류.
                chkbox.ToolTip = booking.ID.ToString().Trim() + "_" +
                                 booking.MovieID.ToString().Trim() + "_" +
                                 booking.TheaterID.ToString().Trim() + "_" +
                                 booking.Playdatetime.ToString().Trim() + "_" +
                                 booking.Seatrow.ToString().Trim() + "_" +
                                 booking.Seatnumber.ToString().Trim();

                chkbox.ID = "CHECKBOXID_" + ID_i;
                ID_i++;

                td.Controls.Add(chkbox);

                tr.Cells.Add(td);

                //영화 상영시간이 현재시간보다 느리면 예매취소 불가능.
                long TimeNOW  = Convert.ToInt64(DateTime.Now.ToString("yyyyMMddHHmmss"));
                long TimeBOOK = Convert.ToInt64(DateTime.ParseExact(booking.Playdatetime, "yyyy-MM-dd tt h:mm:ss", null).ToString("yyyyMMddHHmmss"));
                if (TimeNOW > TimeBOOK)
                {
                    chkbox.Enabled = false;
                }
                // 루프를 돌면서 각 셀을 설정한다.
                for (int j = 0; j < ColCount; j++)
                {
                    td = new TableCell();
                    //임시
                    switch (j)
                    {
                    case 0:
                        td.Text = booking.Playdatetime;
                        break;

                    case 1:
                        td.Text = booking.Moviename;
                        break;

                    case 2:
                        td.Text = booking.TheaterID + "관";
                        break;

                    case 3:
                        td.Text = booking.Seatrow + "열";
                        break;

                    case 4:
                        td.Text = booking.Seatnumber + "번";
                        break;

                    case 5:
                        td.Text = booking.Viewingclass;
                        break;
                    }

                    tr.Cells.Add(td);
                }

                tr.BackColor = Color.White;
                Table1.Rows.Add(tr);
            }
        }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int ColCount = 4;

            LoginedMember = (Member)Session["MEMBER"];
            dbManager     = (DBManager)Session["DBadmin"];

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

            tr.Cells.Add(td);
            //테이블 이름중 1번은 계정명이므로 제외하고 테이블 제목으로 만든다.
            List <string> TableNames = dataSet.Point.GetMemberNameToSting();

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

            //테이블 내용을 채우기 전에 포인트 사용내역을 받아온다.
            string Command = "SELECT * FROM Point WHERE ID=@id ORDER BY Occuredatetime ASC";
            List <Tuple <string, object> > Params = new List <Tuple <string, object> >();

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

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

            //포인트 사용내역만큼 열을 만들어 채워준다.
            foreach (var point in points)
            {
                tr = new TableRow();
                td = new TableCell();

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

                    case 1:
                        td.Text = point.Usedvalue;
                        break;

                    case 2:
                        td.Text = point.Rechargedvalue;
                        break;

                    case 3:
                        td.Text             = point.Remainvalue;
                        RecentlyRemainPoint = Convert.ToInt32(td.Text);
                        break;
                    }

                    tr.Cells.Add(td);
                }

                tr.BackColor = Color.White;
                Table1.Rows.Add(tr);
            }
        }
コード例 #17
0
        //페이지로드
        protected void Page_Load(object sender, EventArgs e)
        {
            LoginedMember = (Member)Session["MEMBER"];
            dbManager     = (DBManager)Session["DBAdmin"];
            int       ColCount = 6;
            TableRow  tr       = new TableRow();
            TableCell td       = new TableCell();

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

                case 1:
                    td.Text = "영화명";
                    break;

                case 2:
                    td.Text = "상영관";
                    break;

                case 3:
                    td.Text = "좌석열";
                    break;

                case 4:
                    td.Text = "좌석번호";
                    break;

                case 5:
                    td.Text = "관람등급";
                    break;
                }
                tr.Cells.Add(td);
            }

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

            //영화 목록 호출
            string Command = "SELECT * FROM Booking Where ID = @ID";
            List <Tuple <string, object> > Params = new List <Tuple <string, object> >();

            Params.Add(new Tuple <string, object>("@ID", LoginedMember.ID));
            SqlDataReader      reader   = dbManager.GetDataList(Command, Params);
            List <Bookinginfo> Bookings = Bookinginfo.SqlDataReaderToBooking(reader);

            foreach (var booking in Bookings)
            {
                tr = new TableRow();
                td = new TableCell();

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

                    case 1:
                        td.Text = booking.Moviename;
                        break;

                    case 2:
                        td.Text = booking.TheaterID + "관";
                        break;

                    case 3:
                        td.Text = booking.Seatrow + "열";
                        break;

                    case 4:
                        td.Text = booking.Seatnumber + "번";
                        break;

                    case 5:
                        td.Text = booking.Viewingclass;
                        break;
                    }

                    tr.Cells.Add(td);
                }

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