Exemplo n.º 1
0
 public void AddMediaAssignmentRule()
 {
     try
     {
         if (!String.IsNullOrWhiteSpace(MediaRuleSuffixText) &&
             SelectedMediaRule != null)
         {
             Model.Local.MediaAssignmentRuleRepository MediaAssignmentRuleRepository = new Model.Local.MediaAssignmentRuleRepository();
             if (!MediaAssignmentRuleRepository.ExistSuffix(MediaRuleSuffixText))
             {
                 Model.Local.MediaAssignmentRule newMediaAssignmentRule = new Model.Local.MediaAssignmentRule()
                 {
                     SuffixText = MediaRuleSuffixText,
                     AssignName = MediaRuleAssignName,
                     Rule       = (short)SelectedMediaRule.Marq,
                 };
                 MediaAssignmentRuleRepository.Add(newMediaAssignmentRule);
                 ListMediaAssignmentRule.Add(newMediaAssignmentRule);
             }
             else
             {
                 MessageBox.Show("Ce suffixe est déjà associée à une règle, veuillez supprimer la règle actuelle d'abord !", "Prestaconnect", MessageBoxButton.OK, MessageBoxImage.Information);
             }
         }
         else
         {
             MessageBox.Show("Vous devez renseigner le suffixe !", "Prestaconnect", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
     catch (Exception ex) { Core.Error.SendMailError(ex.ToString()); }
 }
Exemplo n.º 2
0
 public void DeleteMediaAssignmentRule()
 {
     try
     {
         Model.Local.MediaAssignmentRuleRepository MediaAssignmentRuleRepository = new Model.Local.MediaAssignmentRuleRepository();
         if (SelectedMediaAssignmentRule != null && MediaAssignmentRuleRepository.ExistSuffix(SelectedMediaAssignmentRule.SuffixText))
         {
             MediaAssignmentRuleRepository.Delete(MediaAssignmentRuleRepository.ReadSuffix(SelectedMediaAssignmentRule.SuffixText));
             ListMediaAssignmentRule.Remove(SelectedMediaAssignmentRule);
         }
         MediaAssignmentRuleRepository = null;
     }
     catch (Exception ex) { Core.Error.SendMailError(ex.ToString()); }
 }