public void ShowData1(clsNews cnews) { txtName.Text = cnews.Name; txtQuatity.Text = cnews.edit.ToString(); txtMonth.Text = cnews.Date.ToString(); txtId.Text = cnews.id.ToString(); }
void BtnDeleteClick(object sender, EventArgs e) { try { clsBook current = (clsBook)source[dgshow.CurrentRowIndex]; source.RemoveAt(dgshow.CurrentRowIndex); }catch { } try { clsNews current1 = (clsNews)source1[dgshow.CurrentRowIndex]; source1.RemoveAt(dgshow.CurrentRowIndex); }catch { } try { clsMagazine current2 = (clsMagazine)source2[dgshow.CurrentRowIndex]; source2.RemoveAt(dgshow.CurrentRowIndex); }catch { } }
void BtnAddClick(object sender, EventArgs e) { if (txtQuatity.Text == "" || txtId.Text == "" || txtName.Text == "") { ClearData(); } else { int scan = 0; if (rdbBook.Checked == true) { scan = 1; } if (rdbNewspaper.Checked == true) { scan = 2; } if (rdbMagazine.Checked == true) { scan = 3; } //========= scan radio button ========// if (scan == 1) { if (txtPoet.Text == "" || txtPage.Text == "") { ClearData(); } else { dgshow.DataSource = source; book.id = int.Parse(txtId.Text); book.edit = int.Parse(txtQuatity.Text); book.Name = txtName.Text; book.Page = int.Parse(txtPage.Text); book.Poet = txtPoet.Text; source.Add(book); book = new clsBook(); ClearData(); dgshow.Refresh(); } } if (scan == 2) { if (txtNumber.Text == "" || txtMonth.Text == "") { ClearData(); } else { dgshow.DataSource = source1; newspa.Name = txtName.Text; newspa.id = int.Parse(txtId.Text); newspa.edit = int.Parse(txtQuatity.Text); newspa.Date = int.Parse(txtDate.Text); source1.Add(newspa); newspa = new clsNews(); ClearData(); dgshow.Refresh(); } } if (scan == 3) { if (txtDate.Text == "") { ClearData(); } else { dgshow.DataSource = source2; maga.Name = txtName.Text; maga.id = int.Parse(txtId.Text); maga.edit = int.Parse(txtQuatity.Text); maga.Month = int.Parse(txtMonth.Text); maga.Num = int.Parse(txtNumber.Text); source2.Add(maga); maga = new clsMagazine(); ClearData(); dgshow.Refresh(); } } } }