예제 #1
0
        //Added One Parameter for Ref:Task no:85
        public void GenerateRows(DataTable _dtPharmacies, bool IsSearchPage)
        {
            try
            {
                PanelPharmacyList.Controls.Clear();
                Table tbPharmaciesList = new Table();
                tbPharmaciesList.ID = System.Guid.NewGuid().ToString();

                tbPharmaciesList.Width = new Unit(100, UnitType.Percentage);
                //tbPharmaciesList.Height = new Unit(100, UnitType.Pixel);
                TableHeaderRow  thTitle  = new TableHeaderRow();
                TableHeaderCell thBlank1 = new TableHeaderCell();
                TableHeaderCell thBlank2 = new TableHeaderCell();
                TableHeaderCell thc      = new TableHeaderCell();

                //Pharmacy ID
                TableHeaderCell thID = new TableHeaderCell();
                thID.Text           = "ID";
                thID.Font.Underline = true;

                thID.Attributes.Add("ColumnName", "PharmacyId");
                thID.Attributes.Add("SortOrder", setAttributes());
                //Code added by Loveena in ref to Task#3008
                if (_dtPharmacies.Rows.Count > 0)
                {
                    thID.CssClass = "handStyle";
                    if (IsSearchPage)
                    {
                        thID.Attributes.Add("onclick", "onHeaderSearchClick(this)");
                    }
                    else
                    {
                        thID.Attributes.Add("onclick", "onHeaderClick(this)");
                    }
                }
                thID.Attributes.Add("align", "left");
                if (SortString.Split(' ')[0] == "PharmacyId")
                {
                    thc = thID;
                }

                //Active
                TableHeaderCell thActive = new TableHeaderCell();
                thActive.Text           = "Active";
                thActive.Font.Underline = true;

                thActive.Attributes.Add("ColumnName", "Active");
                thActive.Attributes.Add("SortOrder", setAttributes());
                thActive.Style.Add("padding-right", "10px");
                //Code added by Loveena in ref to Task#3008
                if (_dtPharmacies.Rows.Count > 0)
                {
                    thActive.CssClass = "handStyle";
                    if (IsSearchPage)
                    {
                        thActive.Attributes.Add("onclick", "onHeaderSearchClick(this)");
                    }
                    else
                    {
                        thActive.Attributes.Add("onclick", "onHeaderClick(this)");
                    }
                }
                thActive.Attributes.Add("align", "left");
                if (SortString.Split(' ')[0] == "Active")
                {
                    thc = thActive;
                }

                //Added By Priya to add new Field for Pharmacy Search Page Date 15th Feb 2010
                TableHeaderCell thPreferredPharmacy = new TableHeaderCell();
                if (IsSearchPage)
                {
                    //Preferred Pharmacy

                    thPreferredPharmacy.Text           = "Preferred";
                    thPreferredPharmacy.Font.Underline = true;
                    thPreferredPharmacy.Attributes.Add("ColumnName", "PreferredPharmacy");
                    thPreferredPharmacy.Attributes.Add("SortOrder", setAttributes());
                    //Code added by Loveena in ref to Task#3008
                    if (_dtPharmacies.Rows.Count > 0)
                    {
                        thPreferredPharmacy.CssClass = "handStyle";
                        thPreferredPharmacy.Attributes.Add("onclick", "onHeaderSearchClick(this)");
                    }
                    thPreferredPharmacy.Attributes.Add("align", "left");
                    if (SortString.Split(' ')[0] == "PreferredPharmacy")
                    {
                        thc = thPreferredPharmacy;
                    }
                }
                //Pharmacy Name
                TableHeaderCell thPharmacyName = new TableHeaderCell();
                thPharmacyName.Text           = "Name";
                thPharmacyName.Font.Underline = true;


                thPharmacyName.Attributes.Add("ColumnName", "PharmacyName");
                thPharmacyName.Attributes.Add("SortOrder", setAttributes());
                //Code added by Loveena in ref to Task#3008
                if (_dtPharmacies.Rows.Count > 0)
                {
                    thPharmacyName.CssClass = "handStyle";
                    if (IsSearchPage)
                    {
                        thPharmacyName.Attributes.Add("onclick", "onHeaderSearchClick(this)");
                    }
                    else
                    {
                        thPharmacyName.Attributes.Add("onclick", "onHeaderClick(this)");
                    }
                }
                thPharmacyName.Attributes.Add("align", "left");
                if (SortString.Split(' ')[0] == "PharmacyName")
                {
                    thc = thPharmacyName;
                }

                //Address
                TableHeaderCell thAddress = new TableHeaderCell();
                thAddress.Text           = "Address";
                thAddress.Font.Underline = true;

                thAddress.Attributes.Add("ColumnName", "Address");
                thAddress.Attributes.Add("SortOrder", setAttributes());
                //Code added by Loveena in ref to Task#3008
                if (_dtPharmacies.Rows.Count > 0)
                {
                    thAddress.CssClass = "handStyle";
                    if (IsSearchPage)
                    {
                        thAddress.Attributes.Add("onclick", "onHeaderSearchClick(this)");
                    }
                    else
                    {
                        thAddress.Attributes.Add("onclick", "onHeaderClick(this)");
                    }
                }
                thAddress.Attributes.Add("align", "left");
                if (SortString.Split(' ')[0] == "Address")
                {
                    thc = thAddress;
                }

                //City
                TableHeaderCell thCity = new TableHeaderCell();
                thCity.Text           = "City";
                thCity.Font.Underline = true;

                thCity.Attributes.Add("ColumnName", "City");
                thCity.Attributes.Add("SortOrder", setAttributes());
                //Code added by Loveena in ref to Task#3008
                if (_dtPharmacies.Rows.Count > 0)
                {
                    thCity.CssClass = "handStyle";
                    if (IsSearchPage)
                    {
                        thCity.Attributes.Add("onclick", "onHeaderSearchClick(this)");
                    }
                    else
                    {
                        thCity.Attributes.Add("onclick", "onHeaderClick(this)");
                    }
                }
                thCity.Attributes.Add("align", "left");
                if (SortString.Split(' ')[0] == "City")
                {
                    thc = thCity;
                }

                //State
                TableHeaderCell thState = new TableHeaderCell();
                thState.Text           = "State";
                thState.Font.Underline = true;

                thState.Attributes.Add("ColumnName", "State");
                thState.Attributes.Add("SortOrder", setAttributes());
                thState.Style.Add("padding-right", "10px");
                //Code added by Loveena in ref to Task#3008
                if (_dtPharmacies.Rows.Count > 0)
                {
                    thState.CssClass = "handStyle";
                    if (IsSearchPage)
                    {
                        thState.Attributes.Add("onclick", "onHeaderSearchClick(this)");
                    }
                    else
                    {
                        thState.Attributes.Add("onclick", "onHeaderClick(this)");
                    }
                }
                thState.Attributes.Add("align", "left");
                if (SortString.Split(' ')[0] == "State")
                {
                    thc = thState;
                }

                //State
                TableHeaderCell thZip = new TableHeaderCell();
                thZip.Text           = "Zip Code";
                thZip.Font.Underline = true;

                thZip.Attributes.Add("ColumnName", "ZipCode");
                thZip.Attributes.Add("SortOrder", setAttributes());
                //Code added by Loveena in ref to Task#3008
                if (_dtPharmacies.Rows.Count > 0)
                {
                    thZip.CssClass = "handStyle";
                    if (IsSearchPage)
                    {
                        thZip.Attributes.Add("onclick", "onHeaderSearchClick(this)");
                    }
                    else
                    {
                        thZip.Attributes.Add("onclick", "onHeaderClick(this)");
                    }
                }
                thZip.Attributes.Add("align", "left");
                if (SortString.Split(' ')[0] == "ZipCode")
                {
                    thc = thZip;
                }

                //Phone
                TableHeaderCell thPhone = new TableHeaderCell();
                thPhone.Text           = "Phone";
                thPhone.Font.Underline = true;
                thPhone.Attributes.Add("ColumnName", "PhoneNumber");
                thPhone.Attributes.Add("SortOrder", setAttributes());
                //Code added by Loveena in ref to Task#3008
                if (_dtPharmacies.Rows.Count > 0)
                {
                    thPhone.CssClass = "handStyle";
                    if (IsSearchPage)
                    {
                        thPhone.Attributes.Add("onclick", "onHeaderSearchClick(this)");
                    }
                    else
                    {
                        thPhone.Attributes.Add("onclick", "onHeaderClick(this)");
                    }
                }
                thPhone.Attributes.Add("align", "left");
                if (SortString.Split(' ')[0] == "PhoneNumber")
                {
                    thc = thPhone;
                }

                //Fax
                TableHeaderCell thFax = new TableHeaderCell();
                thFax.Text           = "Fax";
                thFax.Font.Underline = true;
                thFax.Attributes.Add("ColumnName", "FaxNumber");
                thFax.Attributes.Add("SortOrder", setAttributes());
                //Code added by Loveena in ref to Task#3008
                if (_dtPharmacies.Rows.Count > 0)
                {
                    thFax.CssClass = "handStyle";
                    if (IsSearchPage)
                    {
                        thFax.Attributes.Add("onclick", "onHeaderSearchClick(this)");
                    }
                    else
                    {
                        thFax.Attributes.Add("onclick", "onHeaderClick(this)");
                    }
                }
                thFax.Attributes.Add("align", "left");
                if (SortString.Split(' ')[0] == "FaxNumber")
                {
                    thc = thFax;
                }

                TableHeaderCell thSpecialty = new TableHeaderCell();
                thSpecialty.Text           = "Specialty";
                thSpecialty.Font.Underline = true;
                thSpecialty.Attributes.Add("ColumnName", "Specialty");
                thSpecialty.Attributes.Add("SortOrder", setAttributes());
                //Code added by Loveena in ref to Task#3008
                if (_dtPharmacies.Rows.Count > 0)
                {
                    thSpecialty.CssClass = "handStyle";
                    if (IsSearchPage)
                    {
                        thSpecialty.Attributes.Add("onclick", "onHeaderSearchClick(this)");
                    }
                    else
                    {
                        thSpecialty.Attributes.Add("onclick", "onHeaderClick(this)");
                    }
                }
                thSpecialty.Attributes.Add("align", "left");
                if (SortString.Split(' ')[0] == "Specialty")
                {
                    thc = thSpecialty;
                }

                //Added By Priya
                TableHeaderCell thSureScriptsPharmacyIdentifier = new TableHeaderCell();
                if (IsSearchPage)
                {
                    //Preferred Pharmacy

                    thSureScriptsPharmacyIdentifier.Text           = "SureScripts Identifier";
                    thSureScriptsPharmacyIdentifier.Font.Underline = true;
                    thSureScriptsPharmacyIdentifier.Attributes.Add("ColumnName", "SureScriptsPharmacyIdentifier");
                    thSureScriptsPharmacyIdentifier.Attributes.Add("SortOrder", setAttributes());
                    //Code added by Loveena in ref to Task#3008
                    if (_dtPharmacies.Rows.Count > 0)
                    {
                        thSureScriptsPharmacyIdentifier.CssClass = "handStyle";
                        thSureScriptsPharmacyIdentifier.Attributes.Add("onclick", "onHeaderSearchClick(this)");
                    }
                    thSureScriptsPharmacyIdentifier.Attributes.Add("align", "left");
                    if (SortString.Split(' ')[0] == "SureScriptsPharmacyIdentifier")
                    {
                        thc = thSureScriptsPharmacyIdentifier;
                    }
                }

                thTitle.Cells.Add(thBlank1);
                if (!IsSearchPage)
                {
                    thTitle.Cells.Add(thBlank2);
                }
                thTitle.Cells.Add(thID);
                thTitle.Cells.Add(thActive);
                //added By Priya
                if (IsSearchPage)
                {
                    thTitle.Cells.Add(thPreferredPharmacy);
                }
                thTitle.Cells.Add(thPharmacyName);
                thTitle.Cells.Add(thAddress);
                thTitle.Cells.Add(thCity);
                thTitle.Cells.Add(thState);
                thTitle.Cells.Add(thZip);
                thTitle.Cells.Add(thPhone);
                thTitle.Cells.Add(thFax);
                thTitle.Cells.Add(thSpecialty);
                //Added By PRiya
                if (IsSearchPage)
                {
                    thTitle.Cells.Add(thSureScriptsPharmacyIdentifier);
                }
                thTitle.CssClass = "GridViewHeaderText";

                tbPharmaciesList.Rows.Add(thTitle);

                string myscript = "<script id='Pharmacylist' type='text/javascript'>";
                if (!IsSearchPage)
                {
                    myscript += "function $deleteRecord(sender,e){";
                    if (!string.IsNullOrEmpty(_deleteRowMessage))
                    {
                        //myscript += " if (confirm ('" + _deleteRowMessage + "') == true ){" + this._onDeleteEventHandler + "(sender,e)}}";
                        myscript += this._onDeleteEventHandler + "(sender,e);  }";
                    }
                    else
                    {
                        myscript += "}";
                    }
                }
                DataRow dtr = null;
                myscript += "function RegisterPharmacyListControlEvents(){try{";
                if (_dtPharmacies.Rows.Count > 0)
                {
                    if (SortString.Split(' ')[1] == "Asc")
                    {
                        thc.Style.Add("background", "url(App_Themes/Includes/Images/ListPageUp.png) right no-repeat, url(App_Themes/Includes/Images/list_grid_header_bg.gif) left repeat-x");
                    }
                    else
                    {
                        thc.Style.Add("background", "url(App_Themes/Includes/Images/ListPageDown.png) right no-repeat, url(App_Themes/Includes/Images/list_grid_header_bg.gif) left repeat-x");
                    }

                    Int32 rowCount = 0;
                    foreach (DataRow dr in _dtPharmacies.Rows)
                    {
                        rowCount++;
                        string pharmacyId   = Convert.ToString(dr["PharmacyId"]);
                        string pharmacyName = dr["PharmacyName"].ToString();
                        string active       = dr["Active"].ToString();
                        string address      = string.Empty;
                        if (dr["Address"].ToString().Length > 50)
                        {
                            address = dr["Address"].ToString().Substring(0, 50) + "..";
                        }
                        else
                        {
                            address = dr["Address"].ToString();
                        }
                        string City      = dr["City"].ToString();
                        string state     = dr["State"].ToString();
                        string Zip       = dr["ZipCode"].ToString();
                        string phone     = dr["PhoneNumber"].ToString();
                        string fax       = dr["FaxNumber"].ToString();
                        string specialty = dr["Specialty"].ToString();

                        string PreferredPharmacy             = dr["PreferredPharmacy"].ToString();
                        string SureScriptsPharmacyIdentifier = dr["SureScriptsPharmacyIdentifier"].ToString();
                        tbPharmaciesList.Rows.Add(GenerateSubRows(dr, pharmacyId, pharmacyName, active, address, phone, fax, SureScriptsPharmacyIdentifier, PreferredPharmacy, tbPharmaciesList.ClientID, ref myscript, IsSearchPage, City, state, Zip, specialty, rowCount));
                    }
                }
                else
                {
                    tbPharmaciesList.Rows.Add(GenerateSubRows(dtr, "", "", "", "No Records Found", "", "", "", "", tbPharmaciesList.ClientID, ref myscript, IsSearchPage, "", "", "", "", 0));
                }

                TableRow  trLine           = new TableRow();
                TableCell tdHorizontalLine = new TableCell();
                tdHorizontalLine.ColumnSpan = 12;
                tdHorizontalLine.CssClass   = "blackLine";
                trLine.Cells.Add(tdHorizontalLine);
                tbPharmaciesList.Rows.Add(trLine);
                tbPharmaciesList.CellPadding = 0;
                tbPharmaciesList.CellSpacing = 0;
                PanelPharmacyList.Controls.Add(tbPharmaciesList);
                myscript += "}catch(e){  Streamline.SmartClient.ExceptionManager.getInstance().publishException(ERROR_CODE_REGULAR, e);}}</script>";
                Page.RegisterClientScriptBlock(this.ClientID, myscript);
            }
            catch (Exception ex)
            {
                if (ex.Data["CustomExceptionInformation"] == null)
                {
                    ex.Data["CustomExceptionInformation"] = "";
                }
                else
                {
                    ex.Data["CustomExceptionInformation"] = "";
                }
                if (ex.Data["DatasetInfo"] == null)
                {
                    ex.Data["DatasetInfo"] = null;
                }
                throw (ex);
            }
        }
