コード例 #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            WarehouseStock stock = ((WarehouseStock)gridStock.SelectedRows[0].Tag);

            if (stock == null)
            {
                return;
            }

            int count;

            if (!Int32.TryParse(tbNumber.Text, out count) || count < 0)
            {
                return;
            }

            if (tbNumber.Tag == null)
            {
                return;
            }

            int originalCount = (int)tbNumber.Tag;

            if (MessageBox.Show(this, "Frissíteni akarja a cikk \"" + stock.WarehouseName + "\" raktárban lévő számát?\nEredeti darabszám: " + originalCount.ToString() +
                                "\nÚj darabszám: " + count.ToString(),
                                "Módosítás",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                Stock stockRow = Global.Database.SelectOne <Stock>("stock", new Dictionary <string, object>()
                {
                    { "ItemID", _stockItemID },
                    { "WarehouseID", stock.WarehouseID }
                });

                if (stockRow == null)
                {
                    Error("Hiba az adatbázis elérése közben!", "Hiba");
                    return;
                }

                stockRow.Count = count;

                if (Global.Database.Update <Stock>("stock", stockRow))
                {
                    stock.ItemCount = count;

                    DataGridManager.UpdateRow <WarehouseStock>(gridStock.SelectedRows[0], stock);

                    DataChanged = true;

                    tbNumber.Tag      = count;
                    btnUpdate.Enabled = false;
                }
                else
                {
                    Error("Hiba az adat módosítása közben!", "Hiba");
                }
            }
        }
コード例 #2
0
        private void gridItems_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= gridItems.Rows.Count)
            {
                return;
            }

            DataGridViewRow row = gridItems.Rows[e.RowIndex];

            using (ItemEditForm itemEdit = new ItemEditForm((ItemWithCategory)row.Tag))
            {
                if (itemEdit.ShowDialog(this) == DialogResult.OK)
                {
                    if (Global.Database.Update <Item>("item", itemEdit.EditedItem))
                    {
                        DataGridManager.UpdateRow <ItemWithCategory>(row, itemEdit.EditedItem);
                    }
                    else
                    {
                        Error("Hiba a(z) \"" + itemEdit.EditedItem.Name + "\" frissítése közben!", "Hiba");
                    }
                }
            }
        }
コード例 #3
0
        private void gridPartners_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= gridPartners.Rows.Count)
            {
                return;
            }

            DataGridViewRow row = gridPartners.Rows[e.RowIndex];

            using (PartnerEditForm partnerEdit = new PartnerEditForm((Partner)row.Tag))
            {
                if (partnerEdit.ShowDialog(this) == DialogResult.OK)
                {
                    if (Global.Database.Update <Partner>("partner", partnerEdit.EditPartner))
                    {
                        DataGridManager.UpdateRow <Partner>(row, partnerEdit.EditPartner);
                    }
                    else
                    {
                        Error("Hiba a(z) \"" + partnerEdit.EditPartner.Name + "\" frissítése közben!", "Hiba");
                    }
                }
            }
        }
コード例 #4
0
        private void gridWarehouse_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= gridWarehouse.Rows.Count)
            {
                return;
            }

            DataGridViewRow row = gridWarehouse.Rows[e.RowIndex];

            using (WarehouseEditForm whEdit = new WarehouseEditForm((Warehouse)row.Tag))
            {
                if (whEdit.ShowDialog(this) == DialogResult.OK)
                {
                    if (Global.Database.Update <Warehouse>("warehouse", whEdit.EditedWarehouse))
                    {
                        DataGridManager.UpdateRow <Warehouse>(row, whEdit.EditedWarehouse);
                    }
                    else
                    {
                        Error("Hiba a(z) \"" + whEdit.EditedWarehouse.Name + "\" frissítése közben!", "Hiba");
                    }
                }
            }
        }