public async void SaveClaim()
        {
            ClaimDetails newClaim = new ClaimDetails()
            {
                FullName  = _fullName,
                DoB       = _doB,
                PolicyNum = _policyNum,
                PhoneNum  = _phoneNum,
                Email     = _email,
                Date      = _date.ToString(),
                Time      = _time.ToString(),
                Location  = _location,
                Type      = _selectedType.ToString(),
                Injury    = _selectedInjury.ToString(),
                Cmt       = _cmt,
                Extra     = "saved",
                Bytes     = GetString(_bytes)
            };

            await _dialog.Show("Saving Claim", "Synchronising...");

            await _savedClaimDatabase.InsertClaim(newClaim);

            await _dialog.Dismiss();

            await _dialog.ShowToast("Claim saved.");
        }
        public async void UpdateProfile()
        {
            if (string.IsNullOrWhiteSpace(_fullName) || string.IsNullOrWhiteSpace(_doB) || string.IsNullOrWhiteSpace(_policyNum) ||
                string.IsNullOrWhiteSpace(_phoneNum) || string.IsNullOrWhiteSpace(_email))
            {
                await _dialog.ShowToast("Please enter all fields.");
            }
            else
            {
                ClaimDetails newProfile = new ClaimDetails()
                {
                    FullName  = _fullName,
                    DoB       = _doB,
                    PolicyNum = _policyNum,
                    PhoneNum  = _phoneNum,
                    Email     = _email,
                    Extra     = "profile"
                };

                MyProfile.FullName  = _fullName;
                MyProfile.DoB       = _doB;
                MyProfile.PolicyNum = _policyNum;
                MyProfile.PhoneNum  = _phoneNum;
                MyProfile.Email     = _email;
                await _dialog.Show("Save Profile Details", "Synchronising...");

                await _savedClaimDatabase.UpdateProfile(newProfile, _myProfile);

                await _dialog.Dismiss();

                await _dialog.ShowToast("Profile details saved.");
            }
        }
        private void TakeCareOfNextClaim()
        {
            Queue <ClaimDetails> claimDetails = _claimDetailsRepo.SeeAllClaims();
            ClaimDetails         claim        = claimDetails.Peek();

            Console.WriteLine($"{claim.ClaimID}" + $"   {claim.ClaimType}" + $"   {claim.Description}" + $"  {claim.ClaimAmount}" + $"    {claim.DateOfIncident}" + $" {claim.DateOfClaim}" + $"    {claim.IsValid}");
            Console.WriteLine("Do you want to deal with this claim now(y/n)?");
            string input = Console.ReadLine();

            switch (input)
            {
            case "n":
                RunMenu();
                break;

            case "y":
                _claimDetailsRepo.TakeCareOfNextClaim();
                break;

            default:
                Console.WriteLine("Please enter valid input");
                Console.ReadKey();
                TakeCareOfNextClaim();
                break;
            }
        }
        public void addClaimResultLine(string patientId, string itemNumber, string bodyPart, DateTime serviceDate, decimal fee, decimal benefit, string responseCode)
        {
            string data          = "";
            string dateservice   = "";
            string feeamount     = "";
            string benefitamount = "";
            string zerofill      = "00000000";

            patientId  = Right((zerofill + patientId), 2);
            itemNumber = Right(zerofill + itemNumber, 4);
            bodyPart   = Right(zerofill + bodyPart, 2);
            //
            dateservice = serviceDate.ToString("DDMM");

            // Get fee into 012500" format for 125.00
            feeamount = "00000000" + (fee * System.Convert.ToDecimal(100)).ToString();
            feeamount = Left(feeamount, feeamount.IndexOf('.'));
            feeamount = Right(feeamount, 6);

            benefitamount = "00000000" + (benefit * System.Convert.ToDecimal(100)).ToString();
            benefitamount = Left(benefitamount, benefitamount.IndexOf('.'));
            benefitamount = Right(benefitamount, 6);

            responseCode = Right((zerofill + responseCode), 2);

            // Claim Data format stored as a string array to help serialisation
            //Format is  + Separator
            // Patient Id + ItemNumber + BodyPart +  DDMM + FeeAmount)
            data = patientId + itemNumber + bodyPart + dateservice + feeamount + benefitamount + responseCode;
            ClaimDetails.Add(data);

            TransactionAmount += fee;
        }
        private void AddNewClaim()
        {
            Console.Clear();
            ClaimDetails content = new ClaimDetails();

            Console.WriteLine("Add a new claim here");
            Console.WriteLine("Please enter the new claim ID here:");
            string inputID  = Console.ReadLine();
            int    numberID = int.Parse(inputID);

            content.ClaimID = numberID;
            Console.WriteLine("Please select the claim type here:\n" +
                              "1. Car\n" +
                              "2. Home\n" +
                              "3. Theft\n");
            string typeInput  = Console.ReadLine();
            int    typeNumber = int.Parse(typeInput);

            content.ClaimType = (ClaimType)typeNumber;
            _claimRepository.AddClaimDetails(content);
            Console.WriteLine("Please enter a short description of this claim:");
            content.Description = Console.ReadLine();
            Console.WriteLine("Please enter the claim amount here:");
            string amountInput  = Console.ReadLine();
            double amountNumber = double.Parse(amountInput);

            content.Amount = amountNumber;
            Console.WriteLine("Please enter the date of the accident here, in MM/DD/YYYY format:");
            string   dateAccInput  = Console.ReadLine();
            DateTime dateAccNumber = DateTime.Parse(dateAccInput);

            content.DateOfAccident = dateAccNumber;
            Console.WriteLine("Please enter today's date here, in MM/DD/YYYY format:");
            string   dateClInput  = Console.ReadLine();
            DateTime dateClNumber = DateTime.Parse(dateClInput);

            content.DateOfClaim = dateClNumber;
            Console.WriteLine("Is this claim valid?\n" +
                              "1. Yes\n" +
                              "2. No\n");
            string isValid = Console.ReadLine();

            switch (isValid)
            {
            case "1":
                content.IsValid = IsValid.Valid;
                break;

            case "2":
                content.IsValid = IsValid.Invalid;
                break;

            default:
                Console.WriteLine("Please select one of the listed options.");
                Console.ReadKey();
                break;
            }
            _claimRepository.AddClaimDetails(content);
        }
        public void AddNewClaim_ShouldGetCorrectBoolean()
        {
            ClaimDetails           content    = new ClaimDetails();
            ClaimDetailsRepository repository = new ClaimDetailsRepository();
            bool addClaim = repository.AddClaimDetails(content);

            Assert.IsTrue(addClaim);
            System.Console.WriteLine(addClaim);
        }
        public async Task <int> InsertClaim(ClaimDetails claim)
        {
            await SyncAsync(true);

            await azureSyncTable.InsertAsync(claim);

            await SyncAsync();

            return(1);
        }
 private void DisplayClaim(ClaimDetails content)
 {
     Console.WriteLine($"Claim ID: {content.ClaimID}\n" +
                       $"Claim Type: {content.ClaimType}\n" +
                       $"Description of Claim: {content.Description}\n" +
                       $"Claim Amount: {content.Amount}\n" +
                       $"Date of Accident: {content.DateOfAccident}\n" +
                       $"Date of Claim: {content.DateOfClaim}\n" +
                       $"Is a Valid Claim?: {content.IsValid}\n");
 }
        private void SeedClaims()
        {
            ClaimDetails claimOne   = new ClaimDetails(1, ClaimDetails.ClaimTypes.Car, "Car accident on 465", 400, DateTime.Parse("04/18/2018"), DateTime.Parse("04/27/2018"));
            ClaimDetails claimeTwo  = new ClaimDetails(2, ClaimDetails.ClaimTypes.Home, "House Fire in Kitchen", 4000, DateTime.Parse("04/11/2018"), DateTime.Parse("04/12/2018"));
            ClaimDetails claimThree = new ClaimDetails(3, ClaimDetails.ClaimTypes.Theft, "stolen pancakes", 4, DateTime.Parse("04/27/2018"), DateTime.Parse("06/01/2018"));

            _claimDetailsRepo.EnterNewClaim(claimOne);
            _claimDetailsRepo.EnterNewClaim(claimeTwo);
            _claimDetailsRepo.EnterNewClaim(claimThree);
        }
        public void ShowAllClaims_ShouldGetCorrectBoolean()
        {
            ClaimDetails           content    = new ClaimDetails();
            ClaimDetailsRepository repository = new ClaimDetailsRepository();

            repository.AddClaimDetails(content);
            List <ClaimDetails> claimList = repository.GetDetails();
            bool listHasClaims            = claimList.Contains(content);

            Assert.IsTrue(listHasClaims);
        }
