Exemplo n.º 1
0
 public MainWindow()
 {
     this._vm         = new ClientsPageVM();
     this.DataContext = this._vm;
     InitializeComponent();
     ContactTypeBO.AddEmail();
     _vm.SendBirthDayMails();
 }
Exemplo n.º 2
0
 private void lvContacts_SelectionChanged(object sender, RoutedEventArgs e)
 {
     if ((lvContacts.SelectedItem) != null)
     {
         contactValueBox.Text = (lvContacts.SelectedItem as ContactBO).Value;
         ContactTypeBO boo = (lvContacts.SelectedItem as ContactBO).ContactType;
         cBoxContactTypes.Text = boo.Name;
     }
     e.Handled = true;
 }
Exemplo n.º 3
0
        private void lvContactTypes_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ContactTypeBO ctbo = lvContactTypes.SelectedItem as ContactTypeBO;

            if (ctbo != null)
            {
                txtContactTypeName.Text = ctbo.Name;
            }
            e.Handled = true;
        }
Exemplo n.º 4
0
 public static ObservableCollection <ContactTypeBO> GetAllContactTypes()
 {
     using (ElibriumEntities db = new ElibriumEntities())
     {
         var contactTypes = db.ContactType.ToList();
         ObservableCollection <ContactTypeBO> cts = new ObservableCollection <ContactTypeBO>();
         foreach (var contactType in contactTypes)
         {
             ContactTypeBO ct = new ContactTypeBO(contactType);
             cts.Add(ct);
         }
         return(cts);
     }
 }
Exemplo n.º 5
0
 private void btnSaveContactType_Click(object sender, RoutedEventArgs e)
 {
     if (lvContactTypes.SelectedItem != null)
     {
         ContactTypeBO bo = new ContactTypeBO((lvContactTypes.SelectedItem as ContactTypeBO).Id, txtContactTypeName.Text);
         bo.AddOrUpdate();
         lvContactTypes.ItemsSource = _vm.ContactTypes;
         lvContactTypes.UpdateLayout();
     }
     else
     {
         MessageBoxResult result = MessageBox.Show("Select a Contact Type to edit first", "Warning", MessageBoxButton.OK);
     }
     e.Handled = true;
 }
Exemplo n.º 6
0
 private void btnAddContact_Click(object sender, RoutedEventArgs e)
 {
     if (_vm.ContactTypes.Count > 0)
     {
         if (!contactValueBox.Text.Equals(""))
         {
             PersonBO      a           = lvPersons.SelectedItem as PersonBO;
             ContactTypeBO contactType = cBoxContactTypes.SelectedItem as ContactTypeBO;
             if (a != null)
             {
                 ContactBO cbo = new ContactBO(contactValueBox.Text, (lvPersons.SelectedItem as PersonBO).Id, (cBoxContactTypes.SelectedItem as ContactTypeBO).Id);
                 if (contactType.Name.Equals("Email"))
                 {
                     if (!IsValid(contactValueBox.Text))
                     {
                         MessageBoxResult result = MessageBox.Show("The email is invalid, aborting", "Warning", MessageBoxButton.OK);
                         return;
                     }
                 }
                 cbo.AddOrUpdate();
                 this._vm._contacts     = a.Contacts;
                 lvContacts.ItemsSource = _vm.Contacts;
                 lvContacts.UpdateLayout();
             }
             else
             {
                 MessageBox.Show("Select a Person first, to whom you want to add the contact", "A big fat warning", MessageBoxButton.OK);
             }
         }
         else
         {
             MessageBox.Show("Contact value can not be empty", "Warning", MessageBoxButton.OK);
         }
     }
     else
     {
         MessageBox.Show("Add atleast one contact type first", "Warning", MessageBoxButton.OK);
     }
     e.Handled = true;
 }
Exemplo n.º 7
0
 private void btnAddContactType_Click(object sender, RoutedEventArgs e)
 {
     if (!txtContactTypeName.Text.Equals(""))
     {
         if (txtContactTypeName.Text.Length > 32)
         {
             MessageBoxResult result = MessageBox.Show("Contact Type name can not be longer than 32", "Warning", MessageBoxButton.OK);
         }
         else
         {
             ContactTypeBO bo = new ContactTypeBO(txtContactTypeName.Text);
             bo.AddOrUpdate();
             lvContactTypes.ItemsSource = _vm.ContactTypes;
             lvContactTypes.UpdateLayout();
         }
     }
     else
     {
         MessageBoxResult result = MessageBox.Show("Contact Type name can not be empty", "Warning", MessageBoxButton.OK);
     }
     e.Handled = true;
 }
Exemplo n.º 8
0
 public bool ContactTypeInUse(ContactTypeBO a)
 {
     return(ContactTypeService.ContactTypeInUse(a.parseDomain()));
 }