示例#1
0
        public NoteManager(Patron patron, string menuOption, Note noteSelected)
        {
            _presenter = new NotePresenter(this);
            _patron = patron;
            DataContext = patron;
            InitializeComponent();
            if (noteSelected != null)
            {
                NoteListView.SelectedValue = noteSelected;
                NoteBoxActive.Text = noteSelected.Text;
            }
            if (menuOption == "active")
            {
                noteTabs.SelectedIndex = 0;
                CriticalCheckboxUpdate.IsChecked = noteSelected.Critical;
            }
            if (menuOption == "archived")
            {
                noteTabs.SelectedIndex = 1;
            }
            if (menuOption == "add")
            {
                noteTabs.SelectedIndex = 0;
                DiscardButton.Visibility = Visibility.Visible;
                CriticalCheckbox.Visibility = Visibility.Visible;
                AddButton.Visibility = Visibility.Visible;

                NewNoteButton.Visibility = Visibility.Hidden;
                CriticalCheckboxUpdate.Visibility = Visibility.Hidden;
                UpdateButton.Visibility = Visibility.Hidden;
                ArchiveButton.Visibility = Visibility.Hidden;
                NoteBoxActive.Text = "";
                NoteBoxActive.Focus();
            }
        }
        public BadgeToolBar(Patron patron, ApplicationPresenter presenter)
        {
            _patron = patron;
            _presenter = presenter;
            InitializeComponent();
            PrintedName.Text = patron.CurrentCard.Name;

            EligibleCard prompt = new EligibleCard();
            prompt.CardName = "Select Badge";
            TemplateCombo.Items.Add(prompt);

            foreach (XmlCardDefinition def in LoginPresenter.DefinitionsList)
            {
                if (def.TemplateType.Equals("BADGE"))
                {
                    if (def.CardFields.Count > 0)
                    {
                        foreach (CardFields project in def.CardFields)
                        {
                            EligibleCard ec = new EligibleCard();
                            ec.CardProject = def.TemplateFileName;
                            ec.CardProject = ec.CardProject.Substring(0, ec.CardProject.IndexOf("."));
                            ec.CardName = project.CardName;
                            ec.CardType = "BADGE";
                            ec.ExpireMonths = def.ExpireMonths;
                            ec.CardFields = def.CardFields.Find(x => x.CardName == ec.CardName);
                            TemplateCombo.Items.Add(ec);
                        }
                    }
                }
            }
        }
示例#3
0
        public void LoadBadgeBox(Patron patron, string last_badge)
        {
            _badge = last_badge;
            List<Badge> tempBadges = new List<Badge>();
            foreach (Badge badge in patron.Badges)
            {
                tempBadges.Add(badge);
            }

            ListofBadges.ItemsSource = tempBadges;
            badgeGrid.DataContext = tempBadges;
            ListofBadges.SelectedIndex = 0;
        }
 public UserCardDetailsViewTabsTop(Patron patron, Domain.IdCard newCard, byte[] imageBytes)
 {
     InitializeComponent();
     DataContext = new UserCardDetailsViewPresenter(this, patron, newCard, imageBytes);
 }
