public GetPosReceiptOfTestingResponse GetPosReceiptOfTesting(GetPosReceiptOfTestingRequest request) { GetPosReceiptOfTestingResponse response = new GetPosReceiptOfTestingResponse(); PosReceiptOfTesting posReceiptOfTesting = _posReceiptOfTestingRepository .FindBy(request.ReceiptOfTestingId); if (posReceiptOfTesting != null) { response.PosReceiptOfTestingFound = true; response.PosReceiptOfTesting = posReceiptOfTesting.ConvertToPosReceiptOfTestingView(); } else { response.PosReceiptOfTestingFound = false; } return(response); }
public CreatePosReceiptOfTestingResponse CreatePosReceiptOfTesting(CreatePosReceiptOfTestingRequest request) { CreatePosReceiptOfTestingResponse response = new CreatePosReceiptOfTestingResponse(); PosReceiptOfTesting posReceiptOfTesting = new PosReceiptOfTesting(); posReceiptOfTesting.TestDate = request.TestDate; posReceiptOfTesting.AgentAName = request.AgentAName; posReceiptOfTesting.AgentBName = request.AgentBName; posReceiptOfTesting.PosId = request.PosId; posReceiptOfTesting.PosTerminals = request.PosTerminals.ConvertToPosTerminals(); posReceiptOfTesting.PosMerchant = request.PosMerchant.ConvertToPosMerchant(); if (posReceiptOfTesting.GetBrokenRules().Count() > 0) { response.Errors = posReceiptOfTesting.GetBrokenRules().ToList(); } else { try { _posReceiptOfTestingRepository.Add(posReceiptOfTesting); _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 ModifyPosReceiptOfTestingResponse ModifyPosReceiptOfTesting(ModifyPosReceiptOfTestingRequest request) { ModifyPosReceiptOfTestingResponse response = new ModifyPosReceiptOfTestingResponse(); PosReceiptOfTesting posReceiptOfTesting = _posReceiptOfTestingRepository .FindBy(request.ReceiptOfTestingId); posReceiptOfTesting.Id = request.ReceiptOfTestingId; posReceiptOfTesting.TestDate = request.TestDate; posReceiptOfTesting.AgentAName = request.AgentAName; posReceiptOfTesting.AgentBName = request.AgentBName; posReceiptOfTesting.PosId = request.PosId; posReceiptOfTesting.PosTerminals = request.PosTerminals.ConvertToPosTerminals(); posReceiptOfTesting.PosMerchant = request.PosMerchant.ConvertToPosMerchant(); if (posReceiptOfTesting.GetBrokenRules().Count() > 0) { response.Errors = posReceiptOfTesting.GetBrokenRules().ToList(); } else { try { _posReceiptOfTestingRepository.Save(posReceiptOfTesting); _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 static PosReceiptOfTestingView ConvertToPosReceiptOfTestingView( this PosReceiptOfTesting posReceiptOfTesting) { return(Mapper.Map <PosReceiptOfTesting, PosReceiptOfTestingView>(posReceiptOfTesting)); }