コード例 #1
0
        private void btnTraKhach_Click(object sender, EventArgs e)
        {
            BienSoStr = drlBienSo.Text;
            LoaiXeInt = Convert.ToInt32(cbxLoaiXe.SelectedValue);
            var item = LoaiXeList.FirstOrDefault(x => x.ID == LoaiXeInt);

            if (item != null)
            {
                Tien             = item.MucThu.ToString();
                GiaoCa.DoanhThu += item.MucThu;
                lblTongSo.Text   = GiaoCa.DoanhThu.TienVietNam();
            }

            NgayStr = txtThoiGian.Text;
            Loai    = 100;


            if (string.IsNullOrEmpty(BienSoStr) || LoaiXeInt == 0)
            {
                return;
            }
            if (!backgroundWorker2.IsBusy)
            {
                backgroundWorker2.RunWorkerAsync();
            }
            drlBienSo.Text        = "";
            drlBienSo.DroppedDown = false;
            cbxLoaiXe.Text        = "";
        }
コード例 #2
0
        private void drlBienSo_TextChanged(object sender, EventArgs e)
        {
            var term = drlBienSo.Text;

            Debug.WriteLine(term);
            if (term.Length == 0 || term.Length > 20)
            {
                term = "";
            }
            #region binding
            var list = string.IsNullOrEmpty(term)
                           ? XeListStrArray
                           : XeListStrArray.Where(x => x.ToLower().Contains(term.ToLower())).ToArray();

            if (list == null || !list.Any())
            {
                drlBienSo.DroppedDown = false;
                return;
            }
            drlBienSo.Items.Clear();
            foreach (var s in list)
            {
                drlBienSo.Items.Add(s);
            }
            drlBienSo.Select(term.Length, 1);
            drlBienSo.DroppedDown = true;
            #endregion
            Debug.WriteLine(term);
            if (term.Length == 0)
            {
                return;
            }
            var item = XeList.FirstOrDefault(x => x.BienSo.ToLower() == term.ToLower());
            XeId = 0;
            if (item == null)
            {
                return;
            }
            Console.WriteLine(item.BienSo);
            cbxLoaiXe.SelectedValue = item.LOAIXE_ID;
            XeId = item.ID;
            if (!item.XeVangLai)
            {
                txtTien.Text = string.Empty;
                return;
            }
            var loaiXe = LoaiXeList.FirstOrDefault(x => x.ID == item.LOAIXE_ID);
            if (loaiXe != null)
            {
                txtTien.Text = loaiXe.MucThu.TienVietNam();
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: nhatkycon/bxvinh
        private void drlBienSo_TextChanged(object sender, EventArgs e)
        {
            var term = drlBienSo.Text;

            PopulateResult(term);

            if (term.Length == 0)
            {
                return;
            }
            var item = XeList.FirstOrDefault(x => x.BienSo.ToLower() == term.ToLower());

            #region reset value
            XvbId             = 0;
            lblTrangThai.Text = string.Empty;
            txtTien.Text      = string.Empty;
            txtGioVao.Text    = string.Empty;
            Tien = 0;
            #endregion
            if (item == null)
            {
                return;
            }
            XvbId          = item.ID;
            txtGioVao.Text = item.NgayVao.ToString("HH:mm dd/MM/yyyy");
            if (item.Loai != 200)
            {
                txtTien.Text      = item.Tien.TienVietNam();
                lblTrangThai.Text = item.Loai == 0 ? "Xe vãng lai" : "Xe vào trả khách";
                Tien = item.Tien;
            }
            else
            {
                lblTrangThai.Text = "Xe đã cấp lệnh";
            }


            var loaiXe = LoaiXeList.FirstOrDefault(x => x.ID == item.LOAIXE_ID);
            if (loaiXe == null)
            {
                return;
            }
        }
コード例 #4
0
        private void cbxLoaiXe_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbxLoaiXe.SelectedIndex == 1)
            {
                return;
            }
            if (cbxLoaiXe.SelectedValue == null)
            {
                return;
            }
            var id = 0;

            Int32.TryParse(cbxLoaiXe.SelectedValue.ToString(), out id);
            var item = LoaiXeList.FirstOrDefault(x => x.ID == id);

            if (item != null)
            {
                txtTien.Text = item.MucThu.TienVietNam();
            }
        }