Ejemplo n.º 1
0
        private void Bolum_Load(object sender, EventArgs e)
        {
            OkulnoDataContext dc = new OkulnoDataContext();

            comboBox1.DataSource    = dc.Okullar;
            comboBox1.DisplayMember = "OkulAdi";
            comboBox1.ValueMember   = "OkulId";
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            OkulnoDataContext dc = new OkulnoDataContext();

            dataGridView1.DataSource = from a in dc.Bolumler
                                       where a.OkulId == (int)comboBox1.SelectedValue
                                       select new {
                a.BolumId,
                a.BolumAdi,
            };
        }
Ejemplo n.º 3
0
        private void Ekle_Load(object sender, EventArgs e)
        {
            OkulnoDataContext dc = new OkulnoDataContext();

            // Formumuz ilk açıldığında combobox ve datagridview 'i dolduralım
            comboBox1.DataSource     = dc.Okullar;
            comboBox1.DisplayMember  = "OkulAdi";
            comboBox1.ValueMember    = "OkulId";
            dataGridView2.DataSource = from a in dc.Ogrenciler
                                       select new
            {
                a.OgrenciId,
                a.OgrenciAdi,
            };
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            OkulnoDataContext dc  = new OkulnoDataContext();
            Okullar           add = new Okullar();

            {
                add.OkulAdi = textBox1.Text;
            };
            dc.Okullar.InsertOnSubmit(add);
            dc.SubmitChanges();
            dataGridView1.DataSource = from a in dc.Okullar
                                       select new {
                a.OkulId,
                a.OkulAdi,
            };
        }
Ejemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            OkulnoDataContext dc  = new OkulnoDataContext();
            Bolumler          add = new Bolumler();

            {
                add.OkulId   = (int)comboBox1.SelectedValue;
                add.BolumAdi = textBox1.Text;
            };
            dc.Bolumler.InsertOnSubmit(add);
            dc.SubmitChanges();
            dataGridView1.DataSource = from a in dc.Bolumler
                                       join b in dc.Okullar on
                                       a.OkulId equals b.OkulId
                                       select new
            {
                b.OkulAdi,
                a.BolumAdi,
            };
        }
Ejemplo n.º 6
0
        private void button2_Click(object sender, EventArgs e)
        {
            OkulnoDataContext dc = new OkulnoDataContext();

            /* Elimizde olan verileri String türünden yazdıktan sonra
             * Onları birleştirmemiz gerekecek
             * Comboboxtaki Seçtiğimiz değer yani Okul Kodu 2.sırada
             * Datagridviewden seçtiğimiz bölüm kodu 3.sırada
             * Giriş sırasi 4. sırada
             * Giriş yılı ise en başta olacak şekilde toplama işlemini yapıyoruz.
             * String olarak değil de direkt int olarak atasaydık.
             * Toplama yapılırken sayıları sayı olarak  tanımlayıp toplardı
             */
            OgrenciEkle add         = new OgrenciEkle();
            string      okuladi     = Convert.ToString(comboBox1.SelectedValue);
            string      bolumadi    = Convert.ToString(dataGridView1.CurrentRow.Cells["BolumId"].Value);
            string      girisyili   = txtgirisyil.Text;
            string      girissirasi = txtgirissira.Text;
            string      okulno      = girisyili + okuladi + bolumadi + girissirasi;

            {
                add.OkulId     = (int)comboBox1.SelectedValue;
                add.BolumId    = (int)dataGridView1.CurrentRow.Cells["BolumId"].Value;
                add.OgrenciId  = Convert.ToInt32(okulno);
                add.OgrenciAdi = txtadi.Text;
            };
            dc.Ogrenciler.InsertOnSubmit(add);
            dc.SubmitChanges();
            dataGridView2.DataSource = from a in dc.Ogrenciler
                                       join b in dc.Okullar on
                                       a.OkulId equals b.OkulId
                                       join c in dc.Bolumler on
                                       a.BolumId equals c.BolumId
                                       select new {
                a.OgrenciId,
                a.OgrenciAdi,
                b.OkulAdi,
                c.BolumAdi,
            };
        }