예제 #2
0
    public void GenerateRows(DataTable _dtPrinter)
    {
        try
        {
            PanelPrinterList.Controls.Clear();
            Table tbPrinterList = new Table();
            tbPrinterList.ID = System.Guid.NewGuid().ToString();

            tbPrinterList.Width = new Unit(100, UnitType.Percentage);
            //tbPharmaciesList.Height = new Unit(100, UnitType.Pixel);
            TableHeaderRow  thTitle  = new TableHeaderRow();
            TableHeaderCell thBlank1 = new TableHeaderCell();
            thBlank1.Width = new Unit(1, UnitType.Percentage);
            TableHeaderCell thBlank2 = new TableHeaderCell();
            thBlank2.Width = new Unit(1, UnitType.Percentage);
            TableHeaderCell thc = new TableHeaderCell();

            //Printer ID
            TableHeaderCell thID = new TableHeaderCell();
            thID.Text           = "ID";
            thID.Font.Underline = true;
            thID.Attributes.Add("onclick", "onPrinterHeaderClick(this)");
            thID.Attributes.Add("ColumnName", "PrinterDeviceLocationId");
            thID.Attributes.Add("SortOrder", setAttributes());
            thID.CssClass = "handStyle";
            thID.Attributes.Add("align", "left");
            thID.Width = new Unit(7, UnitType.Percentage);

            //Active
            TableHeaderCell thActive = new TableHeaderCell();
            thActive.Text           = "Active";
            thActive.Font.Underline = true;
            thActive.Attributes.Add("onclick", "onPrinterHeaderClick(this)");
            thActive.Attributes.Add("ColumnName", "Active");
            thActive.Attributes.Add("SortOrder", setAttributes());
            thActive.CssClass = "handStyle";
            thActive.Attributes.Add("align", "left");
            thActive.Width = new Unit(11, UnitType.Percentage);

            // DeviceLabel
            TableHeaderCell thPrinterName = new TableHeaderCell();
            thPrinterName.Text           = "Device Label";
            thPrinterName.Font.Underline = true;
            thPrinterName.Attributes.Add("onclick", "onPrinterHeaderClick(this)");
            thPrinterName.Attributes.Add("ColumnName", "DeviceLabel");
            thPrinterName.Attributes.Add("SortOrder", setAttributes());
            thPrinterName.CssClass = "handStyle";
            thPrinterName.Attributes.Add("center", "left");
            thPrinterName.Width = new Unit(35, UnitType.Percentage);

            //DeviceUNCPath
            TableHeaderCell thDeviceUNCPath = new TableHeaderCell();
            thDeviceUNCPath.Text           = "Device UNC Path";
            thDeviceUNCPath.Font.Underline = true;
            thDeviceUNCPath.Attributes.Add("onclick", "onPrinterHeaderClick(this)");
            thDeviceUNCPath.Attributes.Add("ColumnName", "DeviceUNCPath");
            thDeviceUNCPath.Attributes.Add("SortOrder", setAttributes());
            thDeviceUNCPath.CssClass = "handStyle";
            thDeviceUNCPath.Attributes.Add("align", "left");
            thDeviceUNCPath.Width = new Unit(45, UnitType.Percentage);


            thTitle.Cells.Add(thBlank1);
            thTitle.Cells.Add(thBlank2);
            thTitle.Cells.Add(thID);
            thTitle.Cells.Add(thActive);
            thTitle.Cells.Add(thPrinterName);
            thTitle.Cells.Add(thDeviceUNCPath);

            //thTitle.Cells.Add(thPhone);
            //thTitle.Cells.Add(thFax);

            thTitle.CssClass = "GridViewHeaderText";

            tbPrinterList.Rows.Add(thTitle);
            tbPrinterList.CellSpacing = 0;
            tbPrinterList.CellPadding = 0;

            string myscript = "<script id='Printerlist' type='text/javascript'>";
            myscript += "function $deleteRecord(sender,e){";
            if (!string.IsNullOrEmpty(_deleteRowMessage))
            {
                // myscript += " if (confirm ('" + _deleteRowMessage + "') == true ){" + this._onDeleteEventHandler + "(sender,e)}}";
                myscript += this._onDeleteEventHandler + "(sender,e);  }";
            }
            else
            {
                myscript += "}";
            }

            myscript += "function RegisterPrinterListControlEvents(){try{ ";
            if (_dtPrinter.Rows.Count > 0)
            {
                if (SortString.Split(' ')[0] == "PrinterDeviceLocationId")
                {
                    thc = thID;
                }
                else if (SortString.Split(' ')[0] == "Active")
                {
                    thc = thActive;
                }
                else if (SortString.Split(' ')[0] == "DeviceLabel")
                {
                    thc = thPrinterName;
                }
                else if (SortString.Split(' ')[0] == "DeviceUNCPath")
                {
                    thc = thDeviceUNCPath;
                }
                if (SortString.Split(' ')[1] == "Asc")
                {
                    thc.Style.Add("background", "url(App_Themes/Includes/Images/ListPageUp.png) right no-repeat, url(App_Themes/Includes/Images/list_grid_header_bg.gif) left repeat-x");
                }
                else
                {
                    thc.Style.Add("background", "url(App_Themes/Includes/Images/ListPageDown.png) right no-repeat, url(App_Themes/Includes/Images/list_grid_header_bg.gif) left repeat-x");
                }
                string rowClass = "GridViewRowStyle";

                foreach (DataRow dr in _dtPrinter.Rows)
                {
                    int    PrinterDeviceLocationId = Convert.ToInt32(dr["PrinterDeviceLocationId"]);
                    string DeviceLabel             = dr["DeviceLabel"].ToString();
                    string active = dr["Active"].ToString();
                    //string address = string.Empty;
                    //if (dr["Address"].ToString().Length > 50)
                    //{
                    //    address = dr["Address"].ToString().Substring(0, 50) + "..";
                    //}
                    //else
                    //{
                    //    address = dr["Address"].ToString();
                    //}
                    string DeviceUNCPath = dr["DeviceUNCPath"].ToString();
                    //string fax = dr["FaxNumber"].ToString();
                    tbPrinterList.Rows.Add(GenerateSubRows(dr, PrinterDeviceLocationId, DeviceLabel, active, DeviceUNCPath, tbPrinterList.ClientID, ref myscript, rowClass));
                    rowClass = rowClass == "GridViewRowStyle" ? "GridViewAlternatingRowStyle" : "GridViewRowStyle";
                }
            }

            //TableRow trLine = new TableRow();
            //TableCell tdHorizontalLine = new TableCell();
            //tdHorizontalLine.ColumnSpan = 12;
            //tdHorizontalLine.CssClass = "blackLine";
            //trLine.Cells.Add(tdHorizontalLine);
            //tbPrinterList.Rows.Add(trLine);

            PanelPrinterList.Controls.Add(tbPrinterList);
            myscript += "}catch(e){  Streamline.SmartClient.ExceptionManager.getInstance().publishException(ERROR_CODE_REGULAR, e);}}</script>";
            Page.RegisterClientScriptBlock(this.ClientID, myscript);
        }
        catch (Exception ex)
        {
            if (ex.Data["CustomExceptionInformation"] == null)
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            else
            {
                ex.Data["CustomExceptionInformation"] = "";
            }
            if (ex.Data["DatasetInfo"] == null)
            {
                ex.Data["DatasetInfo"] = null;
            }
            throw (ex);
        }
    }
