private void MenuItemEdit_Click(object sender, EventArgs e) { if (!dbLaBelleExcel.IsInstallDB()) { MessageBox.Show("未安裝資料庫", "警告"); return; } LaBelleSelProductForm FromLaBelleSelProduct = new LaBelleSelProductForm(); FromLaBelleSelProduct.Text = "編輯"; FromLaBelleSelProduct.ShowDialog(); if (FromLaBelleSelProduct.DialogResult == DialogResult.OK) { ulong nWndID = LaBelleCmnFunc.GetWndID((ulong)FromLaBelleSelProduct.ProductType, (ulong)0, (ulong)LABELLE_FORM_STATUS.LABELLE_FORM_STATUS_EDIT); bool bFound = false; LaBelleBaseForm FormFront = null; foreach (LaBelleBaseForm frm in this.MdiChildren) { // Cast the generic Form to the expended derived class type. if (frm.WinID == nWndID) { FormFront = frm; bFound = true; break; } } if (bFound) { FormFront.BringToFront(); } else { LaBelleSelDataForm FromLaBelleSelData = new LaBelleSelDataForm(); FromLaBelleSelData.MdiParent = this; FromLaBelleSelData.SetParent(Handle); FromLaBelleSelData.ProductType = FromLaBelleSelProduct.ProductType; FromLaBelleSelData.Show(); } } }
private void MenuItemNew_Click(object sender, EventArgs e) { LaBelleSelProductForm FromLaBelleSelProduct = new LaBelleSelProductForm(); FromLaBelleSelProduct.Text = "新增"; FromLaBelleSelProduct.ShowDialog(); if (FromLaBelleSelProduct.DialogResult == DialogResult.OK) { LaBelleForm FromLaBelle = new LaBelleForm(); FromLaBelle.MdiParent = this; FromLaBelle.ProductType = FromLaBelleSelProduct.ProductType; FromLaBelle.Show(); } }
private void MenuItemClear_Click(object sender, EventArgs e) { if (!dbLaBelleExcel.IsInstallDB()) { MessageBox.Show("未安裝資料庫", "警告"); return; } LaBelleSelProductForm FromLaBelleSelProduct = new LaBelleSelProductForm(); FromLaBelleSelProduct.Text = "清除"; FromLaBelleSelProduct.ShowDialog(); if (FromLaBelleSelProduct.DialogResult == DialogResult.OK) { if (MessageBox.Show("資料將刪除!!!\n要繼續?", "注意", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel) return; foreach (LaBelleBaseForm frm in this.MdiChildren) { if (frm.ProductType == FromLaBelleSelProduct.ProductType) { frm.Close(); } } List<string> listDBEntry = new List<string>(); dbLaBelleExcel.Delete(LaBelleCmnDef.strDBTableName[(uint)FromLaBelleSelProduct.ProductType], listDBEntry); } }