private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e) { NewsModel mod = (NewsModel)dgv.Rows[e.RowIndex].Tag; if (mod.IsGetted) { MessageBox.Show("سىز بۇ خەۋەرنى يىغىپ بولغان"); return; } DataGridViewCell cell = dgv.Rows[e.RowIndex].Cells[e.ColumnIndex]; if (cell is DataGridViewButtonCell) { DataGridViewButtonCell cel = (DataGridViewButtonCell)cell; mod = news.GetNews(mod); if (mod == null) { MessageBox.Show("بۇ خەۋەرنى يىغىشتا خاتالىق بار، قايتا سىناپ بېقىڭ"); return; } IGetBase dal = new ZuklanDAL(); if (dal.Insert(mod) > 0) { //写入日记 news.WriteGettedLog(mod); mod.IsGetted = true; dgv.Rows[e.RowIndex].DefaultCellStyle = new DataGridViewCellStyle() { ForeColor = Color.Gray }; MessageBox.Show("بولدى"); } else { MessageBox.Show("بۇ خەۋەرنى يىغىشتا خاتالىق بار"); } } }
public NewsTableSource(NewsModel[] news, UINavigationController controller) { _news = news; _controller = controller; }