Example #1
0
        public List <PLRSearchClaim1VM> GetSearchGrid(SearchGridVm searchGridVm)
        {
            List <PLRSearchClaim1VM> result = null;

            searchGridVm.claimNo        = StringExtensions.ConvertToNullableString(searchGridVm.claimNo);
            searchGridVm.policyNo       = StringExtensions.ConvertToNullableString(searchGridVm.policyNo);
            searchGridVm.insuredName    = StringExtensions.ConvertToNullableString(searchGridVm.insuredName);
            searchGridVm.engineNo       = StringExtensions.ConvertToNullableString(searchGridVm.engineNo);
            searchGridVm.registrationNo = StringExtensions.ConvertToNullableString(searchGridVm.registrationNo);
            searchGridVm.chasisNo       = StringExtensions.ConvertToNullableString(searchGridVm.chasisNo);
            searchGridVm.reasons        = StringExtensions.ConvertToNullableString(searchGridVm.reasons);
            DateTime?dateEffective    = DateTimeExtensions.ConvertToNullableDateTime(searchGridVm.effectiveDate);
            DateTime?dateExpiry       = DateTimeExtensions.ConvertToNullableDateTime(searchGridVm.expiryDate);
            DateTime?intimateDateFrom = DateTimeExtensions.ConvertToNullableDateTime(searchGridVm.fromIntimationDate);
            DateTime?intimateDateTo   = DateTimeExtensions.ConvertToNullableDateTime(searchGridVm.toIntimationDate);
            int?     claimTypeId      = TypeConversionExtensions.ConvertToNullableInt(searchGridVm.claimType);



            if (searchGridVm.AssessmentType == UserViewType.Billing || searchGridVm.AssessmentType == UserViewType.ClaimHandler ||
                searchGridVm.AssessmentType == UserViewType.PLR || searchGridVm.AssessmentType == UserViewType.RPLR ||
                searchGridVm.AssessmentType == UserViewType.SDPLR || searchGridVm.AssessmentType == UserViewType.NLCPLR ||
                searchGridVm.AssessmentType == UserViewType.LSSPLR || searchGridVm.AssessmentType == UserViewType.ARPLR ||
                searchGridVm.AssessmentType == UserViewType.TLPLR || searchGridVm.AssessmentType == UserViewType.TSPLR ||
                searchGridVm.AssessmentType == UserViewType.TPLR || searchGridVm.AssessmentType == UserViewType.SPLR)
            {
                result = _context.PLR_SearchClaim1_SP(Convert.ToInt16(searchGridVm.userId),
                                                      searchGridVm.policyNo,
                                                      searchGridVm.insuredName,
                                                      searchGridVm.claimNo,
                                                      searchGridVm.registrationNo,
                                                      searchGridVm.engineNo,
                                                      searchGridVm.chasisNo,
                                                      dateEffective,
                                                      dateExpiry,
                                                      searchGridVm.reasons,
                                                      claimTypeId,
                                                      intimateDateFrom.GetDateTimeTostring(),
                                                      intimateDateTo.GetDateTimeTostring(),
                                                      searchGridVm.AssessmentType,
                                                      Convert.ToInt32(searchGridVm.dispositionId))
                         .Select(x => new PLRSearchClaim1VM
                {
                    Id = x.Id,
                    SalesFormMapping_Id = x.SalesFormMapping_Id,
                    ClaimNo             = x.ClaimNo,
                    IntimationDate      = x.IntimationDate,
                    Stage              = x.Stage,
                    RegistrationNo     = x.RegistrationNo,
                    EngineNo           = x.m_Engine_No,
                    ChassisNo          = x.m_Chasis_No,
                    InsuredName        = x.InsuredName,
                    SalesFormNo        = x.SalesFormNo,
                    EffectiveDate      = x.EffectiveDate,
                    ExpiryDate         = x.ExpiryDate,
                    SalesFormDetail_Id = x.SalesFormDetail_Id,
                    Contact_Id         = x.Contact_Id,
                    Stage_Id           = x.Stage_Id,
                    Company_Id         = x.Company_Id,
                    CloseReason_Id     = x.CloseReason_Id,
                    ReOpenReason_Id    = x.ReOpenReason_Id,
                    PLRStatus          = x.PLRStatus,
                    PLRDispositionId   = x.PLRDispositionId,
                    Active             = x.Active,
                    PLRDisposition     = x.PLRDisposition,
                    ClaimType_Id       = x.ClaimType_Id,
                    ClaimType          = x.ClaimType,
                    Aging              = x.Aging,
                    Reason             = x.Reason,
                    ReserveAmount      = x.ReserveAmount,
                    OutStandingAmount  = x.OutStandingAmount,
                    BusinessType_Id    = x.BusinessType_Id,
                    AddBY              = x.AddBY,
                    AppointmentDate    = x.AppointmentDate,
                    SDitemCount        = x.SDitemCount,
                    ItemCount          = x.itemCount
                }).ToList();


                //removing containing SD part items and submitted claims For Billing
                if (searchGridVm.AssessmentType == UserViewType.SDPLR)
                {
                    result = result.Where(x => x.SDitemCount > 0).ToList();
                }
            }
            else if (searchGridVm.AssessmentType == UserViewType.SuperUser)
            {
                searchGridVm.AssessmentType = searchGridVm.AssessmentType;
                result = _context.PLR_SearchClaim1_SP(Convert.ToInt16(searchGridVm.userId),
                                                      searchGridVm.policyNo,
                                                      searchGridVm.insuredName,
                                                      searchGridVm.claimNo,
                                                      searchGridVm.registrationNo,
                                                      searchGridVm.engineNo,
                                                      searchGridVm.chasisNo,
                                                      dateEffective,
                                                      dateExpiry,
                                                      searchGridVm.reasons,
                                                      claimTypeId,
                                                      intimateDateFrom.GetDateTimeTostring(),
                                                      intimateDateTo.GetDateTimeTostring(),
                                                      searchGridVm.AssessmentType,
                                                      Convert.ToInt32(searchGridVm.dispositionId))
                         .Select(x => new PLRSearchClaim1VM
                {
                    Id = x.Id,
                    SalesFormMapping_Id = x.SalesFormMapping_Id,
                    ClaimNo             = x.ClaimNo,
                    IntimationDate      = x.IntimationDate,
                    Stage              = x.Stage,
                    RegistrationNo     = x.RegistrationNo,
                    EngineNo           = x.m_Engine_No,
                    ChassisNo          = x.m_Chasis_No,
                    InsuredName        = x.InsuredName,
                    SalesFormNo        = x.SalesFormNo,
                    EffectiveDate      = x.EffectiveDate,
                    ExpiryDate         = x.ExpiryDate,
                    SalesFormDetail_Id = x.SalesFormDetail_Id,
                    Contact_Id         = x.Contact_Id,
                    Stage_Id           = x.Stage_Id,
                    Company_Id         = x.Company_Id,
                    CloseReason_Id     = x.CloseReason_Id,
                    ReOpenReason_Id    = x.ReOpenReason_Id,
                    ClaimType_Id       = x.ClaimType_Id,
                    ClaimType          = x.ClaimType,
                    Aging              = x.Aging,
                    Reason             = x.Reason,
                    ReserveAmount      = x.ReserveAmount,
                    OutStandingAmount  = x.OutStandingAmount,
                    BusinessType_Id    = x.BusinessType_Id,
                    AddBY              = x.AddBY
                }).ToList();
            }
            else if (searchGridVm.AssessmentType == UserViewType.FRPLR)
            {
                result = _context.CLA_DGI_FinalReportPLR_SP(Convert.ToInt16(searchGridVm.userId),
                                                            searchGridVm.policyNo,
                                                            searchGridVm.insuredName,
                                                            searchGridVm.claimNo,
                                                            searchGridVm.registrationNo,
                                                            searchGridVm.engineNo,
                                                            searchGridVm.chasisNo,
                                                            dateEffective,
                                                            dateExpiry,
                                                            searchGridVm.reasons,
                                                            claimTypeId,
                                                            intimateDateFrom.GetDateTimeTostring(),
                                                            intimateDateTo.GetDateTimeTostring(),
                                                            searchGridVm.AssessmentType,
                                                            Convert.ToInt32(searchGridVm.dispositionId)
                                                            )
                         .Select(x => new PLRSearchClaim1VM
                {
                    Id = x.Id,
                    SalesFormMapping_Id = x.SalesFormMapping_Id,
                    ClaimNo             = x.ClaimNo,
                    IntimationDate      = x.IntimationDate,
                    Stage              = x.Stage,
                    RegistrationNo     = x.RegistrationNo,
                    EngineNo           = x.m_Engine_No,
                    ChassisNo          = x.m_Chasis_No,
                    InsuredName        = x.InsuredName,
                    SalesFormNo        = x.SalesFormNo,
                    EffectiveDate      = x.EffectiveDate,
                    ExpiryDate         = x.ExpiryDate,
                    SalesFormDetail_Id = x.SalesFormDetail_Id,
                    Contact_Id         = x.Contact_Id,
                    Stage_Id           = x.Stage_Id,
                    Company_Id         = x.Company_Id,
                    CloseReason_Id     = x.CloseReason_Id,
                    ReOpenReason_Id    = x.ReOpenReason_Id,
                    ClaimType_Id       = x.ClaimType_Id,
                    ClaimType          = x.ClaimType,
                    Aging              = x.Aging,
                    Reason             = x.Reason,
                    ReserveAmount      = x.ReserveAmount,
                    OutStandingAmount  = x.OutStandingAmount,
                    BusinessType_Id    = x.BusinessType_Id,
                    AddBY              = x.AddBY
                }).DistinctBy(x => x.Id).ToList();
            }

            GetOrderedGridResult(searchGridVm, result);
            return(result);
        }