private void cb_Click(object sender, RoutedEventArgs e)
        {
            CheckBox            chk = (CheckBox)sender;
            DistributeTaskModel vd  = chk.Tag as DistributeTaskModel;

            vd.IsChecked = chk.IsChecked.Value;
        }
        void DoSearch()
        {
            using (GeelyPtlEntities dbContext = new GeelyPtlEntities())
            {
                DateTime minTime = this.datePickerMin.Value ?? DateTime.Today;
                DateTime maxTime = this.datePickerMax.Value ?? DateTime.Today.AddHours(23).AddMinutes(59).AddSeconds(59);

                IQueryable <DST_DistributeTask> queryable = dbContext.DST_DistributeTasks.Where(lt => lt.reqTime > minTime && lt.reqTime < maxTime);

                string sReqType = this.cmbReqType.Text;
                if (!string.IsNullOrEmpty(sReqType))
                {
                    DistributeReqTypes distributeReqTypes = ReqTextToTypeConvert(sReqType);
                    queryable = queryable.Where(lt => lt.DistributeReqTypes == distributeReqTypes);
                }

                string sResponse = this.cmbIsResponse.Text;
                if (!string.IsNullOrEmpty(sResponse))
                {
                    bool IsResponse = false;
                    if (sResponse.Equals("是"))
                    {
                        IsResponse = true;
                    }
                    else if (sResponse.Equals("否"))
                    {
                        IsResponse = false;
                    }
                    queryable = queryable.Where(lt => lt.isResponse == IsResponse);
                }

                string sArrive = this.cmbIsArrive.Text;
                if (!string.IsNullOrEmpty(sArrive))
                {
                    if (sArrive.Equals("是"))
                    {
                        queryable = queryable.Where(lt => lt.arriveTime != null);
                    }
                    else if (sArrive.Equals("否"))
                    {
                        queryable = queryable.Where(lt => lt.arriveTime == null);
                    }
                }

                string sSendType = this.cmbSendType.Text;
                if (!string.IsNullOrEmpty(sSendType))
                {
                    queryable = queryable.Where(lt => lt.podDir.Equals(sSendType));
                }

                List <DistributeTaskModel> distributeTaskModels = new List <DistributeTaskModel>();
                foreach (DST_DistributeTask dstDistributeTask in queryable)
                {
                    DistributeTaskModel distributeTaskModel = new DistributeTaskModel();
                    distributeTaskModel.ID                 = dstDistributeTask.ID;
                    distributeTaskModel.reqCode            = dstDistributeTask.reqCode;
                    distributeTaskModel.reqTime            = dstDistributeTask.reqTime;
                    distributeTaskModel.clientCode         = dstDistributeTask.clientCode;
                    distributeTaskModel.tokenCode          = dstDistributeTask.tokenCode;
                    distributeTaskModel.taskTyp            = dstDistributeTask.taskTyp;
                    distributeTaskModel.userCallCode       = dstDistributeTask.userCallCode;
                    distributeTaskModel.taskGroupCode      = dstDistributeTask.taskGroupCode;
                    distributeTaskModel.startPosition      = dstDistributeTask.startPosition;
                    distributeTaskModel.endPosition        = dstDistributeTask.endPosition;
                    distributeTaskModel.podCode            = dstDistributeTask.podCode;
                    distributeTaskModel.podDir             = dstDistributeTask.podDir;
                    distributeTaskModel.priority           = dstDistributeTask.priority;
                    distributeTaskModel.robotCode          = dstDistributeTask.robotCode;
                    distributeTaskModel.taskCode           = dstDistributeTask.taskCode;
                    distributeTaskModel.data               = dstDistributeTask.data;
                    distributeTaskModel.DistributeReqTypes = dstDistributeTask.DistributeReqTypes;
                    distributeTaskModel.isResponse         = dstDistributeTask.isResponse;
                    distributeTaskModel.arriveTime         = dstDistributeTask.arriveTime;
                    distributeTaskModel.sendErrorCount     = dstDistributeTask.sendErrorCount;
                    distributeTaskModel.IsChecked          = false;

                    distributeTaskModels.Add(distributeTaskModel);
                }

                //this.dataGrid.ItemsSource = queryable.ToList();
                this.dataGrid.ItemsSource = distributeTaskModels;
            }
        }