public Task Handle(MoneyReceived message) { var balance = _database.GetAccountBalanceDto(message.Id); balance.Balance += message.Amount; _database.SaveAccountBalanceDto(balance); return(Task.FromResult(0)); }
private void _CreateReceipt(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Graphics graphic = e.Graphics; Font font = new Font("Courier New", 6); float FontHeight = font.GetHeight(); int startX = 10; int startY = 10; int offset = 90; graphic.DrawString("CÀ PHÊ TRI ÂN".PadLeft(16), new Font("Courier New", 10, System.Drawing.FontStyle.Bold), new SolidBrush(Color.Black), startX, startY); graphic.DrawString("252 Sông Lu, xã Trung An".PadLeft(25), font, new SolidBrush(Color.Black), startX + 22, startY + 15); graphic.DrawString("huyện Củ Chi, TP.HCM".PadLeft(27), font, new SolidBrush(Color.Black), startX, startY + 25); graphic.DrawString("HÓA ĐƠN BÀN SỐ".PadLeft(16), new Font("Courier New", 10, System.Drawing.FontStyle.Bold), new SolidBrush(Color.Black), startX, startY + 40); graphic.DrawString(bill.DeskNo.ToString(), new Font("Courier New", 10, System.Drawing.FontStyle.Bold), new SolidBrush(Color.Black), startX + 150, startY + 40); graphic.DrawString("GIỜ BẮT ĐẦU".PadLeft(8), font, new SolidBrush(Color.Black), startX, startY + 65); graphic.DrawString(bill.OrderTime, font, new SolidBrush(Color.Black), startX + 70, startY + 65); string top = "Tên Mặt Hàng".PadRight(17) + "ĐVT".PadRight(7) + "SL".PadRight(6) + "TT"; graphic.DrawString(top, font, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)FontHeight; //make the spacing consistent graphic.DrawString("------------------------------------", font, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)FontHeight + 5; //make the spacing consistent //Check if product was chosen, then update quantity foreach (DetailBillItemViewModel item in ListDetailBill) { graphic.DrawString(item.ProductName, font, new SolidBrush(Color.Black), startX, startY + offset); graphic.DrawString(item.UnitName, font, new SolidBrush(Color.Black), startX + 90, startY + offset); graphic.DrawString(item.Quantity.ToString(), font, new SolidBrush(Color.Black), startX + 125, startY + offset); graphic.DrawString((item.Price * item.Quantity).ToString(), font, new SolidBrush(Color.Black), startX + 148, startY + offset); offset = offset + (int)FontHeight + 5; //make the spacing consistent } graphic.DrawString("------------------------------------", font, new SolidBrush(Color.Black), startX, startY + offset); offset = offset + (int)FontHeight + 5; //make the spacing consistent graphic.DrawString("TỔNG CỘNG", new Font("Courier New", 8, System.Drawing.FontStyle.Bold), new SolidBrush(Color.Black), startX, startY + offset); graphic.DrawString(SumPrice.ToString(), font, new SolidBrush(Color.Black), startX + 80, startY + offset); graphic.DrawString("Tiền nhận", font, new SolidBrush(Color.Black), startX, startY + offset + 15); graphic.DrawString(MoneyReceived.ToString(), font, new SolidBrush(Color.Black), startX + 80, startY + offset + 15); graphic.DrawString("Tiền thối", font, new SolidBrush(Color.Black), startX, startY + offset + 25); graphic.DrawString(Change.ToString(), font, new SolidBrush(Color.Black), startX + 80, startY + offset + 25); offset = offset + (int)FontHeight + 5; //make the spacing consistent graphic.DrawString("XIN CHÂN THÀNH CẢM ƠN QUÝ KHÁCH!".PadLeft(12), font, new SolidBrush(Color.Black), startX, startY + offset + 35); offset = offset + (int)FontHeight + 5; //make the spacing consistent graphic.DrawString("HẸN GẶP LẠI!".PadLeft(23), font, new SolidBrush(Color.Black), startX, startY + offset + 40); }
public void RequestMoneyFrom(AClient client, SqlMoney money) { if (client.Amount >= money) { InputMoney(money); client.WithdrawMoney(money); MoneyReceived?.Invoke(this, client, money); } else { MessageBox.Show("На счете данного клиента недостаточно средств."); } }
protected override OpResult _Store(MoneyReceived _obj) { if (_obj == null) { return(OpResult.NotifyStoreAction(OpResult.ResultStatus.ObjectIsNull, _obj, "MoneyReceived object cannot be created as it is null")); } if (Exists(_obj)) { ExecuteNonQuery(GetQuery_UpdateQuery(_obj)); return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Updated, _obj)); } ExecuteNonQuery(GetQuery_InsertQuery(_obj)); if (_obj.MoneyReceivedID == null) { _obj.MoneyReceivedID = DbMgr.GetLastInsertID(); } _obj.FromDb = true; return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Created, _obj)); }
private DbUpdateStatement GetQuery_UpdateQuery(MoneyReceived _obj) { return(DbMgr.CreateUpdateClause("MoneyReceived", GetFields(_obj), "MoneyReceivedID", _obj.MoneyReceivedID)); }
private DbInsertStatement GetQuery_InsertQuery(MoneyReceived _obj) { Dictionary <string, DbFieldEntry> fields = GetFields(_obj); return(DbMgr.CreateInsertClause("MoneyReceived", fields)); }
private void Apply(MoneyReceived e) { _balance += e.Amount; }