示例#5
0
 public BadgeBox(Patron patron)
 {
     InitializeComponent();
     LoadBadgeBox(patron, null);
 }
 public NewCardInformationBox(Patron patron)
 {
     InitializeComponent();
 }
        public IDCardToolBar(Patron patron, ApplicationPresenter presenter, UserCardDetailsViewPresenter userCardDetailsViewPresenter)
        {
            _patron = patron;
            _presenter = presenter;
            _userCardDetailsViewPresenter = userCardDetailsViewPresenter;
            InitializeComponent();

            // Check to see if user has rights to print patron
            takePictureButton.Visibility = Visibility.Hidden;
            reissueButton.Visibility = Visibility.Hidden;
            reprintButton.Visibility = Visibility.Hidden;

            if (!ApplicationPresenter.Manager.IsProxPrinter())
                readCardButton.Visibility = Visibility.Hidden;

            if (presenter.PatronIsDoNotIssue)
            {
                TemplateCombo.Visibility = Visibility.Hidden;
                takePictureButton.Visibility = Visibility.Hidden;
                return;
            }

            Session session = SecurityContextHolder.Credential as Session;

            string current_primary_role = "";
            string new_primary_role = "";

            try {current_primary_role = _patron.CurrentCard.CardRole.Primary; }
            catch (Exception e) { }

            try { new_primary_role = _patron.NewCard.CardRole.Primary; }
            catch (Exception e) { }

            foreach (Authorize authorize in session.Authorized.Authorize)
            {
                if (authorize.role == current_primary_role)
                {
                    reprintButton.Visibility = Visibility.Visible;
                }
                if (authorize.role == new_primary_role)
                {
                    if (presenter.View._camera != null && presenter.View._camera.CameraDevice != IntPtr.Zero)
                        takePictureButton.Visibility = Visibility.Visible;
                    reissueButton.Visibility = Visibility.Visible;
                    reprintButton.Visibility = Visibility.Visible;
                }
            }

            if (takePictureButton.Visibility == Visibility.Hidden && reissueButton.Visibility == Visibility.Hidden && reprintButton.Visibility == Visibility.Hidden)
            {
                TemplateCombo.Visibility = Visibility.Hidden;
                NotPrintable.Visibility = Visibility.Visible;
            }
            else
            {
                TemplateCombo.Visibility = Visibility.Visible;
                NotPrintable.Visibility = Visibility.Hidden;
            }

            foreach (EligibleCard ec in patron.NewCard.EligibleCards)
            {
                XmlCardDefinition def = LoginPresenter.DefinitionsList.Find(x => x.TemplateType.Equals("ID"));
                if (def == null)
                {
                    TemplateCombo.Visibility = Visibility.Hidden;
                    reissueButton.Visibility = Visibility.Hidden;
                    reprintButton.Visibility = Visibility.Hidden;
                }
                else
                {
                    ec.CardProject = def.TemplateFileName.Substring(0, def.TemplateFileName.IndexOf("."));
                    TemplateCombo.Items.Add(ec);
                }
            }

            if (TemplateCombo.SelectedItem == null)
                TemplateCombo.SelectedIndex = 0;

            if (patron.CurrentCard == null)
            {
                reprintButton.Visibility = Visibility.Hidden;
            }
            else
            {
                _presenter.View.menuBar.GoldPatron.Tag = _patron.Identifiers.PersonId;
                _presenter.View.menuBar.GoldPatron.Visibility = System.Windows.Visibility.Visible;
                _presenter.View.menuBar.PatronPhoto.Tag = _patron.Identifiers.PersonId;
                _presenter.View.menuBar.PatronPhoto.Visibility = System.Windows.Visibility.Visible;
            }
        }
        private void UpdatePrintedValues(Patron patron)
        {
            if (patron.CurrentCard != null)
            {
                if (_patron.CurrentCard == null)
                {
                    _presenter.ShowPatron(patron.Identifiers.PersonId);
                    return;
                }
                _patron.CurrentCard.Beard = patron.CurrentCard.Beard;
                _patron.CurrentCard.CardId = patron.CurrentCard.CardId;
                _patron.CurrentCard.CardRole = patron.CurrentCard.CardRole;
                _patron.CurrentCard.ExpirationDate = patron.CurrentCard.ExpirationDate;
                _patron.CurrentCard.IssueDate = patron.CurrentCard.IssueDate;
                _patron.CurrentCard.IssueNumber = patron.CurrentCard.IssueNumber;
                _patron.CurrentCard.Name = patron.CurrentCard.Name;
                _patron.CurrentCard.ProxId = patron.CurrentCard.ProxId;
                _patron.CurrentCard.LostOrStolen = patron.CurrentCard.LostOrStolen;
            }

            if (patron.NewCard != null)
            {
                _patron.NewCard.Beard = patron.NewCard.Beard;
                _patron.NewCard.CardId = patron.NewCard.CardId;
                _patron.NewCard.CardRole = patron.NewCard.CardRole;
                _patron.NewCard.ExpirationDate = patron.NewCard.ExpirationDate;
                _patron.NewCard.IssueDate = patron.NewCard.IssueDate;
                _patron.NewCard.IssueNumber = patron.NewCard.IssueNumber;
                _patron.NewCard.Name = patron.NewCard.Name;
                _patron.NewCard.LostOrStolen = patron.NewCard.LostOrStolen;
            }
        }
