示例#1
0
        public void Setup()
        {
            _base = new CallObject();

            var oNode  = new Claim();
            var oNode2 = new Insured();
            var oNode3 = new Vehicle();
            var oNode4 = new Driver();

            _base.Add(oNode);
            oNode.Add(oNode2);
            oNode2.Add(oNode3);
            oNode2.Add(oNode4);

            oNode.SetValue(CallObject.LobCdAttributeName, "WOR");
            oNode.ClaimNumber = "00122345";
            oNode.LossDate    = "12092005";

            oNode2.InsuredName = "Steven Murphy";

            oNode2.SetValue(Address.AddressLine1, "95 Wells Avenue");
            oNode2.SetValue(Address.AddressCity, "Newton");
            oNode2.SetValue(Address.AddressState, "MA");
            oNode2.SetValue(Address.AddressZip, "02459");

            oNode2.PhoneHome = "6178862064";

            oNode3.Make  = "TOYOTA";
            oNode3.Model = "MATRIX";
            oNode3.Vin   = "1234567891011121314";
            oNode3.Year  = "2004";

            oNode4.NameFirst = "Cookie";
            oNode4.NameLast  = " Murphy";

            oNode4.SetValue(Address.AddressLine1, "529 Main Street");
            oNode4.SetValue(Address.AddressCity, "Charlestown");
            oNode4.SetValue(Address.AddressState, "MA");
            oNode4.SetValue(Address.AddressZip, "02129");
            oNode4.SetValue(EntityBase.HomePhoneAttribute, "6178862064");

            _base.Commit();
        }
示例#2
0
        /// <summary>
        /// Calculates the costs of claim and debt
        /// </summary>
        public void CostCalculation()
        {
            // CLAIM
            Claim.Clear();
            foreach (Purchase purchase in Session.Household.Purchases)
            {
                if (purchase.UserPayed.Contains(Session.User.Name))
                {
                    foreach (string user in purchase.UsersInvolved)
                    {
                        if (user != Session.User.Name)
                        {
                            if (!purchase.UsersInvolvedPayed.Contains(user))
                            {
                                if (!_claim_dictionary.ContainsKey(user))
                                {
                                    _claim_dictionary.Add(user, purchase.Price / purchase.UsersInvolved.Count);
                                }
                                else
                                {
                                    _claim_dictionary[user] += (purchase.Price / purchase.UsersInvolved.Count);
                                }
                            }
                        }
                    }
                }
            }
            foreach (KeyValuePair <string, double> entry in _claim_dictionary)
            {
                Claim.Add(new UserClaim()
                {
                    Name = entry.Key, Total = entry.Value
                });
                Netto += entry.Value;
            }

            // DEBT
            Debt.Clear();
            foreach (Purchase purchase in Session.Household.Purchases)
            {
                if (purchase.UsersInvolved.Contains(Session.User.Name) && !purchase.UsersInvolvedPayed.Contains(Session.User.Name))
                {
                    if (!_debt_dictionary.ContainsKey(purchase.UserPayed))
                    {
                        _debt_dictionary.Add(purchase.UserPayed, purchase.Price / purchase.UsersInvolved.Count);
                    }
                    else
                    {
                        _debt_dictionary[purchase.UserPayed] += (purchase.Price / purchase.UsersInvolved.Count);
                    }
                }
            }
            foreach (KeyValuePair <string, double> entry in _debt_dictionary)
            {
                Debt.Add(new UserDebt()
                {
                    Name = entry.Key, Total = entry.Value
                });
                Netto -= entry.Value;
            }
        }