Beispiel #1
0
        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);
        }