Ejemplo n.º 1
0
        private void toolStripTimkiem_Click(object sender, EventArgs e)
        {
            BindingList <CTPhieuBan_DTO> ctphieu;

            try
            {
                int masptk = txtMaSPTK.Text == "" ? 0 : int.Parse(txtMaSPTK.Text);

                int slmin = txtSlmin.Text == "" ? 0 : int.Parse(txtSlmin.Text);
                int slmax = txtSlmax.Text == "" ? 0 : int.Parse(txtSlmax.Text);

                decimal dongiamin = txtDonGiamin.Text == "" ? 0 : decimal.Parse(txtDonGiamin.Text);
                decimal dongiamax = txtDonGiamax.Text == "" ? 0 : decimal.Parse(txtDonGiamax.Text);

                decimal thanhtienmin = txtThanhTienmin.Text == "" ? 0 : decimal.Parse(txtThanhTienmin.Text);
                decimal thanhtienmax = txtThanhTienmin.Text == "" ? 0 : decimal.Parse(txtThanhTienmax.Text);

                ctphieu = CTPhieuBan.Search(int.Parse(txtSPhieu.Text),
                                            masptk,
                                            slmin, slmax,
                                            dongiamin, dongiamax,
                                            thanhtienmin, thanhtienmax
                                            );
                loadgridview(ctphieu);
                txtTongTien.Text = PhieuBan.Search(int.Parse(txtSPhieu.Text)).FirstOrDefault().TongTien.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        private void toolStripTimkiem_Click(object sender, EventArgs e)
        {
            BindingList <PhieuBanHang_DTO> phieu;

            try
            {
                this.dateTimePickerNgayban.CustomFormat       = "yyyy/mm/dd";
                this.dateTimePickerNgayThanhToan.CustomFormat = "yyyy/mm/dd";
                int makh    = txtMaKhachHang.Text == "" ? 0 : int.Parse(txtMaKhachHang.Text);
                int sophieu = txtSoPhieu.Text == "" ? 0 : int.Parse(txtSoPhieu.Text);

                decimal sotientramin = txtSoTienTraMin.Text == "" ? 0 : decimal.Parse(txtSoTienTraMin.Text);
                decimal sotientramax = txtSoTienTraMax.Text == "" ? 0 : decimal.Parse(txtSoTienTraMax.Text);
                decimal tongtienmin  = txtTongTienMin.Text == "" ? 0 : decimal.Parse(txtTongTienMin.Text);
                decimal tongtienmax  = txtTongTienMax.Text == "" ? 0 : decimal.Parse(txtTongTienMax.Text);

                phieu = p.Search(sophieu,
                                 makh,
                                 txtTenKhachHang.Text,
                                 dateTimePickerNgayban.Value.ToShortDateString(),
                                 dateTimePickerNgayThanhToan.Value.ToShortDateString(),
                                 tongtienmin, tongtienmax,
                                 sotientramin, sotientramax
                                 );
                loadgridview(phieu);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            // reset cac o tim kiem
            txtSoPhieu.Text            = "";
            txtMaKhachHang.Text        = "";
            txtTenKhachHang.Text       = "";
            dateTimePickerNgayban.Text = dateTimePickerNgayThanhToan.Text = DateTime.Now.ToShortDateString();
            txtTongTienMin.Text        = txtTongTienMax.Text = "";
            txtSoTienTraMin.Text       = txtSoTienTraMax.Text = "";
        }