Example #1
0
        public void VerifyNonGenericIDictionaryCopyToMethod()
        {
            ObservableDictionary <string, string> genericDictionary = new ObservableDictionary <string, string>();
            IDictionary testDictionary = genericDictionary;

            testDictionary.Add("stringKey1", "TestString");

            Array array = new KeyValuePair <string, string> [5].ToArray();

            testDictionary.CopyTo(array, 0);

            Assert.AreEqual("stringKey1", ((KeyValuePair <string, string>)array.GetValue(0)).Key);
            Assert.AreEqual("TestString", ((KeyValuePair <string, string>)array.GetValue(0)).Value);
            Assert.IsNull(((KeyValuePair <string, string>)array.GetValue(1)).Key);
            Assert.IsNull(((KeyValuePair <string, string>)array.GetValue(1)).Value);

            array = new KeyValuePair <string, string> [5].ToArray();
            testDictionary.CopyTo(array, 1);

            Assert.AreEqual("stringKey1", ((KeyValuePair <string, string>)array.GetValue(1)).Key);
            Assert.AreEqual("TestString", ((KeyValuePair <string, string>)array.GetValue(1)).Value);
            Assert.IsNull(((KeyValuePair <string, string>)array.GetValue(0)).Key);
            Assert.IsNull(((KeyValuePair <string, string>)array.GetValue(0)).Value);
            Assert.IsNull(((KeyValuePair <string, string>)array.GetValue(2)).Key);
            Assert.IsNull(((KeyValuePair <string, string>)array.GetValue(2)).Value);
        }
Example #2
0
        public void ParseKeyValuePairTest()
        {
            //Create parser and parse tokens
            ExpressionParser expressionParser = new ExpressionParser(Init("token1:\"value1\""));
            KeyValuePair     keyValuePair     = expressionParser.ParseKeyValuePair();

            //Check key
            Assert.AreEqual("token1", keyValuePair.GetKey());

            //Check value
            Assert.AreEqual(typeof(TextExpression), keyValuePair.GetValue().GetType());
            TextExpression textExpression = (TextExpression)keyValuePair.GetValue();

            Assert.AreEqual("value1", textExpression.GetText());
        }
Example #3
0
 public bool Remove(KeyValuePair <KEY, VALUE> item)
 {
     if (backingDictionary.ContainsKey(item.GetKey()) &&
         backingDictionary[item.GetKey()].Equals(item.GetValue()))
     {
         Remove(item.GetKey());
     }
     return(false);
 }
 public bool Add(KeyValuePair <KEY, VALUE> item)
 {
     if (!backingDictionary.ContainsKey(item.GetKey()))
     {
         orderedQueue.Add(item.GetKey());
     }
     backingDictionary[item.GetKey()] = item.GetValue();
     return(true);
 }
Example #5
0
 public override bool Equals(object o)
 {
     if (o is KeyValuePair <KEY, VALUE> )
     {
         KeyValuePair <KEY, VALUE> p = (KeyValuePair <KEY, VALUE>)o;
         return(GetKey().Equals(p.GetKey()) &&
                GetValue().Equals(p.GetValue()));
     }
     return(false);
 }
        /// <summary>
        /// Navigates to default command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
        {
            var agencyKey = parameters.GetValue<long> ( "AgencyKey" );

            _navigationService.Navigate (
                RegionManager,
                "AgencyDashboardProgramsRegion",
                "ProgramListView",
                null,
                new[] { new KeyValuePair<string, string> ( "AgencyKey", agencyKey.ToString () ) } );
        }
Example #7
0
        public void ParseRecordExpressionTest()
        {
            //Create parser and parse tokens
            ExpressionParser expressionParser = new ExpressionParser(Init("{token1:\"token1\", token2:10, token3:'symbol}"));
            RecordExpression expression       = expressionParser.ParseRecordExpression();

            //Test Record contents
            Assert.AreEqual(3, expression.GetRecords().Count);
            List <ISyntaxNode> .Enumerator recordEnumerator = expression.GetRecords().GetEnumerator();

            recordEnumerator.MoveNext();
            KeyValuePair current = (KeyValuePair)recordEnumerator.Current;

            Assert.AreEqual("token1", current.GetKey());
            Assert.AreEqual(typeof(TextExpression), current.GetValue().GetType());
            Assert.AreEqual("\"token1\"", current.GetValue().ToString());

            recordEnumerator.MoveNext();
            current = (KeyValuePair)recordEnumerator.Current;

            Assert.AreEqual("token2", current.GetKey());
            Assert.AreEqual(typeof(NumExpression), current.GetValue().GetType());
            Assert.AreEqual(10, ((NumExpression)current.GetValue()).GetNum());

            recordEnumerator.MoveNext();
            current = (KeyValuePair)recordEnumerator.Current;

            Assert.AreEqual("token3", current.GetKey());
            Assert.AreEqual(typeof(SymExpression), current.GetValue().GetType());
            Assert.AreEqual("'symbol", current.GetValue().ToString());
        }
Example #8
0
        /// <summary>
        /// Interpret RecordExpression
        /// </summary>
        /// <param name="expression">RecordExpression to interpret</param>
        public override void Visit(RecordExpression expression)
        {
            //convert record to textvalue
            String tempRecord = "{";

            for (int i = 0; i < expression.GetRecords().Count; i++)
            {
                KeyValuePair pair = (KeyValuePair)expression.GetRecords().Get(i);

                //Convert KeyValuePair to textual representation
                tempRecord += pair.GetKey() + ":";
                pair.GetValue().AcceptVisitor(this);
                tempRecord += TextValue;

                //Add seperator
                if (i != (expression.GetRecords().Count - 1))
                {
                    tempRecord += ",";
                }
            }

            tempRecord += "}";
            TextValue   = tempRecord;
        }
Example #9
0
        private void NavigateToOpenSendNewMailViewCommand( KeyValuePair<string, string>[] parameters )
        {
            var mail = new DirectMailDto { From = _currentContext.Staff.DirectEmailAddress, FromName = _currentContext.Staff.FullName, Sent = DateTime.Now };

            _patientKey = parameters.GetValue<long> ( "PatientKey" );
            var patientName = parameters.GetValue<string> ( "PatientFullName" );
            if ( !string.IsNullOrEmpty ( patientName ) )
            {
                mail.AttachmentName = string.Format ( "{0}.xml, Preview.html", DateTime.Now.Ticks );
            }

            Mail = mail;
        }
 /// <summary>
 /// Determines whether this instance [can navigate to default command] the specified parameters.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 /// <returns><c>true</c> if this instance [can navigate to default command] the specified parameters; otherwise, <c>false</c>.</returns>
 protected override bool CanNavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     var locationKey = parameters.GetValue<long> ( "LocationKey" );
     return LocationSummary.Key == locationKey;
 }
        /// <summary>
        /// Navigates to default command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
        {
            _billingOfficeKey = parameters.GetValue<long> ( "BillingOfficeKey" );

            var shouldReload = true;
            if ( parameters.HasKey ( "ShouldReload" ) )
            {
                shouldReload = parameters.GetValue<bool> ( "ShouldReload" );
            }

            if ( shouldReload )
            {
                _navigationService.Navigate (
                    RegionManager,
                    "PayorTilesRegion",
                    "PayorTypeListView",
                    null,
                    new[] { new KeyValuePair<string, string> ( "BillingOfficeKey", _billingOfficeKey.ToString () ) } );

                _navigationService.Navigate (
                    RegionManager,
                    "PayorTilesRegion",
                    "PayorListView",
                    null,
                    new[] { new KeyValuePair<string, string> ( "BillingOfficeKey", _billingOfficeKey.ToString () ) } );
            }
        }
