narsil/Tanshu.Accounts.PointOfSale/Updates/AutoUpdateForm.cs
2010-03-02 23:26:21 +05:30

63 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Tanshu.Accounts.Helpers;
using System.Threading;
using Tanshu.Accounts.BI;
namespace Accounts.PointOfSale
{
public partial class AutoUpdateForm : Form
{
public AutoUpdateForm()
{
InitializeComponent();
}
private void btnGo_Click(object sender, EventArgs e)
{
if (!Thread.CurrentPrincipal.IsInRole("Security/CreateUser"))
return;
decimal myDecimal;
if (decimal.TryParse(txtTwelve.Text, out myDecimal))
Process(myDecimal, .125M, Convert.ToDecimal(txtTwelveSize.Text));
if (decimal.TryParse(txtFour.Text, out myDecimal))
Process(myDecimal, .04M, Convert.ToDecimal(txtFourSize.Text));
if (decimal.TryParse(txtZero.Text, out myDecimal))
Process(myDecimal, 0M, Convert.ToDecimal(txtZeroSize.Text));
}
private void Process(decimal target, decimal tax, decimal averageSize)
{
return;
//if (target == 0)
// return;
//decimal existing;
//int work, runner = 0;
//ManagementBI man = new ManagementBI();
////dc.CommandTimeout = 5000;
//List<Guid> list = man.GetBillList(dtpFrom.Value, dtpTo.Value);
//existing = man.GetBalance(tax, dtpFrom.Value, dtpTo.Value);
//work = Convert.ToInt32(Math.Floor((list.Count() * averageSize) / (target - existing)));
//while (existing < target)
//{
// if (MessageBox.Show(string.Format("Total Increase needed is {0}", target - existing), "Balance", MessageBoxButtons.OKCancel) == DialogResult.OK)
// {
// runner += 1;
// SalesForm mySaleForm = new SalesForm(list[(runner * work) + 1]);
// mySaleForm.ShowDialog();
// mySaleForm.Dispose();
// }
// else
// return;
// existing = man.GetBalance(target, tax);
//}
}
}
}