narsil/Tanshu.Accounts.PointOfSale/Management/FoodForm.cs

47 lines
1.5 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using Tanshu.Accounts.Repository;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.Management
{
public partial class FoodForm : Form
{
public FoodForm()
{
InitializeComponent();
}
private void Sale_Analysis_Form_Load(object sender, EventArgs e)
{
dtpStart.Value = DateTime.Today;
dtpFinish.Value = DateTime.Today;
}
private void btnGo_Click(object sender, EventArgs e)
{
dtpStart.Value = dtpStart.Value.Date.AddHours(7);
dtpFinish.Value = dtpFinish.Value.Date.AddDays(1).AddHours(7);
var amount = GetFood();
var newAmount = Convert.ToDecimal(txtQuantity.Text);
if (MessageBox.Show(amount.ToString(), "Food Sales", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes && amount > newAmount)
{
MessageBox.Show(SetFood(newAmount).ToString());
}
}
private decimal GetFood()
{
using (var bi = new ManagementBI())
return bi.GetFood(1, dtpStart.Value, dtpFinish.Value);
}
private decimal SetFood(decimal quantity)
{
using (var bi = new ManagementBI())
return bi.SetFood(1, quantity, dtpStart.Value, dtpFinish.Value);
}
}
}