private void btnSil_Click(object sender, EventArgs e) { try { bool success; using (var emanetBusiness = new EmanetBusiness()) { success = emanetBusiness.Sil(Convert.ToInt32(txtBarkodNo.Text)); } var message = success ? "done" : "failed"; try { using (var emanetBusiness = new EmanetBusiness()) { List <Emanet> emanet = emanetBusiness.Listele().OrderBy(x => x.EmanetID).ToList(); dataGrid_Emanet.DataSource = emanet.ToList(); } } catch (Exception ex) { MessageBox.Show("Error happened: " + ex.Message); } MessageBox.Show("Operation " + message); } catch (Exception ex) { MessageBox.Show("Error happened: " + ex.Message); } //int deleteID = Convert.ToInt32(gridControl1.GetFocusedRowCellValue("id")); //Emanet e = db.BorrowedBook.Where(x => x.id == deleteID).FirstOrDefault(); }
private void btnListele_Click(object sender, EventArgs e) { try { using (var emanetBusiness = new EmanetBusiness()) { List <Emanet> emanet = emanetBusiness.Listele().OrderBy(x => x.BarkodNo).ToList(); dataGrid_Emanet.DataSource = emanet.ToList(); //dataGrid_Emanet.DataSource = emanet.ToList(); } } catch (Exception ex) { MessageBox.Show("Error happened: " + ex.Message); } }
private void btnKaydet_Click(object sender, EventArgs e) { try { bool success; using (var emanetBusiness = new EmanetBusiness()) { success = emanetBusiness.Ekle(new Emanet() { UyeID = Convert.ToInt16(txtUyeID.Text), BarkodNo = Convert.ToInt16(txtBarkodNo.Text), VerilisTarihi = dateVerilis.Value, TeslimTarihi = dateTeslim.Value, TeslimDurumu = checkBoxDurum.Checked }); } var message = success ? "done" : "failed"; try { using (var emanetBusiness = new EmanetBusiness()) { List <Emanet> emanet = emanetBusiness.Listele().OrderBy(x => x.BarkodNo).ToList(); dataGrid_Emanet.DataSource = emanet.ToList(); } } catch (Exception ex) { MessageBox.Show("Error happened: " + ex.Message); } MessageBox.Show("Operation " + message); } catch (Exception ex) { MessageBox.Show("Error happened: " + ex.Message); } }