Пример #1
0
 public LossInfoType(CauseOfLossCode col, DateTime rd, string ld)
 {
     CauseOfLoss = col;
     ReportedDate = rd;
     LossDescription = ld;
 }
Пример #2
0
        async private Task <IEnumerable <MitchellClaimType> > FindClaims(string query = "")
        {
            IEnumerable <Claim>      oList  = null;
            List <MitchellClaimType> claims = new List <MitchellClaimType>();

            try
            {
                using (var conn = new SqlConnection(ConnectionString))
                {
                    await conn.OpenAsync();

                    oList = await conn.QueryAsync <Claim>(query == ""?Commands.GetAllClaims : query);

                    if (oList != null && oList.Count <Claim>() > 0)
                    {
                        foreach (var item in oList)
                        {
                            MitchellClaimType claim = new MitchellClaimType();
                            claim.AssignedAdjusterID = item.AssignedAdjusterID;
                            claim.ClaimantFirstName  = item.ClaimantFirstName;
                            claim.ClaimantLastName   = item.ClaimantLastName;
                            claim.ClaimNumber        = item.ClaimNumber;
                            claim.LossDate           = item.LossDate;
                            CauseOfLossCode c = CauseOfLossCode.Collision;
                            if (item.CauseOfLossKey == 2)
                            {
                                c = CauseOfLossCode.Explosion;
                            }
                            if (item.CauseOfLossKey == 3)
                            {
                                c = CauseOfLossCode.Fire;
                            }
                            if (item.CauseOfLossKey == 4)
                            {
                                c = CauseOfLossCode.Hail;
                            }
                            if (item.CauseOfLossKey == 5)
                            {
                                c = CauseOfLossCode.MechanicalBreakdown;
                            }
                            if (item.CauseOfLossKey == 6)
                            {
                                c = CauseOfLossCode.Other;
                            }
                            claim.LossInfo = new LossInfoType {
                                CauseOfLoss = c, LossDescription = item.LossDescription, ReportedDate = item.ReportDate
                            };
                            claim.Status = item.StatusKey == 1 ? StatusCode.OPEN : StatusCode.CLOSED;
                            IEnumerable <VehicleDamageInfo> vehicleInfo = await conn.QueryAsync <VehicleDamageInfo>(string.Format(Commands.GetVehicleDetailsByClaim, item.ClaimNumber));

                            if (vehicleInfo != null)
                            {
                                VehicleInfoType[] vInfo = new VehicleInfoType[vehicleInfo.Count <VehicleDamageInfo>()];
                                int j = 0;
                                foreach (var v in vehicleInfo)
                                {
                                    vInfo[j] = new VehicleInfoType()
                                    {
                                        DamageDescription = v.DamageDescription,
                                        EngineDescription = v.EngineDescription,
                                        ExteriorColor     = v.ExteriorColor,
                                        LicPlate          = v.LicPlate,
                                        LicPlateExpDate   = v.LicPlateExpDate,
                                        MakeDescription   = v.MakeDescription,
                                        ModelYear         = v.ModelYear,
                                        Vin              = v.Vin,
                                        LicPlateState    = v.LicPlateState,
                                        ModelDescription = v.ModelDescription
                                    };

                                    j++;
                                }
                                claim.Vehicles = vInfo;
                            }
                            claims.Add(claim);
                        }
                    }
                }
            }
            catch
            {
            }
            return(claims.AsEnumerable());
        }