Beispiel #11
0
        public void addClaimLine(string patientId, string itemNumber, string bodyPart, DateTime serviceDate, decimal fee)
        {
            string data         = "";
            string dateservice  = "";
            string feeamount    = "00";
            string zerofill     = "00000000";
            string errorMessage = "";

            errorMessage += validatePatientId(patientId);
            errorMessage += validateItemNumber(itemNumber);
            errorMessage += validateBodyPart(bodyPart);
            errorMessage += validateFeeAmount(fee);
            errorMessage += validateServiceDate(serviceDate);
            if (errorMessage.Length > 0)
            {
                throw new InvalidCastException(errorMessage);
            }

            patientId = Right((zerofill + patientId ?? "00".Trim()), 2);
            //itemNumber = Right(zerofill + itemNumber ?? "0000".Trim(), 4);
            itemNumber = Left(itemNumber + new string(' ', 4), 4);
            bodyPart   = Right(zerofill + bodyPart ?? "00".Trim(), 2);
            //
            if (!isNumeric(patientId))
            {
                patientId = "00"; throw new InvalidCastException("Invalid patient id, PatientID must contain numeric values only eg 00");
            }
            if (!isSpaceAlphaNumeric(itemNumber))
            {
                itemNumber = "0000"; throw new InvalidCastException("Invalid Item Number, Item Number must only contain AlphaNumeric values only eg A-Z, a-z, 0-9, and spaces");
            }
            if (!isAlphaNumeric(bodyPart))
            {
                itemNumber = "00"; throw new InvalidCastException("Invalid Bodypart id, Bodypart must contain numeric values only eg 11");
            }
            dateservice = Right(zerofill + serviceDate.Day.ToString(), 2) + Right(zerofill + serviceDate.Month.ToString(), 2);
            // Get fee into 012500" format for 125.00
            feeamount = "00000000" + (fee * System.Convert.ToDecimal(100)).ToString();
            if (feeamount.IndexOf('.') > 0)
            {
                feeamount = Left(feeamount, feeamount.IndexOf('.'));
            }
            feeamount = Right(feeamount, 6);

            // Claim Data format stored as a string array to help serialisation
            //Format is  + Separator
            // Patient Id + ItemNumber + BodyPart +  DDMM + FeeAmount)
            data = patientId + itemNumber + bodyPart + dateservice + feeamount;
            ClaimDetails.Add(data);

            TransactionAmount += fee;
        }
        private void EnterNewClaim()
        {
            Console.Clear();
            ClaimDetails claim = new ClaimDetails();

            Console.WriteLine("Welcome to the new Claim Creator Page");
            Console.WriteLine("Please enter this new claims ID number");
            string claimID = Console.ReadLine();

            claim.ClaimID = Convert.ToInt32(claimID);

            Console.WriteLine("Select a Claim Type as a number 1-3: 1 = Car, 2 = Home, 3 = Theft");


            string claimType = Console.ReadLine();

            switch (claimType)
            {
            case "1":
                claim.ClaimType = ClaimDetails.ClaimTypes.Car;
                break;

            case "2":
                claim.ClaimType = ClaimDetails.ClaimTypes.Home;
                break;

            case "3":
                claim.ClaimType = ClaimDetails.ClaimTypes.Theft;
                break;
            }
            Console.WriteLine("Can you explain the reason for Your new claim");
            string description = Console.ReadLine();

            claim.Description = Convert.ToString(description);

            Console.WriteLine("Please enter the the cost of the damages. ex: 400.00");
            string claimAmount = Console.ReadLine();

            claim.ClaimAmount = Convert.ToDouble(claimAmount);

            Console.WriteLine("Please enter the date of the incident. ex: mm/dd/yyyy");
            string dateOfIncident = Console.ReadLine();

            claim.DateOfIncident = Convert.ToDateTime(dateOfIncident);

            Console.WriteLine("please enter the date the claim was filed ex: mm/dd/yyyy");
            string dateOfClaim = Console.ReadLine();

            claim.DateOfClaim = Convert.ToDateTime(dateOfClaim);

            _claimDetailsRepo.EnterNewClaim(claim);
        }
        public async Task <ClaimDetails> GetProfile()
        {
            await SyncAsync(true);

            ClaimDetails myProfile = new ClaimDetails();
            var          profile   = await azureSyncTable.Where(x => x.Extra == "profile").ToListAsync();

            if (profile.Any())
            {
                myProfile = profile.FirstOrDefault();
            }
            return(myProfile);
        }
        public async void LoadProfile()
        {
            await _dialog.Show("Loading...");

            MyProfile = await _savedClaimDatabase.GetProfile();

            await _dialog.Dismiss();

            FullName    = _myProfile.FullName;
            DateOfBirth = _myProfile.DoB;
            PolicyNum   = _myProfile.PolicyNum;
            PhoneNum    = _myProfile.PhoneNum;
            Email       = _myProfile.Email;
        }
