private void button1_Click(object sender, EventArgs e) { string tiem1 = this.dateTimePicker1.Value.ToString(); string tiem2 = this.dateTimePicker2.Value.ToString(); DateTime dt1 = Convert.ToDateTime(tiem1); DateTime dt2 = Convert.ToDateTime(tiem2); if (DateTime.Compare(dt1, dt2) > 0) { NewFolder1.ReduceGoods reduceGoods = new NewFolder1.ReduceGoods(); this.dataGridView1.DataSource = reduceGoods.dateCilct(this.dateTimePicker2.Value.ToString(), this.dateTimePicker1.Value.ToString()); } else { NewFolder1.ReduceGoods reduceGoods = new NewFolder1.ReduceGoods(); this.dataGridView1.DataSource = reduceGoods.dateCilct(this.dateTimePicker1.Value.ToString(), this.dateTimePicker2.Value.ToString()); } }
/// <summary> /// 修改或保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Click(object sender, EventArgs e) { cilck++; if (btn.Text == "添加") { this.txtF_proID.ReadOnly = false; if (cilck == 2) { iffolat(); if (iffigure == true) { NewFolder1.ReduceGoods reduceGoods = new NewFolder1.ReduceGoods(); reduceGoods.F_proID = this.txtF_proID.Text; reduceGoods.Reduce_Sum = Convert.ToInt32(this.txtReduce_Sum.Text); reduceGoods.Mode = this.comMode.Text; reduceGoods.Reduce_date = Convert.ToString(this.TimeReduce_date.Value); reduceGoods.Why = this.txtWhy.Text; reduceGoods.ClearIncome = Convert.ToSingle(this.txtClearIncome.Text); reduceGoods.ClearCost = Convert.ToSingle(this.txtClearCost.Text); reduceGoods.CustomerID = Convert.ToInt32(this.comName.SelectedValue); reduceGoods.Detail = this.txtDetail.Text; if (reduceGoods.Add()) { MessageBox.Show("添加成功!"); this.txtF_proID.Text = ""; this.txtDetail.Text = ""; this.txtClearCost.Text = ""; this.txtClearIncome.Text = ""; this.txtReduce_Sum.Text = ""; this.txtWhy.Text = ""; this.comMode.Text = ""; this.TimeReduce_date.Text = ""; dataLoad(); cilck = 0; } else { MessageBox.Show("添加失败!"); cilck = 0; } } else { MessageBox.Show("请重新输入数值!"); } } } else { if (cilck == 1) { iffolat(); if (iffigure == true) { NewFolder1.ReduceGoods reduceGoods = new NewFolder1.ReduceGoods(); reduceGoods.ReduceGoodsID = Convert.ToInt32(this.dataGridView1.CurrentRow.Cells["ReduceGoodsID"].Value.ToString()); reduceGoods.F_proID = this.txtF_proID.Text; reduceGoods.Reduce_Sum = Convert.ToInt32(this.txtReduce_Sum.Text); reduceGoods.Mode = this.comMode.Text; reduceGoods.Reduce_date = Convert.ToString(this.TimeReduce_date.Value); reduceGoods.Why = this.txtWhy.Text; reduceGoods.ClearIncome = Convert.ToSingle(this.txtClearIncome.Text); reduceGoods.ClearCost = Convert.ToSingle(this.txtClearCost.Text); reduceGoods.CustomerID = Convert.ToInt32(this.comName.SelectedValue); reduceGoods.Detail = this.txtDetail.Text; if (reduceGoods.Update()) { MessageBox.Show("修改成功!"); this.txtF_proID.Text = ""; this.txtDetail.Text = ""; this.txtClearCost.Text = ""; this.txtClearIncome.Text = ""; this.txtReduce_Sum.Text = ""; this.txtWhy.Text = ""; this.comMode.Text = ""; this.TimeReduce_date.Text = ""; dataLoad(); cilck = 0; } else { MessageBox.Show("修改失败!"); cilck = 0; } } else { MessageBox.Show("请重新输入数值!"); } } } }
private void button2_Click(object sender, EventArgs e) { NewFolder1.ReduceGoods reduceGoods = new NewFolder1.ReduceGoods(); reduceGoods.SelectListByWhere(""); }
private void ReduceReport_Load(object sender, EventArgs e) { NewFolder1.ReduceGoods reduceGoods = new NewFolder1.ReduceGoods(); reduceGoods.SelectListByWhere(""); }