public CustomerVehicalModel() { CustomerModel = new CustomerModel(); PolicyDetail = new PolicyDetail(); RiskDetailModel = new List <RiskDetailModel>(); SummaryDetailModel = new SummaryDetailModel(); }
public PolicyDetail GetPolicyDetail(string policyNumber) { _logger.LogInformation(policyNumber); var cache = _cacheProvider.Get <PolicyDetail>(policyNumber); if (cache != null) { return(cache); } else { //The value will be fetched from core service var policy = new PolicyDetail() { PolicyNumber = policyNumber, PolicyId = Guid.NewGuid().ToString(), StartDate = DateTime.Now, EndDate = DateTime.Now.AddYears(2) }; //Add the response into the cache _cacheProvider.Set(policyNumber, policy); return(policy); } }
public async Task <VerifyRecordResult> UpdateAsync(PolicyDetailAdapterModel paraObject) { try { PolicyDetail itemData = Mapper.Map <PolicyDetail>(paraObject); CleanTrackingHelper.Clean <PolicyDetail>(context); PolicyDetail item = await context.PolicyDetail .AsNoTracking() .FirstOrDefaultAsync(x => x.Id == paraObject.Id); if (item == null) { return(VerifyRecordResultFactory.Build(false, ErrorMessageEnum.無法修改紀錄)); } else { CleanTrackingHelper.Clean <PolicyDetail>(context); context.Entry(itemData).State = EntityState.Modified; await context.SaveChangesAsync(); CleanTrackingHelper.Clean <PolicyDetail>(context); return(VerifyRecordResultFactory.Build(true)); } } catch (Exception ex) { Logger.LogError(ex, "修改記錄發生例外異常"); return(VerifyRecordResultFactory.Build(false, "修改記錄發生例外異常", ex)); } }
public async Task <VerifyRecordResult> DeleteAsync(int id) { try { CleanTrackingHelper.Clean <PolicyDetail>(context); PolicyDetail item = await context.PolicyDetail .AsNoTracking() .FirstOrDefaultAsync(x => x.Id == id); if (item == null) { return(VerifyRecordResultFactory.Build(false, ErrorMessageEnum.無法刪除紀錄)); } else { CleanTrackingHelper.Clean <PolicyDetail>(context); context.Entry(item).State = EntityState.Deleted; await context.SaveChangesAsync(); CleanTrackingHelper.Clean <PolicyDetail>(context); return(VerifyRecordResultFactory.Build(true)); } } catch (Exception ex) { Logger.LogError(ex, "刪除記錄發生例外異常"); return(VerifyRecordResultFactory.Build(false, "刪除記錄發生例外異常", ex)); } }
public object Get(GetPolicy request) { // Get the contract for the Policy by specifying the Policy address var contract = AppServices.web3.Eth.GetContract(AppModelConfig.POLICY.abi, AppServices.GetEcosystemAdr(request.ContractAdr).PolicyContractAdr); // PolicyListEntry entry = contract.GetFunction("get").CallDeserializingToObjectAsync<PolicyListEntry>(i).Result; // If no Policy hash has been provided as part of the request get the corresponding hash that belongs to the provided idx if (request.Hash.IsEmpty() == true) { request.Hash = AppModelConfig.convertToHex(contract.GetFunction("get").CallAsync <byte[]>(request.Idx).Result); } // Retrieve the Policy details from the Blockchain PolicyDetail Policy = contract.GetFunction("dataStorage").CallDeserializingToObjectAsync <PolicyDetail>(request.Hash.HexToByteArray()).Result; // Set the Policy hash to the requested has as specified in the request Policy.Hash = request.Hash; Policy.EventLogs = new List <PolicyEventLog>(); // If Policy hash is set retrieve the logs for the Policy if (AppModelConfig.isEmptyHash(Policy.Hash) == false) { Policy.EventLogs = ((PolicyLogs)this.Get( new GetPolicyLogs { ContractAdr = request.ContractAdr, Hash = request.Hash })).EventLogs; // Just for the Policy specific event logs reverse the order to have the events in ascending order Policy.EventLogs.Reverse(); } // Return the Policy return(Policy); }
public CustomerREVehicalModel() { CustomerModel = new CustomerModel(); PolicyDetail = new PolicyDetail(); RiskDetailModel = new RiskDetailModel(); SummaryDetailModel = new SummaryDetailModel(); }
/// <summary> /// To calculate the maturity /// </summary> /// <param name="policyDetail">The policy details</param> /// <returns>The maturity details</returns> public virtual MaturityDetail CalculateMaturity(PolicyDetail policyDetail) { var maturityValue = ((policyDetail.TotalPremiums - (policyDetail.TotalPremiums * GetManagementFee) + GetDiscretionaryBonus(policyDetail)) * Convert.ToDouble(1 + policyDetail.UpliftPercentage / 100)); return(new MaturityDetail() { PolicyNumber = policyDetail.PolicyNumber, MaturityValue = maturityValue }); }
public void SavePolicy(PolicyDetail policy) { try { InsuranceContext.PolicyDetails.Insert(policy); } catch (Exception ex) { } }
public void GetDiscretionaryBonus_MembershipTrue_VerifyDiscretionaryBonus_Thousand() { var policyDetail = new PolicyDetail() { PolicyNumber = "B100003", Membership = true, DiscretionaryBonus = 1000 }; var PolicyCMaturityCalculatorSpy = new PolicyBMaturityCalculatorSpy(); var discretionaryBonus = PolicyCMaturityCalculatorSpy.GetSpyDiscretionaryBonus(policyDetail); Assert.AreEqual(1000, discretionaryBonus); }
public async Task <PolicyDetailAdapterModel> GetAsync(int id) { PolicyDetail item = await context.PolicyDetail .AsNoTracking() .Include(x => x.PolicyHeader) .Include(x => x.MyUser) .FirstOrDefaultAsync(x => x.Id == id); PolicyDetailAdapterModel result = Mapper.Map <PolicyDetailAdapterModel>(item); await OhterDependencyData(result); return(result); }
public long CreatePolicyDetail([FromBody] PolicyDetail detail) { long result = 0; try { result = repository.AddPolicyDetail(detail); } catch (Exception dbEx) { return(result); } return(result); }
public void GetDiscretionaryBonus_MembershipFalse_VerifyDiscretionaryBonus_Zero() { var policyDetail = new PolicyDetail() { PolicyNumber = "B100002", Membership = false, DiscretionaryBonus = 2000 }; var PolicyCMaturityCalculatorSpy = new PolicyBMaturityCalculatorSpy(); var discretionaryBonus = PolicyCMaturityCalculatorSpy.GetSpyDiscretionaryBonus(policyDetail); Assert.AreEqual(0, discretionaryBonus); }
public void GetDiscretionaryBonus_PolicyTakenBefore_1_1_1990_VerifyDiscretionaryBonus_Zero() { var startDate = DateTime.ParseExact("1/6/1986", "m/d/yyyy", CultureInfo.InvariantCulture); var policyDetail = new PolicyDetail() { PolicyNumber = "C100002", PolicyStartDate = startDate, DiscretionaryBonus = 2000 }; var policyCMaturityCalculatorSpy = new PolicyCMaturityCalculatorSpy(); var discretionaryBonus = policyCMaturityCalculatorSpy.GetSpyDiscretionaryBonus(policyDetail); Assert.AreEqual(0, discretionaryBonus); }
public void GetDiscretionaryBonus_PolicyTakenAfter_1_1_1990_MembershipRightTrue_VerifyDiscretionaryBonus_TwoThousand() { PolicyCMaturityCalculator PolicyCMaturityCalculator = new PolicyCMaturityCalculator(); var startDate = DateTime.ParseExact("1/1/1991", "m/d/yyyy", CultureInfo.InvariantCulture); var policyDetail = new PolicyDetail() { PolicyNumber = "C100001", PolicyStartDate = startDate, DiscretionaryBonus = 2000, Membership = true }; var policyCMaturityCalculatorSpy = new PolicyCMaturityCalculatorSpy(); var discretionaryBonus = policyCMaturityCalculatorSpy.GetSpyDiscretionaryBonus(policyDetail); Assert.AreEqual(2000, discretionaryBonus); }
public bool Post([FromBody] PolicyDetail p) { try { db.PolicyDetails.Add(p); var res = db.SaveChanges(); if (res > 0) { return(true); } } catch (Exception ex) { throw ex; } return(false); }
public SystemMessage PolicyDetail_Save(PolicyDetail data) { SystemMessage systemMessage = new SystemMessage(); try { var param = new DynamicParameters(); param.Add("@Id", data.Id); param.Add("@StaffLevelId", data.StaffLevelId); param.Add("@PolicyID", data.PolicyID); param.Add("@StandardSpendingAmount", data.StandardSpendingAmount); param.Add("@BasicSalaryTo", data.BasicSalaryTo); param.Add("@BasicSalaryFrom", data.BasicSalaryFrom); param.Add("@Margincompensation", data.Margincompensation); param.Add("@EfficiencyBonus", data.EfficiencyBonus); param.Add("@Commission", data.Commission); param.Add("@TotalIncome", data.TotalIncome); param.Add("@MinSpending", data.MinSpending); param.Add("@MinPerson", data.MinPerson); param.Add("@StartDate", data.StartDate); param.Add("@EndDate", data.EndDate); param.Add("@SFormular", data.SFormular); param.Add("@SFormularCompensation", data.SFormularCompensation); param.Add("@SFormularAllowances", data.SFormularAllowances); param.Add("@StandardProbation", data.StandardProbation); param.Add("@SFormularProbation", data.SFormularProbation); param.Add("@SFormularBonus", data.SFormularBonus); param.Add("@SFormularDecemberbonus", data.SFormularDecemberbonus); param.Add("@SFormularKPIYear", data.SFormularKPIYear); param.Add("@Description", data.Description); param.Add("@Status", data.Status); param.Add("@UserId", data.UserId); param.Add("@PolicyDetailIdOutput", 0, DbType.Int32, ParameterDirection.InputOutput); UnitOfWork.ProcedureExecute("PolicyDetail_Save", param); systemMessage.IsSuccess = true; systemMessage.Message = param.GetDataOutput <int>("@PolicyDetailIdOutput").ToString(); return(systemMessage); } catch (Exception e) { systemMessage.IsSuccess = false; systemMessage.Message = e.ToString(); return(systemMessage); } }
public void Calculate_WhenDiscretionaryBonusApplicable_VerifyMaturityValue() { var startDate = DateTime.ParseExact("1/1/1985", "m/d/yyyy", CultureInfo.InvariantCulture); var policyDetail = new PolicyDetail() { PolicyNumber = "A100002", PolicyStartDate = startDate, DiscretionaryBonus = 1350, TotalPremiums = 12500, Membership = true, UpliftPercentage = 37.5 }; var maturityDetail = policyACalculator.CalculateMaturity(policyDetail); Assert.IsNotNull(maturityDetail); Assert.AreEqual(18528.125, maturityDetail.MaturityValue); }
public void Calculate_WhenDiscretionaryBonusNotApplicable_VerifyMaturityValue() { var startDate = DateTime.ParseExact("1/1/1992", "m/d/yyyy", CultureInfo.InvariantCulture); var policyDetail = new PolicyDetail() { PolicyNumber = "C100001", PolicyStartDate = startDate, DiscretionaryBonus = 1000, TotalPremiums = 13000, Membership = false, UpliftPercentage = 42 }; var maturityDetail = policyCCalculator.CalculateMaturity(policyDetail); Assert.IsNotNull(maturityDetail); Assert.AreEqual(17167.8, maturityDetail.MaturityValue); }
public async Task <VerifyRecordResult> AddAsync(PolicyDetailAdapterModel paraObject) { try { PolicyDetail itemParameter = Mapper.Map <PolicyDetail>(paraObject); CleanTrackingHelper.Clean <PolicyDetail>(context); await context.PolicyDetail .AddAsync(itemParameter); await context.SaveChangesAsync(); CleanTrackingHelper.Clean <PolicyDetail>(context); return(VerifyRecordResultFactory.Build(true)); } catch (Exception ex) { Logger.LogError(ex, "新增記錄發生例外異常"); return(VerifyRecordResultFactory.Build(false, "新增記錄發生例外異常", ex)); } }
public ActionResult PolicyDetail_Save(PolicyDetail data) { //return View(); var db = new PolicyDetail_DAL(); data.UserId = Global.CurrentUser.UserID; var result = db.PolicyDetail_Save(data); if (result.IsSuccess == true) { result.Message = AppRes.MS_Update_success; } else { result.Message = AppRes.MS_Update_error; } return(Content(JsonConvert.SerializeObject(new { result }))); }
public async Task EnableIt(PolicyDetailAdapterModel paraObject) { PolicyDetail itemData = Mapper.Map <PolicyDetail>(paraObject); CleanTrackingHelper.Clean <PolicyDetail>(context); PolicyDetail item = await context.PolicyDetail .AsNoTracking() .FirstOrDefaultAsync(x => x.Id == paraObject.Id); if (item == null) { } else { item.Enable = true; context.Entry(item).State = EntityState.Modified; await context.SaveChangesAsync(); CleanTrackingHelper.Clean <MenuData>(context); } }
public static List <PolicySyncRec> SynchronizePolicy(List <Policies> _list) { List <PolicySyncRec> errList = new List <PolicySyncRec>(); bool flag = true; string[] arryPolicyId91e = _list.Select(o => o.PartnerPolicyId).ToArray(); PolicySyncRecLib syncRecLib = new PolicySyncRecLib(); // List<string> existIdList =syncRecLib.ExistPartenerIdList(arryPolicyId91e); syncRecLib.BatchDelPolicy(arryPolicyId91e);//先批量置为无效,然后从新添加一条 List <PolicySyncRec> list = MapperHelper.GetEntityList <List <Policies>, List <PolicySyncRec> >(_list); List <PolicyDetail> listDetail = MapperHelper.GetEntityList <List <Policies>, List <PolicyDetail> >(_list); foreach (var item in list) { item.PartnerId = (int)SupplierType._19E; item.PartnerName = SupplierType._19E.ToString(); PolicyDetail policyDeatil = listDetail.FirstOrDefault(x => x.PolicyId == item.Id); //if (existIdList.Contains(item.PartnerPolicyId)) //{ // flag = syncRecLib.Update(item, policyDeatil);//更新 // if(!flag) // { // errList.Add(item); // } //} //else //{ flag = syncRecLib.Add(item, policyDeatil); //添加 if (!flag) { errList.Add(item); } //} } return(errList); }
public void UserInsertBusiness(PolicyDetail u) { SqlParameter[] sp = new SqlParameter[8]; sp[0] = new SqlParameter("@plan_info_id", u.PlanInfoId); sp[1] = new SqlParameter("@policy_name", u.PolicyName); sp[2] = new SqlParameter("@policy_feature", u.PolicyFeature); sp[3] = new SqlParameter("@policy_benefit", u.PolicyBenefit); sp[4] = new SqlParameter("@benefit_illustration", u.BenefitIllustration); sp[5] = new SqlParameter("@eligible", u.Eligible); sp[6] = new SqlParameter("@product_type", u.ProductType); sp[7] = new SqlParameter("@max_dependent", u.MaxDependent); try { AddPolicyDetailDAL pd = new AddPolicyDetailDAL(); pd.insert_policy(sp); } catch (Exception e) { Console.Write(e); } }
public double GetSpyDiscretionaryBonus(PolicyDetail policyDetail) { return(GetDiscretionaryBonus(policyDetail)); }
private static async Task PrepareData() { #region Prepare Data context.Database.EnsureDeleted(); context.Database.EnsureCreated(); context.ChangeTracker.QueryTrackingBehavior = Microsoft.EntityFrameworkCore.QueryTrackingBehavior.NoTracking; #region Generate Person Person person1 = new Person() { Account = "001", }; context.Entry(person1).State = Microsoft.EntityFrameworkCore.EntityState.Added; Person person2 = new Person() { Account = "002", }; context.Entry(person2).State = Microsoft.EntityFrameworkCore.EntityState.Added; Person person3 = new Person() { Account = "003", }; context.Entry(person3).State = Microsoft.EntityFrameworkCore.EntityState.Added; Person person4 = new Person() { Account = "004", }; context.Entry(person4).State = Microsoft.EntityFrameworkCore.EntityState.Added; await context.SaveChangesAsync(); #endregion #region Generate Polcy Policy policy = new Policy() { Name = "標準簽核流程", }; context.Entry(policy).State = Microsoft.EntityFrameworkCore.EntityState.Added; await context.SaveChangesAsync(); #endregion #region Generate PolcyDetail PolicyDetail detail1 = new PolicyDetail() { Level = 1, Manager = person2.Id, Name = "第一階層審核", PolicyId = policy.Id, }; context.Entry(detail1).State = Microsoft.EntityFrameworkCore.EntityState.Added; PolicyDetail detail2 = new PolicyDetail() { Level = 2, Manager = person3.Id, Name = "第2階層審核", PolicyId = policy.Id, }; context.Entry(detail2).State = Microsoft.EntityFrameworkCore.EntityState.Added; PolicyDetail detail3 = new PolicyDetail() { Level = 3, Manager = person4.Id, Name = "第3階層審核", PolicyId = policy.Id, }; context.Entry(detail3).State = Microsoft.EntityFrameworkCore.EntityState.Added; await context.SaveChangesAsync(); #endregion #endregion }
protected override double GetDiscretionaryBonus(PolicyDetail policyDetail) { return(base.GetDiscretionaryBonus(policyDetail)); }
/// <summary> /// The Discretionary Bonus for PolicyA /// </summary> /// <param name="policyDetail">The Policy Details</param> /// <returns>The discretionary bonus</returns> protected override double GetDiscretionaryBonus(PolicyDetail policyDetail) { var difference = DateTime.Compare(policyDetail.PolicyStartDate.Date, PolicyTakenOutPeriod.Date); return(difference < 0 ? policyDetail.DiscretionaryBonus : 0); }
public void UpdatePolicy(PolicyDetail policy) { InsuranceContext.PolicyDetails.Update(policy); }
public async Task <ApiResponse> Handle(AddEditPolicyCommand request, CancellationToken cancellationToken) { long LatestPolicyId = 0; var policyCode = string.Empty; ApiResponse response = new ApiResponse(); try { if (request.PolicyId == 0) { var policy = _dbContext.PolicyDetails.Where(x => x.PolicyName == request.PolicyName && x.IsDeleted == false).FirstOrDefault(); if (policy == null) { var policyDetail = _dbContext.PolicyDetails.OrderByDescending(x => x.PolicyId) .FirstOrDefault(); if (policyDetail == null) { LatestPolicyId = 1; policyCode = LatestPolicyId.ToString().GetPolicyCode(); } else { LatestPolicyId = Convert.ToInt32(policyDetail.PolicyId) + 1; policyCode = LatestPolicyId.ToString().GetPolicyCode(); } PolicyDetail obj = new PolicyDetail(); obj.CreatedById = request.CreatedById; obj.MediumId = request.MediumId; obj.ProducerId = request.ProducerId; obj.MediaCategoryId = request.MediaCategoryId; obj.PolicyName = request.PolicyName; obj.CreatedDate = DateTime.Now; obj.IsDeleted = false; obj.PolicyCode = policyCode; obj.Description = request.Description; _mapper.Map(request, obj); await _dbContext.PolicyDetails.AddAsync(obj); await _dbContext.SaveChangesAsync(); int totalCount = await _dbContext.PolicyDetails .Where(v => v.IsDeleted == false) .AsNoTracking() .CountAsync(); response.data.policyDetails = obj; response.data.TotalCount = totalCount; response.StatusCode = StaticResource.successStatusCode; response.Message = "Policy created successfully"; } else { response.StatusCode = StaticResource.failStatusCode; response.Message = "Policy Name already exists. Please try again with other policy name."; } } else { var existRecord = await _dbContext.PolicyDetails.FirstOrDefaultAsync(x => x.IsDeleted == false && x.PolicyId == request.PolicyId); if (existRecord != null) { existRecord.IsDeleted = false; existRecord.Description = request.Description; existRecord.ModifiedById = request.ModifiedById; existRecord.ModifiedDate = DateTime.Now; existRecord.LanguageId = request.LanguageId; existRecord.MediaCategoryId = request.MediaCategoryId; existRecord.MediumId = request.MediumId; existRecord.PolicyName = request.PolicyName; existRecord.ProducerId = request.ProducerId; _mapper.Map(request, existRecord); await _dbContext.SaveChangesAsync(); response.data.policyDetails = existRecord; response.StatusCode = StaticResource.successStatusCode; response.Message = "Policy updated successfully"; } } } catch (Exception ex) { response.StatusCode = StaticResource.failStatusCode; response.Message = ex.Message; } return(response); }
public QRCodePolicyDetails GetQRCodes(string QRCode) { QRCodePolicyDetails details = new QRCodePolicyDetails(); try { details.Policies = new List <QRCodeModel>(); // InsuranceContext.CertSerialNoDetails var CertSerialNoDetails = InsuranceContext.CertSerialNoDetails.Single(where : $"CertSerialNo='" + QRCode + "'"); PolicyDetail policyDetetials = null; if (CertSerialNoDetails != null) { policyDetetials = InsuranceContext.PolicyDetails.Single(CertSerialNoDetails.PolicyId); } if (policyDetetials != null) { var receiptHistory = InsuranceContext.ReceiptHistorys.Single(where : "PolicyNumber='" + policyDetetials.PolicyNumber + "'"); if (receiptHistory != null) { QRCodeModel model = new QRCodeModel { CustomerId = 0 }; details.Policies.Add(model); details.RecieptNumber = 0; details.Message = "QRCode has been already read."; return(details); } } var query = "Select VehicleLicenceFee,Email,IsCustomEmail,StampDuty,ZTSCLevy,Premium,Customer.Id as CustomerId,ModelDescription,VehicleDetail.RenewalDate, RadioLicenseCost, IncludeRadioLicenseCost, CoverType.Name as CoverTypeName,"; query += " PaymentTerm.Name as PaymentTermName,Covertype.Name, FirstName,LastName,PolicyNumber,RegistrationNo,SummaryDetail.Id as SummaryId, case when PaymentMethod.Name<>'PayLater' then 'Paid' else 'PayLater' end as PaymentStatus from VehicleDetail"; query += " join PolicyDetail on VehicleDetail.PolicyId=PolicyDetail.Id"; query += " Left join Customer on PolicyDetail.CustomerId=Customer.Id"; query += " Left Join CoverType on VehicleDetail.CoverTypeId=CoverType.Id"; query += " Left Join PaymentTerm on VehicleDetail.PaymentTermId=PaymentTerm.Id"; query += " Left Join VehicleModel On VehicleDetail.ModelId=VehicleModel.ModelCode"; query += " Left Join SummaryVehicleDetail On VehicleDetail.Id=SummaryVehicleDetail.VehicleDetailsId"; query += " Left Join SummaryDetail On SummaryVehicleDetail.SummaryDetailId=SummaryDetail.Id"; query += " left join AspNetUsers on Customer.UserID=AspNetUsers.Id"; query += " left join PaymentMethod on SummaryDetail.PaymentMethodId= PaymentMethod.Id "; query += " left join CertSerialNoDetail on PolicyDetail.Id=CertSerialNoDetail.PolicyId where VehicleDetail.IsActive=1 and CertSerialNo= '" + QRCode + "'"; //var query = "select policyDetail.Number as PolicyNumber"; List <QRCodeModel> list = InsuranceContext.Query(query).Select(c => new QRCodeModel { Message = "Successfully.", CustomerId = c.CustomerId, CustomerName = c.FirstName + " " + c.LastName, PolicyNumber = c.PolicyNumber, Registrationno = c.RegistrationNo, ModelDescription = c.ModelDescription, Covertype = c.CoverTypeName, PaymentTerm = c.PaymentTermName, ExpireDate = c.RenewalDate, IncludeRadioLicenseCost = Convert.ToBoolean(c.IncludeRadioLicenseCost), RadioLicenseCost = c.IncludeRadioLicenseCost == false ? 0 : Convert.ToDecimal(c.IncludeRadioLicenseCost), TotalPremium = c.VehicleLicenceFee + c.StampDuty + c.ZTSCLevy + c.Premium + c.RadioLicenseCost, SummaryId = c.SummaryId, Email = c.Email, IsCustomEmail = c.IsCustomEmail, PaymentStatus = c.PaymentStatus }).ToList(); // in case of renew //test var query1 = "SELECT top 1 [Id] FROM ReceiptModuleHistory order by Id Desc"; //var re = InsuranceContext.ReceiptHistorys.All(x => x.Id); var receipt = InsuranceContext.Query(query1).Select(x => new ReceiptModuleHistory() { Id = x.Id, }).FirstOrDefault(); // var receiptid=InsuranceContext.r details.RecieptNumber = receipt == null ? 100000 : receipt.Id + 1; details.Policies = list; if (list.Count() > 0) { details.AmountDue = list.Sum(c => c.TotalPremium); details.Message = "Records found."; } else { details.Message = "No records found."; } } catch (Exception ex) { details.Message = "Exception."; } return(details); }