//双击卡片修改预约 private void bt_Click(object sender, EventArgs e) { Control ct = (Control)sender; if (ct.Tag.ToString() != "预约" && ct.Tag.ToString() != "失约") { MessageBox.Show("改预约状态为“" + ct.Tag.ToString() + "”,不能修改!"); return; } int ID = -1; if (ct.Name != string.Empty) { ID = int.Parse(ct.Name); } frmBookNew fb = new frmBookNew(ID); fb.UpdateCardHandle += new frmBookNew.UpdateCard(fb_UpdateCardHandle); fb.UpdateCardHoursdHandle += new frmBookNew.UpdateCardHours(SumWorkHours); if (fb.ShowDialog() == DialogResult.OK) { ToolTip tt = new ToolTip(); tt.SetToolTip(ct, UpdateDetail); } }
private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { if (ClsBLL.CarBookRecord(textBox1.Text)) { frmBookNew fbn = new frmBookNew(textBox1.Text); fbn.Show(); } else { MessageBox.Show("没有车牌号为“" + textBox1.Text + "”预约信息!"); } } }
//双击卡片修改预约 private void bt_Click(object sender, EventArgs e) { DoubleClickButton ct = (DoubleClickButton)sender; int ID = -1; if (ct.Name != string.Empty) { ID = int.Parse(ct.Name); } if (ID > -1) { frmBookNew fb = new frmBookNew(ID, false); if (fb.ShowDialog() == DialogResult.OK) { 刷新ToolStripMenuItem_Click(null, null); } } }
//双击新增预约 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (!ClsBLL.IsPower("新增预约")) { MessageBox.Show("你没有权限新增预约!"); return; } Colindex = e.ColumnIndex; Rowindex = e.RowIndex; if (e.RowIndex < 1) { return; } DateTime Date1 = DateTime.Parse(label1.Text); DateTime Date2; string cellval = dataGridView1.Rows[Rowindex].Cells[0].Value.ToString(); //if (Rowindex == dataGridView1.Rows.Count) //{ // Date2 = DateTime.Parse(Date1.ToString("yyyy-MM-dd") + " " + cellval).AddMinutes(30); //} //else //{ // if (dataGridView1.Rows[Rowindex - 1].Cells[0].Value.ToString() == cellval) // { // Date2 = DateTime.Parse(Date1.ToString("yyyy-MM-dd") + " " + cellval).AddMinutes(30); // } // else // { Date2 = DateTime.Parse(Date1.ToString("yyyy-MM-dd") + " " + cellval); // } //} if (Date2.CompareTo(DateTime.Now) > 0) { frmBookNew fm3 = new frmBookNew(Date2, dataGridView1.Columns[e.ColumnIndex].HeaderText); fm3.AddCarHandle += new frmBookNew.AddCar(AddCarCard); fm3.UpdateCardHoursdHandle += new frmBookNew.UpdateCardHours(SumWorkHours); fm3.Show(); } else { MessageBox.Show("选择的预约时间不能小于当前时间!"); } }
//双击新增预约 private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 1 || e.ColumnIndex == 0) { return; } if (!ClsBLL.IsPower("新增预约")) { MessageBox.Show("你没有权限新增预约!"); return; } Colindex = e.ColumnIndex; Rowindex = e.RowIndex; if (e.RowIndex < 1) { return; } DateTime Date1 = DateTime.Parse(labDateTime.Text); DateTime Date2; string cellval = dataGridView1.Rows[Rowindex].Cells[0].Value.ToString(); Date2 = DateTime.Parse(Date1.ToString("yyyy-MM-dd") + " " + cellval); if (!ClsBLL.CheckFormIsOpen("frmBookNew")) { string servicetype = "机电维修"; if (Colindex == 2) { servicetype = "车身维修"; } frmBookNew fm3 = new frmBookNew(Date2, servicetype); fm3.AddCarHandle += new frmBookNew.AddCar(AddCarCardNew); if (fm3.ShowDialog() == DialogResult.OK) { 刷新ToolStripMenuItem_Click(null, null); } } else { Form frm = Application.OpenForms["frmBookNew"]; frm.Focus(); } }