Beispiel #1
0
        public void AddRow()
        {
            if (RoomStates.Count() > 0)
            {
                if (RoomStates[RoomStates.Count() - 1].Name == null && RoomStates[RoomStates.Count() - 1].Color == null)
                {
                    new MessageWindow(thiswindow, "有空行还未填写").ShowDialog();
                    return;
                }
                else if (RoomStates[RoomStates.Count() - 1].Name == null)
                {
                    new MessageWindow(thiswindow, "房间状态不能为空").ShowDialog();
                    return;
                }
            }
            RoomStateModel rt = new RoomStateModel()
            {
                StateID = Guid.NewGuid(),
                Color   = "默认(灰色)"
            };

            RoomStates.Add(rt);
        }
Beispiel #2
0
 public void LoadData()
 {
     GetRoomStates = new ObservableCollection <RoomStateModel>();
     using (RetailContext context = new RetailContext())
     {
         var rmtypes = context.RoomStates.ToList();
         foreach (RoomStateModel rt in rmtypes)
         {
             GetRoomStates.Add(rt);
         }
     }
     if (RoomStates != null)
     {
         RoomStates.Clear();
     }
     else
     {
         RoomStates = new ObservableCollection <RoomStateModel>();
     }
     foreach (RoomStateModel rs in GetRoomStates)
     {
         RoomStates.Add(rs);
     }
 }