private void btnSearch_Click(object sender, EventArgs e) { string riqi = dtpTouzhuDate.Value.Date.ToString("yyyy-MM-dd"); DataSet ds = new TouzhuSpfDAL().SearchTouzhuSpf(riqi); dgTouzhuSpf.DataSource = ds.Tables[0]; }
private void btnTouzhu_Click(object sender, EventArgs e) { //先获取选中的两行 List <DataGridViewRow> rows = new List <DataGridViewRow>(); foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.DefaultCellStyle.BackColor == Color.Green) { rows.Add(row); } } TouzhuSpfDAL dal = new TouzhuSpfDAL(); TouzhuSpf spf = new TouzhuSpf(); long batchid = Convert.ToInt64(DateTime.Now.ToString("MMddhhmmss") + DateTime.Now.Millisecond); spf.BatchID = batchid; spf.Beishu = 1000; spf.Riqi = rows[0].Cells["时间"].Value.ToString() + "," + rows[1].Cells["时间"].Value.ToString(); spf.Zhudui = rows[0].Cells["主队"].Value.ToString() + "," + rows[1].Cells["主队"].Value.ToString(); spf.Kedui = rows[0].Cells["客队"].Value.ToString() + "," + rows[1].Cells["客队"].Value.ToString(); spf.Result = rows[0].Cells["预测结果"].Value.ToString() + "," + rows[1].Cells["预测结果"].Value.ToString(); spf.Rangqiu = rows[0].Cells["让球数"].Value.ToString() + "," + rows[1].Cells["让球数"].Value.ToString(); spf.Peilv = rows[0].Cells["赔率"].Value.ToString() + "," + rows[1].Cells["赔率"].Value.ToString(); spf.Lucky = -1; spf.OperateTime = DateTime.Now; spf.Operator = "系统随机推荐"; dal.InsertTouzhuSpf(spf); MessageBox.Show("投注成功!"); }
private void BindGrid() { DataSet ds = new TouzhuSpfDAL().SearchTouzhuSpf(""); dgTouzhuSpf.DataSource = ds.Tables[0]; }