private void btAddOrders_Click(object sender, EventArgs e) { int Ref; this.ordersBindingSource.EndEdit(); MDataSet.OrdersRow ordrow = (this.ordersBindingSource.Current as DataRowView).Row as MDataSet.OrdersRow; if (ordrow != null) { Ref = ordrow.TradePupletRef; } else { Ref = 1; } this.btSave_Click(sender, e); this.grid.EmbeddedNavigator.Buttons.Append.DoClick(); MDataSet.OrdersRow row = (this.ordersBindingSource.Current as DataRowView).Row as MDataSet.OrdersRow; row.TradePupletRef = Ref; row.Reserved = 0; FormDialog formDialog = new FormDialog(); formDialog.Text = "Добавить новый заказ "; formDialog.AcceptButton = null; OrderAdd orderAdd = new OrderAdd(row, this.ParentForm as MainForm); formDialog.panel.Controls.Add(orderAdd); if (formDialog.ShowDialog(this) == DialogResult.OK) { this.grid.EmbeddedNavigator.Buttons.EndEdit.DoClick(); this.ordersBindingSource.EndEdit(); this.btSave_Click(sender, e); } else { this.ordersBindingSource.CancelEdit(); this.mDataSet.Orders.RejectChanges(); } this.grid.Refresh(); }
private void btAddOrders_Click(object sender, EventArgs e) { int Ref; this.ordersBindingSource.EndEdit(); MDataSet.OrdersRow ordrow =(this.ordersBindingSource.Current as DataRowView).Row as MDataSet.OrdersRow; if (ordrow != null) Ref = ordrow.TradePupletRef; else Ref = 1; this.btSave_Click(sender, e); this.grid.EmbeddedNavigator.Buttons.Append.DoClick(); MDataSet.OrdersRow row = (this.ordersBindingSource.Current as DataRowView).Row as MDataSet.OrdersRow; row.TradePupletRef = Ref; row.Reserved = 0; FormDialog formDialog = new FormDialog(); formDialog.Text = "Добавить новый заказ "; formDialog.AcceptButton = null; OrderAdd orderAdd = new OrderAdd(row, this.ParentForm as MainForm); formDialog.panel.Controls.Add(orderAdd); if (formDialog.ShowDialog(this) == DialogResult.OK) { this.grid.EmbeddedNavigator.Buttons.EndEdit.DoClick(); this.ordersBindingSource.EndEdit(); this.btSave_Click(sender, e); } else { this.ordersBindingSource.CancelEdit(); this.mDataSet.Orders.RejectChanges(); } this.grid.Refresh(); }