示例#9
0
 public FlagViewBox(Patron patron)
 {
     _patron = patron;
     InitializeComponent();
 }
 public CurrentCardInformationBox(Patron patron, ApplicationPresenter presenter)
 {
     _patron = patron;
     _presenter = presenter;
     InitializeComponent();
 }
        public UserCardDetailsTotalTabs(Patron patron, Domain.IdCard newIdCard, byte[] imageBytes, ApplicationPresenter presenter)
        {
            try
            {
                InitializeComponent();
                UserCardDetailsViewPresenter userCardDetailsViewPresenter = new UserCardDetailsViewPresenter(this, patron, newIdCard, imageBytes);
                DataContext = userCardDetailsViewPresenter;
                bool eMail = false;

                if (presenter.PatronIsDoNotIssue)
                    this.Badges.Visibility = System.Windows.Visibility.Hidden;
                else if (patron.CurrentCard != null)
                {
                    this.Badges.Visibility = System.Windows.Visibility.Hidden;
                    Session session = SecurityContextHolder.Credential as Session;
                    foreach (Authorize authorize in session.Authorized.Authorize)
                    {
                        if (authorize.role.Equals("Badge"))
                        {
                            this.Badges.Visibility = System.Windows.Visibility.Visible;
                            badgeBox.Content = new BadgeBox(patron);
                            badgeToolBar.Content = new BadgeToolBar(patron, presenter);
                            break;
                        }
                        if (authorize.role.Equals("Email"))
                            eMail = true;
                    }
                }

                notesControl.Content = new NotesBox(patron);
                idCardToolBar.Content = new IDCardToolBar(patron, presenter, userCardDetailsViewPresenter);

                _personId = patron.Identifiers.PersonId;
                _imageBytes = imageBytes;
                if (patron.Notes.ActiveNotes != null)
                {

                    foreach (Note activeNote in patron.Notes.ActiveNotes)
                    {
                        if (activeNote.Critical == true)
                        {
                            string menuOpening = "active";
                            var NoteManger = new NoteManager(patron, menuOpening, activeNote);
                            NoteManger.Show();
                            break;
                        }
                    }
                }

                if (patron.CurrentCard == null)
                {
                    currentCard.Content = new NoCurrentCardBox();
                }
                else
                {
                    currentCard.Content = new CurrentCardInformationBox(patron, presenter);
                }

                if (newIdCard == null)
                {
                    if (patron.NewCard != null && patron.NewCard.CardRole.Secondary == "BANNED")
                        newCard.Content = new BannedBox();
                    else
                        newCard.Content = new DoNotIssueBox();
                }
                else
                {
                    newCard.Content = new NewCardInformationBox(patron);
                }

                personInformation.Content = new PersonalInformationBox(patron.Names.PreferredFirstName, patron.Identifiers.ByuId, eMail);
                residentialAddress.Content = new ResidentialAddressBox();
                permanentAddress.Content = new PermanentAddressBox();
            }
            catch (Exception x)
            {
                MessageBox.Show("EXCEPTION " + x.Message);

            }
        }
 public void UpdateBadges(Patron patron, string badge)
 {
     ((BadgeBox)badgeBox.Content).LoadBadgeBox(patron, badge);
 }
示例#13
0
 public NotesBox(Patron patron)
 {
     InitializeComponent();
     _patron = patron;
 }