private void btnDongY_Click(object sender, EventArgs e)
        {
            string s_ID = s_BanNang;

            if (s_BanNang.Length < 2)
            {
                s_ID = "0" + s_BanNang;
            }
            string s_NDLayXe = txtNoiDung.Text;
            string str       = "#CTR," + s_ID + "," + s_NDLayXe + ",*";

            if (s_NDLayXe != "")
            {
                byte[] data = System.Text.Encoding.UTF8.GetBytes(str);
                if (s_SerialPort != "")
                {
                    ThuVienSerialPort.serialPort_Send(data, 0, data.Length);
                }
            }
            if (SQLiteCon.State == ConnectionState.Open && b_TaoMoi == false)
            {
                try
                {
                    string        sql     = "UPDATE bannang SET maql = '0',counter = 0 WHERE ID = " + s_BanNang;
                    SQLiteCommand command = new SQLiteCommand(sql, SQLiteCon);
                    command.ExecuteNonQuery();

                    sql     = "insert into  baocao (maql,id,khachhang,biensoxe,thoigian,ktv) values ('" + s_MaQL + "','" + s_BanNang + "','" + s_TTKhachHang + "','" + s_BienSoXe + "'," + d_ThoiGian.ToString() + ",'" + s_KyThuatVien + "')";
                    command = new SQLiteCommand(sql, SQLiteCon);
                    command.ExecuteNonQuery();
                }
                catch { }
            }
            this.Close();
        }
        private void btnDongY_Click(object sender, EventArgs e)
        {
            string s_ID = s_BanNang;

            if (s_BanNang.Length < 2)
            {
                s_ID = "0" + s_BanNang;
            }
            string s_CauChao = txtCauChao.Text == "" ? " " : txtCauChao.Text;
            string str       = "#CFG," + s_ID + "," + s_CauChao + ",*";

            byte[] data = System.Text.Encoding.UTF8.GetBytes(str);
            ThuVienSerialPort.serialPort_Send(data, 0, data.Length);
            if (SQLiteCon.State == ConnectionState.Open)
            {
                try
                {
                    string        sql     = "UPDATE bannang SET greetings = '" + txtCauChao.Text + "', ktv = '" + txtKTV.Text + "' WHERE ID = " + s_BanNang + " ";
                    SQLiteCommand command = new SQLiteCommand(sql, SQLiteCon);
                    command.ExecuteNonQuery();
                }
                catch
                {
                    MessageBox.Show("Xử lý lỗi\rVui lòng kiểm tra lại!", "Cảnh báo");
                }
            }
            this.Close();
        }
 private void frmTTCauHinhBN_Load(object sender, EventArgs e)
 {
     if (s_SerialPort != "")
     {
         ThuVienSerialPort.serialPort_Open(s_SerialPort, false);
     }
     txtCauChao.Text = s_LoiChao;
     txtKTV.Text     = s_KyThuatVien;
 }
 private void frmTraXe_Load(object sender, EventArgs e)
 {
     this.Text = String.Format("Thông tin trả xe [Bàn nâng {0}]", s_BanNang);
     if (s_SerialPort != "")
     {
         ThuVienSerialPort.serialPort_Open(s_SerialPort, false);
     }
     txtKhachHang.Text = s_TTKhachHang;
     txtBSX.Text       = s_BienSoXe;
 }
