private void toolStripMenuItem价格汇总_Click(object sender, EventArgs e) { var sf = new Form_SelectDate(); if (DialogResult.OK == sf.ShowDialog(this)) { Show_JG(sf.dateTimePicker1.Value, sf.dateTimePicker2.Value); } }
private void toolStripMenuItem按天统计_Click(object sender, EventArgs e) { var sf = new Form_SelectDate(); if (sf.ShowDialog(this) != DialogResult.OK) { return; } Show_Day(sf.dateTimePicker1.Value, sf.dateTimePicker2.Value); }
public void InitEventHandler() { //新增备注 this.toolStripButton_add_note.Click += (o, e) => { var input = new Form_Input(); if (input.ShowDialog() == DialogResult.OK) { //command.Parameters.Clear(); //command.Parameters.Add(@"rq", MySqlDbType.DateTime).Value = DateTime.Now; //command.Parameters.Add(@"text", MySqlDbType.VarChar).Value = input.Input; command.CommandText = string.Format(@"insert into note(rq,text) values('{0}','{1}')", DateTime.Now.ToString(), input.Input); command.ExecuteNonQuery(); MessageBox.Show("新增备注成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }; //查看备注 this.toolStripButton_view_note.Click += (o, e) => { var select = new Form_SelectDate(); if (select.ShowDialog() == DialogResult.OK) { //command.Parameters.Clear(); //command.Parameters.Add("start", MySqlDbType.DateTime).Value = select.dateTimePicker1.Value; //command.Parameters.Add("end", MySqlDbType.DateTime).Value = select.dateTimePicker2.Value; //command.CommandText = "select rq as 日期,text as 备注 from note where date(rq)>=date(?start) and date(rq)<date(?end) order by rq desc"; command.CommandText = string.Format(@"select rq as 日期,text as 备注 from note where date(rq)>='{0}' and date(rq)<='{1}'", select.dateTimePicker1.Value.ToShortDateString(), select.dateTimePicker2.Value.ToShortDateString()); var dt = new DataTable(); var adapter = new MySqlDataAdapter(command); adapter.Fill(dt); var mdi = new MdiForm(); mdi.MdiParent = this; mdi.dataGridView.DataSource = dt; mdi.dataGridView.Columns[0].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss dddd"; mdi.Text = "查看备注"; mdi.Show(); } }; }