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); }
public List <InterestMasterDto> GetAll(Enums.InterestTypes type) { List <uspInterestGetAll_Result> lstuspInterestGetAll_Result = _dbContext.uspInterestGetAll().ToList(); List <InterestMasterDto> lstInterestMasterDto = new List <InterestMasterDto>(); foreach (var result in lstuspInterestGetAll_Result) { if ( (type == Enums.InterestTypes.D && result.InterestCode.ToUpper().StartsWith("DIR-")) || (type == Enums.InterestTypes.L && result.InterestCode.ToUpper().StartsWith("LIR-")) ) { lstInterestMasterDto.Add(Mapper.Map <uspInterestGetAll_Result, InterestMasterDto>(result)); } } return(lstInterestMasterDto); }
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); }
public ResultDto Update(InterestMasterDto interest, Enums.InterestTypes type) { return(InsertUpdateInterest(interest, type)); }