Beispiel #15
0
        public void MapToClaimDetails_ShouldMap()
        {
            // Arrange
            var expectedResult = new ClaimDetails
            {
                PersonName  = "Test Test",
                Number      = "123",
                Status      = "Current",
                NextPayment = new ClaimNextPayment
                {
                    Amount         = "200.00",
                    Method         = "Direct debit",
                    PaidUpToAmount = "50.00",
                    Payee          = "test",
                    DueDate        = "12/12/2019",
                    Schedule       = "fortnightly",
                    Status         = EPaymentStatus.Expected
                },
                Address             = "Address1, Address2, Address3, Address4, Postcode",
                BenefitsCombination = BenefitsCombinationEnum.AllBenefits,
                CurrentEntitlement  = new CurrentEntitlement
                {
                    WeeklyCtaxBenefitEntitlement    = "25.00",
                    WeeklyHousingBenefitEntitlement = "100.00"
                }
            };

            // Act
            var result = _benefitsClaim.MapToClaimDetails();

            // Assert
            Assert.Equal(expectedResult.PersonName, result.PersonName);
            Assert.Equal(expectedResult.Number, result.Number);
            Assert.Equal(expectedResult.Status, result.Status);
            Assert.Equal(expectedResult.NextPayment.Amount, result.NextPayment.Amount);
            Assert.Equal(expectedResult.NextPayment.Method, result.NextPayment.Method);
            Assert.Equal(expectedResult.NextPayment.PaidUpToAmount, result.NextPayment.PaidUpToAmount);
            Assert.Equal(expectedResult.NextPayment.Payee, result.NextPayment.Payee);
            Assert.Equal(expectedResult.NextPayment.DueDate, result.NextPayment.DueDate);
            Assert.Equal(expectedResult.NextPayment.Schedule, result.NextPayment.Schedule);
            Assert.Equal(expectedResult.NextPayment.Status, result.NextPayment.Status);
            Assert.Equal(expectedResult.Address, result.Address);
            Assert.Equal(expectedResult.BenefitsCombination, result.BenefitsCombination);
            Assert.Equal(expectedResult.CurrentEntitlement.WeeklyHousingBenefitEntitlement, result.CurrentEntitlement.WeeklyHousingBenefitEntitlement);
            Assert.Equal(expectedResult.CurrentEntitlement.WeeklyCtaxBenefitEntitlement, result.CurrentEntitlement.WeeklyCtaxBenefitEntitlement);
        }
