private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { int rowIndex = e.RowIndex; DoubleBoll data = new DoubleBoll(); data.QiShu = dataGridView1.Rows[rowIndex].Cells[0].Value.ToString(); data.OpenDate = DateTime.Parse(dataGridView1.Rows[rowIndex].Cells[1].Value.ToString()); data.SaleTotal = int.Parse(dataGridView1.Rows[rowIndex].Cells[10].Value.ToString()); data.Red1 = int.Parse(dataGridView1.Rows[rowIndex].Cells[2].Value.ToString()); data.Red2 = int.Parse(dataGridView1.Rows[rowIndex].Cells[3].Value.ToString()); data.Red3 = int.Parse(dataGridView1.Rows[rowIndex].Cells[4].Value.ToString()); data.Red4 = int.Parse(dataGridView1.Rows[rowIndex].Cells[5].Value.ToString()); data.Red5 = int.Parse(dataGridView1.Rows[rowIndex].Cells[6].Value.ToString()); data.Red6 = int.Parse(dataGridView1.Rows[rowIndex].Cells[7].Value.ToString()); data.Blue = int.Parse(dataGridView1.Rows[rowIndex].Cells[8].Value.ToString()); data.TouJiangZhuShu = int.Parse(dataGridView1.Rows[rowIndex].Cells[11].Value.ToString()); //data.TouJiang = int.Parse(dataGridView1.Rows[rowIndex].Cells[11].Value.ToString()); data.ErJiangZhuShu = int.Parse(dataGridView1.Rows[rowIndex].Cells[12].Value.ToString()); //data.ErJiang = int.Parse(dataGridView1.Rows[rowIndex].Cells[13].Value.ToString()); // data.SanJiangZhuShu = int.Parse(dataGridView1.Rows[rowIndex].Cells[14].Value.ToString()); //data.SanJiang = int.Parse(dataGridView1.Rows[rowIndex].Cells[15].Value.ToString()); Detail d = new Detail(data); d.Show(); } }
public Detail(DoubleBoll data) { InitializeComponent(); if (data != null) { _data = data; } LoadData(); }
int IQueryComparator.Compare(object first, object second) { DoubleBoll f = (DoubleBoll)first; DoubleBoll s = (DoubleBoll)second; int first_qi = int.Parse(f.QiShu); int second_qi = int.Parse(s.QiShu); return(-(first_qi - second_qi)); }
void LoadBack() { if (_data != null) { //Update DoubleBoll newOne = new DoubleBoll(); newOne.OpenDate = DateTime.Parse(textbox_date.Text); newOne.TouJiang = int.Parse(textBox_fBonus.Text); newOne.TouJiangZhuShu = int.Parse(textBox_fNo.Text); newOne.QiShu = textBox_qi.Text; newOne.SaleTotal = int.Parse(textBox_sales.Text); newOne.ErJiang = int.Parse(textBox_seBonus.Text); newOne.ErJiangZhuShu = int.Parse(textBox_seNo.Text); newOne.SanJiang = int.Parse(textBox_thBonus.Text); newOne.SanJiangZhuShu = int.Parse(textBox_thNo.Text); newOne.Red1 = int.Parse(Red1.Text); newOne.Red2 = int.Parse(Red2.Text); newOne.Red3 = int.Parse(Red3.Text); newOne.Red4 = int.Parse(Red4.Text); newOne.Red5 = int.Parse(Red5.Text); newOne.Red6 = int.Parse(Red6.Text); newOne.Blue = int.Parse(Blue1.Text); DBHelper.UpdateFromDB(MainWindow._db, newOne); } else { _data = new DoubleBoll();//ADD _data.OpenDate = DateTime.Parse(textbox_date.Text); _data.TouJiang = int.Parse(textBox_fBonus.Text.Replace(",", string.Empty)); _data.TouJiangZhuShu = int.Parse(textBox_fNo.Text); _data.QiShu = textBox_qi.Text; _data.SaleTotal = int.Parse(textBox_sales.Text.Replace(",", string.Empty)); _data.ErJiang = int.Parse(textBox_seBonus.Text.Replace(",", string.Empty)); _data.ErJiangZhuShu = int.Parse(textBox_seNo.Text); _data.SanJiang = int.Parse(textBox_thBonus.Text.Replace(",", string.Empty)); _data.SanJiangZhuShu = int.Parse(textBox_thNo.Text.Replace(",", string.Empty)); _data.Red1 = int.Parse(Red1.Text); _data.Red2 = int.Parse(Red2.Text); _data.Red3 = int.Parse(Red3.Text); _data.Red4 = int.Parse(Red4.Text); _data.Red5 = int.Parse(Red5.Text); _data.Red6 = int.Parse(Red6.Text); _data.Blue = int.Parse(Blue1.Text); DBHelper.SaveToDB(MainWindow._db, _data, true); } }
bool ICaiCompare.Compare(object first, object second) { DoubleBoll f = (DoubleBoll)first; DoubleBoll s = (DoubleBoll)second; if (f.Red1 == s.Red1 && f.Red2 == s.Red2 && f.Red3 == s.Red3 && f.Red4 == s.Red4 && f.Red5 == s.Red5 && f.Red6 == s.Red6 && f.Blue == s.Blue ) { return(true); } else { return(false); } }
private void bt_syncRecent_Click(object sender, EventArgs e) { if (CommonHelper.IsInterNetConnected()) { try { string ulrPrefix = @"http://kaijiang.zhcw.com/zhcw/html/ssq/list_"; string ulrSufix = @".html"; string realUlr = ulrPrefix + "1" + ulrSufix; HtmlHelper.HtmlFromWebReq req = new HtmlHelper.HtmlFromWebReq( realUlr, delegate(byte[] data) { string constructedString = System.Text.Encoding.UTF8.GetString(data); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(constructedString); //HtmlAgilityPack.HtmlNode node = doc.DocumentNode.SelectSingleNode("/html[1]/body[1]/table[1]/tr[3]/td[3]"); HtmlAgilityPack.HtmlNodeCollection _nodes = doc.DocumentNode.SelectNodes("/html[1]/body[1]/table[1]/tr[position()>2]"); foreach (HtmlAgilityPack.HtmlNode no in _nodes) { string s = no.InnerText; s = s.Trim().Replace(" ", "");//.Replace('\n',' ').Replace('\r',' ');//Replace(" ","|"); string[] lines = s.Split(new char[] { '\r', '\n' }); List <string> _infos = new List <string>(); foreach (string ss in lines) { if (string.IsNullOrEmpty(ss)) { continue; } _infos.Add(ss); } if (!(_infos.Count == 12 || _infos.Count == 13)) { continue; } DoubleBoll temp = new DoubleBoll(); string riqi = _infos[0]; string qishu = _infos[1]; string r1 = _infos[2]; string r2 = _infos[3]; string r3 = _infos[4]; string r4 = _infos[5]; string r5 = _infos[6]; string r6 = _infos[7]; string b1 = _infos[8]; string allmoney = _infos[9]; string fno = "", fpro = "", sno = ""; if (_infos.Count == 13) { fno = _infos[10]; fpro = _infos[11]; sno = _infos[12]; } else if (_infos.Count == 12) { fno = _infos[10]; sno = _infos[11]; } string[] ymd = riqi.Split(new char[] { '-' }); DateTime opendate = new DateTime(Convert.ToInt32(ymd[0]), Convert.ToInt32(ymd[1]), Convert.ToInt32(ymd[2])); temp.OpenDate = opendate; temp.Red1 = Convert.ToInt32(r1); temp.Red2 = Convert.ToInt32(r2); temp.Red3 = Convert.ToInt32(r3); temp.Red4 = Convert.ToInt32(r4); temp.Red5 = Convert.ToInt32(r5); temp.Red6 = Convert.ToInt32(r6); temp.Blue = Convert.ToInt32(b1); temp.SaleTotal = Convert.ToInt32(allmoney.Replace(",", "")); temp.TouJiangZhuShu = Convert.ToInt32(fno); temp.ErJiangZhuShu = Convert.ToInt32(sno); temp.FirstProvince = fpro; temp.QiShu = qishu; if (!DBHelper.SaveToDB(_db, temp, true)) { DBHelper.UpdateFromDB(_db, temp); } } //string temp = node.InnerText; MessageBox.Show("完成"); }); req.BeginCreateHtml(); } catch (Exception ex) { LOGGER.Error("**************导入数据错误***********", ex); } } else { MessageBox.Show("没有互联网!"); } }