コード例 #1
0
        private void btnEkle_Click(object sender, EventArgs e)
        {
            Marka m = new Marka();

            m.MarkaAdi = txtMarkaAdi.Text;

            //Marka m = new Marka() //üsttekinin farklı hali
            //{
            //    MarkaAdi = txtMarkaAdi.Text
            //};

            MarkaRepository rep    = new MarkaRepository();
            int             mid    = 0;
            bool            result = rep.MarkaEkle(m, out mid);

            if (result)
            {
                MarkaLabel lbl = new MarkaLabel();
                lbl.Text    = txtMarkaAdi.Text;
                lbl.MarkaId = 0;

                MarkalarForm f = (MarkalarForm)Application.OpenForms["MarkalarForm"];
                if (f != null)
                {
                    f.MarkaLabelEkle(lbl);
                }

                txtMarkaAdi.Clear();
                MessageBox.Show("Eklendi");
            }
            else
            {
                MessageBox.Show("Hata");
            }
        }
コード例 #2
0
        private void btnEkle_Click(object sender, EventArgs e)
        {
            Marka m = new Marka()
            {
                MarkaAdi = txtmarkaAd.Text
            };
            MarkaRepository rep    = new MarkaRepository();
            int             mid    = 0;
            bool            result = rep.MarkaEkle(m, out mid);

            if (result == true)
            {
                MarkaLabel lbl = new MarkaLabel();
                lbl.Text    = txtmarkaAd.Text;
                lbl.MarkaId = mid;

                MarkalarForm f = (MarkalarForm)Application.OpenForms["MarkalarForm"];
                if (f != null)
                {
                    f.MarkaLabelEkle(lbl);
                }
                txtmarkaAd.Clear();
                MessageBox.Show("Eklendi");
            }
            else
            {
                MessageBox.Show("hata olustu");
            }
        }