Exemplo n.º 1
0
 private void BuildCache()
 {
     Cache.Images.ForEach(img =>
     {
         AddImage(img);
     });
     Cache.GiftGroups.ForEach(g =>
     {
         GiftGroupViewModel giftGroupVM = new GiftGroupViewModel(g);
         LocalCache.AllGiftGroupVMs.Add(giftGroupVM);
     });
     Cache.Gifts.ForEach(g =>
     {
         GiftViewModel giftVM = new GiftViewModel(g);
         giftVM.Initialize();
         LocalCache.AllGiftVMs.Add(giftVM);
     });
     LocalCache.AllGiftGroupVMs.ForEach(g =>
     {
         g.Initialize();
     });
     Cache.RoomGroups.ForEach(rg =>
     {
         RoomGroupViewModel roomGroupVM = new RoomGroupViewModel(rg);
         LocalCache.AllRoomGroupVMs.Add(roomGroupVM);
     });
     //Create all the RoomViewModels so that we can initialize the RoomVMs of RoomGroupVM
     Cache.Rooms.ForEach(r =>
     {
         RoomViewModel roomVM = new RoomViewModel(r);
         roomVM.Initialize();
         LocalCache.AllRoomVMs.Add(roomVM);
     });
     LocalCache.AllRoomGroupVMs.ForEach(rgv =>
     {
         rgv.Initialize();
     });
     Cache.Commands.ForEach(c =>
     {
         if (c.Application_Id == ApplicationId || c.Application_Id == BuiltIns.AllApplication.Id)
         {
             CommandViewModel vm = new CommandViewModel(c);
             vm.Initialize();
             LocalCache.AllCommandVMs.Add(vm);
         }
     });
     Cache.Roles.ForEach(r =>
     {
         if (r.Application_Id == ApplicationId || r.Application_Id == BuiltIns.AllApplication.Id)
         {
             RoleViewModel vm = new RoleViewModel(r);
             LocalCache.AllRoleVMs.Add(vm);
         }
     });
     Cache.RoleCommands.ForEach(rc =>
     {
         if (rc.Application_Id == ApplicationId || rc.Application_Id == BuiltIns.AllApplication.Id)
         {
             RoleCommandViewModel vm = new RoleCommandViewModel(rc);
             vm.Initialize();
             LocalCache.AllRoleCommandVMs.Add(vm);
         }
     });
     LocalCache.AllRoleVMs.ForEach(r =>
     {
         r.Initialize();
     });
     Cache.RoomRoles.ForEach(rr =>
     {
         RoomRoleViewModel vm = new RoomRoleViewModel(rr);
         vm.Initialize();
         LocalCache.AllRoomRoleVMs.Add(vm);
     });
     Cache.ExchangeRates.ForEach(er =>
     {
         ExchangeRateViewModel vm = new ExchangeRateViewModel(er);
         LocalCache.AllExchangeRateVMs.Add(vm);
     });
 }
		private void BuildCache()
		{
			Cache.Images.ForEach(img =>
			{
                AddImage(img);
			});
			Cache.GiftGroups.ForEach(g =>
			{
				GiftGroupViewModel giftGroupVM = new GiftGroupViewModel(g);
				LocalCache.AllGiftGroupVMs.Add(giftGroupVM);
			});
			Cache.Gifts.ForEach(g =>
			{
				GiftViewModel giftVM = new GiftViewModel(g);
				giftVM.Initialize();
				LocalCache.AllGiftVMs.Add(giftVM);
			});
			LocalCache.AllGiftGroupVMs.ForEach(g =>
			{
				g.Initialize();
			});
			Cache.RoomGroups.ForEach(rg =>
			{
				RoomGroupViewModel roomGroupVM = new RoomGroupViewModel(rg);
				LocalCache.AllRoomGroupVMs.Add(roomGroupVM);
			});
			//Create all the RoomViewModels so that we can initialize the RoomVMs of RoomGroupVM
			Cache.Rooms.ForEach(r =>
			{
				RoomViewModel roomVM = new RoomViewModel(r);
				roomVM.Initialize();
				LocalCache.AllRoomVMs.Add(roomVM);
			});
			LocalCache.AllRoomGroupVMs.ForEach(rgv =>
			{
				rgv.Initialize();
			});
			Cache.Commands.ForEach(c =>
			{
				if (c.Application_Id == ApplicationId || c.Application_Id == BuiltIns.AllApplication.Id)
				{
					CommandViewModel vm = new CommandViewModel(c);
					vm.Initialize();
					LocalCache.AllCommandVMs.Add(vm);
				}
			});
			Cache.Roles.ForEach(r =>
			{
				if (r.Application_Id == ApplicationId || r.Application_Id == BuiltIns.AllApplication.Id)
				{
					RoleViewModel vm = new RoleViewModel(r);
					LocalCache.AllRoleVMs.Add(vm);
				}
			});
			Cache.RoleCommands.ForEach(rc =>
			{
				if (rc.Application_Id == ApplicationId || rc.Application_Id == BuiltIns.AllApplication.Id)
				{
					RoleCommandViewModel vm = new RoleCommandViewModel(rc);
					vm.Initialize();
					LocalCache.AllRoleCommandVMs.Add(vm);
				}
			});
			LocalCache.AllRoleVMs.ForEach(r =>
			{
				r.Initialize();
			});
			Cache.RoomRoles.ForEach(rr =>
			{
				RoomRoleViewModel vm = new RoomRoleViewModel(rr);
                vm.Initialize();
				LocalCache.AllRoomRoleVMs.Add(vm);
			});
            Cache.ExchangeRates.ForEach(er =>
                {
                    ExchangeRateViewModel vm = new ExchangeRateViewModel(er);
                    LocalCache.AllExchangeRateVMs.Add(vm);
                });

		}