public PolicyDetailsVM GetPolicyDetail(CLA_ClaimForm_TB ClaimObj) { int SalesFormId = _context.SLS_SalesFormMapping_TB.Where(x => x.Id == ClaimObj.SalesFormMapping_Id).FirstOrDefault().SalesForm_Id; return(_context.CLA_GetPolicyDetails_SP(SalesFormId).Select(x => new PolicyDetailsVM { }).FirstOrDefault()); }
public DriverDetailVM GetDriverDetail(int?ClaimId) { DriverDetailVM _DriverDetail = new DriverDetailVM(); CLA_ClaimForm_TB ClaimForm = _context.CLA_ClaimForm_TB.Where(x => x.Id == ClaimId).OrderByDescending(x => x.Add_On).FirstOrDefault(); if (ClaimForm != null) { _DriverDetail.DriverName = ClaimForm.DriverName; _DriverDetail.DriverDOB = ClaimForm.DriverDOB?.ToString("dd/MM/yyyy"); _DriverDetail.VehicleSpeed = ClaimForm.VehicleSpeed; _DriverDetail.LicenseNo = ClaimForm.LicenseNo; _DriverDetail.LicenseIssueDate = ClaimForm.LicenseIssueDate?.ToString("dd/MM/yyyy"); _DriverDetail.LicenseExpiry = ClaimForm.LicenseExpiryDate?.ToString("dd/MM/yyyy"); _DriverDetail.DriverRelationship_Id = ClaimForm.DriverRelationship_Id; _DriverDetail.Mileage = ClaimForm.Mileage; _DriverDetail.ClaimId = ClaimId.GetValueOrDefault(); } return(_DriverDetail); }
public Policy GetPLRDetails(int ClaimId, string UserId, string IPAddress) { Policy policy = new Policy { SurveyorDetailVM = new SurveyorDetailVM() }; PolicyVM PolicyVM = new PolicyVM(); try { BillingAssessmentDetail _BillingAssesmentDetails = new BillingAssessmentDetail(); CLA_ClaimForm_TB ClaimObj = _context.CLA_ClaimForm_TB.Where(x => x.Id == ClaimId).FirstOrDefault(); PolicyVM.PolicyDetailsVM = GetPolicyDetail(ClaimObj); PolicyVM.InsuredDetailVM = GetInsuredDetail(ClaimId); PolicyVM.SingleVehicleAccessoriesVM = GetSingleVehicleAccessories(ClaimObj.SalesFormDetail_Id); policy.DriverDetailVM = GetDriverDetail(ClaimId); policy.PoliceDetailVM = GetPoliceDetail(ClaimId); policy.DriverDetailVM.RelationInsured = GetRelationInsured(); PolicyVM.PolicyEndorsementHistoryVM = GetPolicyEndorsementHistory(PolicyVM.PolicyDetailsVM.ChassisNo, PolicyVM.PolicyDetailsVM.RegistrationNo); PolicyVM.PolicyHistoryVM = GetPolicyHistory(PolicyVM.PolicyDetailsVM.ChassisNo, PolicyVM.PolicyDetailsVM.RegistrationNo); PolicyVM.ClaimMotorHistoryVM = GetClaimMotorHistory(PolicyVM.PolicyDetailsVM.ChassisNo, PolicyVM.PolicyDetailsVM.RegistrationNo); PolicyVM.AddCoversVM = GetGetAddCovers(ClaimObj.SalesFormDetail_Id); policy.UserInfo = new UserInfoVM { UserID = UserId, UserIP = IPAddress }; _BillingAssesmentDetails.ClaimId = ClaimId; policy.SurveyorDetailVM.ClaimId = ClaimId.ToString(); SURP_GetSurveyDetail_SP_Result SurveyddetailObj = _context.SURP_GetSurveyDetail_SP(ClaimId).FirstOrDefault(); policy.SurveyorDetailVM.TypeOfClaim = SurveyddetailObj.ClaimType; policy.SurveyorDetailVM.IncidentDateTime = SurveyddetailObj.IncidentDateTime.ToString(); policy.SurveyorDetailVM.PlaceOfIncidentCity = SurveyddetailObj.PlaceOfIncidentCity; policy.SurveyorDetailVM.PlaceOfIncidentArea = SurveyddetailObj.PlaceOfIncidentArea; policy.SurveyorDetailVM.Workshop = SurveyddetailObj.Workshop; policy.SurveyorDetailVM.VehicleMovementDateTime = SurveyddetailObj.VehicleMovementDateTime; policy.SurveyorDetailVM.CircumstancesofLoss = SurveyddetailObj.CircumstancesOfLoss; policy.SurveyorDetailVM.SurveyDate = SurveyddetailObj.SurveyDate.ToString(); _BillingAssesmentDetails.ClaimId = ClaimId; _BillingAssesmentDetails.ClaimNo = ClaimObj.ClaimNo; _BillingAssesmentDetails.BillingPartiesObj = new BillingParties(); policy.BillingAssessmentDetail = _BillingAssesmentDetails; policy.BillingAssessmentDetail.BillingPartiesObj = (from p in _context.CLA_PLRParties_TB where p.ClaimForm_Id == ClaimId && (p.PartyType_Id == (int)PartyType.Workshop || p.PartyType_Id == (int)PartyType.Supplier) || ((p.PartyType_Id == (int)PartyType.ExternalSurveyor || p.PartyType_Id == (int)PartyType.InternalSurveyor) && p.IsLead == true) select new BillingParties { Id = p.Id, ClaimForm_Id = p.ClaimForm_Id, PartyType_Id = p.PartyType_Id, BillingPartyAmountObj = _context.CLA_PLRPartyAmount_TB.Where(a => a.PLRPartiesId == p.Id && a.Active == Status.Active).Select(a => new BillingPartyAmount { Id = a.Id, PLRPartiesId = a.PLRPartiesId, PLRNo = a.PLRNo, EstimateDate = a.EstimateDate, EstimateNo = a.EstimateNo, PLRDispositionId = a.PLRDispositionId, PLRStatus = a.PLRStatus, PaymentToWhom = a.PaymentToWhom, Active = a.Active, ClaimId = a.ClaimId, TotalDeductiblePart = a.TotalDeductiblePart, TotalDeductibleLab = a.TotalDeductibleLab, TotalUnderInsurancePart = a.TotalUnderInsurancePart, TotalUnderInsuranceLab = a.TotalUnderInsuranceLab, TotalDemandedLab = a.TotalDemandedLab, TotalAgreedLab = a.TotalAgreedLab, PartsAmount = a.TotalPartsAmount, TotalPartsAmount = a.TotalPartsAmount, TotalGrossAmountPart = a.TotalGrossAmount, TotalAssessment = a.TotalAssesment, SubTotalParts = a.SubTotalPart, SubTotalLab = a.SubTotalLab, TotalGrossAmountLab = a.TotalGrossAmountLab, TotalVendorGrossAmount = a.TotalVendorGrossAmount, TotalTDIGrossAmount = a.TotalTDIGrossAmount, AssesmentConclusion = a.AssesmentConclusion, Findings = a.Findings, AssessmentRemarks = a.AssessmentRemarks, IsAssessment = a.IsAssessment ?? false, MarketValue = a.MarketValue ?? 0, SettledAmount = a.SettleAmount ?? 0, TotalSumAssessment = _context.CLA_PLRPartyAmount_TB.Where(x => x.PLRPartiesId == p.Id && a.Active == Status.InActive).FirstOrDefault().TotalPartsAmount, BillingPartyItemList = _context.CLA_PLRPartyItem_TB.Where(i => i.PLRPartiesId == p.Id).AsEnumerable().Select(i => new BillingPartyItem { Id = i.Id, PLRPartyAmountId = i.PLRPartyAmountId, PLRPartiesId = i.PLRPartiesId, ItemType = i.ItemType, PartType = i.PartType, PartTag = i.PartTag, ItemName = i.ItemName, ItemName_Id = i.ItemName_Id, Amount = i.Amount, TDIAmount = i.TDIAmount, BillingAmount = i.BillingAmount, VendorType = SqlFunctions.StringConvert((decimal)i.VendorType), DepRate = i.DepRate, DepreciateAmount = i.DepreciateAmount, IncludeInLabor = i.IncludeInLabor, Remarks = i.Remarks, GrossAmount = i.GrossAmount, VendorGrossAmount = i.VendorGrossAmount, TDIGrossAmount = i.TDIGrossAmount, ContactId = GetContactIdByPartyItem(i) }).ToList() }).FirstOrDefault() }).OrderByDescending(x => x.Id).FirstOrDefault(); policy.BillingAssessmentDetail = _BillingAssesmentDetails; policy.PLRAssessmentDetail.VendorList = (from p in _context.CLA_PLRParties_TB join c in _context.SLS_ContactRelation_TB on p.Id equals c.Transaction_Id where p.ClaimForm_Id == ClaimId && c.RelationType_Id == (int)RelationType.PLR && ((c.TransactionType_Id == (int)TransactionType.Supplier && p.PartyType_Id == (int)PartyType.Supplier) || (c.TransactionType_Id == (int)TransactionType.Workshop && p.PartyType_Id == (int)PartyType.Workshop)) select new Vendor { ContactId = c.Contact_Id, Name = _context.SLS_Contact_vw.Where(cc => cc.Id == c.Contact_Id).FirstOrDefault().Name, PartyTypeId = p.PartyType_Id, PartiesId = p.Id }).Distinct().ToList(); policy.ClaimForm = _context.CLA_ClaimForm_TB.AsQueryable().Where(x => x.Id == ClaimId).Select(x => new ClaimForm { Id = x.Id, _SurveyDate = x.SurveyDate, _EstimateDate = x.EstimateDate, EstimatedLabourCharges = x.EstimatedLabourCharges, EstimatedPartsCharges = x.EstimatedPartsCharges, EstimateNo = x.EstimateNo, Conclusion = x.Conclusion, CircumstancesOfLoss = x.CircumstancesOfLoss, SurveyRemarks = x.SurveyRemarks, Remarks = x.Remarks, SurveyPlace = x.SurveyPlace }).FirstOrDefault(); policy.UploadImageStatus = UploadedImagesDetail(ClaimId.ToString()); policy.PaymentToWhomList = GetPaymentToWhomList(); } catch (InvalidOperationException ex) { LoggerService.LogExceptionsToDebugConsole(ex); } catch (System.Data.SqlClient.SqlException ex) { LoggerService.LogExceptionsToDebugConsole(ex); } catch (Exception ex) { LoggerService.LogExceptionsToDebugConsole(ex); } return(policy); }