public void Update() { dealsAdapter.FillBy(deals, Node.Id); if (deals.Rows.Count != 1) { throw new Exception("DH.Update()"); } var row = deals.Rows[0]; DealForm form = new DealForm(Convert.ToInt32(row[1]), Convert.ToDateTime(row[2])); form.ShowDialog(); int client; DateTime date; if (form.DialogResult == System.Windows.Forms.DialogResult.OK) { client = form.Client; date = form.DateSign; } else { return; } UpdateDealsInfo(Node.Id, client, date); UpdateTextOfNode(); }
public void Add() { DealForm form = new DealForm(); form.ShowDialog(); int client; DateTime date; if (form.DialogResult == System.Windows.Forms.DialogResult.OK) { client = form.Client; date = form.DateSign; } else { return; } int id = InsertIntoDeals(client, date, 0); dealsShowAdapter.FillBy(dealsShow, id); if (dealsShow.Rows.Count != 1) { throw new Exception("Sth gone wrong with inserting new deal"); } var row = dealsShow.Rows[0]; CustomNode newNode = new CustomNode(text: Convert.ToString(row[1]), type: CustomNode.DEAL, id: Convert.ToInt32(row[0])); newNode.ContextMenu = new CustomMenu(new Controller().GetDealsMenuItems(), newNode); View.Nodes.Add(newNode); }