private async Task <bool> ValidateMedicalNumber(Database.Consumer model) { var lowCaseMedicalNumber = model.MedicaidNo.ToLower().Trim(); bool findAnyConsumer = await _context.Consumers.AnyAsync(x => (x.ConsumerId != model.ConsumerId) && x.MedicaidNo.ToLower() == lowCaseMedicalNumber); return(!findAnyConsumer); }
public String GetMedicaidNumberByDate(Database.Consumer consumer, DateTime?processingDate) { var result = ConsumerMedicaidNumberManagement.GetMedicaidNumberByDate(_context, processingDate, consumer.ConsumerId); return(result?.MedicaidNo ?? consumer.MedicaidNo); }
public async Task <List <string> > ValidateConsumerModel(Database.Consumer model) { List <string> errors = new List <string>(); if (!await ValidateMedicalNumber(model)) { errors.Add("Medical numer is not valid"); } return(errors); }
private ReportAddressModel getCurrentAddress(Database.Consumer consumer, DateTime?lastReviewDate) { ReportAddressModel result = null; if (lastReviewDate != null) { result = ConsumerAddressManagement.GetScheduledAddressByDate(_context, lastReviewDate.Value, consumer.ConsumerId); } return(result ?? getAddressFromCustomer(consumer)); }
public async Task <Boolean> SaveRate(Database.Consumer model) { var data = await _context.Consumers.SingleOrDefaultAsync(x => x.ConsumerId == model.ConsumerId); if (data != null) { data.Rate = model.Rate; data.MaxHoursPerWeek = model.MaxHoursPerWeek; data.MaxHoursPerYear = model.MaxHoursPerYear; data.RateNote = model.RateNote; await _context.SaveChangesAsync(); return(true); } return(false); }
public async Task <Int32> Save(Database.Consumer dbModel) { if (dbModel.ConsumerId == 0) { _context.Consumers.Add(dbModel); } else { var model = await _context.Consumers.SingleOrDefaultAsync(x => x.ConsumerId == dbModel.ConsumerId); if (model != null) { ITCraftFrame.CustomMapper.MapEntity(dbModel, model); } if (string.IsNullOrEmpty(model.LastName)) { Logger.LogError($" record with id has been set LastName to null {model.ConsumerId}"); } } await _context.SaveChangesAsync(); return(dbModel.ConsumerId); }
private ReportAddressModel getAddressFromCustomer(Database.Consumer consumer) { return(ITCraftFrame.CustomMapper.MapEntity <ReportAddressModel>(consumer)); }