private void menuItemWithAccessLevel22_Click(object sender, EventArgs e) { if (CheckIfFormSpawned(typeof(OrderChartForm)) == null) { OrderChartForm ocf = new OrderChartForm(postgreConnection); ocf.MdiParent = this; ocf.Show(); } else ((OrderChartForm)CheckIfFormSpawned(typeof(OrderChartForm))).Focus(); }
private void buttonWithAccessLevel2_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { OrderChartForm sf; if (((MainForm)this.MdiParent).CheckIfFormSpawned(typeof(OrderChartForm)) == null) { sf = new OrderChartForm(postgreConnection, from: String.Format("orders where customer={0} order by work_end_date", listBox1.SelectedValue), formName: "Доход/Расход для заказчика " + listBox1.Text); sf.MdiParent = this.MdiParent; sf.Show(); } else { ((OrderChartForm)((MainForm)this.MdiParent).CheckIfFormSpawned( typeof(OrderChartForm))).DrawData(-1, -1, postgreConnection, String.Format("orders where customer={0} order by work_end_date", listBox1.SelectedValue), "Доход/Расход для заказчика" + listBox1.Text); ((OrderChartForm)((MainForm)this.MdiParent).CheckIfFormSpawned(typeof(OrderChartForm))).Focus(); } } }