//////////////////////////////////////////amanat butten private void button1_Click_1(object sender, EventArgs e) { int tka = 0; studentclass d = new studentclass(); d.stdIDsg = txt_stdID2.Text; DataTable df = d.seaech_studend_ID(); if (df.Rows.Count == 0) { MessageBox.Show("این دانشجو قبلا ثبت نام نکرده است "); } else { tka = Convert.ToInt32(df.Rows[0]["tedad_kamanati"].ToString()); } int tedad_ketab_mojod = 0; bookclass dd = new bookclass(); dd.bookIdsg = txt_bookid2.Text; DataTable dtt = dd.search_book_ID(); if (dtt.Rows.Count == 0) { MessageBox.Show(" این کتاب موجود نیست"); } else { tedad_ketab_mojod = Convert.ToInt32(dtt.Rows[0]["tedad_kmojod"].ToString()); } if (tka < 3 && tedad_ketab_mojod > 0) { d.stdIDsg = txt_stdID2.Text; d.tedad_kamanatisg = Convert.ToString(tka + 1); d.update_amanat_student(); dd.bookIdsg = txt_bookid2.Text; dd.tedad_kmojodsg = Convert.ToString(tedad_ketab_mojod - 1); dd.update_amanat_book(); amanatclass f = new amanatclass(); f.stdIDsg = txt_stdID2.Text; f.bookIDsg = txt_bookid2.Text; f.tarikh_amanatsg = "13" + txtyearamanat.Text + "/" + txtmonthamanat.Text + "/" + txtdayamanat.Text; f.insert_amanat(); } else { MessageBox.Show("این دانشجو نمیتواند کتابی به امانت بگیرد"); } txt_stdID2.Text = ""; txt_bookid2.Text = ""; txtdayamanat.Text = ""; txtmonthamanat.Text = ""; txtyearamanat.Text = ""; //////////////////////////////////////////amanat butten }
private void btnjostojo_Click(object sender, EventArgs e) { bookclass b = new bookclass(); b.bookIdsg = txtbookId1.Text; DataTable dt = b.search_book_ID(); if (dt.Rows.Count == 0) { panel2.Enabled = false; txtname_book1.Text = ""; txtname_nevisande1.Text = ""; txtshabk1.Text = ""; txtmozoe1.Text = ""; txtnasher1.Text = ""; txtmoshakhsat1.Text = ""; txtnoe_chap1.Text = ""; txtsale_enteshar1.Text = ""; txttedad_kmojod1.Text = ""; MessageBox.Show("این کتاب قبلا ثبت نشده است"); } else { panel2.Enabled = true; txtname_book1.Text = dt.Rows[0]["name_ketab"].ToString(); txtname_nevisande1.Text = dt.Rows[0]["name_nevisande"].ToString(); txtshabk1.Text = dt.Rows[0]["shabak"].ToString(); txtmozoe1.Text = dt.Rows[0]["mozoe"].ToString(); txtnasher1.Text = dt.Rows[0]["nasher"].ToString(); txtmoshakhsat1.Text = dt.Rows[0]["moshakhsat"].ToString(); txtnoe_chap1.Text = dt.Rows[0]["noe_chap"].ToString(); txtsale_enteshar1.Text = dt.Rows[0]["sale_enteshar"].ToString(); txttedad_kmojod1.Text = dt.Rows[0]["tedad_kmojod"].ToString(); } }
private void btneditbook_Click(object sender, EventArgs e) { bookclass b = new bookclass(); b.bookIdsg = txtbookId1.Text; b.name_ketabsg = txtname_book1.Text; b.name_nevisandesg = txtname_nevisande1.Text; b.shabaksg = txtshabk1.Text; b.mozoesg = txtmozoe1.Text; b.nashersg = txtnasher1.Text; b.moshakhsatsg = txtmoshakhsat1.Text; b.noe_chapsg = txtnoe_chap1.Text; b.sale_entesharsg = txtsale_enteshar1.Text; b.tedad_kmojodsg = txttedad_kmojod1.Text; b.update_book(); txtbookId1.Text = ""; txtname_book1.Text = ""; txtname_nevisande1.Text = ""; txtshabk1.Text = ""; txtmozoe1.Text = ""; txtnasher1.Text = ""; txtmoshakhsat1.Text = ""; txtnoe_chap1.Text = ""; txtsale_enteshar1.Text = ""; txttedad_kmojod1.Text = ""; panel2.Enabled = false; }
private void button1_Click(object sender, EventArgs e) { bookclass b = new bookclass(); b.name_ketabsg = txt_nameketab3.Text; b.name_nevisandesg = txt_namenevisande3.Text; DataSet ds = b.search_book_name(); dataGridView1.AutoGenerateColumns = true; dataGridView1.DataSource = ds.Tables["tblbook"]; }
private void button2_Click(object sender, EventArgs e) { int teadad_ketab_amanati = 0; studentclass d = new studentclass(); d.stdIDsg = txt_stdID3.Text; DataTable df = d.seaech_studend_ID(); if (df.Rows.Count == 0) { MessageBox.Show("این دانشجو قبلا ثبت نام نکرده است"); } else { teadad_ketab_amanati = Convert.ToInt32(df.Rows[0]["tedad_kamanati"].ToString()); } int tedad_ketab_mojod = 0; bookclass dd = new bookclass(); dd.bookIdsg = txt_bookid3.Text; DataTable dtt = dd.search_book_ID(); if (dtt.Rows.Count == 0) { MessageBox.Show("این کتاب موجود نیست"); } else { tedad_ketab_mojod = Convert.ToInt32(dtt.Rows[0]["tedad_kmojod"].ToString()); d.stdIDsg = txt_stdID3.Text; d.tedad_kamanatisg = Convert.ToString(teadad_ketab_amanati - 1); d.update_amanat_student(); dd.bookIdsg = txt_bookid3.Text; dd.tedad_kmojodsg = Convert.ToString(tedad_ketab_mojod + 1); dd.update_amanat_book(); amanatclass f = new amanatclass(); f.stdIDsg = txt_stdID3.Text; f.bookIDsg = txt_bookid3.Text; f.tarikh_bargashtsg = "13" + txtyearbargasht.Text + "/" + txtmonthbargasht.Text + "/" + txtdaybargasht.Text; f.update_amanat(); } txt_stdID3.Text = ""; txt_bookid3.Text = ""; txtdaybargasht.Text = ""; txtmonthbargasht.Text = ""; txtyearbargasht.Text = ""; }
private void btnsavebook_Click(object sender, EventArgs e) { bookclass b = new bookclass(); b.bookIdsg = txtbookId.Text; b.name_ketabsg = txtbookId.Text; b.name_nevisandesg = txtname_nevisande.Text; b.shabaksg = txtshabk.Text; b.mozoesg = txtmozoe.Text; b.nashersg = txtnasher.Text; b.moshakhsatsg = txtmoshakhsat.Text; b.noe_chapsg = txtnoe_chap.Text; b.sale_entesharsg = txtsale_enteshar.Text; b.tedad_kmojodsg = txttedad_kmojod.Text; b.insert_book(); }
private void btndeletbook_Click(object sender, EventArgs e) { bookclass b = new bookclass(); b.bookIdsg = txtbookId1.Text; b.delete_book(); txtbookId1.Text = ""; txtname_book1.Text = ""; txtname_nevisande1.Text = ""; txtshabk1.Text = ""; txtmozoe1.Text = ""; txtnasher1.Text = ""; txtmoshakhsat1.Text = ""; txtnoe_chap1.Text = ""; txtsale_enteshar1.Text = ""; txttedad_kmojod1.Text = ""; panel2.Enabled = false; }
///////////////////////////////////////////////////////insert book button private void btnsavebook_Click_1(object sender, EventArgs e) { bookclass b = new bookclass(); b.bookIdsg = txtbookId.Text; DataTable dt = b.search_book_ID(); if (dt.Rows.Count == 0) { b.name_ketabsg = txtname_book.Text; b.name_nevisandesg = txtname_nevisande.Text; b.shabaksg = txtshabk.Text; b.mozoesg = txtmozoe.Text; b.nashersg = txtnasher.Text; b.moshakhsatsg = txtmoshakhsat.Text; b.noe_chapsg = txtnoe_chap.Text; b.sale_entesharsg = txtsale_enteshar.Text; b.tedad_kmojodsg = txttedad_kmojod.Text; b.insert_book(); } else { MessageBox.Show("این کتاب قبلا ثبت شده است"); } txtbookId.Text = ""; txtname_book.Text = ""; txtname_nevisande.Text = ""; txtshabk.Text = ""; txtmozoe.Text = ""; txtnasher.Text = ""; txtmoshakhsat.Text = ""; txtnoe_chap.Text = ""; txtsale_enteshar.Text = ""; txttedad_kmojod.Text = ""; ///////////////////////////////////////////////////////insert book button }