protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } if (Request.QueryString["ID"] != null) { EEmployees member = new EEmployees(); member.ID = int.Parse(Request.QueryString["ID"]); bool sonuc = BLLEmployees.Delete(member); if (sonuc) { Response.Write("<script>alert('Harika! Silindi!')</script>"); } else { Response.Write("<script>alert('Hay Aksi! Silinemedi!')</script>"); } } rptPersoneller.DataSource = BLLEmployees.GetAll(); rptPersoneller.DataBind(); if (Request.QueryString["scs"] != null) { int scsID = Convert.ToInt32(Request.QueryString["scs"].ToString()); if (scsID == 1) { Response.Write("<script>alert('Harika! Güncellendi!');</script>"); } } }
private void btnSil_Click(object sender, EventArgs e) { EEmployees silinecekEmployee = (EEmployees)dataGridView1.SelectedRows[0].DataBoundItem; if (silinecekEmployee != null) { DialogResult result = MessageBox.Show("Silmek istediğinize emin misiniz ?", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { EEmployees employee = new EEmployees(); employee.ID = silinecekEmployee.ID; if (BLLEmployees.Delete(employee)) { MessageBox.Show("Silme işleminiz başarıyla tamamlanmıştır."); dataGridView1.DataSource = BLLEmployees.GetAll(); } else { MessageBox.Show("Bir hata oluştu!"); } } } else { MessageBox.Show("Lütfen silmek istediğiniz personeli seçiniz!"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <EBooks> bookList = BLLBooks.GetBookNames(); if (bookList != null && bookList.Count > 0) { bookList = (from l in bookList where l.IsReturned == false select l).ToList <EBooks>(); } cmbVerilenKitap.DataSource = bookList; cmbVerilenKitap.DataTextField = "Name"; cmbVerilenKitap.DataValueField = "ID"; cmbVerilenKitap.ClearSelection(); cmbVerilenKitap.DataBind(); cmbMembers.DataSource = BLLMembers.GetMemberNames(); cmbMembers.DataTextField = "FullName"; cmbMembers.DataValueField = "ID"; cmbMembers.ClearSelection(); cmbMembers.DataBind(); cmbEmployees.DataSource = BLLEmployees.GetEmployeeNames(); cmbEmployees.DataTextField = "FullName"; cmbEmployees.DataValueField = "ID"; cmbEmployees.ClearSelection(); cmbEmployees.DataBind(); } }
protected void btnKaydet_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtTCNo.Text) & !string.IsNullOrEmpty(txtAdi.Text) & !string.IsNullOrEmpty(txtSoyadi.Text) & !string.IsNullOrEmpty(txtCepNo.Text) & !string.IsNullOrEmpty(txtAdres.Text) & !string.IsNullOrEmpty(txtKullaniciAdi.Text) & !string.IsNullOrEmpty(txtSifre.Text)) { if (txtTCNo.Text.Length == 11) { List <EEmployees> employeeeList = BLLEmployees.GetAll(); employeeeList = (from l in employeeeList where l.TCNo.Trim().ToLower().Equals(txtTCNo.Text.Trim().ToLower()) select l).ToList(); if (employeeeList.Count == 0) { EEmployees member = new EEmployees(); member.TCNo = txtTCNo.Text; member.FirstName = txtAdi.Text; member.LastName = txtSoyadi.Text; member.Phone = txtCepNo.Text; member.Address = txtAdres.Text; member.UserName = txtKullaniciAdi.Text; member.Password = txtSifre.Text; if (BLLEmployees.InsertNewEmployee(member)) { Response.Write("<script>alert('Personel kayıt işleminiz başarıyla gerçekleşmiştir.')</script>"); } else { Response.Write("<script>alert('Hata Oluştu!')</script>"); } } else { Response.Write("<script>alert('Kaydetmek istediğiniz personel zaten kayıtlı!')</script>"); } txtTCNo.Text = String.Empty; txtAdi.Text = String.Empty; txtSoyadi.Text = String.Empty; txtCepNo.Text = String.Empty; txtAdres.Text = String.Empty; txtKullaniciAdi.Text = String.Empty; txtSifre.Text = String.Empty; txtTCNo.Focus(); } else { Response.Write("<script>alert('TC Kimlik Numarası 11 hane olmalıdır!')</script>"); } } else { Response.Write("<script>alert('Eksik bilgi girdiniz. Lütfen kontrol ediniz!')</script>"); } }
private void btnKaydet_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtAdi.Text) & !string.IsNullOrEmpty(txtSoyadi.Text) & !string.IsNullOrEmpty(txtTCNo.Text) & !string.IsNullOrEmpty(txtCepNo.Text) & !string.IsNullOrEmpty(txtAdres.Text) & !string.IsNullOrEmpty(txtUserName.Text) & !string.IsNullOrEmpty(txtPassword.Text)) { if (txtTCNo.Text.Length == 11) { List <EEmployees> employeeList = BLLEmployees.GetAll(); employeeList = (from l in employeeList where l.TCNo.Trim().ToLower().Equals(txtTCNo.Text.Trim().ToLower()) select l).ToList(); if (employeeList.Count == 0) { EEmployees employee = new EEmployees(); employee.TCNo = txtTCNo.Text; employee.FirstName = txtAdi.Text; employee.LastName = txtSoyadi.Text; employee.Phone = txtCepNo.Text; employee.Address = txtAdres.Text; employee.UserName = txtUserName.Text; employee.Password = txtPassword.Text; bool sonuc = BLLEmployees.InsertNewEmployee(employee); if (sonuc) { MessageBox.Show("Yeni personel kaydı başarıyla tamamlanmıştır!"); dataGridView1.DataSource = BLLEmployees.GetAll(); Clear(); } else { MessageBox.Show("Bir hata oluştu!"); } } else { MessageBox.Show("Aynı TC kimlik numarasına sahip personel zaten kayıtlıdır!"); } } else { MessageBox.Show("TC kimlik numarası 11 haneli olmalıdır!"); } } else { MessageBox.Show("Eksik bilgi girdiniz. Lütfen kontrol ediniz!"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int personelID = Convert.ToInt32(Request.QueryString["personelID"].ToString()); EEmployees employee = new EEmployees(); employee = BLLEmployees.GetIdOnly(personelID); txtAdi.Text = employee.FirstName; txtSoyadi.Text = employee.LastName; txtTCNo.Text = employee.TCNo; txtCepNo.Text = employee.Phone; txtAdres.Text = employee.Address; txtKullaniciAdi.Text = employee.UserName; } }
private void btnGuncelle_Click(object sender, EventArgs e) { if (seciliPersonel != null) { if (txtTCNo.Text.Length == 11) { if (!string.IsNullOrEmpty(txtAdi.Text) & !string.IsNullOrEmpty(txtSoyadi.Text) & !string.IsNullOrEmpty(txtTCNo.Text) & !string.IsNullOrEmpty(txtCepNo.Text) & !string.IsNullOrEmpty(txtAdres.Text) & !string.IsNullOrEmpty(txtUserName.Text) & !string.IsNullOrEmpty(txtPassword.Text)) { EEmployees personel = new EEmployees(); personel.ID = Convert.ToInt32(seciliPersonel.ID); personel.TCNo = txtTCNo.Text; personel.FirstName = txtAdi.Text; personel.LastName = txtSoyadi.Text; personel.Phone = txtCepNo.Text; personel.Address = txtAdres.Text; personel.UserName = txtUserName.Text; personel.Password = txtPassword.Text; bool sonuc = BLLEmployees.Update(personel); if (sonuc) { MessageBox.Show("Güncelleme başarılı!"); dataGridView1.DataSource = BLLEmployees.GetAll(); Clear(); } else { MessageBox.Show("Güncelleme başarısız oldu!"); } } else { MessageBox.Show("Eksik bilgi girdiniz. Lütfen kontrol ediniz!"); } } else { MessageBox.Show("TC Kimlik numarası 11 haneli olmalıdır!"); } } else { MessageBox.Show("Güncelleme işlemi yapmak istediğiniz personelin üzerine çift tıklayarak seçiniz."); } }
protected void btnGirisYap_Click(object sender, EventArgs e) { List <EEmployees> userList = BLLEmployees.GetAll(); string userName = txtKullaniciAdi.Text; string password = txtSifre.Text; if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(password)) { if (userList != null && userList.Count() > 0) { userList = (from l in userList where l.UserName.Trim().ToLower().Equals(userName.Trim().ToLower()) && l.Password.Trim().ToLower().Equals(password.Trim().ToLower()) select l).ToList <EEmployees>(); if (userList != null && userList.Count() > 0) { EEmployees user = new EEmployees(); user = userList.FirstOrDefault(); Session.Add("UserName", user.FullName); Response.Redirect("Default.aspx"); } else { Response.Write("<script>alert('Kullanıcı adı yada şifreyi yanlış girdiniz!')</script>"); txtKullaniciAdi.Text = String.Empty; txtSifre.Text = String.Empty; } } else { Response.Write("<script>alert('Sisteme kayıtlı kullanıcı bulunamadı!')</script>"); } } else { Response.Write("<script>alert('Kullanıcı adı yada şifre boş geçilemez!')</script>"); txtSifre.Text = String.Empty; } }
private void Form2_Load(object sender, EventArgs e) { List <EBooks> bookList = BLLBooks.GetBookNames(); if (bookList != null && bookList.Count > 0) { bookList = (from l in bookList where l.IsReturned == false select l).ToList <EBooks>(); } cmbVerilenKitap.DataSource = bookList; cmbVerilenKitap.DisplayMember = "Name"; cmbVerilenKitap.ValueMember = "ID"; cmbMembers.DataSource = BLLMembers.GetMemberNames(); cmbMembers.DisplayMember = "FullName"; cmbMembers.ValueMember = "ID"; cmbEmployees.DataSource = BLLEmployees.GetEmployeeNames(); cmbEmployees.DisplayMember = "FullName"; cmbEmployees.ValueMember = "ID"; }
protected void btnGuncelle_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtTCNo.Text) & !string.IsNullOrEmpty(txtAdi.Text) & !string.IsNullOrEmpty(txtSoyadi.Text) & !string.IsNullOrEmpty(txtCepNo.Text) & !string.IsNullOrEmpty(txtAdres.Text) & !string.IsNullOrEmpty(txtKullaniciAdi.Text) & !string.IsNullOrEmpty(txtSifre.Text)) { if (txtTCNo.Text.Length == 11) { EEmployees guncellenecek = new EEmployees(); guncellenecek.ID = int.Parse(Request.QueryString["personelID"]); guncellenecek.TCNo = txtTCNo.Text; guncellenecek.FirstName = txtAdi.Text; guncellenecek.LastName = txtSoyadi.Text; guncellenecek.Phone = txtCepNo.Text; guncellenecek.Address = txtAdres.Text; guncellenecek.UserName = txtKullaniciAdi.Text; guncellenecek.Password = txtSifre.Text; bool sonuc = BLLEmployees.Update(guncellenecek); if (sonuc) { Response.Write("<script>alert('Harika! Güncellendi!');</script>"); Response.Redirect("Personeller.aspx?scs=1"); } else { Response.Write("<script>alert('Hay Aksi! Hata Oluştu!')</script>"); } } else { Response.Write("<script>alert('TC kimlik numarası 11 haneli olmalıdır!')</script>"); } } else { Response.Write("<script>alert('Eksik bilgi girdiniz. Lütfen kontrol ediniz!')</script>"); } }
private void Yeni_Personel_Kayıt_Load(object sender, EventArgs e) { dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = BLLEmployees.GetAll(); }