private void button1_Click(object sender, EventArgs e)
        {
            if (!maskedTextBox1.MaskCompleted || string.IsNullOrWhiteSpace(materialSingleLineTextField1.Text) ||
                string.IsNullOrWhiteSpace(materialSingleLineTextField2.Text))
            {
                MessageBox.Show("Boş yerileri uygun şekilde doldurup tekrar deneyin!", "Uyarı", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            saglikDBEntities_1 db   = new saglikDBEntities_1();
            kullanicilar       kull = new kullanicilar();

            kull.tckimlikno       = long.Parse(maskedTextBox1.Text);
            kull.username         = materialSingleLineTextField1.Text;
            kull.sifre            = materialSingleLineTextField2.Text;
            kull.yetki            = "1";
            kull.birey            = new birey();
            kull.birey.tckimlikno = long.Parse(maskedTextBox1.Text);
            db.kullanicilar.Add(kull);
            db.SaveChanges();
            db.Entry(kull).State = EntityState.Detached;
            aktifKullanıcı       = kull;
            DialogResult         = DialogResult.OK;
        }
示例#2
0
        public void SilAksiyon(kullanicilar kull)
        {
            db = new saglikDBEntities_1();

            if (aktifKullanici.username == kull.username)
            {
                MessageBox.Show("Kendi Hesabınızı silemezsiniz!", "Uyarı", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            DialogResult res = MessageBox.Show($"'{kull.username}' kullanıcısını silmek istediğinize Emin misiniz?",
                                               "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (res != DialogResult.Yes)
            {
                return;
            }

            foreach (var user in flowLayoutPanel1.Controls.Cast <User>())
            {
                if (kull.id == user.EntityKullanici.id)
                {
                    db.Entry(new kullanicilar
                    {
                        id       = user.EntityKullanici.id,
                        username = user.EntityKullanici.username
                    }).State = EntityState.Deleted;
                    db.SaveChanges();
                    //new saglikDBEntities_1().kullanici.Remove(user.EntityKullanici);
                    flowLayoutPanel1.Controls.Remove(user);
                    break;
                }
            }
        }
示例#3
0
        private void button3_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show(
                $"'{aktifSevk.dosya.hasta.birey.ad} {aktifSevk.dosya.hasta.birey.soyad}' isimli hastanın çıkışı yapılacak.Çıkışı yapılan hasta geri alınamaz\n\nDevam etmek istediğinize Emin misiniz?",
                "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (res != DialogResult.Yes)
            {
                return;
            }


            var taburcu = db.taburcu.Where(a => a.taburcuid == aktifSevk.taburcuid).First();

            taburcu.cikisSaati      = DateTime.Now;
            taburcu.odemeid         = ((odeme)comboBox1.SelectedItem).odemeid;
            taburcu.taburcuoldumu   = true;
            taburcu.toplamtutar     = toplamTutar.ToString();
            db.Entry(taburcu).State = EntityState.Modified;
            db.SaveChanges();


            DialogResult = DialogResult.OK;
            MessageBox.Show("Hasta Taburcu Edildi.", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
            button3.Enabled = false;
        }
示例#4
0
        private void Sil(object o, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Seçili Nesneyi silmek istediğinize Emin misiniz?", "Uyarı",
                                               MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (res != DialogResult.Yes)
            {
                return;
            }
            var  nesne = o as DrVePersonelItem;
            long tcno  = long.Parse(nesne.activeTCNO);

            if (db.sevk.Any(a => a.doktor.tckimlikno == tcno) || db.islemler.Any(a => a.personel.tckimlikno == tcno))
            {
                MessageBox.Show("Şu anda bu kişi kullanımda Silinemez!", "Uyarı", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            db = new saglikDBEntities_1();

            switch (aktifTür)
            {
            case DrVePersonelEkleForm.EklemeTürü.Doktor:
                doktor dr = db.doktor.Where(a => a.tckimlikno == tcno).FirstOrDefault();
                db.Entry(dr).State = EntityState.Deleted;

                break;

            case DrVePersonelEkleForm.EklemeTürü.Personel:
                personel persn = db.personel.Where(a => a.tckimlikno == tcno).FirstOrDefault();

                db.Entry(persn).State = EntityState.Deleted;
                break;
            }

            db.SaveChanges();
            db = new saglikDBEntities_1();
            MessageBox.Show("Silme işlemi başarılı", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Yenile();
        }
示例#5
0
        private void SevkTaburcuOrtakButton(sevk s)
        {
            TaburcuForm  form = new TaburcuForm(s);
            DialogResult res  = form.ShowDialog();

            if (res == DialogResult.OK)
            {
                db = new saglikDBEntities_1();

                ActiveHasta = db.hasta.Where(a => a.dosyaID == ActiveHasta.dosyaID).First();
                db.Entry(ActiveHasta).State = EntityState.Detached;
                sevkIslemDoldur(ActiveHasta);
            }
        }
示例#6
0
        private void button1_Click(object sender, EventArgs e)
        {
            var db  = new saglikDBEntities_1();
            int uye = db.kullanicilar.Count();

            if (uye == 0)
            {
                MessageBox.Show("Veritabanında kayıtlı üye yok\n" +
                                "Yönetici Seviyesinde kullanıcı hesabı oluşturulmak üzere yeni bir forma yönlendirileceksiniz\n"
                                , "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                UserAddDialog frm = new UserAddDialog();
                Hide();
                DialogResult res = frm.ShowDialog();
                Show();
                if (res == DialogResult.OK)
                {
                    form = new MainForm(frm.aktifKullanıcı);
                    göster();
                }

                return;
            }

            var kullanıcı = db.kullanicilar.FirstOrDefault(a =>
                                                           a.username == materialSingleLineTextField1.Text.Trim() &&
                                                           a.sifre == materialSingleLineTextField2.Text.Trim());

            if (kullanıcı == null)
            {
                MessageBox.Show("Kullanıcı Adı veya Şifre hatalı!", "Uyarı", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }

            db.Entry(kullanıcı).State = EntityState.Detached;
            form = new MainForm(kullanıcı);
            göster();
        }
示例#7
0
        private void button1_Click(object sender, EventArgs e)
        {
            saglikDBEntities_1 db = new saglikDBEntities_1();

            if (!YıldızlılarDolumu())
            {
                MessageBox.Show("Lütfen Yıldızlı Kısımları Doldurup Tekrar Deneyin!", "Hata", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }


            var userCheck = new ObjectParameter("result", typeof(int));

            db.userCheck(textBox2.Text, userCheck);
            if ((bool)userCheck.Value && !editMode)
            {
                MessageBox.Show("Zaten Böyle Bir kullanıcı Adı mevcut!", "Hata", MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return;
            }


            kullanicilar kull = new kullanicilar();

            kull.birey = new birey();
            if (editMode)
            {
                kull = db.kullanicilar.Where(a => a.tckimlikno == activeKullanici.tckimlikno).First();
                db.Entry(kull).State = EntityState.Unchanged;
            }


            kull.username   = textBox2.Text;
            kull.sifre      = textBox3.Text;
            kull.yetki      = comboBox1.SelectedIndex.ToString();
            kull.tckimlikno = long.Parse(maskedTextBox3.Text);
            kull.isebaslama = dateTimePicker2.Value;
            kull.unvan      = textBox11.Text;
            kull.maas       = textBox19.Text;

            kull.birey.tckimlikno = kull.tckimlikno;
            kull.birey.ad         = textBox5.Text;
            kull.birey.soyad      = textBox6.Text;
            kull.birey.cinsiyet   = comboBox2.SelectedIndex.ToString();
            kull.birey.dtarihi    = dateTimePicker1.Value;
            kull.birey.evtel      = maskedTextBox1.Text;
            kull.birey.ceptel     = maskedTextBox2.Text;
            kull.birey.dogumyeri  = textBox16.Text;
            kull.birey.anneadi    = textBox15.Text;
            kull.birey.babaadi    = textBox17.Text;
            kull.birey.kangrubu   = textBox18.Text;
            kull.birey.medenihal  = comboBox3.SelectedIndex.ToString();
            kull.birey.adres      = richTextBox1.Text;

            if (!editMode)
            {
                db.kullanicilar.AddOrUpdate(kull);
            }


            db.SaveChanges();
            if (!editMode)
            {
                MessageBox.Show("Kayıt Eklendi", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Kayıt Güncellendi", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            //var yedek = activeKullanici.birey;
            db.Entry(kull.birey).State = EntityState.Detached;
            //db.Entry(kull).State = EntityState.Detached;
            activeKullanici = kull;
            //activeKullanici.birey = yedek;
            DialogResult = DialogResult.OK;
            Close();
        }