コード例 #1
0
 public EligibilityDesc(
     Eligibility eligibility,
     int?streamNum)
 {
     Eligibility = eligibility;
     StreamNum   = streamNum;
 }
コード例 #2
0
        public async Task <ThorDto> GetThor(Guid userId)
        {
            var user = await core.User.GetBy(userId).ConfigureAwait(false);

            var eligibility = Eligibility.Check(user.Dob, user.Subscription);

            if (eligibility != UserEligibility.Ok)
            {
                core.Analytics.ReportUserStatus(
                    "GetThor",
                    eligibility
                    );

                return(new ThorDto
                {
                    UserEligibility = eligibility
                });
            }

            var thor = await core
                       .Repository.MarvelCharactors
                       .Get(Superhero.Thor).ConfigureAwait(false);

            var stormbreaker = await core
                               .Weaponary.Nidavellir
                               .Get(Substance.Uru).ConfigureAwait(false);

            thor.Stormbreaker = stormbreaker;

            return(new ThorDto
            {
                UserEligibility = eligibility,
                Thor = thor
            });
        }
コード例 #3
0
        public IActionResult Update(long id, [FromBody] Eligibility item)
        {
            // set bad request if contact data is not provided in body
            if (item == null || id == 0)
            {
                return(BadRequest());
            }
            var eligibility = _context.Eligibilitys.FirstOrDefault(t => t.Id == id);

            if (eligibility == null)
            {
                return(NotFound());
            }
            eligibility.DLNumber   = item.DLNumber;
            eligibility.Dob        = item.Dob;
            eligibility.LastSSN    = item.LastSSN;
            eligibility.IssueDate  = item.IssueDate;
            eligibility.LastName   = item.LastName;
            eligibility.Firstname  = item.Firstname;
            eligibility.MiddleName = item.MiddleName;
            //  eligibility.Suffix = item.Suffix;
            _context.Eligibilitys.Update(eligibility);
            _context.SaveChanges();
            item.Id = eligibility.Id;
            return(Ok(eligibility));
        }
コード例 #4
0
        public IActionResult CreateEligibility([FromBody] Eligibility item)
        {
            // set bad request if contact data is not provided in body
            if (item == null)
            {
                return(BadRequest());
            }

            var entity = new Eligibility();

            entity.IsCitizen        = item.IsCitizen;
            entity.IsFelon          = item.IsFelon;
            entity.IsMentalIncomp   = item.IsMentalIncomp;
            entity.NewRegistration  = item.NewRegistration;
            entity.RecordUpdate     = item.RecordUpdate;
            entity.RequesttoReplace = item.RequesttoReplace;
            entity.DLNumber         = item.DLNumber;
            entity.LastSSN          = item.LastSSN;
            entity.IssueDate        = item.IssueDate;
            entity.LastName         = item.LastName;
            entity.Firstname        = item.Firstname;
            entity.MiddleName       = item.MiddleName;
            entity.Suffix           = item.Suffix;
            entity.Dob = item.Dob;
            _context.Eligibilitys.Add(entity);
            _context.SaveChanges();
            item.Id = entity.Id;
            // Debug.WriteLine(" ID is " + entity.Id);

            // return Ok(entity);

            return(Ok(entity));
        }
コード例 #5
0
        public User AddUser(User user, string cacheKey)
        {
            try
            {
                var isEligible = _utils.IsEligibleForCard(user);
                var cardId     = this.GetApplicableCard(user);
                var el         = new Eligibility();

                if (isEligible && cardId != -1)
                {
                    el.CardId = cardId;
                }

                el.isEligible    = isEligible;
                user.CreatedOn   = DateTime.Now;
                user.Eligibility = el;

                _context.Add(user);
                _context.SaveChanges();
                return(user);
            }
            catch (Exception ex)
            {
                throw new DbUpdateException(ex.Message);
            }
        }
