示例#1
0
		static void Notify(Zone zone, Email email)
		{
			string message = " Изменение состояния зоны " +
				zone.PresentationName +
				" на состояние " +
				zone.ZoneState.StateType.ToDescription();
			MailHelper.Send(FiresecManager.SystemConfiguration.EmailData.EmailSettings, email.Address, message, email.MessageTitle);
		}
		private static void AddSampleEmail()
		{
			Email email = new Email
			{
				Address = "*****@*****.**",
				Name = "Максим Обычев",
				States = new List<StateType>(),
				MessageTitle = "Test message"
			};
			email.States.Add(StateType.Fire);
			email.States.Add(StateType.Failure);
			FiresecManager.SystemConfiguration.EmailData.Emails.Add(email);
		}
示例#3
0
		static void CheckForNotify(Email email)
		{
			foreach (var zone in FiresecManager.Zones)
			{
				if (email.Zones.Contains(zone.UID) && 
					email.States.Contains(zone.ZoneState.StateType))
				{
					Notify(zone, email);
					email.IsActivated = true;
					break;
				}
			}
		}
		public EmailDetailsViewModel(Email email)
		{
			SelectZonesCommand = new RelayCommand(OnSelectZonesCommand);
			StateTypes = new ObservableCollection<StateTypeViewModel>();
			foreach (StateType stateType in Enum.GetValues(typeof(StateType)))
			{
				StateTypes.Add(new StateTypeViewModel(stateType));
			}
			Title = "Редактировать получателя";
			EmailViewModel = new EmailViewModel(email);
			StateTypes.Where(
				eventViewModel => email.States.Any(
					x => x == eventViewModel.StateType)).All(x => x.IsChecked = true);
		}
示例#5
0
		static void CheckForDeactivate(Email email)
		{
			bool shouldDeactivate = true;
			foreach (var zoneGuid in email.Zones)
			{
				var zone = FiresecManager.Zones.FirstOrDefault(x => x.UID == zoneGuid);
				if (email.States.Contains(zone.ZoneState.StateType))
				{
					shouldDeactivate = false;
					break;
				}
			}
			if (shouldDeactivate)
			{
				email.IsActivated = false;
			}
		}
示例#6
0
		public EmailViewModel()
		{
			Email = new Email();
		}
示例#7
0
		public EmailViewModel(Email email)
		{
			Email = email;
		}