private void OPA_PURCHASE_LIST_Click(object sender, EventArgs e) { frmMain frmmain = (frmMain)this.ParentForm; if (frmmain.CheckChildFrmExist("OPA_PURCHASE_LIST") == true) { return; } OPA_PURCHASE_LIST newFrm = new OPA_PURCHASE_LIST(); if (newFrm != null && !frmmain.ShowMDIChild(newFrm, newFrm)) { newFrm.Dispose(); newFrm = null; } }
private void mnuNewPurchaseList_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (DBGrid.CurrentRow == null) { return; } string selectionlist = string.Empty; if (DBGrid.SelectedRows.Count == 0) { for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Visible) { if (string.IsNullOrEmpty(selectionlist)) { selectionlist = DBGrid.Rows[i].Cells["Id"].Value.ToString(); } else { selectionlist += "," + DBGrid.Rows[i].Cells["Id"].Value.ToString(); } } } } else { for (int i = 0; i < DBGrid.SelectedRows.Count; i++) { if (DBGrid.SelectedRows[i].Visible) { if (string.IsNullOrEmpty(selectionlist)) { selectionlist = DBGrid.SelectedRows[i].Cells["Id"].Value.ToString(); } else { selectionlist += "," + DBGrid.SelectedRows[i].Cells["Id"].Value.ToString(); } } } } EditPurchaseList frm = new EditPurchaseList(); frm.ImportOrder(selectionlist); if (frm.ShowDialog() == DialogResult.OK) { frmMain frmmain = (frmMain)this.ParentForm; if (frmmain.CheckChildFrmExist("OPA_PURCHASE_LIST") == true) { return; } OPA_PURCHASE_LIST newFrm = new OPA_PURCHASE_LIST(); if (newFrm != null && !frmmain.ShowMDIChild(newFrm, newFrm)) { newFrm.Dispose(); newFrm = null; } } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }