public TransactionRecord GetPromotionDetails(TransactionRecord tr) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Booking ID Response from PG " + tr.BookingID.ToString()); if (tr.BookingID.ToString().Substring(0, 2) == "31") { DataTable chkID = TransactionBOL.Select_MarchPromotionTransactionCounter_CounterIDWise(tr.BookingID); if (chkID.Rows.Count > 0) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Booking ID and Conter from March Promotion Table " + chkID.Rows[0][1].ToString() + "," + chkID.Rows[0][0].ToString()); if (chkID.Rows[0][0].ToString().Substring(0, 2) == "31") { tr.BookingID = long.Parse(chkID.Rows[0][1].ToString()); } } Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Booking ID after Switch " + tr.BookingID.ToString()); } DataTable dttransaction = TransactionBOL.Select_Temptransaction_transactionIDWise(tr.BookingID); if (dttransaction.Rows.Count > 0) { DataRow dr = dttransaction.Rows[0]; decimal DiscountPercentage = decimal.Parse(dr["DiscountPercentage"].ToString()); tr.PromotionCode = dr["PromotionCode"].ToString(); tr.DiscountPercentage = DiscountPercentage; tr.WebPromotionId = dr["WebPromotionId"].ToString(); } return(tr); }
protected void HandleFailure(TransactionRecord tr) { #region handlefailure String _refNo = tr.ReferenceNo.ToString(); KoDTicketing.GTICKV.LogEntry(tr.ReferenceNo.ToString(), "IDBI Error Occured -- Payment Not Successful", "27", tr.ReferenceNo.ToString()); long BookingID = long.Parse(tr.ReferenceNo.ToString()); try { DataTable dt = TransactionBOL.Select_Temptransaction_REFIDWISE(BookingID); if (dt.Rows.Count == 0) { ReceiptUtils.FailurePaymentResponse(); } else { ReceiptUtils.FailurePaymentResponse(dt.Rows[0]); } } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write("Error occurred processing unsuccessful payment through IDBI..." + ex.Message); } #endregion handlefailure }
public void AddTransaction(Transaction transaction) { var accounts = client.GetAllAccounts(); var transactionRecord = new TransactionRecord { Sum = transaction.Sum, Description = transaction.Description, DateTime = transaction.DateTime, AccountToIncreaseId = accounts.FirstOrDefault(a => a.Name == transaction.AccountToIncreaseName).Id, AccountToSubstractId = accounts.FirstOrDefault(a => a.Name == transaction.AccountToSubstractName).Id }; client.InsertTransactionRecord(transactionRecord); Account accountToSubstruct = client.GetAccountById(transactionRecord.AccountToSubstractId); accountToSubstruct.Balance -= transactionRecord.Sum; client.UpdateAccount(accountToSubstruct); Account accountToIncrease = client.GetAccountById(transactionRecord.AccountToIncreaseId); accountToIncrease.Balance += transactionRecord.Sum; client.UpdateAccount(accountToIncrease); }
public TransactionRecord GetTransactionById(int id) { var transactionRecord = new TransactionRecord(); using (var connection = new MySqlConnection(connstring)) { connection.Open(); var commandString = $"SELECT * FROM {databaseName}.TestTransactions WHERE Id = {id};"; var command = new MySqlCommand(commandString, connection); command.ExecuteNonQuery(); using (var reader = command.ExecuteReader()) { reader.Read(); transactionRecord.Id = reader.GetInt32(0); transactionRecord.Sum = reader.GetInt32(1); transactionRecord.Description = reader.GetString(2); transactionRecord.DateTime = reader.GetString(3); transactionRecord.AccountToIncreaseId = reader.GetInt32(4); transactionRecord.AccountToSubstractId = reader.GetInt32(5); } } return(transactionRecord); }
public IList <TransactionRecord> GetTransactions() { var result = new List <TransactionRecord>(); using (var connection = new MySqlConnection(connstring)) { connection.Open(); var commandString = $"SELECT * FROM {databaseName}.TestTransactions;"; var command = new MySqlCommand(commandString, connection); command.ExecuteNonQuery(); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var tr = new TransactionRecord { Id = reader.GetInt32(0), Sum = reader.GetInt32(1), Description = reader.GetString(2), DateTime = reader.GetString(3), AccountToIncreaseId = reader.GetInt32(4), AccountToSubstractId = reader.GetInt32(5) }; result.Add(tr); } } } return(result); }
public IQueryable <TransactionRecord> GetImportantDatesForUser(int id) { var transactionRecordList = new List <TransactionRecord>(); var maxDate = DateTime.Now.AddDays(7); var transactions = db.Transactions.Where(t => t.BillDate >= DateTime.Now && t.BillDate <= maxDate && t.UserId == id && t.TransactionTypeId == (int)Constants.TransactionType.Expense); foreach (var transaction in transactions) { var tr = new TransactionRecord(transaction); var expense = db.Expenses.Where(ex => ex.ExpenseId == tr.TransactionSourceId).FirstOrDefault(); if (expense == null) { continue; } tr.ExpenseName = expense != null ? expense.ExpenseName : string.Empty; var expenseAccountName = db.ExpenseAccounts.Where(ex => ex.ExpenseAccountId == expense.ExpenseAccountId).FirstOrDefault(); tr.ExpenseAccountName = expense != null ? expenseAccountName.ExpenseAccountName : "Expense Account Not Found"; tr.Frequency = expense.Frequency; transactionRecordList.Add(tr); } return(transactionRecordList.AsQueryable()); }
private async Task ConfirmationTask(TransactionRecord <TState> record) { try { var tasks = new List <Task>(); record.LastConfirmationAttempt = DateTime.UtcNow; foreach (var p in record.WriteParticipants) { if (!p.Equals(resource)) { tasks.Add(p.Reference.AsReference <ITransactionalResourceExtension>() .Confirm(p.Name, record.TransactionId, record.Timestamp)); } } await Task.WhenAll(tasks); confirmationTasks.Remove(record.TransactionId); // all prepare records have been removed from all participants. // Now we can remove the commit record. this.storageBatch.Collect(record.TransactionId); storageWorker.Notify(); } catch (Exception e) { // we are giving up for now. // if pinged or reloaded from storage, we'll try again. logger.Warn(333, $"Could not notify/collect:", e); } }
public async Task Temporal_Insert_Test() { var factory = new TemporalTestDesignTimeDbContextFactory(); using (TemporalTestDbContext context = factory.CreateDbContext(null)) { await context.Database.EnsureDeletedAsync(); var migrations = await context.Database.GetPendingMigrationsAsync(); Assert.IsTrue(migrations.Any(), "At least one migration is needed."); await context.Database.MigrateAsync(); } using (TemporalTestDbContext context = factory.CreateDbContext(null)) { var transaction = new TransactionRecord() { Amount = 10, CreatedDate = DateTime.Now, LastModifiedDate = DateTime.Now }; context.Add(transaction); await context.SaveChangesAsync(); } }
public override void Post(TransactionRecord rec) { string sqlString = BuildPostSQLStatement(rec); //if the connection fails for whatever reason during the post, then i don't want //the app to crash try { //i dont want these objects just lying around on the stack using (MySqlDbConnection dbCon = new MySqlDbConnection()) using (MySqlCommand cmd = new MySqlCommand(sqlString)) { cmd.Connection = dbCon.Connection; cmd.Connection.Open(); cmd.ExecuteNonQuery(); string msg = String.Format($"Post success."); Console.WriteLine(msg); } } catch (Exception ex) { string _err = String.Format($"Post failed: {ex.ToString()}"); Console.WriteLine(_err); } }
/// <summary> /// 修改实时交易信息 /// </summary> /// <param name="query"></param> /// <returns></returns> public Result_Msg ModifyTransactionRecord(TransactionRecordModifyQuery query) { Result_Msg res = new Result_Msg(); TransactionRecord modelOld = context.TransactionRecord.FindById <TransactionRecord>(query.ID); try { if (modelOld != null) { modelOld.Id = query.ID; modelOld.XName_CN = query.XName_CN; modelOld.XName_Eng = query.XName_Eng; modelOld.Y_CompleteAmount = query.Y_CompleteAmount; modelOld.Y_OrderAmount = query.Y_OrderAmount; modelOld.Y_CompleteNumber = query.Y_CompleteNumber; modelOld.Y_OrderQuantity = query.Y_OrderQuantity; modelOld.YearMonth = query.YearMonth; modelOld.IsTrue = query.IsTrue; modelOld.CurveType = query.CurveType; res.IsSuccess = context.SaveChanges() == 1; } else { res.IsSuccess = false; res.Message = "修改失败,数据库中不存在该记录"; } } catch (Exception ex) { res.IsSuccess = false; res.Message = "修改失败,失败原因:" + ex.Message; } return(res); }
public IRecord GetLastTransactionRecord(string qname, string qtype) { lock (_lock) { var transaction = transactions.Where(x => x.Records.Any(y => y.qname.ToLower() == qname.ToLower() & y.qtype == qtype)).LastOrDefault(); if (transaction != null) { TransactionRecord record = qtype == "ANY" ? transaction.Records.LastOrDefault(x => x.qname.ToLower() == qname.ToLower()) : transaction.Records.LastOrDefault(x => x.qname.ToLower() == qname.ToLower() & x.qtype == qtype); if (record.TransactionMode == TransactionMode.INSERT) { return(record); } else { return(null); } } else { return(null); } } }
private void Insert(TransactionRecord record) { bool hasOrid = record.ORID != null; bool needsOrid = record.RecordType != RecordType.Create; if (hasOrid && !needsOrid) { throw new InvalidOperationException("Objects to be added via a transaction must not already be in the database"); } if (needsOrid && !hasOrid) { throw new InvalidOperationException("Objects to be updated or deleted via a transaction must already be in the database"); } if (!hasOrid) { record.ORID = CreateTempORID(); record.ORID.ClusterId = _connection.Database.GetClusterIdFor(record.OClassName); } if (_records.ContainsKey(record.ORID)) { if (record.RecordType != _records[record.ORID].RecordType) { throw new InvalidOperationException("Same object already part of transaction with a different CRUD "); } _records[record.ORID] = record; } else { _records.Add(record.ORID, record); } }
private void CreateOrUpdateTransactionViewModel(TransactionRecord aTransactionRecord, uint aCoinID, IEnumerable <string> aAccounts) { if (!FTransactionsViewModels.ContainsKey(aCoinID)) { FTransactionsViewModels[aCoinID] = new List <TransactionViewModel>(); } if ((!FTransactionsViewModels[aCoinID].Exists(x => x.TransactionID == aTransactionRecord.TxId))) { FTransactionsViewModels[aCoinID].Add(new TransactionViewModel(aTransactionRecord, aAccounts)); } if (aCoinID != 0) { TransactionViewModel lTransactionViewModel = FTransactionsViewModels[aCoinID].Find(x => x.TransactionID == aTransactionRecord.TxId); if (aTransactionRecord.Block != 0 && lTransactionViewModel.Block == 0) { lTransactionViewModel.Set(aTransactionRecord, aAccounts); } lTransactionViewModel.SetBlockHeight(FWalletPandoraServer.GetBlockHeight(aCoinID), FWalletPandoraServer.GetCurrency(aCoinID).MinConfirmations); if (!lTransactionViewModel.isConfirmed) { FWalletPandoraServer.CheckIfConfirmed(Convert.ToUInt32(aCoinID), aTransactionRecord.Block); } } }
public IActionResult UpdateTransaction(long id, [FromBody] TransactionRecord item) { _context.Entry(item); item.UserId = item?.User?.Id ?? default(int); item.CategoryId = item?.Category?.Id ?? default(int); item.BankId = item?.Bank?.Id ?? default(int); var existingTags = _context.TransactionRecordTag.Where(t => t.TransactionRecordId == id).ToList(); var existingTagIds = existingTags.Select(t => t.Id).ToList(); foreach (var tag in item.TransactionRecordTag) { if (existingTagIds.Contains(tag.Id)) { var existingEntry = _context.Entry(existingTags.Single(t => t.Id == tag.Id)); existingEntry.CurrentValues.SetValues(tag); existingEntry.State = EntityState.Modified; } else { tag.Id = 0; var newEntry = _context.Entry(tag); newEntry.State = EntityState.Added; existingTags.Add(tag); } } var deleteTags = existingTags.Where(old => !item.TransactionRecordTag.Any(t => t.Id == old.Id)); _context.TransactionRecordTag.RemoveRange(deleteTags); return(Update <TransactionRecord>(id, item)); }
private List <TransactionRecord> GetTransactionList(String[] ps) { List <TransactionRecord> records = new List <TransactionRecord>(); for (int i = 1; i < ps.Length; i++) { Console.WriteLine(ps[i]); String[] stocks = ps[i].Split(new string[] { "\t" }, StringSplitOptions.None); TransactionRecord rec = new TransactionRecord { Date = DateTime.Parse(stocks[0]), EntrustNo = int.Parse(stocks[1]), StockCode = stocks[2], StockName = stocks[3], OperType = stocks[4], Amount = int.Parse(stocks[5]), Price = float.Parse(stocks[6]), Turnover = float.Parse(stocks[7]), TransactionNo = int.Parse(stocks[10]) }; records.Add(rec); } return(records); }
/// <summary> /// 新增实时交易信息 /// </summary> /// <param name="query"></param> /// <returns></returns> public Result_Msg TransactionRecordAdd(TransactionRecordAddQuery query) { Result_Msg res = new Result_Msg(); Result_Model <TransactionRecord> model = GetTransactionRecordByYearMonthAndCurveType(query.CurveType, query.YearMonth); if (!model.Msg.IsSuccess) { TransactionRecord job = new TransactionRecord() { CurveType = query.CurveType, YearMonth = query.YearMonth, XName_CN = query.XName_CN, XName_Eng = query.XName_Eng, Y_CompleteAmount = query.Y_CompleteAmount, Y_OrderAmount = query.Y_OrderAmount, Y_CompleteNumber = query.Y_CompleteNumber, Y_OrderQuantity = query.Y_OrderQuantity, IsTrue = 1//1:真是;0:伪造 }; context.TransactionRecord.Add(job); res.IsSuccess = context.SaveChanges() == 1; } else { res.IsSuccess = false; res.Message = model.Msg.Message; } return(res); }
public async Task <ResponseData <OverviewResponse> > IndexAsync([FromBody] UserToken request) { if (!request.IsValid()) { return(new ResponseData <OverviewResponse>() { Succeed = false, Message = "用户验证失败" }); } OverviewResponse response = new OverviewResponse(); foreach (var car in await db.Cars.Where(p => p.CarOwnerID == request.UserID).ToListAsync()) { int recordCount = await db.ParkRecords.CountAsync(p => p.CarID == car.ID); response.Cars.Add(new { car.LicensePlate, Records = recordCount, car.ID }); } TransactionRecord transaction = await db.TransactionRecords .LastOrDefaultRecordAsync(p => p.Time, p => p.CarOwnerID == request.UserID); response.Balance = transaction == null?0:transaction.Balance; response.ExpireTime = transaction == null ? System.DateTime.MinValue : transaction.ExpireTime; response.Parks = await db.ParkAreas.ToListAsync(); return(new ResponseData <OverviewResponse>() { Data = response }); }
protected virtual void OnLocalCommit(TransactionRecord <TState> entry) { this.storageBatch.Prepare(entry.SequenceNumber, entry.TransactionId, entry.Timestamp, entry.TransactionManager, entry.State); this.storageBatch.Commit(entry.TransactionId, entry.Timestamp, entry.WriteParticipants); this.storageBatch.Confirm(entry.SequenceNumber); // after store, send response back to TA this.storageBatch.FollowUpAction(() => { if (logger.IsEnabled(LogLevel.Trace)) { logger.Trace($"committed {entry.TransactionId} {entry.Timestamp:o}"); } entry.PromiseForTA.TrySetResult(TransactionalStatus.Ok); }); if (entry.WriteParticipants.Count > 1) { // after committing, we need to run a task to confirm and collect this.storageBatch.FollowUpAction(() => { confirmationTasks.Add(entry.TransactionId, entry); confirmationWorker.Notify(); }); } else { // there are no remote write participants to notify, so we can finish it all in one shot this.storageBatch.Collect(entry.TransactionId); } }
public IQueryable <TransactionRecord> GetExpenseTransactionsByUserId(int id) { var transactionRecordList = new List <TransactionRecord>(); var transactions = (from t in db.Transactions from tp in db.TransactionPeriods where t.TransactionPeriodId == tp.TransactionPeriodId && tp.UserId == id && t.TransactionTypeId == (int)Constants.TransactionType.Expense && t.AmountContributed != null select t).OrderBy(t => t.BillDate); foreach (var transaction in transactions) { var tr = new TransactionRecord(transaction); var expense = db.Expenses.Where(ex => ex.ExpenseId == tr.TransactionSourceId).FirstOrDefault(); tr.ExpenseName = expense != null ? expense.ExpenseName : string.Empty; var expenseAccountName = db.ExpenseAccounts.Where(ex => ex.ExpenseAccountId == expense.ExpenseAccountId).FirstOrDefault(); tr.ExpenseAccountName = expense != null ? expenseAccountName.ExpenseAccountName : "Expense Account Not Found"; transactionRecordList.Add(tr); } return(transactionRecordList.AsQueryable()); }
private void AddTransactionRecord(TransactionRecord record) { TransactionHistory.Add(record); if (TransactionHistory.Count > _transactionHistoryLimit) { TransactionHistory.RemoveAt(0); } }
protected void btnGo_Click(object sender, EventArgs e) { decimal discountamt = 0; TransactionRecord tr = new TransactionRecord(); tr.BookingID = txt_BookingID.Text.Length > 0 ? long.Parse(txt_BookingID.Text) : 0; tr.ReceiptNo = txt_ReceiptNo.Text.Length > 0 ? txt_ReceiptNo.Text : "0"; tr.DateOfBooking = txt_BookingDate.Text.Length > 0 ? txt_BookingDate.Text : "0"; tr.Location = txt_bookingDateTo.Text.Length > 0 ? txt_bookingDateTo.Text : "0"; tr.ShowDate = txt_ShowDate.Text.Length > 0 ? txt_ShowDate.Text : "0"; tr.MobileNo = txt_ShowDateTo.Text.Length > 0 ? txt_ShowDateTo.Text : "0"; tr.Name = txt_Name.Text.Length > 0 ? txt_Name.Text : "0"; tr.AgentCode = ddlAgent.SelectedValue; DataSet ds = TransactionBOL.Select_Report_FromTransactionTable(tr); if (ds.Tables[0].Rows.Count > 0) { Btn_Excel.Enabled = true; btnPrint.Disabled = false; //for (int i = 0; i < ds.Tables[0].Rows.Count; i++) //{ // if (ds.Tables[0].Rows[i][10].ToString() == "") // { // discountamt = discountamt + decimal.Parse(dr[2].ToString()); // } //} gv_Report.DataSource = ds.Tables[0]; lblMess.Text = ""; gv_Report.DataBind(); if (ds.Tables[1].Rows.Count > 0) { string card = ""; foreach (DataRow dr in ds.Tables[1].Rows) { Seats = Seats + int.Parse(dr[0].ToString()); totamt = totamt + decimal.Parse(dr[1].ToString()); if (dr[2].ToString() !="") { discountamt = discountamt + decimal.Parse(dr[2].ToString()); card += "<br/>Amount Received Using " + dr[3] + " : " + dr[2]; } //card += "<br/>Amount Received Using " + dr[3] + " : " + dr[2]; } lblTotSeats.Text = card; } gv_Report.FooterRow.Cells[0].Text = "Total"; gv_Report.FooterRow.Cells[1].Text = Seats.ToString(); gv_Report.FooterRow.Cells[2].Text = totamt.ToString(); gv_Report.FooterRow.Cells[3].Text = discountamt.ToString(); } else { btnPrint.Disabled = true; Btn_Excel.Enabled = false; lblMess.Text = "No Records Found!"; } }
void context_Completed(TransactionContext sender, RetailSDKException error, TransactionRecord record) { var errorMsg = (error != null ? error.ToString() : "no error"); Dispatcher.BeginInvoke(new Action(() => { MessageTextBlock.Text = "Transaction Completed " + errorMsg; })); _context = null; }
public async Task <ActionResult> DeleteConfirmed(int id) { TransactionRecord transactionRecord = await db.TransactionRecords.FindAsync(id); db.TransactionRecords.Remove(transactionRecord); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
protected void btnGo_Click(object sender, EventArgs e) { try { if (Page.IsPostBack) { lblMess.Text = "No Records Found!"; gv_Failed.Dispose(); gv_Report.Dispose(); gv_Report.DataBind(); gv_Failed.DataBind(); } long BookingID = txt_BookingID.Text.Length > 0 ? long.Parse(txt_BookingID.Text) : 0; string ReceiptNo = txt_ReceiptNo.Text.Length > 0 ? txt_ReceiptNo.Text : "0"; string Name = txt_Name.Text.Length > 0 ? txt_Name.Text : "0"; string today = DateTime.Today.ToShortDateString(); string daysfromtoday = DateTime.Today.Subtract(TimeSpan.FromDays(30)).ToShortDateString(); DataSet ds = TransactionBOL.Select_Report_SearchFromTransactions_DS(BookingID, ReceiptNo, daysfromtoday, today, "0", "0", Name, "0"); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { gv_Report.DataSource = ds; lblMess.Text = "BOOKINGS IN LAST 30 DAYS"; gv_Report.DataBind(); } else { lblMess.Text = "NO BOOKINGS IN LAST 30 DAYS"; } TransactionRecord tr = new TransactionRecord(); tr.BookingID = txt_BookingID.Text.Length > 0 ? long.Parse(txt_BookingID.Text) : 0; tr.ReceiptNo = txt_ReceiptNo.Text.Length > 0 ? txt_ReceiptNo.Text : "0"; tr.DateOfBooking = daysfromtoday; //location is bookingDate to tr.Location = today; tr.ShowDate = "0"; // ShowDateFrom tr.MobileNo = "0"; //used as ShowDateTo tr.Name = txt_Name.Text.Length > 0 ? txt_Name.Text : "0"; ds = TransactionBOL.Select_Report_SearchFromTransactionsTemp_DS(tr); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { gv_Failed.DataSource = ds; lblMess2.Text = "FAILED TRANSACTIONS IN LAST 30 DAYS"; gv_Failed.DataBind(); } else { lblMess2.Text = "NO FAILED TRANSACTION IN LAST 30 DAYS"; } } catch (Exception ex) { Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(ex.Message); } }
/// <summary> /// 删除指定ID数据 /// </summary> /// <param name="Id">实时交易信息ID</param> /// <returns></returns> public Result_Msg DeleteById(int Id, long userId) { Result_Msg res = new Result_Msg(); TransactionRecord job = (from p in context.TransactionRecord where p.Id == Id select p).FirstOrDefault(); context.TransactionRecord.Remove(job); res.IsSuccess = context.SaveChanges() == 1; return(res); }
public async Task Test1() { var files = Enumerable.Range(2010, 10).Select(o => $"output_{o}.se"); var roots = await TestingTools.ReadSIEFiles(files); // new[] { "output_2016.se", "output_2017.se", "output_2018.se" }); var allVouchers = roots.SelectMany(o => o.Children).OfType <VoucherRecord>(); var annoyingAccountIds = new[] { 24400, 26410 }.ToList(); IEnumerable <TransactionRecord> txFilter(IEnumerable <TransactionRecord> txs) => TransactionRecord.PruneCorrections(txs).Where(t => !annoyingAccountIds.Contains(t.AccountId)); var multi = allVouchers.Where(o => !(new[] { "FAS", "LAN", "LON", "MA", "BS", "RV" }.Contains(o.VoucherTypeCode)) && TransactionRecord.PruneCorrections(o.Transactions).Count(t => !(new[] { '1', '2' }.Contains(t.AccountId.ToString()[0]))) > 1).ToList(); var matchResult = MatchSLRResult.MatchSLRVouchers(allVouchers, VoucherRecord.DefaultIgnoreVoucherTypes); var multiAccount = matchResult.Matches.Where(mv => txFilter(mv.SLR.Transactions).Count() > 1); //var dbg2 = string.Join("\n\n", matchResult.Matched.OrderBy(o => o.other.Date) // .Select(mv => $"{PrintVoucher(mv.slr, txFilter)}\n{PrintVoucher(mv.other, txFilter)}")); Assert.DoesNotContain(matchResult.Matches, o => !o.SLR.Transactions.Any()); Assert.DoesNotContain(matchResult.NotMatchedOther, o => !o.Transactions.Any()); Assert.DoesNotContain(matchResult.NotMatchedSLR, o => !o.Transactions.Any()); var cc = matchResult.Matches .Select(o => new { o.Other.Date, txFilter(o.SLR.Transactions).First().Amount, txFilter(o.SLR.Transactions).First().AccountId, txFilter(o.SLR.Transactions).First().CompanyName, Comment = "", }) .Concat((matchResult.NotMatchedSLR.Concat(matchResult.NotMatchedOther)) .Select(o => new { o.Date, Amount = txFilter(o.Transactions).FirstOrDefault()?.Amount ?? 0, AccountId = 0, CompanyName = txFilter(o.Transactions).FirstOrDefault()?.CompanyName ?? "N/A", Comment = o.VoucherTypeCode, })); //cc = cc.Where(o => !string.IsNullOrEmpty(o.Comment) && o.Comment != "LON" && o.Comment != "LAN"); cc = cc.OrderBy(o => o.Date).ToList(); //var dbg = string.Join("\n", cc.Select(o => $"{o.Date.AtMidnight().ToDateTimeUnspecified():yyyy-MM-dd}\t{o.Comment}\t{o.Amount}\t{o.AccountId}\t{o.CompanyName}")); //string PrintVoucher(VoucherRecord voucher, Func<IEnumerable<TransactionRecord>, IEnumerable<TransactionRecord>> funcModifyTransactions = null) //{ // if (funcModifyTransactions == null) // funcModifyTransactions = val => val; // return voucher.ToString() + "\n\t" + string.Join("\n\t", funcModifyTransactions(voucher.Transactions).Select(t => t.ToString())); //} }
public static TransactionRecord CreateTransactionRecord(double price, int quanity, DateTime timeStamp) { TransactionRecord res = new TransactionRecord(); res.Price = price; res.Quantity = quanity; res.TimeStamp = timeStamp; return(res); }
private void CollectEventsForBatch(int batchsize) { // collect events for batch for (int i = 0; i < batchsize && this.problemFlag == TransactionalStatus.Ok; i++) { TransactionRecord <TState> entry = commitQueue[i]; switch (entry.Role) { case CommitRole.LocalCommit: { OnLocalCommit(entry); break; } case CommitRole.RemoteCommit: { if (entry.ConfirmationResponsePromise == null) { // this is a read-only participant that has sent // its prepared message. // So we are really done and need not store or do anything. } else { // we must confirm in storage, and then respond to TM so it can collect this.storageBatch.Confirm(entry.SequenceNumber); this.storageBatch.FollowUpAction(() => { entry.ConfirmationResponsePromise.TrySetResult(true); }); } break; } case CommitRole.ReadOnly: { // we are a participant of a read-only transaction. Must store timestamp and then respond. this.storageBatch.Read(entry.Timestamp); this.storageBatch.FollowUpAction(() => { entry.PromiseForTA.TrySetResult(TransactionalStatus.Ok); }); break; } default: { logger.LogError(777, "internal error: impossible case {CommitRole}", entry.Role); throw new NotSupportedException($"{entry.Role} is not a supported CommitRole."); } } } }
}//end of WithdrawMonies // method to create a new transaction public bool CreateTransaction(TransactionRecord tr, out int transID) { DALTransactionManager manager = new DALTransactionManager(); bool retVal = false; retVal = manager.CreateTransaction(tr, out transID); return(retVal); }//end of CreateTransaction
public TransactionVM(TransactionRecord tr) { TransactionRecordId = tr.Id; SellerId = tr.SellerId; SellerName = tr.Seller.HDBUserName; ItemsTotal = tr.ItemCosts; ShippingTotal = tr.ShippingCost; TrackingNumber = tr.ShippingRecord.TrackingNumber; NumItems = tr.NumOfItems; }
public bool CheckForChanges(TransactionRecord aTx) { bool lResult = false; if (FTransactionRecordsCache.TryGetValue(aTx.TxId, out TransactionRecord lCacheTx)) { lResult = !aTx.IsEqual(lCacheTx); } return(lResult); }