Example #12
0
        /// <summary>
        /// Navigates to default command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
        {
            _patientKey = parameters.GetValue<long>("PatientKey");
            var key = parameters.GetValue<long> ( "ClinicalCaseKey" );
            _clinicalCaseKey = key;

            if ( _clinicalCaseKey > 0 )
            {
                GetRecentActivitiesByClinicalCaseAsync ( key );
                GetScheduledActivitiesByClinicalCaseAsync ( key );
            }
        }
 /// <summary>
 /// Navigates to default command.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 protected override void NavigateToDefaultCommand(KeyValuePair<string, string>[] parameters)
 {
     var reload = parameters.GetValue<bool?> ( "ShouldReload" );
     if ( reload != false )
     {
         OnCurrentContextChanged ( this, new EventArgs () );
         ContextChanged += OnCurrentContextChanged;
     }
 }
Example #14
0
        /// <summary>
        /// Navigates to default command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
        {
            var clinicalCaseKey = parameters.GetValue<long> ( "ClinicalCaseKey" );
            var patientKey = parameters.GetValue<long> ( "PatientKey" );

            var navigationParameters = new[]
                {
                    new KeyValuePair<string, string> ( "ClinicalCaseKey", clinicalCaseKey.ToString () ),
                    new KeyValuePair<string, string> ( "PatientKey", patientKey.ToString () )
                };

            _navigationService.Navigate ( RegionManager, "SnapshotItemsRegion", "CaseSummaryView", null, navigationParameters );
        }
        private void NavigateToEditCommand( KeyValuePair<string, string>[] parameters )
        {
            _initialSystemRoleKeyToEdit = parameters.GetValue<long> ( "SystemRoleKey" );
            var initialSystemRoleTypeToEdit =
                ( SystemRoleType )Enum.Parse ( typeof( SystemRoleType ), parameters.GetValue<string> ( "SystemRoleType" ), true );

            switch ( initialSystemRoleTypeToEdit )
            {
                case SystemRoleType.Task:
                    ExecuteRoleWorkingModeChangedCommand ( true );
                    break;
                case SystemRoleType.TaskGroup:
                    ExecuteRoleWorkingModeChangedCommand ( false );
                    break;
            }
        }
        /// <summary>
        /// Navigates to default command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
        {
            var patientKey = parameters.GetValue<long> ( "PatientKey" );

            if (SelfPayment != null)
            {
                _ruleExecutor.StopWatchingSubject ( this );
            }

            SelfPayment = new SelfPaymentDto ();
            SelfPayment.PatientKey = patientKey;
            SelfPayment.CollectedByStaffKey = _currentStaffKey;
            SelfPayment.CultureName = "en-US";
            SelfPayment.CurrencyWellKnownName = Currency.USDollars;

            _ruleExecutor.WatchSubject ( this );

            var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
            requestDispatcher.AddLookupValuesRequest ( "PaymentMethod" );
            requestDispatcher.ProcessRequests ( HandleInitializationCompleted, HandleInitializationError );
            IsLoading = true;
        }
 /// <summary>
 /// Determines whether this instance [can navigate to default command] the specified parameters.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 /// <returns><c>true</c> if this instance [can navigate to default command] the specified parameters; otherwise, <c>false</c>.</returns>
 protected override bool CanNavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     var agencyKey = parameters.GetValue<long> ( "AgencyKey" );
     return agencyKey == _agencyKey;
 }
Example #18
0
        /// <summary>
        /// Navigates to default command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
        {
            var patientKey = parameters.GetValue<long> ( "PatientKey" );
            var staffKey = parameters.GetValue<long> ( "StaffKey" );
            var agencyKey = parameters.GetValue<long> ( "AgencyKey" );
            var locationKey = parameters.GetValue<long> ( "LocationKey" );

            var url = _launcher.BuildUrl ( patientKey, staffKey, agencyKey, locationKey );
            SourceUrl = url.AbsoluteUri;
        }
Example #19
0
 /// <summary>
 /// Navigates to default command.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     _agencyKey = parameters.GetValue<long> ( "AgencyKey" );
     GetAllProgramsByAgencyAsync ( _agencyKey );
 }
Example #20
0
 /// <summary>
 /// Navigates to default command.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     Title = parameters.GetValue<string> ( "Title" );
 }
 /// <summary>
 /// Navigates to default command.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     _billingOfficeKey = parameters.GetValue<long> ( "BillingOfficeKey" );
     RefreshList ();
 }
        /// <summary>
        /// Navigates to default command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
        {
            _locationKey = parameters.GetValue<long> ( "LocationKey" );
            var isCreateMode = parameters.GetValue<bool> ( "IsCreate" );

            var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
            requestDispatcher.Add ( new GetDtoRequest<LocationSummaryDto> { Key = _locationKey } );
            requestDispatcher.ProcessRequests ( HandleGetLocationSummaryDtoCompleted, HandleGetLocationSummaryDtoException );
            IsLoading = true;

            if ( isCreateMode )
            {
                _navigationService.Navigate (
                    RegionManager,
                    "WorkspaceContentScopedRegion",
                    "LocationEditorView",
                    null,
                    new[]
                        {
                            new KeyValuePair<string, string> ( "LocationKey", _locationKey.ToString () ),
                            new KeyValuePair<string, string> ( "IsCreate", "true" )
                        } );
            }
            else
            {
                _navigationService.Navigate (
                    RegionManager,
                    "WorkspaceContentScopedRegion",
                    "LocationDashboardView",
                    null,
                    new[] { new KeyValuePair<string, string> ( "LocationKey", _locationKey.ToString () ) } );
            }
        }
 /// <summary>
 /// Determines whether this instance [can navigate to default command] the specified parameters.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 /// <returns><c>true</c> if this instance [can navigate to default command] the specified parameters; otherwise, <c>false</c>.</returns>
 protected override bool CanNavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     var patientKey = parameters.GetValue<long> ( "PatientKey" );
     return _patientKey == patientKey;
 }
 /// <summary>
 /// Navigates to default command.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     _patientKey = parameters.GetValue<long> ( "PatientKey" );
 }
 private void NavigateToEditCommand( KeyValuePair<string, string>[] parameters )
 {
     var systemRoleKey = parameters.GetValue<long> ( "SystemRoleKey" );
     var dispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
     dispatcher.Add ( new GetDtoRequest<SystemRoleDto> { Key = systemRoleKey } );
     IsLoading = true;
     dispatcher.ProcessRequests ( HandleEditRequestComplete, HandleEditRequestDispatcherException );
 }
        private void NavigateToCloneCommand( KeyValuePair<string, string>[] parameters )
        {
            var systemRoleKeyToClone = parameters.GetValue<long> ( "SystemRoleKey" );

            var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
            requestDispatcher.Add ( new CloneSystemRoleRequest { SystemRoleKey = systemRoleKeyToClone } );
            requestDispatcher.ProcessRequests ( HandleCloneRequestCompleted, HandleCloneRequestException );
            IsLoading = true;
        }
 /// <summary>
 /// Navigates to default command.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     AgencyKey = parameters.GetValue<long> ( "AgencyKey" );
     var isCreateMode = parameters.GetValue<bool> ( "IsCreate" );
     LoadAgencySummary ( _agencyKey );
     if ( isCreateMode )
     {
         _navigationService.Navigate (
             RegionManager,
             "WorkspaceContentScopedRegion",
             "AgencyEditorView",
             null,
             new[]
                 {
                     new KeyValuePair<string, string> ( "AgencyKey", _agencyKey.ToString () ),
                     new KeyValuePair<string, string> ( "IsCreate", "true" )
                 } );
     }
     else
     {
         _navigationService.Navigate (
             RegionManager,
             "WorkspaceContentScopedRegion",
             "AgencyDashboardView",
             null,
             new[]
                 {
                     new KeyValuePair<string, string> ( "AgencyKey", _agencyKey.ToString () )
                 } );
     }
 }