Beispiel #16
0
        public static void FillInBuildDetails(BuildDetails res, XmlDocument xml)
        {
            XmlNode claimedNode = xml.SelectSingleNode("/*/action[claimed/text() = 'true']");

            if (claimedNode == null)
            {
                return;
            }

            var reasonNode    = claimedNode.SelectSingleNode("reason");
            var claimedByNode = claimedNode.SelectSingleNode("claimedBy");

            ClaimDetails claimDetails = new ClaimDetails();

            claimDetails.User   = claimedByNode.InnerText;
            claimDetails.Reason = reasonNode != null ? reasonNode.InnerText : "";
            res.ClaimDetails    = claimDetails;
        }
        public async Task <int> UpdateProfile(ClaimDetails newProfile, ClaimDetails oldProfile)
        {
            await SyncAsync(true);

            var profile = await azureSyncTable.Where(x => x.Extra == "profile").ToListAsync();

            if (profile.Any())
            {
                await azureSyncTable.UpdateAsync(oldProfile);
                await SyncAsync();
            }
            else
            {
                await azureSyncTable.InsertAsync(newProfile);
                await SyncAsync();
            }

            return(1);
        }
        public async void UseProfileDetails()
        {
            ClaimDetails MyProfile = new ClaimDetails();

            MyProfile = await _savedClaimDatabase.GetProfile();

            FullName    = MyProfile.FullName;
            DateOfBirth = MyProfile.DoB;
            PolicyNum   = MyProfile.PolicyNum;
            PhoneNum    = MyProfile.PhoneNum;
            Email       = MyProfile.Email;
            if (string.IsNullOrWhiteSpace(MyProfile.FullName))
            {
                await _dialog.ShowToast("Profile details have not been entered.");
            }
            else
            {
                await _dialog.ShowToast("Profile details used.");
            }
        }
        public async Task <int> DeleteClaim(ClaimDetails claim)
        {
            await SyncAsync(true);

            await azureSyncTable.DeleteAsync(claim);

            await SyncAsync();

            return(0);
            //await SyncAsync(true);
            //var claim = await azureSyncTable.Where(x => x.Id == (string)id).ToListAsync();
            //if (claim.Any())
            //{
            //    await azureSyncTable.DeleteAsync(claim.FirstOrDefault());
            //    await SyncAsync();
            //    return 1;
            //}
            //else
            //{
            //    return 0;

            //}
        }
        public async void SubmitClaim()
        {
            if (string.IsNullOrWhiteSpace(_fullName) || string.IsNullOrWhiteSpace(_doB) || string.IsNullOrWhiteSpace(_policyNum) ||
                string.IsNullOrWhiteSpace(_phoneNum) || string.IsNullOrWhiteSpace(_email) ||
                string.IsNullOrWhiteSpace(_location) || string.IsNullOrWhiteSpace(_cmt))
            {
                await _dialog.ShowToast("Please enter all fields.");
            }
            else
            {
                ClaimDetails newClaim = new ClaimDetails()
                {
                    FullName  = _fullName,
                    DoB       = _doB,
                    PolicyNum = _policyNum,
                    PhoneNum  = _phoneNum,
                    Email     = _email,
                    Date      = _date.ToString(),
                    Time      = _time.ToString(),
                    Location  = _location,
                    Type      = _selectedType.ToString(),
                    Injury    = _selectedInjury.ToString(),
                    Cmt       = _cmt,
                    Extra     = "submitted",
                    Bytes     = GetString(_bytes)
                };

                await _dialog.Show("Lodging claim...");

                await _savedClaimDatabase.InsertClaim(newClaim);

                await _dialog.Dismiss();

                ShowViewModel <FirstViewModel>();
                await _dialog.ShowToast("Claim lodged.");
            }
        }
