public override void Start()
        {
            _worklistTable = new Table <WorklistTableEntry>();
            _worklistTable.Columns.Add(new TableColumn <WorklistTableEntry, bool>(SR.ColumnCreate,
                                                                                  delegate(WorklistTableEntry item) { return(item.Checked); },
                                                                                  delegate(WorklistTableEntry item, bool value) { item.Checked = value; }, 0.5f));
            _worklistTable.Columns.Add(new TableColumn <WorklistTableEntry, string>(SR.ColumnClass,
                                                                                    delegate(WorklistTableEntry item) { return(string.Format("{0} - {1}", item.Class.DisplayName, item.Class.Description)); }, 1.0f));
            _worklistTable.Columns.Add(new TableColumn <WorklistTableEntry, string>(SR.ColumnWorklistName,
                                                                                    delegate(WorklistTableEntry item) { return(item.Name); },
                                                                                    delegate(WorklistTableEntry item, string value) { item.Name = value; }, 1.0f));
            _worklistTable.Columns.Add(new TableColumn <WorklistTableEntry, string>(SR.ColumnWorklistDescription,
                                                                                    delegate(WorklistTableEntry item) { return(item.Description); },
                                                                                    delegate(WorklistTableEntry item, string value) { item.Description = value; }, 1.0f));

            _worklistActionModel = new CrudActionModel(false, true, false);
            _worklistActionModel.Edit.SetClickHandler(EditSelectedWorklist);

            UpdateWorklistActionModel();

            // add validation rule to ensure all worklists that will be created have a name
            this.Validation.Add(new ValidationRule("SelectedWorklist",
                                                   delegate
            {
                bool allWorklistsHaveNames = CollectionUtils.TrueForAll(_worklistTable.Items,
                                                                        delegate(WorklistTableEntry item) { return(!item.Checked || !string.IsNullOrEmpty(item.Name)); });

                return(new ValidationResult(allWorklistsHaveNames, SR.MessageWorklistMustHaveName));
            }));

            base.Start();
        }
        public override void Start()
        {
            _xmlValidationManager = XmlValidationManager.Instance;

            // try to load existing rules
            // if this fails, an exception will be thrown, preventing this component from starting
            var rules = CollectionUtils.Map(_xmlValidationManager.GetRules(_applicationComponentClass),
                                            (XmlElement node) => new Rule(node.OuterXml, _liveComponent));

            _rules.Items.AddRange(rules);

            _componentProperties = CollectionUtils.Select(_applicationComponentClass.GetProperties(),
                                                          p => !p.DeclaringType.Equals(typeof(IApplicationComponent)) &&
                                                          !p.DeclaringType.Equals(typeof(ApplicationComponent)));

            _rulesActionModel = new CrudActionModel(true, false, true);
            _rulesActionModel.Add.SetClickHandler(AddNewRule);
            _rulesActionModel.Delete.SetClickHandler(DeleteSelectedRule);
            _rulesActionModel.Delete.Enabled = false;

            _editor          = CodeEditorFactory.CreateCodeEditor();
            _editor.Language = "xml";

            _editorHost = new ChildComponentHost(this.Host, _editor.GetComponent());
            _editorHost.StartComponent();

            base.Start();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public VisitPractitionersSummaryComponent(List <EnumValueInfo> visitPractitionerRoleChoices)
        {
            _practitionersTable           = new VisitPractitionerTable();
            _visitPractitionerRoleChoices = visitPractitionerRoleChoices;

            _visitPractitionerActionHandler = new CrudActionModel();
            _visitPractitionerActionHandler.Add.SetClickHandler(AddVisitPractitioner);
            _visitPractitionerActionHandler.Edit.SetClickHandler(UpdateSelectedVisitPractitioner);
            _visitPractitionerActionHandler.Delete.SetClickHandler(DeleteSelectedVisitPractitioner);

            _visitPractitionerActionHandler.Add.Enabled = true;
        }
示例#4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public VisitLocationsSummaryComponent(List <EnumValueInfo> visitLocationRoleChoices)
        {
            _locationsTable           = new VisitLocationTable();
            _visitLocationRoleChoices = visitLocationRoleChoices;

            _visitLocationActionHandler = new CrudActionModel();
            _visitLocationActionHandler.Add.SetClickHandler(AddVisitLocation);
            _visitLocationActionHandler.Edit.SetClickHandler(UpdateSelectedVisitLocation);
            _visitLocationActionHandler.Delete.SetClickHandler(DeleteSelectedVisitLocation);

            _visitLocationActionHandler.Add.Enabled = true;
        }
        /// <summary>
        /// Called by the host to initialize the application component.
        /// </summary>
        public override void Start()
        {
            // init lookup handlers
            _cannedTextLookupHandler = new CannedTextLookupHandler(this.Host.DesktopWindow);

            // init recip table here, and not in constructor, because it relies on Host being set
            _recipients = new RecipientTable(this);

            // if exactly 1 template choice, then it is selected
            _selectedTemplate = _templateChoices.Count == 1 ? _templateChoices[0] : null;

            // create soft keys
            UpdateSoftKeys();

            // load the existing conversation, plus editor form data
            GetConversationEditorFormDataResponse formDataResponse = null;

            Platform.GetService <IOrderNoteService>(
                service =>
            {
                var formDataRequest = new GetConversationEditorFormDataRequest(
                    _selectedTemplate != null ? _selectedTemplate.GetStaffRecipients() : new List <string>(),
                    _selectedTemplate != null ? _selectedTemplate.GetGroupRecipients() : new List <string>());
                formDataResponse = service.GetConversationEditorFormData(formDataRequest);

                var request  = new GetConversationRequest(_orderRef, new List <string>(_orderNoteCategories), false);
                var response = service.GetConversation(request);

                _orderRef   = response.OrderRef;
                _orderNotes = response.OrderNotes;
            });


            // init on-behalf of choices
            _onBehalfOfChoices = formDataResponse.OnBehalfOfGroupChoices;
            _onBehalfOfChoices.Insert(0, _emptyStaffGroup);

            // initialize from template (which may be null)
            InitializeFromTemplate(_selectedTemplate, formDataResponse.RecipientStaffs, formDataResponse.RecipientStaffGroups);

            // build the action model
            _recipientsActionModel = new CrudActionModel(true, false, true, new ResourceResolver(this.GetType(), true));
            _recipientsActionModel.Add.SetClickHandler(AddRecipient);
            _recipientsActionModel.Delete.SetClickHandler(DeleteRecipient);

            // init conversation view component
            _orderNoteViewComponent = new OrderNoteViewComponent(_orderNotes);
            _orderNoteViewComponent.CheckedItemsChanged += delegate { NotifyPropertyChanged("CompleteButtonLabel"); };
            _orderNotesComponentHost = new ChildComponentHost(this.Host, _orderNoteViewComponent);
            _orderNotesComponentHost.StartComponent();

            base.Start();
        }
示例#6
0
        public override void Start()
        {
            // create table
            _staffGroupTable = new Table <TableItem>();
            _staffGroupTable.Columns.Add(new TableColumn <TableItem, bool>("Show Folder",
                                                                           delegate(TableItem item) { return(item.IsChecked); },
                                                                           delegate(TableItem item, bool value) { item.IsChecked = value; }));

            _staffGroupTable.Columns.Add(new TableColumn <TableItem, string>("Group Name",
                                                                             delegate(TableItem item) { return(item.Item.Name); }));
            _staffGroupTable.Columns.Add(new TableColumn <TableItem, string>("Description",
                                                                             delegate(TableItem item) { return(item.Item.Description); }));

            _actionModel = new CrudActionModel(false, false, true);
            _actionModel.Delete.SetClickHandler(DeleteStaffGroup);
            _actionModel.Delete.Enabled = false;

            // load existing group memberships
            Platform.GetService <IOrderNoteService>(
                delegate(IOrderNoteService service)
            {
                List <string> visibleGroups     = OrderNoteboxFolderSystemSettings.Default.GroupFolders.StaffGroupNames;
                List <StaffGroupSummary> groups = service.ListStaffGroups(new ListStaffGroupsRequest()).StaffGroups;
                _staffGroupTable.Items.AddRange(
                    CollectionUtils.Map <StaffGroupSummary, TableItem>(groups,
                                                                       delegate(StaffGroupSummary g)
                {
                    bool visible = CollectionUtils.Contains(visibleGroups,
                                                            delegate(string groupName) { return(g.Name == groupName); });
                    return(new TableItem(g, visible, false));
                }));
            });

            _staffGroupLookupHandler = new StaffGroupLookupHandler(this.Host.DesktopWindow, true);

            base.Start();
        }