Exemple #1
0
        public Form1()
        {
            InitializeComponent();
            db = new FlatsContext();
            db.Types.Load();
            db.Flats.Load();
            db.Clients.Load();


            dataGridView1.DataSource         = db.Flats.Local.ToList();
            dataGridView1.Columns[0].Visible = false;



            if (db.Types.Count() == 0 && db.Clients.Count() == 0)
            {
                db.Types.Add(Entities.Type.CreateType("Студия"));
                db.Types.Add(Entities.Type.CreateType("1к"));
                db.Types.Add(Entities.Type.CreateType("1к"));
                db.Types.Add(Entities.Type.CreateType("2к"));
                db.Types.Add(Entities.Type.CreateType("3к"));
                db.Types.Add(Entities.Type.CreateType("Дом"));
                db.Clients.Add(Client.CreateClient("Test", "Test", 1, true));
                db.SaveChanges();
            }
        }
Exemple #2
0
        public FlatForm()
        {
            InitializeComponent();
            db = new FlatsContext();
            db.Clients.Load();
            db.Types.Load();

            cbType.DataSource    = db.Types.Local.ToBindingList();
            cbType.DisplayMember = "Name";
            cbType.ValueMember   = "Id";


            cbClient.DataSource    = db.Clients.Local.ToBindingList();
            cbClient.DisplayMember = "Name";
            cbClient.ValueMember   = "Id";
        }