private void BtnZimemetKaydet_Click(object sender, EventArgs e) { try { DateTime selectedDate = Convert.ToDateTime(calendarControl.SelectionStart.ToShortDateString()); if (string.IsNullOrEmpty(txtAdet.Text) || string.IsNullOrEmpty(cmbPersonel.Text)) { throw new ValidationException("Lütfen Bilgileri Kontrol Ediniz !"); } if ((short.Parse(txtAdet.Text) <= 0) || (int.Parse(txtAdet.Text) > Convert.ToInt16(dgwZimmetListesi.CurrentRow.Cells[2].Value))) { throw new ValidationException("Adet Değeri Sıfır veya Daha Düşük Değerler Olamaz !"); } if (selectedDate > DateTime.Now) { throw new ValidationException("Satın alma tarihi bugünden daha sonraki bir tarih olamaz!"); } Zimmetler zimmet = new Zimmetler { urunID = urunID, zimmetAdet = int.Parse(txtAdet.Text), personelID = Convert.ToInt32(cmbPersonel.SelectedValue), kullaniciID = FormKullaniciSecim._userIdSession, zimmetTarihi = selectedDate }; ZimmetController.ZimmetEkle(zimmet); MessageBox.Show("Zimmet Başarıyla Eklendi !", "Zimmet Eklendi !", MessageBoxButtons.OK, MessageBoxIcon.Information); ZimmetUrunListele(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Dikkat !", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnZimmetKaldir_Click(object sender, EventArgs e) { DialogResult sonuc = MessageBox.Show(_zimmetID + " ID'li Zimmet Silinsin Mi ?", "Karar ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (sonuc == DialogResult.Yes) { ZimmetController.ZimmetSil(_zimmetID); MessageBox.Show(_zimmetID + " ID'li Zimmet Silindi !", "İşlem Başarılı !", MessageBoxButtons.OK, MessageBoxIcon.Information); ZimmetListele(); } AtikController.AtikEkle(_zimmetID); }
private void BtnPersonelSil_Click(object sender, EventArgs e) { DialogResult sonuc = MessageBox.Show(txtAdi.Text + " İsimli Personel Silinsin Mi ?", "Karar ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (sonuc == DialogResult.Yes) { PersonelController.PersonelSil(int.Parse(txtPersonelID.Text)); MessageBox.Show(txtAdi.Text + " " + txtSoyadi.Text + " İsimli Personel Silindi !", "İşlem Başarılı !", MessageBoxButtons.OK, MessageBoxIcon.Information); PersonelListele(); } List <Zimmetler> zimmetler; zimmetler = ZimmetController.ZimmetListele(); foreach (Zimmetler z in zimmetler) { if (z.personelID == int.Parse(txtPersonelID.Text)) { AtikController.AtikEkle(z.zimmetID); } } }
private void ZimmetGuncelle() { try { DateTime selectedDate = Convert.ToDateTime(calendarControl1.SelectionStart.ToShortDateString()); if (string.IsNullOrEmpty(txtAdet.Text) || string.IsNullOrEmpty(txtAdet.Text)) { throw new Exception("Zimmet Bilgileri Boş Geçilemez !"); } try { if ((Convert.ToInt32(txtAdet.Text) <= 0)) { MessageBox.Show("Adet Değeri Sıfır veya Daha Düşük Değerler Olamaz !"); txtAdet.Text = ""; txtAdet.Focus(); } } catch { MessageBox.Show("Geçerli bir değer girin"); txtAdet.Text = ""; txtAdet.Focus(); } if (selectedDate > DateTime.Now) { throw new Exception("Zimmet tarihi bugünden daha sonraki bir tarih olamaz!"); } DemirbasTakipEntitiess db = new DemirbasTakipEntitiess(); var urunler = db.sp_UrunListeleme(); foreach (var urun in urunler) { if (urun.urunID == _urunID) { _stokAdet = Convert.ToInt32(urun.stokMiktari); } } if ((Convert.ToInt32(txtAdet.Text) > _stokAdet + (Convert.ToInt32(txtAdet.Text)))) { MessageBox.Show("Stok Yetersiz!"); txtAdet.Text = ""; txtAdet.Focus(); } Zimmetler zimmet = new Zimmetler { zimmetID = _zimmetID, urunID = _urunID, zimmetAdet = int.Parse(txtAdet.Text), zimmetTarihi = selectedDate, personelID = Convert.ToInt32(cmbPersonelGuncelle.SelectedValue), kullaniciID = FormKullaniciSecim._userIdSession }; ZimmetController.ZimmetGuncelle(zimmet); MessageBox.Show("Zimmet Başarıyla Düzenlendi !", "İşlem Başarılı !", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Hata Meydana Geldi !", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void TestZimmetle() { zimmetdbEntities db = new zimmetdbEntities(); ZimmetController.Zimmetle(db, "alprsntrkk", "telefon", "iphone", "se"); }