public ModifyPosStatusTerminalResponse ModifyPosStatusTerminal(ModifyPosStatusTerminalRequest request) { ModifyPosStatusTerminalResponse response = new ModifyPosStatusTerminalResponse(); PosStatusTerminal posStatusTerminal = _posStatusTerminalRepository .FindBy(request.TerminalStatusId); posStatusTerminal.Id = request.TerminalStatusId; posStatusTerminal.StatusName = request.StatusName; posStatusTerminal.PosTerminals = request.PosTerminals.ConvertToPosTerminals(); if (posStatusTerminal.GetBrokenRules().Count() > 0) { response.Errors = posStatusTerminal.GetBrokenRules().ToList(); } else { try { _posStatusTerminalRepository.Save(posStatusTerminal); _uow.Commit(); response.Errors = new List <BusinessRule>(); } catch (Exception ex) { response.Errors = new List <BusinessRule>(); response.Errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message)); } } return(response); }
public CreatePosStatusTerminalResponse CreatePosStatusTerminal(CreatePosStatusTerminalRequest request) { CreatePosStatusTerminalResponse response = new CreatePosStatusTerminalResponse(); PosStatusTerminal posStatusTerminal = new PosStatusTerminal(); posStatusTerminal.StatusName = request.StatusName; posStatusTerminal.PosTerminals = request.PosTerminals.ConvertToPosTerminals(); if (posStatusTerminal.GetBrokenRules().Count() > 0) { response.Errors = posStatusTerminal.GetBrokenRules().ToList(); } else { try { _posStatusTerminalRepository.Add(posStatusTerminal); _uow.Commit(); response.Errors = new List <BusinessRule>(); } catch (Exception ex) { List <BusinessRule> errors = new List <BusinessRule>(); do { errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message)); ex = ex.InnerException; } while (ex != null); response.Errors = errors; } } return(response); }
public GetPosStatusTerminalResponse GetPosStatusTerminal(GetPosStatusTerminalRequest request) { GetPosStatusTerminalResponse response = new GetPosStatusTerminalResponse(); PosStatusTerminal posStatusTerminal = _posStatusTerminalRepository .FindBy(request.TerminalStatusId); if (posStatusTerminal != null) { response.PosStatusTerminalFound = true; response.PosStatusTerminal = posStatusTerminal.ConvertToPosStatusTerminalView(); } else { response.PosStatusTerminalFound = false; } return(response); }
public static PosStatusTerminalView ConvertToPosStatusTerminalView( this PosStatusTerminal posStatusTerminal) { return(Mapper.Map <PosStatusTerminal, PosStatusTerminalView>(posStatusTerminal)); }