public List <InterestLookupDto> GetLookup(Enums.InterestTypes type) { var lstInterestLookupDto = new List <InterestLookupDto>(); var uspInterestmasterLookupResults = _dbContext.uspInterestLookup(type.ToString()).ToList(); foreach (var interest in uspInterestmasterLookupResults) { InterestLookupDto lookupDto = Mapper.Map <uspInterestLookup_Result, InterestLookupDto>(interest); lstInterestLookupDto.Add(lookupDto); } return(lstInterestLookupDto); }
private ResultDto InsertUpdateInterest(InterestMasterDto interest, Enums.InterestTypes type) { ResultDto resultDto = new ResultDto(); string objectName = type.ToString() == "D" ? "deposit interest" : "loan interest"; try { string interestratexml = CommonMethods.SerializeListDto <List <InterestRatesDto> >(interest.InterestRates); ObjectParameter paraminterestID = new ObjectParameter("InterestID", interest.InterestID); ObjectParameter paraminterestCode = new ObjectParameter("InterestCode", string.Empty); int effectedcount = _dbContext.uspInterestInsertUpdate(paraminterestID, interest.InterestName, interest.PrincipalAHID, interest.InterestAHID, interest.PenalAHID, interest.Base, interest.CaluculationMethod, type.ToString(), interest.UserId, interestratexml, paraminterestCode); resultDto.ObjectId = (int)paraminterestID.Value; resultDto.ObjectCode = string.IsNullOrEmpty((string)paraminterestCode.Value) ? interest.InterestCode : (string)paraminterestCode.Value; if (resultDto.ObjectId > 0) { resultDto.Message = string.Format("{0} details saved successfully with code : {1}", objectName, resultDto.ObjectCode); } else if (resultDto.ObjectId == -1) { resultDto.Message = string.Format("Error occured while generating {0} code", objectName); } else { resultDto.Message = string.Format("Error occured while saving {0} details", objectName); } } catch (Exception) { resultDto.Message = string.Format("Service layer error occured while saving the {0} details", objectName); resultDto.ObjectId = -98; } return(resultDto); }