private void OnItemClick(object sender, System.EventArgs e) { //Menu services int id = 0; LTLClient2 client = null; dlgLTLClient dlg = null; try { ToolStripItem menu = (ToolStripItem)sender; switch (menu.Name) { case "csNew": client = new LTLClient2(); dlg = new dlgLTLClient(client); dlg.Font = this.Font; if (dlg.ShowDialog(this) == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; id = FreightGateway.CreateLTLClient(client); MessageBox.Show(this, "New client created.", App.Product, MessageBoxButtons.OK); Refresh(); } break; case "csOpen": id = (int)this.grdClients.Selected.Rows[0].Cells["ID"].Value; client = FreightGateway.ReadLTLClient(id); dlg = new dlgLTLClient(client); dlg.Font = this.Font; if (dlg.ShowDialog(this) == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; FreightGateway.UpdateLTLClient(client); MessageBox.Show(this, "Client updated.", App.Product, MessageBoxButtons.OK); Refresh(); } break; case "csRefresh": this.Cursor = Cursors.WaitCursor; Refresh(); break; case "csApprove": id = (int)this.grdClients.Selected.Rows[0].Cells["ID"].Value; FreightGateway.ApproveLTLClient(id, true); Refresh(); break; case "csDeny": id = (int)this.grdClients.Selected.Rows[0].Cells["ID"].Value; FreightGateway.ApproveLTLClient(id, false); Refresh(); break; } } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } finally { setUserServices(); this.Cursor = Cursors.Default; } }