Files
ravenqbi/AyaNovaQBI/MainForm.cs
2022-06-22 02:31:12 +00:00

93 lines
2.8 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.Threading.Tasks;
using System.Windows.Forms;
namespace AyaNovaQBI
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
async private void MainForm_Load(object sender, EventArgs e)
{
//Initialize
StringBuilder initErrors = new StringBuilder();
if (await util.InitializeQBI(initErrors) == false)
{
if (initErrors.Length>0)
await Task.Run(() => MessageBox.Show($"AyaNova QBI was unable to start:\r\n{initErrors.ToString()}"));
Close();
}
// grid.DataSource = util.GetInvoiceableItems();
}
private void grid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == grid.Columns["Status"].Index
&& e.Value != null)
{
var isLinked = (bool)grid.Rows[e.RowIndex].Cells["linked"].Value;
if (!isLinked)
{
grid.Rows[e.RowIndex].ErrorText = "Not invoiceable: use \"Invoice\" -> \"Fix problems\" to resolve";
}
else
{
grid.Rows[e.RowIndex].ErrorText = null;
}
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Close();
}
private void multipleWorkordersPerInvoiceToolStripMenuItem_Click(object sender, EventArgs e)
{
if (grid.SelectedRows.Count < 1)
{
MessageBox.Show("There are no rows selected, select one or more rows to invoice");
return;
}
MessageBox.Show($"STUB: MULTIPLEwoperinvoice {grid.SelectedRows.Count} rows selected");
}
private void oneWorkOrderPerInvoiceToolStripMenuItem_Click(object sender, EventArgs e)
{
if (grid.SelectedRows.Count < 1)
{
MessageBox.Show("There are no rows selected, select one or more rows to invoice");
return;
}
MessageBox.Show($"STUB: onwoperinvoice {grid.SelectedRows.Count} rows selected");
}
private void fixProblemsToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("STUB: FIX PROBLEMS");
}
private void refreshInvoicesToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("STUB: REFRESH INVOICES");
}
}
}