コード例 #6
0
        public async Task <WandaMaximoffDto> GetWandaMaximoff(Guid userId)
        {
            var user = await core.User.GetBy(userId).ConfigureAwait(false);

            var eligibility = Eligibility.Check(user.Dob, user.Subscription);

            if (eligibility != UserEligibility.Ok)
            {
                core.Analytics.ReportUserStatus(
                    "GetWandaMaximoff",
                    eligibility
                    );

                return(new WandaMaximoffDto
                {
                    UserEligibility = eligibility
                });
            }

            var wandaMaximoff = await core
                                .Repository.MarvelCharactors
                                .Get(Superhero.WandaMaximoff).ConfigureAwait(false);

            var chaosMagic = await core
                             .Weaponary.Earth.Mutant
                             .Get(Power.ChaosMagic).ConfigureAwait(false);

            wandaMaximoff.ChaosMagic = chaosMagic;

            return(new WandaMaximoffDto
            {
                UserEligibility = eligibility,
                WandaMaximoff = wandaMaximoff
            });
        }
コード例 #7
0
        public async Task <SpiderManDto> GetSpiderMan(Guid userId)
        {
            var user = await core.User.GetBy(userId).ConfigureAwait(false);

            var eligibility = Eligibility.Check(user.Dob, user.Subscription);

            if (eligibility != UserEligibility.Ok)
            {
                core.Analytics.ReportUserStatus(
                    "GetSpiderMan",
                    eligibility
                    );

                return(new SpiderManDto
                {
                    UserEligibility = eligibility
                });
            }

            var spiderMan = await core
                            .Repository.MarvelCharactors
                            .Get(Superhero.SpiderMan).ConfigureAwait(false);

            var weapons = await core
                          .Weaponary.Earth.StarkIndustries
                          .GetFor(Superhero.SpiderMan).ConfigureAwait(false);

            spiderMan.StarkSuit = weapons.StarkSuit;

            return(new SpiderManDto
            {
                UserEligibility = eligibility,
                SpiderMan = spiderMan
            });
        }
コード例 #8
0
        public IActionResult CreateEligibility([FromBody] Eligibility item)
        {
            // set bad request if contact data is not provided in body
            if (item == null)
            {
                return(BadRequest());
            }

            _context.Eligibilitys.Add(new Eligibility
            {
                IsCitizen        = item.IsCitizen,
                IsFelon          = item.IsFelon,
                IsMentalIncomp   = item.IsMentalIncomp,
                NewRegistration  = item.NewRegistration,
                RecordUpdate     = item.RecordUpdate,
                RequesttoReplace = item.RequesttoReplace,
                DLNumber         = item.DLNumber,
                LastSSN          = item.LastSSN,
                IssueDate        = item.IssueDate,
                LastName         = item.LastName,
                Firstname        = item.Firstname,
                MiddleName       = item.MiddleName,
                Suffix           = item.Suffix,
                Dob = item.Dob
            });
            _context.SaveChanges();

            return(Ok(new { message = "Eligibility is added successfully." }));
        }
コード例 #9
0
        public static int Save(Eligibility eligibility)
        {
            var a = new Eligibility
            {
                EligibilityExamDate    = eligibility.EligibilityExamDate,
                EligibilityExamPlace   = eligibility.EligibilityExamPlace,
                EligibilityLicenseDate = eligibility.EligibilityLicenseDate,
                EligibilityLicenseNo   = eligibility.EligibilityLicenseNo,
                EligibilityName        = eligibility.EligibilityName,
                EligibilityNo          = eligibility.EligibilityNo,
                PersonnelNo            = eligibility.PersonnelNo,
                EligibilityRating      = eligibility.EligibilityRating,
                modifieddate           = eligibility.modifieddate
            };

            using (_d = new DataRepository <Eligibility>())
            {
                if (eligibility.EligibilityNo > 0)
                {
                    _d.Update(a);
                }
                else
                {
                    _d.Add(a);
                }

                _d.SaveChanges();
            }

            return(a.EligibilityNo);
        }
コード例 #10
0
        public async Task <ThanosDto> GetThanos(Guid userId)
        {
            var user = await core.User.GetBy(userId).ConfigureAwait(false);

            var eligibility = Eligibility.Check(user.Dob, user.Subscription);

            if (eligibility != UserEligibility.Ok)
            {
                core.Analytics.ReportUserStatus(
                    "GetThanos",
                    eligibility
                    );

                return(new ThanosDto
                {
                    UserEligibility = eligibility
                });
            }

            var thanos = await core
                         .Repository.MarvelCharactors
                         .Get(SuperVillains.Thanos).ConfigureAwait(false);

            var weapons = await core
                          .Weaponary.Titan
                          .MakeFrom(Substance.Adamantium).ConfigureAwait(false);

            thanos.DoubleEdgedSword = weapons.DoubleEdgedSword;

            return(new ThanosDto
            {
                UserEligibility = eligibility,
                Thanos = thanos
            });
        }
