private void simpleButtonOK_Click(object sender, EventArgs e) { ConnDB conn = new ConnDB(); string strsql, strsql2; int rows; strsql = "insert into COST_TEMP_EMPLOYEE_PRICE(TYPE,BEGIN_DATE,END_DATE,PRICE,INSURANCE_PRICE) values(2,'" + dateTimePickerBegin.Text.ToString() + "','" + dateTimePickerEnd.Text.ToString() + "','" + textEditPrice.Text.ToString().Trim() + "','" + textEditInsurance.Text.ToString().Trim() + "')"; strsql2 = "select price from COST_TEMP_EMPLOYEE_PRICE where not (begin_date > '" + dateTimePickerEnd.Text.ToString() + "' or end_date <'" + dateTimePickerBegin.Text.ToString() + "') and type = 2"; if (textEditPrice.Text.ToString().Trim() != "" || textEditInsurance.Text.ToString().Trim() != "") { rows = conn.ReturnRecordCount(strsql2); if (rows > 0) { MessageBox.Show("此时间范围的记录已经存在!"); } else { bool isok = conn.EditDatabase(strsql); if (isok) { MessageBox.Show("添加成功!"); TempEmpStandardPriceQuery.RefreshEX(); this.Close(); } else { MessageBox.Show("失败!"); } } } else { MessageBox.Show("关键数据不能为空!"); } conn.Close(); }
private void barButtonItem刷新_ItemClick(object sender, ItemClickEventArgs e) { TempEmpStandardPriceQuery.RefreshEX(); }