Dem_Timofeev_itog/DEM_Timofeev_prob/Form_guest.cs

61 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DEM_Timofeev_prob.Models;
using Microsoft.EntityFrameworkCore;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace DEM_Timofeev_prob
{
public partial class Form_guest : Form
{
DemDemContext context;
public Form_guest()
{
InitializeComponent();
dataGridView1.DataError += (sender, e) => e.ThrowException = false;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
context = new DemDemContext();
context.Products.Include(x => x.IdTipeProductNavigation).Include(x => x.IdManufacturNavigation).Include(x => x.IdSuplierNavigation).Include(x => x.IdEdNavigation).Load();
context.Database.EnsureCreated();
bindingSource_product.DataSource = context.Products.Local.ToBindingList();
bindingSource_manufactur.DataSource = context.Manufacts.Local.ToBindingList();
bindingSource_ed.DataSource = context.Eds.Local.ToBindingList();
bindingSource_supplier.DataSource = context.Supliers.Local.ToBindingList();
bindingSource_tipe_product.DataSource = context.TipeProducts.Local.ToBindingList();
}
private void button3_Click(object sender, EventArgs e)
{
this.Hide();
Form1 ff = new Form1();
ff.Show();
}
private void button_delete_Click(object sender, EventArgs e)
{
this.Hide();
Form1 ff = new Form1();
ff.Show();
}
private void Form_guest_Load(object sender, EventArgs e)
{
}
}
}