private void btnNew_ItemClick(object sender, ItemClickEventArgs e) { EditCustomerForm form = new EditCustomerForm(); form.MdiParent = this.MdiParent; form.WindowState = FormWindowState.Maximized; form.Show(); form.FormClosing += EditForm_FormClosing; }
private void EditCustomer() { EditCustomerForm form = new EditCustomerForm(); form.CustomerId = (int)CustomersView.GetFocusedRowCellValue("Oid"); form.WindowState = FormWindowState.Maximized; form.MdiParent = this.MdiParent; form.Show(); form.FormClosing += EditForm_FormClosing; }
private void EditForm_FormClosing(object sender, FormClosingEventArgs e) { EditCustomerForm form = (EditCustomerForm)sender; Customer modified = Session.GetLoadedObjectByKey <Customer>(form.CustomerId); if (modified == null) { XPBaseCollection collection = (XPBaseCollection)CustomersBindingSource.DataSource; collection.Reload(); CustomersView.FocusedRowHandle = CustomersView.LocateByValue("Oid", form.CustomerId); } else { Session.Reload(modified); } }