Beispiel #5
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            string sql  = "";
            string s_ID = s_BanNang;

            if (s_BanNang.Length < 2)
            {
                s_ID = "0" + s_BanNang;
            }
            string s_Name     = txtKhachHang.Text == "" ? " " : txtKhachHang.Text;
            string s_BienSoXe = txtBienSoXe.Text == "" ? " " : txtBienSoXe.Text;
            string s_ThoiGian = Convert.ToDecimal(txtGio.Text == "" ? "0" : txtGio.Text).ToString("00") + ":" + Convert.ToDecimal(txtPhut.Text == "" ? "0" : txtPhut.Text).ToString("00");

            d_ThoiGian = Convert.ToDecimal(txtGio.Text == "" ? "0" : txtGio.Text) * 60 + Convert.ToDecimal(txtPhut.Text == "" ? "0" : txtPhut.Text);
            if (d_ThoiGian > 0)
            {
                string str  = "#LED," + s_ID + "," + s_Name + "," + s_BienSoXe + "," + s_ThoiGian + "*";
                byte[] data = System.Text.Encoding.UTF8.GetBytes(str);
                ThuVienSerialPort.serialPort_Send(data, 0, data.Length);
                if (SQLiteCon.State == ConnectionState.Open && b_TaoMoi == true && d_ThoiGian > 0)
                {
                    sql = "UPDATE bannang SET maql = '" + s_Maql + "' WHERE id = " + s_BanNang;
                    try
                    {
                        SQLiteCommand command = new SQLiteCommand(sql, SQLiteCon);
                        command.ExecuteNonQuery();
                    }
                    catch { }
                }
                if (SQLiteCon.State == ConnectionState.Open)
                {
                    try
                    {
                        sql = "UPDATE bannang SET counter = '" + d_ThoiGian.ToString() + "',khachhang = '" + txtKhachHang.Text + "',biensoxe='" + txtBienSoXe.Text + "',ktv='" + txtKTV.Text + "',time = (datetime('now','localtime')) WHERE id = " + s_BanNang;
                        SQLiteCommand command = new SQLiteCommand(sql, SQLiteCon);
                        command.ExecuteNonQuery();
                    }
                    catch { }
                }
            }
            else
            {
                MessageBox.Show("Thông tin không hợp lệ\rVui lòng kiểm tra lại!", "Cảnh báo");
            }
            this.Close();
        }
Beispiel #6
0
        private void DKTGPhatSinh(string s_Mode)
        {
            string s_ID = s_BanNang;

            if (s_BanNang.Length < 2)
            {
                s_ID = "0" + s_BanNang;
            }
            string s_TGPhatSinh = numPhut.Value.ToString();
            string str          = "#TIME," + s_ID + "," + s_Mode + "," + s_TGPhatSinh + ",*";

            if (numPhut.Value != 0)
            {
                byte[] data = System.Text.Encoding.UTF8.GetBytes(str);
                ThuVienSerialPort.serialPort_Send(data, 0, data.Length);
                if (s_Mode == "1")
                {
                    d_ThoiGian += numPhut.Value;
                }
                else
                {
                    d_ThoiGian -= numPhut.Value;
                    if (d_ThoiGian < 0)
                    {
                        d_ThoiGian = 0;
                    }
                }
                if (SQLiteCon.State == ConnectionState.Open)
                {
                    try
                    {
                        string        sql     = "UPDATE bannang SET counter = '" + d_ThoiGian.ToString() + "' WHERE id = " + s_ID + " ";
                        SQLiteCommand command = new SQLiteCommand(sql, SQLiteCon);
                        command.ExecuteNonQuery();
                    }
                    catch { }
                }
            }
            else
            {
                MessageBox.Show("Thông tin không hợp lệ!", "Cảnh báo");
            }
        }
Beispiel #7
0
 private void frmDCTGSuaChua_Load(object sender, EventArgs e)
 {
     this.Text = String.Format("Chỉnh thời gian [Bàn nâng {0}]", s_BanNang);
     if (s_SerialPort != null)
     {
         ThuVienSerialPort.serialPort_Open(s_SerialPort, false);
     }
     if (d_ThoiGian == 0)
     {
         numPhut.Enabled = false;
         btnGiam.Enabled = false;
         btnTang.Enabled = false;
     }
     else
     {
         numPhut.Enabled = true;
         btnGiam.Enabled = true;
         btnTang.Enabled = true;
     }
 }
Beispiel #8
0
 private void frmTiepNhanXe_Load(object sender, EventArgs e)
 {
     this.Text = String.Format("Tiếp nhận xe [Bàn nâng {0}]", s_BanNang);
     this.txtGio.Properties.Mask.EditMask  = "\\d+";
     this.txtGio.Properties.Mask.MaskType  = DevExpress.XtraEditors.Mask.MaskType.RegEx;
     this.txtPhut.Properties.Mask.EditMask = "\\d+";
     this.txtPhut.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;
     ThuVienSerialPort.serialPort_Open(s_SerialPort, false);
     txtKTV.Text = s_KyThuatVien;
     if (b_TaoMoi == false)
     {
         txtKTV.Enabled       = false;
         txtGio.Enabled       = false;
         txtPhut.Enabled      = false;
         txtKhachHang.Enabled = false;
         txtBienSoXe.Enabled  = false;
         txtKhachHang.Text    = s_KhachHang;
         txtBienSoXe.Text     = s_BienSoXe;
         txtGio.Text          = Convert.ToInt32(d_ThoiGian / 60).ToString();
         txtPhut.Text         = (d_ThoiGian % 60).ToString();
         btnDongY.Enabled     = false;
     }
 }