コード例 #11
0
        public async Task <IActionResult> UpdateEligibility(long id, [FromBody] Eligibility model)
        {
            // set bad request if contact data is not provided in body
            if (id == 0 || id != model.OvrApplicationId)
            {
                return(BadRequest());
            }

            var dbOvrApplication = this.GetOvrApplicationById(id);

            if (dbOvrApplication == null || model == null)
            {
                return(NotFound());
            }

            dbOvrApplication.UsCitizen             = model.UsCitizen;
            dbOvrApplication.NotAFelon             = model.NotAFelon;
            dbOvrApplication.MentalIncompStatus    = model.MentalIncompStatus;
            dbOvrApplication.NewRegistration       = model.NewRegistration;
            dbOvrApplication.VoterClaimsNoSsnOrDln = model.VoterClaimsNoSsnOrDln;
            dbOvrApplication.RecordUpdate          = model.RecordUpdate;
            dbOvrApplication.RequesttoReplace      = model.RequesttoReplace;
            dbOvrApplication.FlDlNum     = model.FlDlNum;
            dbOvrApplication.SsnLast4    = model.SsnLast4;
            dbOvrApplication.DlIssueDate = model.DlIssueDate;
            dbOvrApplication.LastName    = model.LastName;
            dbOvrApplication.FirstName   = model.FirstName;
            dbOvrApplication.MiddleName  = model.MiddleName;
            dbOvrApplication.NameSuffix  = model.NameSuffix;
            dbOvrApplication.DateOfBirth = model.DateOfBirth;
            _context.Update(dbOvrApplication);
            await _context.SaveChangesAsync();

            return(new ObjectResult(GetEligibilityById(dbOvrApplication.OvrApplicationId)));
        }
コード例 #12
0
        public async Task <CaptainAmericaDto> GetCaptainAmerica(Guid userId)
        {
            var user = await core.User.GetBy(userId).ConfigureAwait(false);

            var eligibility = Eligibility.Check(user.Dob, user.Subscription);

            if (eligibility != UserEligibility.Ok)
            {
                core.Analytics.ReportUserStatus(
                    "GetCaptainAmerica",
                    eligibility
                    );

                return(new CaptainAmericaDto
                {
                    UserEligibility = eligibility
                });
            }

            var captainAmerica = await core
                                 .Repository.MarvelCharactors
                                 .Get(Superhero.CaptainAmerica).ConfigureAwait(false);

            var shield = await core
                         .Weaponary.Earth
                         .MakeFrom(Substance.VibraniumSteel).ConfigureAwait(false);

            captainAmerica.Shield = shield;

            return(new CaptainAmericaDto
            {
                UserEligibility = eligibility,
                CaptainAmerica = captainAmerica
            });
        }
コード例 #13
0
        private void determineEligibilityButton_Click_1(object sender, EventArgs e)
        {
            int  age;
            bool testAge = int.TryParse(ageTextBox.Text, out age);

            if (!testAge)
            {
                validLabel.Text    = "Plese enter a valid age";
                eligibleLabel.Text = " ";
            }

            int  years;
            bool testYears = int.TryParse(yearsInUSTextBox.Text, out years);

            if (!testYears)
            {
                validLabel.Text    = "Plese enter a valid number of years";
                eligibleLabel.Text = " ";
            }

            int  priorTerms;
            bool testTerms = int.TryParse(priorTermsTextBox.Text, out priorTerms);

            if (!testTerms)
            {
                validLabel.Text    = "Plese enter a valid number of terms";
                eligibleLabel.Text = " ";
            }

            bool citizen = false;

            if (citizenCheckBox.Checked)
            {
                citizen = true;
            }

            bool rebelled = false;

            if (rebelledUSCheckBox.Checked)
            {
                rebelled = true;
            }

            if (testTerms && testYears && testAge)
            {
                Eligibility eligiblePrez = new Eligibility(age, years, citizen, priorTerms, rebelled);
                bool        couldRun     = eligiblePrez.EligiblePrez();

                if (couldRun)
                {
                    eligibleLabel.Text = "You are eligible to run for President of the US!";
                    validLabel.Text    = " ";
                }
                else
                {
                    eligibleLabel.Text = "You are not eligible to run for President of the US!";
                    validLabel.Text    = " ";
                }
            }
        }
