//////////////////////////////////////////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 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 frm_student_Load(object sender, EventArgs e) { studentclass s = new studentclass(); s.stdIDsg = std_id_sarasari; DataTable dt = s.seaech_studend_ID(); if (dt.Rows[0]["jensiyat"].ToString() == "زن") { this.Text = "welcome mrs" + " " + dt.Rows[0]["name"].ToString() + " " + dt.Rows[0]["family"].ToString(); } else { this.Text = "welcome mr" + " " + dt.Rows[0]["name"].ToString() + " " + dt.Rows[0]["family"].ToString(); } }
///////////////////////////////////////////////////////insert studend button private void btnsavestudent_Click(object sender, EventArgs e) { studentclass d = new studentclass(); d.stdIDsg = txt_stdID.Text; DataTable dt = d.seaech_studend_ID(); if (dt.Rows.Count == 0) { d.namesg = txt_name.Text; d.familysg = txt_family.Text; d.reshte_tahsilysg = txt_reshte_tahsily.Text; if (zan.Checked == true) { d.jensiyatsg = "زن"; } else if (mard.Checked == true) { d.jensiyatsg = "مرد"; } if (motahel.Checked == true) { d.taaholsg = "متاهل"; } else if (mojarad.Checked == true) { d.taaholsg = "مجرد"; } d.tarikh_tavalodsg = txtyear.Text + "/" + txtmonth.Text + "/" + txtday.Text; d.code_mellisg = txt_codemelli.Text; d.maghte_tahsilysg = txt_maghte_tahsily.Text; d.name_pedarsg = txt_namepedar.Text; d.addresssg = txt_address.Text; d.code_postysg = txt_codeposty.Text; d.tedad_kamanatisg = "0"; d.insert_student(); } else { MessageBox.Show("این دانشجو قبلا ثبت نام کرده است"); } txt_stdID.Text = ""; txt_name.Text = ""; txt_family.Text = ""; txt_reshte_tahsily.Text = ""; zan.Checked = false; mard.Checked = false; mojarad.Checked = false; motahel.Checked = false; txtyear.Text = ""; txtmonth.Text = ""; txtday.Text = ""; txt_codemelli.Text = ""; txt_maghte_tahsily.Text = ""; txt_namepedar.Text = ""; txt_address.Text = ""; txt_codeposty.Text = ""; ///////////////////////////////////////////////////////insert studend button }
private void btnjostojoystudent_Click(object sender, EventArgs e) { studentclass d = new studentclass(); d.stdIDsg = txt_stdID1.Text; DataTable dt = d.seaech_studend_ID(); if (dt.Rows.Count == 0) { panel1.Enabled = false; txt_name1.Text = ""; txt_name1.Text = ""; txt_family1.Text = ""; txt_reshte_tahsily1.Text = ""; zan1.Checked = false; mard1.Checked = false; mojarad1.Checked = false; motahel1.Checked = false; txtyear1.Text = ""; txtmonth1.Text = ""; txtday1.Text = "";; txt_codemelli1.Text = ""; txt_maghte_tahsily1.Text = ""; txt_namepdar1.Text = ""; txt_address1.Text = ""; txt_codeposty1.Text = ""; txt_kamanati.Text = ""; MessageBox.Show("این دانشجو قبلا ثبت نام نکرده است"); } else { panel1.Enabled = true; txt_name1.Text = dt.Rows[0]["name"].ToString(); txt_family1.Text = dt.Rows[0]["family"].ToString(); txt_reshte_tahsily1.Text = dt.Rows[0]["reshte_tahsily"].ToString(); if (dt.Rows[0]["jensiyat"].ToString() == "زن") { zan1.Checked = true; } else if (dt.Rows[0]["jensiyat"].ToString() == "مرد") { mard1.Checked = true; } if (dt.Rows[0]["taahol"].ToString() == "مجرد") { mojarad1.Checked = true; } else if (dt.Rows[0]["taahol"].ToString() == "متاهل") { motahel1.Checked = true; } string[] bd = dt.Rows[0]["tarikh_tavalod"].ToString().Split('/'); txtyear1.Text = bd[0]; txtmonth1.Text = bd[1]; txtday1.Text = bd[2]; txt_codemelli1.Text = dt.Rows[0]["code_melli"].ToString(); txt_maghte_tahsily1.Text = dt.Rows[0]["maghte_tahsily"].ToString(); txt_namepdar1.Text = dt.Rows[0]["name_pedar"].ToString(); txt_address1.Text = dt.Rows[0]["address"].ToString(); txt_codeposty1.Text = dt.Rows[0]["code_posty"].ToString(); txt_kamanati.Text = dt.Rows[0]["tedad_kamanati"].ToString(); } }