/// <summary> /// Dodaj nowy wiersz do Tabeli /// </summary> private void AddNewRowToDataBase() { try { if (lblTitle.Text == Title.Orders) { using (ShopOrderForm ShopOrderForm = new ShopOrderForm()) { ShopOrderForm.ShowDialog(); } } else if (lblTitle.Text == Title.Contractor) { using (ShopContractorForm ShopContractorForm = new ShopContractorForm()) { ShopContractorForm.ShowDialog(); } } RefreshGrid(); } catch (Exception ex) { Messages.ShowErrorMessage(ex.Message); } }
/// <summary> /// Edytuje wiersz w tabeli gdy argument - True, Duplikuje wiersz z Tabeli gdy argument - False /// </summary> public void EditRowInDataBase(bool Duplicate) { try { if (gridMain.RowCount == 0) { return; } if ((lblTitle.Text == Title.Orders || lblTitle.Text == Title.Contractor || lblTitle.Text == Title.Products) == false) { return; } int row = gridMain.CurrentCell.RowIndex; int ID = (int)dtableOrder.Rows[row]["ID"]; if (lblTitle.Text == Title.Orders) { using (ShopOrderForm ShopOrderForm = new ShopOrderForm(ID, Duplicate)) { //wyswielt nowa forme ShopOrderForm.ShowDialog(); } } else if (lblTitle.Text == Title.Contractor) { using (ShopContractorForm ShopContractorForm = new ShopContractorForm(ID, Duplicate)) { //wyswielt nowa forme ShopContractorForm.ShowDialog(); } } else if (lblTitle.Text == Title.Products) { using (ShopProductsForm ShopProductsForm = new ShopProductsForm(ID, Duplicate)) { //wyswielt nowa forme ShopProductsForm.ShowDialog(); } } RefreshGrid(); } catch (Exception ex) { Messages.ShowErrorMessage(ex.Message); } }
/// <summary> /// Edytuj wiersz w tabeli /// </summary> public void EditRowInDataBase() { var row = gridMain.CurrentCell.RowIndex; int ID = (int)gridMain.Rows[row].Cells["ID"].Value; string sID = ID.ToString(); if (lblTitle.Text == Title.Orders) { using (ShopOrderForm ShopOrderForm = new ShopOrderForm(ID)) { try { //wyswielt nowa forme ShopOrderForm.ShowDialog(); } catch (Exception ee) { Messages.ShowErrorMessage(ee.Message); } } } else if (lblTitle.Text == Title.Contractor) { using (ShopContractorForm ShopContractorForm = new ShopContractorForm(sID)) { try { //wyswielt nowa forme ShopContractorForm.ShowDialog(); } catch (Exception ee) { Messages.ShowErrorMessage(ee.Message); } } } RefreshGrid(); }