コード例 #14
0
 public Eligibility Save(Eligibility domain)
 {
     using (var adapter = PersistenceLayer.GetDataAccessAdapter())
     {
         var entity = Mapper.Map <Eligibility, EligibilityEntity>(domain);
         adapter.SaveEntity(entity, true, false);
         return(Mapper.Map <EligibilityEntity, Eligibility>(entity));
     }
 }
コード例 #15
0
        public static bool Delete(Eligibility eligibility)
        {
            using (_d = new DataRepository <Eligibility>())
            {
                _d.Delete(eligibility);
                _d.SaveChanges();
            }

            return(true);
        }
コード例 #16
0
 public Player(string name, string team, Eligibility eligibility, Position position, double projected, bool isMovable)
 {
     this.name        = name;
     this.team        = team;
     this.eligibility = eligibility;
     this.position    = position;
     this.projected   = projected;
     this.isMovable   = isMovable;
     byeWeek          = Team.GetByeWeek(team);
 }
コード例 #17
0
 public Player(string name, string team, string eligibility, string position, double projected, bool isMovable)
 {
     this.name        = name;
     this.team        = team;
     this.eligibility = GetEligibility(eligibility);
     this.position    = GetPosition(position);
     this.projected   = projected;
     this.isMovable   = isMovable;
     byeWeek          = Team.GetByeWeek(team);
 }
コード例 #18
0
        /// <summary>
        /// Helper to convert enum to a valid string sent/received in from the API
        /// <returns>String</returns>
        /// </summary>
        public static String EligibilityToString(Eligibility value)
        {
            switch (value)
            {
            case Eligibility.Coupon: return("C");

            case Eligibility.All: return("A");

            case Eligibility.Customer: return("X");

            case Eligibility.LoggedIn: return("L");
            }
            return("");
        }
