コード例 #1
0
ファイル: frmBook.cs プロジェクト: gvhung/shenzhen_porsche
 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 + "”预约信息!");
         }
     }
 }
コード例 #2
0
ファイル: frmBook.cs プロジェクト: gvhung/shenzhen_porsche
        //双击新增预约
        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("选择的预约时间不能小于当前时间!");
            }
        }