private void Main_Load(object sender, EventArgs e) { dgvTaskCapture.Rows.Clear(); try { Urlconfigs_kBll urlBll = new Urlconfigs_kBll(); List <Urlconfigs_k> urlList = null; urlList = urlBll.GetModelList(""); ListToDataGridView(dgvTaskCapture, urlList); // DataGridViewCellEventArgs focus = dgvTaskCapture.Tag as DataGridViewCellEventArgs; if (IsTaskOver()) { DeWorkingState(focus); } else { SetWorkingState(focus); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { var result = MessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { Urlconfigs_kBll urlBll = new Urlconfigs_kBll(); urlBll.Delete(Convert.ToInt32(dgvTaskCapture.SelectedRows[0].Cells[0].Value)); //id是自动生成的,应该不会有错 //刷新 dgvTaskCapture.Rows.Clear(); List <Urlconfigs_k> urlList = null; urlList = urlBll.GetModelList("");//后期改成分页的 ListToDataGridView(dgvTaskCapture, urlList); } }
private void btnAdd_Click(object sender, EventArgs e) { frmAdd frmAdd_k = new frmAdd(); //frmAdd_k.ShowDialog(); if (frmAdd_k.ShowDialog(this) == DialogResult.Cancel) { //为了保证一致性,不在内存中读对象。 //KiwiCrawler.Model.Urlconfigs_k urlConfigFrmMode = frmAdd_k.urlFrmMode_k; dgvTaskCapture.Rows.Clear(); Urlconfigs_kBll urlBll = new Urlconfigs_kBll(); List <Urlconfigs_k> urlList = null; urlList = urlBll.GetModelList("");//后期改成分页的 ListToDataGridView(dgvTaskCapture, urlList); } }
private void btnUpdate_Click(object sender, EventArgs e) { //获得Row里的值 KiwiCrawler.Model.Urlconfigs_k model = GetModelByRow(); frmEdit frmEdit_k = new frmEdit(model); if (frmEdit_k.ShowDialog(this) == DialogResult.Cancel) { dgvTaskCapture.Rows.Clear(); Urlconfigs_kBll urlBll = new Urlconfigs_kBll(); List <Urlconfigs_k> urlList = null; urlList = urlBll.GetModelList("");//后期改成分页的 ListToDataGridView(dgvTaskCapture, urlList); } }
private void tabControl1_Selected(object sender, TabControlEventArgs e) { TabPage focusPage = e.TabPage; switch (focusPage.Text) { case "任务抓取": dgvTaskCapture.Rows.Clear(); try { Urlconfigs_kBll urlBll = new Urlconfigs_kBll(); List <Urlconfigs_k> urlList = null; urlList = urlBll.GetModelList(""); ListToDataGridView(dgvTaskCapture, urlList); // DataGridViewCellEventArgs focus = dgvTaskCapture.Tag as DataGridViewCellEventArgs; if (IsTaskOver()) { DeWorkingState(focus); } else { SetWorkingState(focus); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } break; default: break; } }