コード例 #1
0
        private void btnNewWarehouse_Click(object sender, System.EventArgs e)
        {
            using (WarehouseEditForm whEdit = new WarehouseEditForm())
            {
                if (whEdit.ShowDialog(this) == DialogResult.OK)
                {
                    Warehouse newWarehouse = whEdit.EditedWarehouse;

                    if (Global.Database.InsertInto <Warehouse>("warehouse", newWarehouse))
                    {
                        DataGridManager.AddDataGridEntry <Warehouse>(gridWarehouse, newWarehouse);
                    }
                    else
                    {
                        Error("Hiba a \"" + whEdit.EditedWarehouse.Name + "\" hozzáadása közben!", "Hiba!");
                    }
                }
            }
        }
コード例 #2
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");
                    }
                }
            }
        }