コード例 #19
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (DiscountType != null)
         {
             hashCode = hashCode * 59 + DiscountType.GetHashCode();
         }
         if (Amount != null)
         {
             hashCode = hashCode * 59 + Amount.GetHashCode();
         }
         if (BalanceRate != null)
         {
             hashCode = hashCode * 59 + BalanceRate.GetHashCode();
         }
         if (TransactionRate != null)
         {
             hashCode = hashCode * 59 + TransactionRate.GetHashCode();
         }
         if (AccruedRate != null)
         {
             hashCode = hashCode * 59 + AccruedRate.GetHashCode();
         }
         if (AdditionalValue != null)
         {
             hashCode = hashCode * 59 + AdditionalValue.GetHashCode();
         }
         if (Eligibility != null)
         {
             hashCode = hashCode * 59 + Eligibility.GetHashCode();
         }
         if (AdditionalInfo != null)
         {
             hashCode = hashCode * 59 + AdditionalInfo.GetHashCode();
         }
         if (AdditionalInfoUri != null)
         {
             hashCode = hashCode * 59 + AdditionalInfoUri.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #20
0
        public IHttpActionResult post(Eligibility eligibility)
        {
            if (eligibility.level == 1)
            {
                return(Ok("valid"));
            }
            var results         = db.ViewAll_Results_ByExam().ToList();
            int exam_id         = 0;
            int found           = 0;
            var student_results = new List <int>();

            //FIND THE EXAM ID OF THE PREVIOUS LEVEL
            foreach (var i in results)
            {
                if (i.Course_id == eligibility.c_id && i.level == eligibility.level - 1)
                {
                    exam_id = (int)i.e_id;
                    break;
                }
            }
            //SELECT THE REUSLTS FOR THAT PREVIOUS LEVEL
            foreach (var i in results)
            {
                if (i.s_id == eligibility.s_id && i.e_id == exam_id)
                {
                    found = 1;
                    student_results.Add(Convert.ToInt32(i.Result));
                }
            }
            //CHECK THE SCORES FOR THE PREVIOUS LEVEL

            if (found == 1)
            {
                //IF SCORE IS >=65 valid
                int max = student_results.Max();
                if (max >= 65)
                {
                    return(Ok("valid"));
                }
                else
                {
                    return(Ok("error"));
                }
            }
            else
            {
                return(Ok("error"));
            }
        }
コード例 #21
0
        /// <summary>
        /// Returns true if BankingProductDetail instances are equal
        /// </summary>
        /// <param name="other">Instance of BankingProductDetail to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BankingProductDetail other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Bundles == other.Bundles ||
                     Bundles != null &&
                     Bundles.SequenceEqual(other.Bundles)
                     ) &&
                 (
                     Features == other.Features ||
                     Features != null &&
                     Features.SequenceEqual(other.Features)
                 ) &&
                 (
                     Constraints == other.Constraints ||
                     Constraints != null &&
                     Constraints.SequenceEqual(other.Constraints)
                 ) &&
                 (
                     Eligibility == other.Eligibility ||
                     Eligibility != null &&
                     Eligibility.SequenceEqual(other.Eligibility)
                 ) &&
                 (
                     Fees == other.Fees ||
                     Fees != null &&
                     Fees.SequenceEqual(other.Fees)
                 ) &&
                 (
                     DepositRates == other.DepositRates ||
                     DepositRates != null &&
                     DepositRates.SequenceEqual(other.DepositRates)
                 ) &&
                 (
                     LendingRates == other.LendingRates ||
                     LendingRates != null &&
                     LendingRates.SequenceEqual(other.LendingRates)
                 ));
        }
コード例 #22
0
        public void UpdateEligibility()
        {
            if (null != SelectedHIVStatus && !SelectedHIVStatus.ItemId.IsNullOrEmpty() &&
                SelectedHIVStatus.ItemId == new Guid("b25efd8a-852f-11e7-bb31-be2e44b06b34"))  //pos
            {
                EnableBookingDate = EnablePNSApproach = AllowEligibility = true;
            }
            else
            {
                SelectedEligibility = Eligibility.OrderBy(x => x.Rank).FirstOrDefault();
                EnableBookingDate   = EnablePNSApproach = AllowEligibility = false;
            }


            if (AllowScreening)
            {
                MakeEligibile = true;
//                if (null != SelectedPhysicalAssult)
//                {
//                    assulted = null != SelectedPhysicalAssult.Item &&
//                               SelectedPhysicalAssult.Item.Code.ToLower() == "Y".ToLower();
//                }
//
//                if (null != SelectedSexuallyUncomfortable)
//                {
//                    uncomfortable = null != SelectedSexuallyUncomfortable.Item &&
//                                    SelectedSexuallyUncomfortable.Item.Code.ToLower() == "Y".ToLower();
//                }
//
//                if (null != SelectedThreatened)
//                {
//                    threatened = null != SelectedThreatened.Item &&
//                                 SelectedThreatened.Item.Code.ToLower() == "Y".ToLower();
//                }
//
//                MakeEligibile = !assulted && !uncomfortable && !threatened;
            }

            if (null != SelectedHIVStatus)
            {
                var hivpos = null != SelectedHIVStatus.Item && SelectedHIVStatus.Item.Code.ToLower() == "P".ToLower();
                if (hivpos)
                {
                    MakeEligibile = false;
                }
            }
        }
コード例 #23
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Eligibility != null)
         {
             hashCode = hashCode * 59 + Eligibility.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #24
0
        // [Route("addEligibility")]
        public async Task <IActionResult> CreateEligibility([FromBody] Eligibility item)
        {
            // set bad request if contact data is not provided in body
            if (item == null)
            {
                return(BadRequest());
            }

            var dbOvrApplication = _mapper.Map <OvrApplication>(item);

            dbOvrApplication.SessionId = Guid.NewGuid().ToString();
            await _context.OvrApplications.AddAsync(dbOvrApplication);

            await _context.SaveChangesAsync();

            var data = GetEligibilityById(dbOvrApplication.OvrApplicationId);

            return(new ObjectResult(data));
        }
コード例 #25
0
 private void SetEligibilityState()
 {
     if (null != SelectedHIVStatus && !SelectedHIVStatus.ItemId.IsNullOrEmpty() &&
         SelectedHIVStatus.ItemId == new Guid("B25EFD8A-852F-11E7-BB31-BE2E44B06B34"))  //pos
     {
         AllowEligibility = EnableBookingDate = EnablePNSApproach = false;
         try
         {
             SelectedEligibility = Eligibility.FirstOrDefault(x => x.ItemId == new Guid("b25ed04e-852f-11e7-bb31-be2e44b06b34"));
         }
         catch
         {
             SelectedEligibility = Eligibility.OrderBy(x => x.Rank).FirstOrDefault();
         }
     }
     else
     {
         AllowEligibility = EnableBookingDate = EnablePNSApproach = true;
     }
 }
コード例 #26
0
        public int Post([FromBody] Eligibility eligibility)
        {
            int val = 0;
            List <application> app = hle.applications.ToList().FindAll(item => item.loginid == eligibility.user.id && item.status == "success");

            List <loan> loans = new List <loan>();

            foreach (var item in app)
            {
                loans.Add(hle.loans.ToList().Find(item1 => item1.loanId == item.appId && item1.noOfEmiLeft > 0));
            }

            foreach (var item in loans)
            {
                if (item != null && item.noOfEmiLeft > 0)
                {
                    val += item.amountApproved / item.noOfEmiTotal;
                }
            }

            return(val);
        }
コード例 #27
0
        /// <summary>
        /// Returns true if ProtectionEligibility instances are equal
        /// </summary>
        /// <param name="other">Instance of ProtectionEligibility to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ProtectionEligibility other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Eligibility == other.Eligibility ||
                     Eligibility != null &&
                     Eligibility.Equals(other.Eligibility)
                     ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ));
        }
コード例 #28
0
        public async Task <IronManDto> GetIronMan(Guid userId)
        {
            var user = await core.User.GetBy(userId).ConfigureAwait(false);

            var eligibility = Eligibility.Check(user.Dob, user.Subscription);

            if (eligibility != UserEligibility.Ok)
            {
                core.Analytics.ReportUserStatus(
                    "GetIronMan",
                    eligibility
                    );

                return(new IronManDto
                {
                    UserEligibility = eligibility
                });
            }

            var ironMan = await core
                          .Repository.MarvelCharactors
                          .Get(Superhero.IronMan).ConfigureAwait(false);

            var classicGrayArmor = await core
                                   .Weaponary.Earth.StarkIndustries
                                   .GetArmor(
                Superhero.IronMan,
                Superhero.IronMan.Era.ClassicGrayArmor).ConfigureAwait(false);

            ironMan.Armor = classicGrayArmor;

            return(new IronManDto
            {
                UserEligibility = eligibility,
                IronMan = ironMan
            });
        }
