/// <summary>
        /// 填充下拉框cbVoucherId
        /// </summary>
        public void FillcbVoucherId()
        {
            List <VoucherBatch> voucherBatchList = new List <VoucherBatch>();

            cbVoucherId.DisplayMember = "VoucherBatchId";
            cbVoucherId.ValueMember   = "VoucherBatchId";

            VoucherBatchManage dataManager = new VoucherBatchManage();

            voucherBatchList = dataManager.GetDataList();
            if (voucherBatchList.Count > 0 || voucherBatchList != null)
            {
                VoucherBatch vBatch = new VoucherBatch();
                vBatch.VoucherName    = "全部";
                vBatch.VoucherBatchId = "全部";
                voucherBatchList.Add(vBatch);
                cbVoucherId.DataSource = voucherBatchList;
            }
        }
        private void btnEnter_Click(object sender, EventArgs e)
        {
            try
            {
                List <VoucherBatch> voucherBatchList        = new List <VoucherBatch>();
                VoucherBatchManage  voucherBatchDataManager = new VoucherBatchManage();

                if (chbSearchByNo.Checked && cbVoucherId.SelectedValue != null)
                {
                    if (cbVoucherId.SelectedValue.ToString() == "全部")
                    {
                        //var obj = voucherBatchDataManager.GetDataList();
                        var tmp = voucherBatchDataManager.GetDataList();
                        if (tmp != null || tmp.Count > 0)
                        {
                            foreach (var tmpobj in tmp)
                            {
                                var objList = voucherBatchDataManager.GetSearchList("VoucherBatchId", tmpobj.VoucherBatchId);

                                VoucherBatch obj;

                                if (dataManage.IsSale(tmpobj.VoucherBatchId.ToString()))
                                {
                                    obj = objList.Find(p => p.VoucherBatchId == tmpobj.VoucherBatchId);
                                    if (obj != null)
                                    {
                                        obj.Description = "是";
                                    }
                                }
                                else
                                {
                                    obj = objList.Find(p => p.VoucherBatchId == tmpobj.VoucherBatchId);

                                    if (obj != null)
                                    {
                                        obj.Description = "否";
                                    }
                                }

                                if (objList != null && objList.Count > 0)
                                {
                                    voucherBatchList.AddRange(objList);
                                }
                            }
                            dgvList.DataSource = voucherBatchList;
                        }
                    }
                    else
                    {
                        var objList = voucherBatchDataManager.GetSearchList("VoucherBatchId", cbVoucherId.SelectedValue.ToString());
                        if (objList != null && objList.Count > 0)
                        {
                            VoucherBatch obj;

                            if (dataManage.IsSale(cbVoucherId.SelectedValue.ToString()))
                            {
                                obj = objList.Find(p => p.VoucherBatchId == cbVoucherId.SelectedValue.ToString());
                                if (obj != null)
                                {
                                    obj.Description = "是";
                                }
                            }
                            else
                            {
                                obj = objList.Find(p => p.VoucherBatchId == cbVoucherId.SelectedValue.ToString());
                                if (obj != null)
                                {
                                    obj.Description = "否";
                                }
                            }
                        }
                        if (objList != null && objList.Count > 0)
                        {
                            voucherBatchList.AddRange(objList);
                        }
                        dgvList.DataSource = voucherBatchList;
                    }
                }
                else
                {
                    if (cbVoucherTypeId.SelectedValue.ToString() == "10000")
                    {
                        dgvList.DataSource = dataManage.dgvSearch(dateTimeFrom.Value, dateTimeTo.Value);
                    }
                    else
                    {
                        dgvList.DataSource = dataManage.dgvSearch(dateTimeFrom.Value, dateTimeTo.Value, Convert.ToInt32(cbVoucherTypeId.SelectedValue));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("没有您要查询的数据!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnQuery_Click(object sender, EventArgs e)
        {
            try
            {
                List <VoucherBatch> voucherBatchList = new List <VoucherBatch>();
                string type;
                if (cbSearchType.SelectedItem.ToString() == "券类型")
                {
                    string[] list = dataManager.GetVoucherIdList("VoucherTypeName", txtKeyWord.Text.Trim());

                    foreach (string str in list)
                    {
                        if (str == null || str == string.Empty)
                        {
                            continue;
                        }
                        int id  = Convert.ToInt32(str);
                        var tmp = dataManager.GetDataList().FindAll(p => p.VoucherTypeId == id);
                        if (tmp == null || tmp.Count <= 0)
                        {
                            continue;
                        }
                        foreach (var tmpobj in tmp)
                        {
                            var obj = dataManager.GetSearchList("VoucherBatchId", tmpobj.VoucherBatchId);
                            if (obj != null && obj.Count > 0)
                            {
                                voucherBatchList.AddRange(obj);
                            }
                        }
                    }
                    dataBindingSource.DataSource = voucherBatchList;
                }
                else
                if (cbSearchType.SelectedItem.ToString() == "票券名称")
                {
                    type = "VoucherName";
                    dataBindingSource.DataSource = dataManager.GetSearchList(type, txtKeyWord.Text.Trim());
                }
                else if (cbSearchType.SelectedItem.ToString() == "发行日期")
                {
                    dataBindingSource.DataSource = dataManager.GetSearchList("ReleaseDate", txtKeyWord.Text.Trim());
                }
                else
                {
                    string[] list = dataManager.GetVoucherSubTypeIdList("VoucherSubTypeName", txtKeyWord.Text.Trim());

                    foreach (string str in list)
                    {
                        if (str == null || str == string.Empty)
                        {
                            continue;
                        }
                        int id  = Convert.ToInt32(str);
                        var tmp = dataManager.GetDataList().FindAll(p => p.VoucherSubTypeId == id);
                        if (tmp == null || tmp.Count <= 0)
                        {
                            continue;
                        }
                        foreach (var tmpobj in tmp)
                        {
                            var obj = dataManager.GetSearchList("VoucherBatchId", tmpobj.VoucherBatchId);
                            if (obj != null && obj.Count > 0)
                            {
                                voucherBatchList.AddRange(obj);
                            }
                        }
                    }
                    dataBindingSource.DataSource = voucherBatchList;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("没有您要查询的数据!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }