コード例 #1
0
ファイル: Program.cs プロジェクト: pr033r/ORM
        public void testTabulkyZakaznik(Database db)
        {
            Console.Out.WriteLine("-------------------------------------------------------------------------------");
            Console.Out.WriteLine("Test tabulky Zakaznik:");

            Zakaznik zakaznik = new Zakaznik();

            zakaznik.jmeno        = "Adam";
            zakaznik.prijmeni     = "Lasák";
            zakaznik.tel          = 739141091;
            zakaznik.tel2         = 0;
            zakaznik.email        = "*****@*****.**";
            zakaznik.mesto        = "Kobeřice";
            zakaznik.ulice        = "Nádražní";
            zakaznik.cisloPopisne = 35;
            zakaznik.psc          = 74727;

            EvidenceZakaznika.Insert(zakaznik, db);
            Console.Out.WriteLine("Nový zákazník vložen!\n");

            Collection <Zakaznik> zakaznici = new Collection <Zakaznik>();

            zakaznici = EvidenceZakaznika.Select(db);
            Console.Out.WriteLine("Select z tabulky Zakaznik:");

            foreach (Zakaznik select in zakaznici)
            {
                Console.Out.WriteLine("\t" + select.idZakaznik + " " + select.jmeno + " " + select.prijmeni + " " + select.mesto + " " + select.ulice + " " + select.cisloPopisne + " " + select.psc);
            }

            Console.Out.WriteLine("\nPoslední záznam z tabulky osoba byl upraven! (město, tel. číslo, email)");
            zakaznik.tel   = 123456789;
            zakaznik.email = "*****@*****.**";
            zakaznik.mesto = "Opava";
            EvidenceZakaznika.Update(zakaznik, db);

            Console.Out.WriteLine("\nDetail posledního záznamu z tabulky osoba:");
            Zakaznik selectDetail = new Zakaznik();

            selectDetail = EvidenceZakaznika.SelectDetail(zakaznik.idZakaznik - 1, db);
            Console.Out.WriteLine("\t" + selectDetail.idZakaznik + " " + selectDetail.jmeno + " " + selectDetail.prijmeni + " " + selectDetail.mesto + " " + selectDetail.ulice + " " + selectDetail.cisloPopisne + " " + selectDetail.psc + " " + selectDetail.tel + " " + selectDetail.tel2 + " " + selectDetail.email);

            Console.Out.WriteLine("Poslední záznam z tabulky osoba byl odstraněn!");
            EvidenceZakaznika.Delete(zakaznik.idZakaznik, db);

            Console.Out.WriteLine("-------------------------------------------------------------------------------\n");
            Console.ReadKey();
        }
コード例 #2
0
        public void Zobrazit(FormMain f)
        {
            mainForm = f;
            Database db = new Database();

            db.Connect();
            zakaznici = EvidenceZakaznika.Select(db);
            zarizeni  = EvidenceZarizeni.Select(db);
            db.Close();

            nazevTextBox.Text   = "";
            smlouvaTextBox.Text = "";

            comboBox1.DisplayMember = "Prijmeni";
            comboBox1.DataSource    = zakaznici;
            comboBox2.DisplayMember = "nazev";
            comboBox2.DataSource    = zarizeni;

            dateTimePicker1.Value = DateTime.Now;

            this.Show();
        }