private void button1_Click(object sender, EventArgs e) { PersonellerORM porm = new PersonellerORM(); Personeller p = new Personeller(); p.KullaniciAdi = txt_Kadi.Text; p.Sifre = txt_Sifre.Text; Personeller aktif = porm.GirisYap(p); if (aktif == null) { MessageBox.Show("Kullanıcı adı veya Parola hatalı"); } else { PersonellerORM.aktifKullanici = aktif; Form1 f = new Form1(); this.Visible = false; f.ShowDialog(); } }
private void btnGiris_Click(object sender, EventArgs e) { PersonellerORM pOrm = new PersonellerORM(); Personeller p = new Personeller(); p.KullaniciAdi = txtKullaniciAdi.Text; p.Parola = txtParola.Text; Personeller aktif = pOrm.GirisYap(p); if (aktif == null) { MessageBox.Show("Kullanıcı adı veya parola yanlış"); } else { PersonellerORM.AktifKullanici = aktif; Form1 f = new Form1(); this.Hide(); f.ShowDialog(); } }
private void btn_Kaydet_Click(object sender, EventArgs e) { try { SatisORM s = new SatisORM(); Satis satisEntity = new Satis(); satisEntity.MusteriID = (int)cmb_Müsteri.SelectedValue; satisEntity.OdaFiyati = nmr_OdaFiyatı.Value; int OdaID; bool kontrolOda = int.TryParse(cmb_Oda.SelectedValue.ToString(), out OdaID); if (kontrolOda == true) { satisEntity.OdaID = OdaID; } satisEntity.KasaID = (int)cmbKasaTip.SelectedValue; satisEntity.PersonelID = PersonellerORM.aktifKullanici.Id; bool kontrol = s.Insert(satisEntity); if (kontrol == true) { MessageBox.Show("Oda Satıldı"); dataGridView1.DataSource = s.Select(); OdalarORM oORM = new OdalarORM(); cmb_Oda.DataSource = oORM.Select(); PersonellerORM porm = new PersonellerORM(); Personeller p = PersonellerORM.aktifKullanici; Personeller aktif = porm.GirisYap(p); ControlCollection mdiControls = (ControlCollection)this.MdiParent.Controls; mdiControls["lblSatis"].Text = aktif.SatisSayisi.ToString(); mdiControls["lblSatisFiyat"].Text = aktif.SatisFiyati.ToString(); } } catch (Exception) { MessageBox.Show("Satış sırasında bir hata meydana geldi"); } }