예제 #1
0
		void OnSelectConsumer(Guid? consumerUid)
		{
			if (consumerUid.HasValue)
				Bootstrapper.MainViewModel.ConsumersViewModel.Select(consumerUid.Value);
			else
			{
				var selectConsumerViewModel = new SelectConsumerViewModel("Выбор лицевого счета для привязки");
				if (DialogService.ShowModalWindow(selectConsumerViewModel))
					Consumer = selectConsumerViewModel.SelectedConsumer.Consumer;
			}
		}
예제 #2
0
		void OnChangeParent()
		{
			var selectConsumerViewModel = new SelectConsumerViewModel("Выбор группы для перемещения", SelectedConsumer.Consumer.UID, true);
			if (DialogService.ShowModalWindow(selectConsumerViewModel) && selectConsumerViewModel.SelectedConsumer != null)
			{
				var parentConsumerViewModel = AllConsumers.FirstOrDefault(x => x.Consumer.UID == selectConsumerViewModel.SelectedConsumer.Consumer.UID);
				if (parentConsumerViewModel != null)
				{
					SelectedConsumer.Consumer = DbCache.GetConsumer(SelectedConsumer.Consumer.UID);
					SelectedConsumer.Consumer.ParentUID = selectConsumerViewModel.SelectedConsumer.Consumer.UID;

					DbCache.SaveConsumer(SelectedConsumer.Consumer);

					var consumerViewModel = SelectedConsumer;
					SelectedConsumer.Parent.RemoveChild(SelectedConsumer);

					parentConsumerViewModel.AddChild(consumerViewModel);
					consumerViewModel.ExpandToThis();

					SelectedConsumer = consumerViewModel;
					DbCache.AddJournalForUser(JournalType.EditConsumer, 
						SelectedConsumer.Consumer, 
						string.Format("Перемещение в группу \"{0}\"", selectConsumerViewModel.SelectedConsumer.Consumer.Name));
				}
			}
		}