コード例 #29
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Bundles != null)
         {
             hashCode = hashCode * 59 + Bundles.GetHashCode();
         }
         if (Features != null)
         {
             hashCode = hashCode * 59 + Features.GetHashCode();
         }
         if (Constraints != null)
         {
             hashCode = hashCode * 59 + Constraints.GetHashCode();
         }
         if (Eligibility != null)
         {
             hashCode = hashCode * 59 + Eligibility.GetHashCode();
         }
         if (Fees != null)
         {
             hashCode = hashCode * 59 + Fees.GetHashCode();
         }
         if (DepositRates != null)
         {
             hashCode = hashCode * 59 + DepositRates.GetHashCode();
         }
         if (LendingRates != null)
         {
             hashCode = hashCode * 59 + LendingRates.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #30
0
        public ModifyPatientResp CreatePatient(Customer customer, Eligibility eligibility, IEnumerable <InsuranceCompany> insuranceCompanies, PrimaryCarePhysician pcp, BillingAccount billingAccount)
        {
            try
            {
                var client = new KareoServicesClient();

                var requestHeader = new RequestHeader
                {
                    ClientVersion = ClientVersion,
                    CustomerKey   = billingAccount.CustomerKey,
                    User          = billingAccount.UserName,
                    Password      = billingAccount.Password
                };

                // Create the patient to insert.
                var newPatient = new PatientCreate
                {
                    FirstName           = customer.Name.FirstName,
                    MiddleName          = customer.Name.MiddleName,
                    LastName            = customer.Name.MiddleName,
                    DateofBirth         = customer.DateOfBirth,
                    Gender              = customer.Gender == Gender.Male ? GenderCode.Male : customer.Gender == Gender.Female ? GenderCode.Female : GenderCode.Unknown,
                    MedicalRecordNumber = customer.CustomerId.ToString(),
                    AddressLine1        = customer.Address.StreetAddressLine1,
                    AddressLine2        = customer.Address.StreetAddressLine2,
                    City         = customer.Address.City,
                    State        = customer.Address.StateCode,
                    ZipCode      = customer.Address.ZipCode.Zip,
                    HomePhone    = customer.HomePhoneNumber != null ? customer.HomePhoneNumber.FormatPhoneNumber : string.Empty,
                    WorkPhone    = customer.OfficePhoneNumber != null ? customer.OfficePhoneNumber.FormatPhoneNumber : string.Empty,
                    MobilePhone  = customer.MobilePhoneNumber != null ? customer.MobilePhoneNumber.FormatPhoneNumber : string.Empty,
                    EmailAddress = customer.Email != null?customer.Email.ToString() : string.Empty,
                                       PatientExternalID = customer.CustomerId.ToString()
                };

                // Set the practice we want to add this patient to
                var practice = new PracticeIdentifierReq
                {
                    PracticeName = billingAccount.Name
                };

                // Create the case details for the patient
                var patientCase = new PatientCaseCreateReq
                {
                    CaseName = CaseName,
                    //patientCase.PayerScenario
                    Active = true,
                    SendPatientStatements = true
                };

                var eligibleResponse = JsonConvert.DeserializeObject <EligibleResponse>(eligibility.Response);
                InsuranceCompany insuranceCompany = null;
                if (eligibleResponse.PrimaryInsurance != null)
                {
                    insuranceCompany = insuranceCompanies.FirstOrDefault(ic => ic.Code == eligibleResponse.PrimaryInsurance.Id);
                }
                else if (eligibleResponse.Insurance != null)
                {
                    insuranceCompany = insuranceCompanies.FirstOrDefault(ic => ic.Code == eligibleResponse.Insurance.Id);
                }

                if (insuranceCompany == null)
                {
                    insuranceCompany = insuranceCompanies.First(ic => ic.Id == eligibility.InsuranceCompanyId);
                }

                // Create the insurance policies for the patient case
                var primaryPolicy = new InsurancePolicyCreateReq
                {
                    CompanyName       = insuranceCompany.Name,
                    PlanName          = eligibleResponse.Plan.PlanName,
                    PolicyNumber      = eligibleResponse.Demographics.Subscriber.MemberId,
                    PolicyGroupNumber = eligibleResponse.Demographics.Subscriber.GroupId,
                    Copay             = eligibility.CoPayment.ToString("0.00")
                };
                //primaryPolicy.PlanID = eligibleResponse.Plan.PlanNumber;

                patientCase.Policies = new InsurancePolicyCreateReq[] { primaryPolicy };


                newPatient.Practice = practice;
                newPatient.Cases    = new PatientCaseCreateReq[] { patientCase };
                if (pcp != null)
                {
                    newPatient.PrimaryCarePhysician = new PhysicianIdentifierReq
                    {
                        FullName = pcp.Name.FullName
                    };
                }

                // Create the create patient request object
                var request = new CreatePatientReq
                {
                    RequestHeader = requestHeader,
                    Patient       = newPatient
                };

                // Call the Create Patient method
                var response = client.CreatePatient(request);

                // Check the response for an error
                if (response.ErrorResponse.IsError)
                {
                    throw new Exception(response.ErrorResponse.ErrorMessage);
                }

                if (!response.SecurityResponse.SecurityResultSuccess)
                {
                    throw new Exception(response.SecurityResponse.SecurityResult);
                }

                client.Close();

                return(response);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }