Exemplo n.º 1
0
        public void TestSedgwickRuleProcessor()
        {
            const string asiDisabilityAttribute = "ASI:CTA_EMPLOYEE_BEGIN_DISABILITY_DT";

            using (var call = new CallWrapper())
            {
                call.LoadFromDSN("7679", GeneralUtility.GetDsnFromInstance(DbBaseClass.SEDBA));
                var myCall = new CallObject();
                myCall.LoadFromXml(call.GetXML());
                var originalDate = myCall.GetValue(asiDisabilityAttribute);
                //NUnit.Framework.Assert.IsTrue(originalDate.Length == 8, "Bad date format!");
                var records = RuleRecordSet.GetRuleSetByClientAndEvent("18", "CLOSE", "SEDBA");
                NUnit.Framework.Assert.IsTrue(records.Count >= 1, "Problems!");
                foreach (var record in records)
                {
                    var results = Eval.EvaluateCallObject(myCall.ToXml(), record.RuleText);
                    NUnit.Framework.Assert.IsNotEmpty(results, "Nothing returned!");

                    var resultCall = new CallObject();
                    resultCall.LoadFromXml(results);
                    NUnit.Framework.Assert.IsNotEmpty(resultCall.GetValue(asiDisabilityAttribute), "Expected result was not returned!");
                    NUnit.Framework.Assert.IsFalse(originalDate.Equals((resultCall.GetValue(asiDisabilityAttribute))),
                                                   "dates are unchanged!");
                    Console.WriteLine("Original: {0} Transformed: {1}", originalDate, resultCall.GetValue(asiDisabilityAttribute));
                }
            }
        }
Exemplo n.º 2
0
        public void SendingCallJSONCategory_JSONConverted()
        {
            try
            {
                // Arrange
                var            testString     = "Test";
                CategoryEntity categoryEntity = new CategoryEntity
                {
                    CategoryId = Guid.NewGuid().ToString(),
                    Name       = "TestTestTest"
                };
                CallEntity callEntity = CallWrapper.WrapCall(CPRNUMMER, CallUtil.StatusCode.Active, categoryEntity, null,
                                                             null);

                //Act
                PatientCall call = new PatientCall();

                var callId = call.MakeCall(callEntity);

                Assert.IsTrue(!String.IsNullOrEmpty(callId));
            }
            catch (Exception ex)
            {
                //Assert
                Assert.Fail("Status Code not OK " + ex.Message);
            }
        }
Exemplo n.º 3
0
        public override View OnCreateView(LayoutInflater inflater,
                                          ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(
                Resource.Layout.activity_category, container, false);

            GridView gridView = (GridView)view.FindViewById(Resource.Id.grid_view);
            // Instance of ImageAdapter Class

            var categories = DataHandler.LoadCategoriesFromLocalDatabase(new LocalDB());

            gridView.SetAdapter(new CategoryAdapter(view.Context, categories));

            gridView.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
            {
                Intent intent = new Intent(Application.Context, typeof(ChoiceActivity));

                List <string> choiceList = new List <string>();
                List <string> detailList = new List <string>();

                var category = categories[args.Position];
                var choices  = categories[args.Position].Choices;

                // Add each choice from selected category to list
                // Add each detail from selected choice to list
                foreach (var choice in choices)
                {
                    choiceList.Add(choice.Name);

                    detailList.AddRange(choice.Details.Select(detail => detail.Name));
                }

                if (choices == null || choices.Count == 0 || String.IsNullOrEmpty(choices[0].Name))
                // Dummy, hvis der er en tom Choice liste uden et navn
                {
                    CallEntity callEntity = CallWrapper.WrapCall(UserData.CPRNR, CallUtil.StatusCode.Active, category);
                    //AppDelegate.MakeCall(callEntity, category.Name, this);
                }
                else
                {
                    Bundle bundle = new Bundle();

                    bundle.PutStringArray("choices", choiceList.ToArray());
                    bundle.PutStringArray("details", detailList.ToArray());
                    bundle.PutString("category", categories[args.Position].Name);
                    intent.PutExtras(bundle);

                    StartActivity(intent);
                }
            };
            return(view);
        }
Exemplo n.º 4
0
        public void SendingCallJSONCategoryChoiceDetail_JSONConverted()
        {
            // Arrange
            var testString = "Test";

            var detail = new DetailEntity()
            {
                DetailId = Guid.NewGuid().ToString(),
                Name     = "Mælk",
            };

            var choice = new ChoiceEntity()
            {
                ChoiceId = Guid.NewGuid().ToString(),
                Name     = "Kaffe",
                Details  = new List <DetailEntity> {
                    detail
                }
            };

            var category = new CategoryEntity()
            {
                CategoryId = Guid.NewGuid().ToString(),
                Name       = "Dinmor",
                //Picture = "http://multimedia.pol.dk/archive/00537/ITALY_CLONED_CHAMPI_537998a.jpg",
                Choices = new List <ChoiceEntity> {
                    choice
                }
            };

            CallEntity callEntity = CallWrapper.WrapCall(CPRNUMMER, CallUtil.StatusCode.Active, category, choice, detail);

            try
            {
                //Act
                PatientCall call   = new PatientCall();
                var         callId = call.MakeCall(callEntity);

                Assert.IsTrue(!String.IsNullOrEmpty(callId));
            }
            catch (Exception ex)
            {
                Assert.Fail("Status Code not OK " + ex.Message);
            }
        }
Exemplo n.º 5
0
        private void CategoryTapped(CategoryEntity category)
        {
            // The category tapped
            Category = category;

            // Hvis der ikke er nogle typer, så start kaldet her
            if (Category.Choices == null || Category.Choices.Count == 0 || String.IsNullOrEmpty(Category.Choices[0].Name)) // Dummy, hvis der er en tom Choice liste uden et navn
            {
                CallEntity callEntity = CallWrapper.WrapCall(UserData.CPRNR, CallUtil.StatusCode.Active, Category);
                AppDelegate.MakeCall(callEntity, this);
            }

            // Ellers gå videre til næste view.
            else
            {
                PerformSegue("CategorySegue", this);
            }
        }
Exemplo n.º 6
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            tableView.DeselectRow(indexPath, true);

            var detail = Details[indexPath.Row];
            var choice = detail.Choices[0];

            if (detail.Choices.Count > 1)
            {
                choice = detail.Choices[ChoiceIndexPathRow];
            }

            var category = choice.CategoryEntity;


            CallEntity callEntity = CallWrapper.WrapCall(UserData.CPRNR, CallUtil.StatusCode.Active, category, choice, detail);

            AppDelegate.MakeCall(callEntity, vc);
        }
Exemplo n.º 7
0
        void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            var choice = choiceList[e.Position];
            var intent = new Intent(Application.Context, typeof(DetailChoiceActivity));

            // Hvis der er ikke er nogen detailer, start kaldet her
            if (choice == null || details.Count == 0)
            {
                CallEntity callEntity = CallWrapper.WrapCall(UserData.CPRNR, CallUtil.StatusCode.Active, category, choice);
                AppDelegate.MakeCall(callEntity, choice.Name, vc);
            }


            Bundle bundle = new Bundle();

            bundle.PutStringArray("details", detailList.ToArray());
            bundle.PutString("choice", choice);
            intent.PutExtras(bundle);
            StartActivity(intent);
        }
Exemplo n.º 8
0
        public void UpdatingCallJSON_CalledUpdated()
        {
            //Arrange
            // Arrange
            var testString = "Test";

            var choice = new ChoiceEntity()
            {
                ChoiceId = Guid.NewGuid().ToString(),
                Name     = "Morfin"
            };

            var category = new CategoryEntity()
            {
                CategoryId = Guid.NewGuid().ToString(),
                Name       = "Smertestillende",
                //Picture = "http://multimedia.pol.dk/archive/00537/ITALY_CLONED_CHAMPI_537998a.jpg",
                Choices = new List <ChoiceEntity> {
                    choice
                }
            };

            CallEntity callEntity = CallWrapper.WrapCall(CPRNUMMER, CallUtil.StatusCode.Active, category, choice, null);

            //Act
            PatientCall call = new PatientCall();

            try
            {
                callEntity._id    = "5641c5dd02a93d27a8910f9c";
                callEntity.Status = (int)CallUtil.StatusCode.Canceled;
                call.UpdateCall(callEntity);
            }
            catch (Exception e)
            {
                // Assert
                Assert.Fail("No calls has been updated");
            }
        }
Exemplo n.º 9
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            tableView.DeselectRow(indexPath, true);

            var category = Choices[indexPath.Row].CategoryEntity;
            var choice   = Choices[indexPath.Row];
            var details  = Choices[indexPath.Row].Details;

            // Hvis der er ikke er nogen detailer, start kaldet her
            if (details == null || details.Count == 0)
            {
                CallEntity callEntity = CallWrapper.WrapCall(UserData.CPRNR, CallUtil.StatusCode.Active, category, choice);
                AppDelegate.MakeCall(callEntity, vc);
            }
            // Ellers overføre detaljer videre til næste view
            else
            {
                // Transfer details back and switch to DetailChoiceViewController
                vc.ChoiceName         = choice.Name;
                vc.Details            = details.ToArray();
                vc.ChoiceIndexPathRow = indexPath.Row;
                vc.PerformSegue("DetailChoiceSegue", this);
            }
        }