Beispiel #21
0
 public Task <BaseResponse> UpdateClaims(ClaimDetails claimDetail)
 {
     throw new NotImplementedException();
 }
        private void PullQueue(ClaimDetails content)
        {
            Queue <ClaimDetails> claim_queue = new Queue <ClaimDetails>();

            claim_queue.Enqueue(content);
        }
        public List <Dictionary <string, string> > GetM1Fields()
        {
            string m1Field    = "";
            string m1SubField = "";
            //TODO extract details out of             HicapsParams.ClaimData
            List <Dictionary <string, string> > listFieldsM1 = new List <Dictionary <string, string> >();

            ///   int linecount = 0;
            //  int m1FieldLen = 0;
            string[] ClaimData = ClaimDetails.ToArray();
            // Each Sub Claim Line
            for (int i = 0; i < ClaimData.Length; i++)
            {
                var fieldsM1 = new Dictionary <string, string>();
                //        6          6          8                  2            6           5            1                       6
                //data = itemNum + feeamount + dateofservice + itemOverrideCde + lspNum + equipmentId + selfDeemedCde + contribPatientAmountStr;
                //00002301000021072009        000000
                //00002301000021072009              000000
                string data                 = ClaimData[i];
                string itemNumber           = data.Substring(0, 6).Trim();   //= "12345";
                string chargeAmount         = data.Substring(6, 6).Trim();;  //= "0000060";
                string dateofservice        = data.Substring(12, 8).Trim();; //= "01072009";
                string itemOverrideCode     = data.Substring(20, 2).Trim();  //= "AP"; //"AP"
                string lspn                 = data.Substring(22, 6).Trim();  //= "123456"; //123456
                string equipmentId          = data.Substring(28, 5).Trim();  //= "12345"; //12345
                string selfDeemedCde        = data.Substring(33, 2).Trim();  //= "Y";  //Y
                string contribPatientAmount = data.Substring(35, 6).Trim();  //= "000000"; // "0000000";
                string spcid                = data.Substring(41, 4).Trim();  // = "    "

                // D1 = Charge Amount
                if (!string.IsNullOrEmpty(chargeAmount) && chargeAmount != "000000")
                {
                    // can only be size 7
                    int    amount   = Convert.ToInt32(chargeAmount);
                    string hexField = amount.ToString("X").PadLeft(6, '0');
                    fieldsM1.Add("D1", hexField);
                }
                // D9 = Date of Service
                if (!string.IsNullOrEmpty(dateofservice))
                {
                    // can only be size 8
                    fieldsM1.Add("D9", dateofservice);
                }
                // D2 = ItemNumber AlphsNumeric
                if (!string.IsNullOrEmpty(itemNumber))
                {
                    // Can only be size 6
                    fieldsM1.Add("D2", itemNumber);
                }
                // D3 = Item OVerride Code ?
                if (!string.IsNullOrEmpty(itemOverrideCode))
                {
                    // itemOverrideCode can only be 2.
                    fieldsM1.Add("D3", itemOverrideCode);
                }
                // D4 = Patient Contributon amount
                if (!string.IsNullOrEmpty(contribPatientAmount) && contribPatientAmount != "000000")
                {
                    // Can only be most size 7, 9999999
                    int    contribAmount = Convert.ToInt32(contribPatientAmount);
                    string hexField2     = contribAmount.ToString("X").PadLeft(6, '0');
                    fieldsM1.Add("D4", hexField2);
                }

                // D8 = LSPN
                if (!string.IsNullOrEmpty(lspn))
                {
                    // can only be len 6
                    lspn = lspn.PadLeft(6, '0');
                    fieldsM1.Add("D8", lspn);
                }

                // DA selfDeemedCde Id
                if (!string.IsNullOrEmpty(selfDeemedCde))
                {
                    // can only be len 2
                    fieldsM1.Add("DA", selfDeemedCde);
                }

                // DB Equipment Id
                if (!string.IsNullOrEmpty(equipmentId))
                {
                    // Can only be len 5
                    fieldsM1.Add("DB", equipmentId);
                }
                // DC spcid
                if (!string.IsNullOrEmpty(spcid))
                {
                    // Can only be len 4
                    fieldsM1.Add("DC", spcid);
                }

                listFieldsM1.Add(fieldsM1);
                // End of repeat line
            }
            return(listFieldsM1);
        }
 public async Task <BaseResponse> UpdateClaims(ClaimDetails claimDetails) => await _claimsService.UpdateClaims(claimDetails);
Beispiel #25
0
 public async void DeleteClaim(ClaimDetails claim)
 {
     await _database.DeleteClaim(claim);
 }
 public async Task <int> SubmitClaim(ClaimDetails claimDetails) => await _claimsService.SaveClaims(claimDetails);