예제 #3
0
    /// <summary>
    /// 调用 OnQuery 回调方法获得数据源
    /// </summary>
    protected async Task QueryData()
    {
        // 目前设计使用 Items 参数后不回调 OnQueryAsync 方法
        if (Items == null)
        {
            if (OnQueryAsync == null && DynamicContext != null && typeof(TItem).IsAssignableTo(typeof(IDynamicObject)))
            {
                // 动态数据
                SelectedRows.Clear();
                QueryItems = DynamicContext.GetItems().Cast <TItem>();
                if (DynamicContext.OnGetSelectedRows != null)
                {
                    SelectedRows.AddRange(DynamicContext.OnGetSelectedRows().Cast <TItem>());
                }
                TotalCount = QueryItems.Count();
            }
            else
            {
                // 数据集合
                await OnQuery();
            }
        }
        else
        {
            RowsCache = null;
        }

        async Task OnQuery()
        {
            QueryData <TItem>?queryData = null;
            var queryOption             = new QueryPageOptions()
            {
                IsPage          = IsPagination,
                PageIndex       = PageIndex,
                PageItems       = PageItems,
                SearchText      = SearchText,
                SortOrder       = SortOrder,
                SortName        = SortName,
                SortList        = string.IsNullOrEmpty(SortString) ? null : new List <string>(SortString.Split(",", StringSplitOptions.RemoveEmptyEntries)),
                Filters         = Filters.Values,
                Searchs         = GetSearchs(),
                AdvanceSearchs  = GetAdvanceSearchs(),
                CustomerSearchs = GetCustomerSearchs(),
                SearchModel     = SearchModel,
                StartIndex      = StartIndex
            };

            if (CustomerSearchModel != null)
            {
                queryOption.SearchModel = CustomerSearchModel;
            }

            queryData = await InternalOnQueryAsync(queryOption);

            RowsCache       = null;
            Items           = null;
            QueryItems      = queryData.Items;
            TotalCount      = queryData.TotalCount;
            IsAdvanceSearch = queryData.IsAdvanceSearch;

            // 处理选中行逻辑
            ProcessSelectedRows();

            // 分页情况下内部不做处理防止页码错乱
            if (!queryOption.IsPage)
            {
                ProcessPageData(queryData, queryOption);
            }

            if (IsTree)
            {
                await ProcessTreeData();
            }

            void ProcessSelectedRows()
            {
                // 判断模型是否有 [Key] Id 等可识别字段尝试重构
                var rows = new List <TItem>();

                if (HasKeyAttribute)
                {
                    // 更新选中行逻辑
                    foreach (var item in SelectedRows)
                    {
                        var key = Utility.GetKeyValue <TItem, object>(item);
                        if (key != null)
                        {
                            var row = QueryItems.FirstOrDefault(i => Utility.GetKeyValue <TItem, object>(i).ToString() == key.ToString());
                            if (row != null)
                            {
                                rows.Add(row);
                            }
                        }
                    }
                }
                else
                {
                    foreach (var row in SelectedRows)
                    {
                        if (QueryItems.Any(i => i == row))
                        {
                            rows.Add(row);
                        }
                    }
                }
                SelectedRows = rows;
            }

            void ProcessPageData(QueryData <TItem> queryData, QueryPageOptions queryOption)
            {
                var filtered = queryData.IsFiltered;
                var sorted   = queryData.IsSorted;
                var searched = queryData.IsSearch;

                // 外部未处理 SearchText 模糊查询
                if (!searched && queryOption.Searchs.Any())
                {
                    QueryItems = QueryItems.Where(queryOption.Searchs.GetFilterFunc <TItem>(FilterLogic.Or));
                    TotalCount = QueryItems.Count();
                }

                // 外部未处理自定义高级搜索 内部进行高级自定义搜索过滤
                if (!IsAdvanceSearch && queryOption.CustomerSearchs.Any())
                {
                    QueryItems      = QueryItems.Where(queryOption.CustomerSearchs.GetFilterFunc <TItem>());
                    TotalCount      = QueryItems.Count();
                    IsAdvanceSearch = true;
                }

                // 外部未过滤,内部自行过滤
                if (!filtered && queryOption.Filters.Any())
                {
                    QueryItems = QueryItems.Where(queryOption.Filters.GetFilterFunc <TItem>());
                    TotalCount = QueryItems.Count();
                }

                // 外部未处理排序,内部自行排序
                // 先处理列头排序 再处理默认多列排序
                if (!sorted)
                {
                    if (queryOption.SortOrder != SortOrder.Unset && !string.IsNullOrEmpty(queryOption.SortName))
                    {
                        var invoker = Utility.GetSortFunc <TItem>();
                        QueryItems = invoker(QueryItems, queryOption.SortName, queryOption.SortOrder);
                    }
                    else if (queryOption.SortList != null && queryOption.SortList.Any())
                    {
                        var invoker = Utility.GetSortListFunc <TItem>();
                        QueryItems = invoker(QueryItems, queryOption.SortList);
                    }
                }
            }

            async Task ProcessTreeData()
            {
                KeySet.Clear();
                if (HasKeyAttribute)
                {
                    CheckExpandKeys(TreeRows);
                }
                if (KeySet.Count > 0)
                {
                    TreeRows = new List <TableTreeNode <TItem> >();
                    foreach (var item in QueryItems)
                    {
                        var node = new TableTreeNode <TItem>(item)
                        {
                            HasChildren = CheckTreeChildren(item),
                        };
                        node.IsExpand = IsExpandRow(node);
                        if (node.IsExpand)
                        {
                            await RestoreIsExpand(node);
                        }
                        TreeRows.Add(node);
                    }
                }
                else
                {
                    TreeRows = QueryItems.Select(item => new TableTreeNode <TItem>(item)
                    {
                        HasChildren = CheckTreeChildren(item)
                    }).ToList();
                }
            }
        }
    }