/*---Car OUT---*/
 void Car_out(string out_location) // lấy xe ra với vị trí và mã thẻ
 {
     try
     {
         if (IsNumber(out_location) && Convert.ToInt32(out_location) <= 6 && Convert.ToInt32(out_location) > 0 && done == true)
         {
             if (check_out_car(out_location) == true)
             {
                 done           = false;
                 txt_vitri.Text = out_location;
                 Set_status(false, out_location);
                 Set_ID_card_time("", "", "", out_location);
                 Timer_4.Start();
             }
             else
             {
                 MessageBox.Show("Chưa có xe tại vị trí đó");
             }
         }
         else
         {
             MessageBox.Show("Địa chỉ không hợp lệ");
         }
     }
     catch
     {
         MessageBox.Show("Có lỗi xảy ra");
     }
 }
Beispiel #2
0
 /*---------OUT----------*/
 /*---Time 4---*/
 private void Timer_4_Tick(object sender, EventArgs e)
 {
     pic_car_v2.Location = new Point(pic_car_v2.Location.X, pic_car_v2.Location.Y - 10);
     if (pic_car_v2.Location.Y < 284)
     {
         pic_car_v2.Image = new Bitmap(Application.StartupPath + "\\picture\\er.png");
         Set_out(txt_vitri.Text);
         Timer_4.Stop();
         Timer_5.Start();
     }
 }
Beispiel #3
0
 /*---Car OUT---*/
 void Car_out(string out_location) // lấy xe ra với vị trí với mã thẻ
 {
     try
     {
         if (IsNumber(out_location) && Convert.ToInt32(out_location) <= 6 && Convert.ToInt32(out_location) > 0 && done == true)
         {
             if (check_out_car(out_location) == true)
             {
                 if (Admin_test == false)
                 {
                     Serial_port.Write("E0");                      // OKE
                 }
                 else
                 {
                     Admin_test = false;
                 }
                 lb_error.Text  = "Complete";
                 done           = false;
                 txt_vitri.Text = out_location;
                 Set_status(false, out_location);
                 Set_ID_card_time("", "", "", out_location);
                 Timer_4.Start();
             }
             else
             {
                 MessageBox.Show("Chưa có xe tại vị trí đó", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             Serial_port.Write("E5"); // Thẻ chưa đc xử dụng
             lb_error.Text = "Card error";
         }
     }
     catch
     {
         lb_error.Text = "Error";
         if (Serial_port.IsOpen)
         {
             Serial_port.Write("E4"); //Có lỗi xảy ra
         }
         else
         {
             MessageBox.Show("Chưa mở cổng COM");
         }
     }
 }