public void Init()
        {
            if (LineCollection.Count > 0) return;

            foreach (var line in LineNames)
            {
                var lineName = string.Empty;
                var lineType = string.Empty;
                if (line.Length > 0)
                {
                    lineName = line.Substring(0, 1);
                    lineType = line.Substring(1, 1);
                }
                var newLine = new LineModel
                {
                    LineName = lineName
                };

                string[] seats = { };
                switch (lineType)
                {
                    case "1":
                        seats = Line1;
                        break;
                    case "2":
                        seats = Line2;
                        break;
                    default:
                        seats = Line0;
                        break;
                }

                foreach (var s in seats)
                {
                    var seat = new SeatModel();
                    seat.LineName = newLine.LineName;
                    switch (s)
                    {
                        case "":
                            seat.SeatNum = "";
                            seat.SeatState = SeatStateEnum.Nothing;
                            break;
                        default:
                            seat.SeatNum = s;
                            seat.SeatState = SeatStateEnum.ChoiceNobodyNormal;
                            break;
                    }
                    newLine.SeatCollection.Add(seat);
                }

                LineCollection.Add(newLine);
            }
            if (1 == 1)
            {
            }
        }
Example #2
0
        //public void GetSeatStateAll()
        //{
        //    var result = ViewModelLocator.SeatVM.LineCollection;
        //    Caller.seatStateAll(result);
        //}

        public void SetSeatState(SeatModel setSeat)
        {
            var seat = ViewModelLocator.SeatVM.LineCollection
                        .SelectMany(p => p.SeatCollection)
                        .FirstOrDefault(p => p.LineName == setSeat.LineName
                                        && p.SeatNum == setSeat.SeatNum);
            //일단 좌석정보 가지고 오고
            if (seat != null)
            {
                //좌석을 선택한 사람이 동일인이라면 좌석 클리어
                if (seat.ChoiceUser == setSeat.ChoiceUser)
                {
                    seat.SeatState = SeatStateEnum.ChoiceNobodyNormal;
                    seat.ChoiceUser = "";
                    Clients.seatStateChange(seat);
                }
                else
                {
                    if (seat.ChoiceUser == null || seat.ChoiceUser == "")
                    {
                        //선택한 사람이 없어서 동일인이 아닌 것이라면 선택한 사람이 좌석 예약
                        seat.SeatState = SeatStateEnum.ChoiceOther;
                        seat.ChoiceUser = setSeat.ChoiceUser;
                        Clients.seatStateChange(seat);
                    }
                    else
                    { 
                        //선택한 사람이 있는데 다른 사람이 또 선택 한것이라면 메시지 출력
                        Caller.systemMessage("선택하실 수 없는 좌석입니다.");
                    }
                }
            }
            else
            {
                Caller.systemMessage("선택하실 수 없는 좌석입니다.");
            }
        }