Example #1
0
        /// <summary>
        /// Handles the Click event of the btnAddOrg control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private void btnAddOrg_Click(object sender, RoutedEventArgs e)
        {
            addEditMode           = AddEditMode.Add;
            spUser.Visibility     = System.Windows.Visibility.Visible;
            tbFirstName.IsEnabled = true;
            autoEmail.Text        = "";
            autoEmail.IsEnabled   = true;
            tbFirstName.Text      = "";
            tbLastName.IsEnabled  = true;
            tbLastName.Text       = "";
            tbPhone.IsEnabled     = true;
            tbPhone.Text          = "";

            autoEmail.ItemsSource = null;
            autoEmail.ItemsSource = applicationViewModel.UserNames;

            //  SwitchMode(UserConrolUIMode.Add);

            AddEditOrganization aeo = new AddEditOrganization();

            aeo.Title                   = "Add Organization";
            aeo.AddEditMode             = addEditMode;
            aeo.cboActive.SelectedIndex = 0;
            aeo.Closed                 += new EventHandler(aeo_Closed);
            aeo.Show();
        }
Example #2
0
        /// <summary>
        /// Edits the selected org.
        /// </summary>
        /// <param name="orgDto">The org dto.</param>
        private void EditSelectedOrg(ref OrganizationDto modelODto)
        {
            AddEditOrganization aeo = new AddEditOrganization();

            aeo.DataContext = modelODto;
            aeo.tbOrganizationName.DataContext = aeo.DataContext;
            aeo.cboActive.SelectedIndex        = (modelODto.Active) ? 0 : 1;   //                 GetComboIndex(cboActive, modelODto.Active);
            aeo.AddEditMode   = addEditMode;
            aeo.SelectedOrgID = selectedOrgID;
            aeo.Closed       += new EventHandler(aeo_Closed);
            aeo.Show();
        }
Example #3
0
        /// <summary>
        /// Handles the Closed event of the aeo control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs" /> instance containing the event data.</param>
        void aeo_Closed(object sender, EventArgs e)
        {
            AddEditOrganization aeo = (AddEditOrganization)sender as AddEditOrganization;

            if (aeo.DialogResult == true)
            {
                aeo.Closed -= new EventHandler(aeo_Closed);

                organizationViewModel          = new OrganizationViewModel();
                organizationViewModel.DtoRead += new EventHandler <NotificationEventArgs <Exception> >(organizationViewModel_DtoRead);
                organizationViewModel.ReadAll();
                spMsg.Visibility = System.Windows.Visibility.Visible;
                if (addEditMode == AddEditMode.Add)
                {
                    SucessMsg.Text = "Organization " + aeo.tbOrganizationName.Text + " has been added.";
                }
                else
                {
                    SucessMsg.Text = "Organization " + aeo.tbOrganizationName.Text + " has been updated.";
                }
                waitCursor.Visibility = System.Windows.Visibility.Visible;
            }
        }