示例#1
0
        /// <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);
            }
        }
示例#2
0
        /// <summary>
        /// Dodaj nowy wiersz do Tabeli
        /// </summary>
        private void AddNewRowToDataBase()
        {
            try
            {
                if (lblTitle.Text == Title.Orders)
                {
                    //Jeżeli istnieje
                    if (CheckValueOrder())
                    {
                        using (ShopOrderForm ShopOrderForm = new ShopOrderForm())
                        {
                            ShopOrderForm.ShowDialog();
                        }
                    }
                }
                else if (lblTitle.Text == Title.Contractor)
                {
                    using (ShopContractorForm ShopContractorForm = new ShopContractorForm())
                    {
                        ShopContractorForm.ShowDialog();
                    }
                }
                else if (lblTitle.Text == Title.Products)
                {
                    using (ShopProductsForm ShopProductsForm = new ShopProductsForm())
                    {
                        ShopProductsForm.ShowDialog();
                    }
                }

                RefreshGrid();
            }
            catch (Exception ex)
            {
                Messages.ShowErrorMessage(ex.Message);
            }
        }