private void frmThongKeDoanhThu_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'doAnLapTrinhTrenWIndowsDataSet.ThongKe' table. You can move, or remove it, as needed.
            this.thongKeTableAdapter.Fill(this.doAnLapTrinhTrenWIndowsDataSet.ThongKe);
            // TODO: This line of code loads data into the 'doAnLapTrinhTrenWIndowsDataSet.ThongKe' table. You can move, or remove it, as needed.
            this.thongKeTableAdapter.Fill(this.doAnLapTrinhTrenWIndowsDataSet.ThongKe);
            SqlCommand command = new SqlCommand("SELECT * FROM ThongKe");

            dataGridView1.ReadOnly = true;
            DataGridViewImageColumn picCol = new DataGridViewImageColumn();

            dataGridView1.RowTemplate.Height = 80;
            dataGridView1.DataSource         = guixe.getGuiXe(command);
            picCol             = (DataGridViewImageColumn)dataGridView1.Columns[4];
            picCol.ImageLayout = DataGridViewImageCellLayout.Stretch;
            dataGridView1.AllowUserToAddRows = false;

            int DoanhThuThang = 0;

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                DoanhThuThang += int.Parse(dataGridView1.Rows[i].Cells[9].Value.ToString());
            }
            lb_TongDoanhThu.Text = DoanhThuThang.ToString();
        }
        public void fillGrid(SqlCommand command)
        {
            dtgv_XeGui.ReadOnly = true;
            DataGridViewImageColumn picCol = new DataGridViewImageColumn();

            dtgv_XeGui.RowTemplate.Height = 80;
            dtgv_XeGui.DataSource         = guixe.getGuiXe(command);
            picCol                        = (DataGridViewImageColumn)dtgv_XeGui.Columns[4];
            picCol.ImageLayout            = DataGridViewImageCellLayout.Stretch;
            dtgv_XeGui.AllowUserToAddRows = false;
        }
        private void btn_Find_Click(object sender, EventArgs e)
        {
            GuiXe      guixe   = new GuiXe();
            int        mave    = int.Parse(txb_MaVe.Text);
            SqlCommand command = new SqlCommand("SELECT mave, bienso, loaixe, hieuxe, hinhanh, giovaoben, ngayvaoben, loaive FROM GuiXe WHERE mave= " + mave);
            DataTable  table   = guixe.getGuiXe(command);

            if (table.Rows.Count > 0)
            {
                txb_BienSo.Text = table.Rows[0]["bienso"].ToString();
                if (table.Rows[0]["loaixe"].ToString() == "Xe dap")
                {
                    cb_LoaiXe.SelectedIndex = 0;
                }
                else if (table.Rows[0]["loaixe"].ToString() == "Xe may")
                {
                    cb_LoaiXe.SelectedIndex = 1;
                }
                else
                {
                    cb_LoaiXe.SelectedIndex = 2;
                }
                txb_HieuXe.Text = table.Rows[0]["hieuxe"].ToString();
                byte[]       pic     = (byte[])table.Rows[0]["hinhanh"];
                MemoryStream picture = new MemoryStream(pic);
                ptb_HinhAnh.Image    = Image.FromStream(picture);
                dtp_GioVaoBen.Value  = Convert.ToDateTime(table.Rows[0]["giovaoben"].ToString());
                dtp_NgayVaoBen.Value = (DateTime)table.Rows[0]["ngayvaoben"];
                if (table.Rows[0]["loaive"].ToString() == "Ve gio")
                {
                    cb_LoaiVe.SelectedIndex = 0;
                }
                else if (table.Rows[0]["loaive"].ToString() == "Ve ngay")
                {
                    cb_LoaiVe.SelectedIndex = 1;
                }
                else if (table.Rows[0]["loaive"].ToString() == "Ve tuan")
                {
                    cb_LoaiVe.SelectedIndex = 2;
                }
                else
                {
                    cb_LoaiVe.SelectedIndex = 3;
                }
            }
            else
            {
                MessageBox.Show("Không tìm thấy", "Chỉnh sửa danh sách gửi xe", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private void BtThanhToan_Click(object sender, EventArgs e)
        {
            /*
             * FrmThanhToan frmThanhToan = new FrmThanhToan();
             * frmThanhToan.lb_ValueMaVe.Text = txb_MaVe.Text;
             * frmThanhToan.lb_ValueBienSo.Text = txb_BienSo.Text;
             * frmThanhToan.lb_ValueHieuXe.Text = txb_HieuXe.Text;
             * frmThanhToan.lb_ValueLoaiVe.Text = cb_LoaiVe.Text;
             * frmThanhToan.lb_ValueLoaiXe.Text = cb_LoaiXe.Text;
             * //byte[] pic = (byte[])table.Rows[0]["hinhanh"];
             * //MemoryStream picture = new MemoryStream(pic);
             * ptb_HinhAnh.Image = Image.FromStream(picture);
             * //  MemoryStream hinhanh = new MemoryStream();
             * /// ptb_HinhAnh.Image.Save(frmThanhToan.ptb_HinhAnh, ptb_HinhAnh.Image.RawFormat);
             * //frmThanhToan.ptb_HinhAnh.Image = hinhanh;
             * frmThanhToan.dtp_GioVaoBen.Value = dtp_GioVaoBen.Value;
             * frmThanhToan.dtp_NgayVaoBen.Value = dtp_NgayVaoBen.Value;
             * frmThanhToan.ShowDialog(this);
             */
            FrmThanhToan frmThanhToan = new FrmThanhToan();
            GuiXe        guixe        = new GuiXe();
            int          mave         = int.Parse(txb_MaVe.Text);
            SqlCommand   command      = new SqlCommand("SELECT mave, bienso, loaixe, hieuxe, hinhanh, giovaoben, ngayvaoben, loaive FROM GuiXe WHERE mave= " + mave);
            DataTable    table        = guixe.getGuiXe(command);

            if (table.Rows.Count > 0)
            {
                frmThanhToan.lb_ValueMaVe.Text   = txb_MaVe.Text;
                frmThanhToan.lb_ValueBienSo.Text = table.Rows[0]["bienso"].ToString();
                if (table.Rows[0]["loaixe"].ToString() == "Xe dap")
                {
                    frmThanhToan.lb_ValueLoaiXe.Text = "Xe đạp";
                }
                else if (table.Rows[0]["loaixe"].ToString() == "Xe may")
                {
                    frmThanhToan.lb_ValueLoaiXe.Text = "Xe máy";
                }
                else
                {
                    frmThanhToan.lb_ValueLoaiXe.Text = "Xe hơi";
                }
                frmThanhToan.lb_ValueHieuXe.Text = table.Rows[0]["hieuxe"].ToString();
                byte[]       pic     = (byte[])table.Rows[0]["hinhanh"];
                MemoryStream picture = new MemoryStream(pic);
                frmThanhToan.ptb_HinhAnh.Image    = Image.FromStream(picture);
                frmThanhToan.dtp_GioVaoBen.Value  = Convert.ToDateTime(table.Rows[0]["giovaoben"].ToString());
                frmThanhToan.dtp_NgayVaoBen.Value = (DateTime)table.Rows[0]["ngayvaoben"];
                if (table.Rows[0]["loaive"].ToString() == "Ve gio")
                {
                    frmThanhToan.lb_ValueLoaiVe.Text = "Vé giờ";
                }
                else if (table.Rows[0]["loaive"].ToString() == "Ve ngay")
                {
                    frmThanhToan.lb_ValueLoaiVe.Text = "Vé ngày";
                }
                else if (table.Rows[0]["loaive"].ToString() == "Ve tuan")
                {
                    frmThanhToan.lb_ValueLoaiVe.Text = "Vé tuần";
                }
                else
                {
                    frmThanhToan.lb_ValueLoaiVe.Text = "Vé tháng";
                }
                frmThanhToan.ShowDialog(this);
            }
            else
            {
                MessageBox.Show("Không tìm thấy", "Form Thanh toán", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }