protected void storeData_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            //storeData.DataSource = new List<SPRecordWrapper>();
            //storeData.DataBind();

            PageQueryParams pageQueryParams = WebUIHelper.GetPageQueryParamFromStoreRefreshDataEventArgs(e,
                                                                                                         this.
                                                                                                         PagingToolBar1);

            RecordSortor recordSortor = WebUIHelper.GetRecordSortorFromStoreRefreshDataEventArgs(e);

            SPChannelWrapper channel = null;



            SPSClientWrapper client = this.Client;



            SPCodeWrapper code = null;

            if (this.cmbCode.SelectedItem != null)
            {
                code = SPCodeWrapper.FindById(Convert.ToInt32(this.cmbCode.SelectedItem.Value));
            }

            DateTime?startDate = null;

            if (this.dfStart.SelectedValue != null)
            {
                startDate = this.dfStart.SelectedDate;
            }

            DateTime?endDate = null;

            if (this.dfEnd.SelectedValue != null)
            {
                endDate = this.dfEnd.SelectedDate;
            }

            List <QueryFilter> queryFilters = new List <QueryFilter>();

            if (!string.IsNullOrEmpty(this.txtPhoneNumber.Text.Trim()))
            {
                queryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_MOBILE, this.txtPhoneNumber.Text.Trim(), FilterFunction.StartsWith));
            }

            if (!string.IsNullOrEmpty(this.txtLinkID.Text.Trim()))
            {
                queryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_LINKID, this.txtLinkID.Text.Trim(), FilterFunction.StartsWith));
            }

            if (!string.IsNullOrEmpty(this.txtSpNumber.Text.Trim()))
            {
                queryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_SPNUMBER, this.txtSpNumber.Text.Trim(), FilterFunction.StartsWith));
            }

            if (!string.IsNullOrEmpty(this.txtMo.Text.Trim()))
            {
                queryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_MO, this.txtMo.Text.Trim(), FilterFunction.StartsWith));
            }


            queryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_ISINTERCEPT, (false).ToString(), FilterFunction.EqualTo));


            queryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_ISSTATOK, (true).ToString(), FilterFunction.EqualTo));


            //if (this.cmbSycnStatus.SelectedItem != null && this.cmbSycnStatus.SelectedItem.Value != null)
            //{
            //    queryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_ISSYCNSUCCESSED, (this.cmbSycnStatus.SelectedItem.Value == "1").ToString(), FilterFunction.EqualTo));
            //}

            if (this.cmbProvince.SelectedItem != null && this.cmbProvince.SelectedItem.Value != null)
            {
                queryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_PROVINCE, this.cmbProvince.SelectedItem.Value.ToString(), FilterFunction.EqualTo));
            }

            if (this.cmbOperateType.SelectedItem != null && this.cmbOperateType.SelectedItem.Value != null)
            {
                queryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_OPERATORTYPE, this.cmbOperateType.SelectedItem.Value.ToString(), FilterFunction.EqualTo));
            }

            storeData.DataSource = SPRecordWrapper.QueryRecordByPage(channel, code, client, SPRecordWrapper.DayReportType_AllUp, startDate, endDate, queryFilters, recordSortor.OrderByColumnName, recordSortor.IsDesc, pageQueryParams);
            e.Total = pageQueryParams.RecordCount;
            storeData.DataBind();
        }
        private ReportSearchCondition GetReportSearchCondition(RecordSortor eSortor)
        {
            ReportSearchCondition reportSearchCondition = new ReportSearchCondition();

            reportSearchCondition.RecordSortor = eSortor;

            reportSearchCondition.Channel = null;

            if (this.cmbChannel.SelectedItem != null)
            {
                reportSearchCondition.Channel = SPChannelWrapper.FindById(Convert.ToInt32(this.cmbChannel.SelectedItem.Value));
            }

            reportSearchCondition.Client = null;

            if (this.cmbClient.SelectedItem != null)
            {
                reportSearchCondition.Client = SPSClientWrapper.FindById(Convert.ToInt32(this.cmbClient.SelectedItem.Value));
            }

            reportSearchCondition.Code = null;

            if (this.cmbCode.SelectedItem != null)
            {
                reportSearchCondition.Code = SPCodeWrapper.FindById(Convert.ToInt32(this.cmbCode.SelectedItem.Value));
            }

            reportSearchCondition.StartDate = null;

            if (this.dfStart.SelectedValue != null)
            {
                reportSearchCondition.StartDate = this.dfStart.SelectedDate;
            }

            reportSearchCondition.EndDate = null;

            if (this.dfEnd.SelectedValue != null)
            {
                reportSearchCondition.EndDate = this.dfEnd.SelectedDate;
            }

            reportSearchCondition.QueryFilters = new List <QueryFilter>();

            if (!string.IsNullOrEmpty(this.txtPhoneNumber.Text.Trim()))
            {
                reportSearchCondition.QueryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_MOBILE,
                                                                       this.txtPhoneNumber.Text.Trim(),
                                                                       FilterFunction.StartsWith));
            }

            if (!string.IsNullOrEmpty(this.txtLinkID.Text.Trim()))
            {
                reportSearchCondition.QueryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_LINKID,
                                                                       this.txtLinkID.Text.Trim(), FilterFunction.StartsWith));
            }

            if (!string.IsNullOrEmpty(this.txtSpNumber.Text.Trim()))
            {
                reportSearchCondition.QueryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_SPNUMBER,
                                                                       this.txtSpNumber.Text.Trim(), FilterFunction.StartsWith));
            }

            if (!string.IsNullOrEmpty(this.txtMo.Text.Trim()))
            {
                reportSearchCondition.QueryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_MO, this.txtMo.Text.Trim(),
                                                                       FilterFunction.StartsWith));
            }

            if (this.cmbIntercepter.SelectedItem != null && this.cmbIntercepter.SelectedItem.Value != null)
            {
                reportSearchCondition.QueryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_ISINTERCEPT,
                                                                       (this.cmbIntercepter.SelectedItem.Value == "1").ToString(),
                                                                       FilterFunction.EqualTo));
            }

            if (this.cmbStatus.SelectedItem != null && this.cmbStatus.SelectedItem.Value != null)
            {
                reportSearchCondition.QueryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_ISSTATOK,
                                                                       (this.cmbStatus.SelectedItem.Value == "1").ToString(),
                                                                       FilterFunction.EqualTo));
            }

            if (this.cmbSycnStatus.SelectedItem != null && this.cmbSycnStatus.SelectedItem.Value != null)
            {
                reportSearchCondition.QueryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_ISSYCNSUCCESSED,
                                                                       (this.cmbSycnStatus.SelectedItem.Value == "1").ToString(),
                                                                       FilterFunction.EqualTo));
            }

            if (this.cmbProvince.SelectedItem != null && this.cmbProvince.SelectedItem.Value != null)
            {
                reportSearchCondition.QueryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_PROVINCE,
                                                                       this.cmbProvince.SelectedItem.Value.ToString(),
                                                                       FilterFunction.EqualTo));
            }

            if (this.cmbOperateType.SelectedItem != null && this.cmbOperateType.SelectedItem.Value != null)
            {
                reportSearchCondition.QueryFilters.Add(new QueryFilter(SPRecordWrapper.PROPERTY_NAME_OPERATORTYPE,
                                                                       this.cmbOperateType.SelectedItem.Value.ToString(),
                                                                       FilterFunction.EqualTo));
            }
            return(reportSearchCondition);
        }