63 lines
2.0 KiB
C#
63 lines
2.0 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();
|
|
}
|
|
|
|
private void MainForm_Load(object sender, EventArgs e)
|
|
{
|
|
cbCustomersWithInvoiceableWorkorders.DataSource = util.GetCustomersWithInvoiceableItems();
|
|
cbCustomersWithInvoiceableWorkorders.DisplayMember = "Name";
|
|
// 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].Cells["wonumber"].ErrorText = "Not invoiceable: use \"Invoice\" -> \"Fix problems\" to resolve";
|
|
}else
|
|
{
|
|
grid.Rows[e.RowIndex].Cells["wonumber"].ErrorText = null;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void cbCustomersWithInvoiceableWorkorders_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (cbCustomersWithInvoiceableWorkorders.SelectedValue != null)
|
|
{
|
|
var selectedNameIdItem = cbCustomersWithInvoiceableWorkorders.SelectedValue as NameIdItem;
|
|
grid.DataSource = util.GetInvoiceableItems(selectedNameIdItem.Name);
|
|
}
|
|
else
|
|
grid.DataSource = null;
|
|
}
|
|
}
|
|
}
|