Пример #1
0
        private void personelEkleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form_personel_guncelle_ekle personel_ekle = new Form_personel_guncelle_ekle();

            if (Form_personel_guncelle_ekle.form_acik_mi)
            {
                foreach (Form item in this.MdiChildren)
                {
                    if (personel_ekle.Text == item.Text)
                    {
                        FormuOneGetir(personel_ekle);
                        return;
                    }
                }
            }
            personel_ekle.MdiParent = this;
            personel_ekle.Show();
        }
        private void button_kaydet_Click(object sender, EventArgs e)
        {
            foreach (Char item in textBox_calisan_ID.Text)
            {
                if (!Char.IsDigit(item))
                {
                    toolStripStatusLabel_durum.Text = "Numara sadece rakamlardan oluşabilir.";
                    return;
                }
            }

            int        guncellenecekID = Convert.ToInt32(textBox_calisan_ID.Text);
            Calisanlar calisan         = null;

            try
            {
                calisan = db.Calisanlars.Where(s => s.ID == guncellenecekID).Select(s => s).First();
            }
            catch (Exception ex)
            {
                Form_ana_ekran.HataKaydi(ex);
                toolStripStatusLabel_durum.Text = "Çalışan bulunamadı.";
                return;
            }
            Form_personel_guncelle_ekle frm_guncelle = new Form_personel_guncelle_ekle(calisan);

            frm_guncelle.Text = "Personel Güncelle";
            if (Form_personel_guncelle_ekle.form_acik_mi)
            {
                foreach (Form item in this.MdiParent.MdiChildren)
                {
                    if (item.Text == frm_guncelle.Text)
                    {
                        MessageBox.Show("Lütfen açık olan güncelleme penceresini kapatıp tekrar deneyiniz.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        item.BringToFront();
                        return;
                    }
                }
            }

            frm_guncelle.MdiParent = this.MdiParent;
            frm_guncelle.Show();
            this.Close();
        }
        private void dataGridView_calisanlar_listesi_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            dataGridView_calisanlar_listesi.Rows[e.RowIndex].Selected = true;
            int id = Convert.ToInt32(dataGridView_calisanlar_listesi.SelectedRows[0].Cells[0].Value);

            Form_personel_guncelle_ekle personel_guncelle = new Form_personel_guncelle_ekle();

            if (Form_personel_guncelle_ekle.form_acik_mi)
            {
                if (Form_personel_guncelle_ekle.ID > 0)
                {
                    MessageBox.Show("Aynı anda birden fazla güncelleme ekranı açılamaz.");
                    return;
                }
            }

            Form_personel_guncelle_ekle.ID          = id;
            Form_personel_guncelle_ekle.sehir       = comboBox_sehir.SelectedItem as Sehirler;
            Form_personel_guncelle_ekle.sube        = comboBox_sube.SelectedItem as Subeler;
            Form_personel_guncelle_ekle.calisma_tip = dataGridView_calisanlar_listesi.SelectedRows[0].Cells[7].Value.ToString();
            personel_guncelle.MdiParent             = this.MdiParent;
            personel_guncelle.Show();
        }