Esempio n. 1
0
        public FormOdalarEkleDuzenle(Odalar obj)
        {
            InitializeComponent();
            bindingSourceOdalar.DataSource = obj;


            if (obj.id == 0)
            {
                txtOdaTipi.Visible = false;
                uyariYazi.Visible  = true;
            }
            else
            {
                txtOdaTipi.Visible = true;
                uyariYazi.Visible  = false;
                odaId = obj.id;
            }
        }
Esempio n. 2
0
        private async void mtrBtnDuzenle_Click(object sender, EventArgs e)
        {
            Odalar obj = bindingSourceOdalar.Current as Odalar;

            if (obj != null)
            {
                using (FormOdalarEkleDuzenle frm = new FormOdalarEkleDuzenle(obj))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        try
                        {
                            bindingSourceOdalar.EndEdit();
                            await db.SaveChangesAsync();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message, "Mesaj", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }