public override int GetHashCode() { int hash = 13; hash += (hash * 43) + ReceiptId.GetHashCode(); return(hash); }
private void ReceiptSearch() { if (!ValidateChildren()) { return; } if (!ValidateForSearch()) { return; } ReceiptsResult resultReceipt = null; ReceiptSearch receiptSearch = GetSearchCondition(); try { var task = LoadReceiptAsync(receiptSearch); ProgressDialog.Start(ParentForm, task, false, SessionKey); resultReceipt = task.Result; } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); } if (!resultReceipt.ProcessResult.Result) { ShowWarningDialog(MsgWngNotExistSearchData); return; } var searchResult = resultReceipt.Receipts.Where(x => !ReceiptId.Contains(x.Id)).ToArray(); if (searchResult.Length == 0) { ShowWarningDialog(MsgWngNotExistSearchData); return; } else { ReceiptInfo = searchResult; ParentForm.DialogResult = DialogResult.OK; } }
public async Task <ReceiptEntity> GetOrAddReceiptAsync( long userEntityId, ReceiptId receiptId, CancellationToken token) { using (var entityContext = _entityContextFactory.Create()) { var entity = await entityContext .Receipts .Include(x => x.ReceiptResponseEntity) .Where(x => x.DivisionNumber == receiptId.DivisionNumber && x.StoreNumber == receiptId.StoreNumber && x.TransactionDate == receiptId.TransactionDate && x.TerminalNumber == receiptId.TerminalNumber && x.TransactionId == receiptId.TransactionId) .FirstOrDefaultAsync(token); if (entity == null) { entity = new ReceiptEntity { UserEntityId = userEntityId, DivisionNumber = receiptId.DivisionNumber, StoreNumber = receiptId.StoreNumber, TransactionDate = receiptId.TransactionDate, TerminalNumber = receiptId.TerminalNumber, TransactionId = receiptId.TransactionId, GetReceiptOperationEntities = new List <GetReceiptEntity>(), }; await entityContext.Receipts.AddAsync(entity, token); await entityContext.SaveChangesAsync(token); } return(entity); } }