Example #28
0
 /// <summary>
 /// Navigates to default command.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     try
     {
         _patientKey = parameters.GetValue<long> ( "PatientKey" );
     }
     catch ( ArgumentException )
     {
         // Patient Key was not provided, so I must be outside of the context of a patient. I.e.:Interoperability workspace
         _patientKey = 0;
     }
 }
 /// <summary>
 /// Determines whether this instance [can navigate to default command] the specified parameters.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 /// <returns><c>true</c> if this instance [can navigate to default command] the specified parameters; otherwise, <c>false</c>.</returns>
 protected override bool CanNavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     var key = parameters.GetValue<long> ( "MedicationKey" );
     return _medication == null || key == _medication.Key;
 }
        /// <summary>
        /// Navigates to default command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
        {
            _patientKey = parameters.GetValue<long> ( "PatientKey" );

            var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
            requestDispatcher.Add ( new GetDefaultClinicalCaseByPatientRequest { PatientKey = _patientKey } );
            requestDispatcher.Add ( new GetAllClinicalCasesByPatientRequest { PatientKey = _patientKey } );

            IsLoading = true;
            requestDispatcher.ProcessRequests ( HandleInitializationCompleted, HandleInitializationException );

            _patientAccessService.LogEventAccess(_patientKey, "Patient Dashboard", "The Patient Dashboard for Patient {0} was accessed");
        }
Example #31
0
 /// <summary>
 /// Navigates to default command.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     _billingOfficeKey = parameters.GetValue<long> ( "BillingOfficeKey" );
     GetPayorTypesByBillingOfficeAsync ( _billingOfficeKey );
 }
Example #32
0
 /// <summary>
 /// Navigates to default command.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     Gender = parameters.GetValue<string> ( "Gender" );
     Score = parameters.GetValue<int> ( "Score" );
 }
Example #33
0
 public bool Add(KeyValuePair <KEY, VALUE> item)
 {
     backingDictionary.Add(item.GetKey(), item.GetValue());
     return(true);
 }
        /// <summary>
        /// Navigates to default command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
        {
            var key = parameters.GetValue<long> ( "MedicationKey" );
            var patientkey = parameters.GetValue<long> ( "PatientKey" );
            var dispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher ();
            if ( key == 0 )
            {
                Medication = new MedicationDto ();
                Medication.PatientKey = patientkey;
            }
            else
            {
                dispatcher.Add ( new GetMedicationByKeyRequest { Key = key } );
                IsLoading = true;
            }
            dispatcher.AddLookupValuesRequest ( "MedicationStatus" );
            dispatcher.AddLookupValuesRequest ( "DiscontinuedReason" );
            dispatcher.ProcessRequests ( HandleRequestComplete, HandleRequestDispatcherException );
            IsLoading = true;

            StartRuleWatch ();
        }
 public bool Contains(KeyValuePair <KEY, VALUE> item)
 {
     return(backingDictionary.ContainsKey(item.GetKey()) &&
            backingDictionary[item.GetKey()].Equals(item.GetValue()));
 }
Example #36
0
 /// <summary>
 /// Determines whether this instance [can navigate to default command] the specified parameters.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 /// <returns><c>true</c> if this instance [can navigate to default command] the specified parameters; otherwise, <c>false</c>.</returns>
 protected override bool CanNavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     var key = parameters.GetValue<long> ( "BillingOfficeKey" );
     return key == 0 || key == _billingOfficeKey;
 }
Example #37
0
        /// <summary>
        /// Navigates to default command.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
        {
            var note = parameters.GetValue<string> ( "Note" );
            _name = parameters.GetValue<string> ( "Name" );
            RaisePropertyChanged ( () => Title );

            Note = note;
        }
 /// <summary>
 /// Navigates to default command.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     _clinicalCaseKey = parameters.GetValue<long> ( "ClinicalCaseKey" );
     _patientKey = parameters.GetValue<long> ( "PatientKey" );
     GetAllProblemsByClinicalCase ( _clinicalCaseKey );
 }
 /// <summary>
 /// Navigates to default command.
 /// </summary>
 /// <param name="parameters">The parameters.</param>
 protected override void NavigateToDefaultCommand( KeyValuePair<string, string>[] parameters )
 {
     _locationKey = parameters.GetValue<long> ( "LocationKey" );
     GetProgramOfferingsByLocationAsync ( _locationKey );
 }