private void ShowTerminalsBinded(int pageIndex) { var totalRecords = 0; // 表达式 Expression <Func <TB_Equipment, bool> > expression = PredicateExtensions.True <TB_Equipment>(); // 必须是绑定了终端的设备 expression = expression.And(f => f.Deleted == false && f.Terminal != (int?)null); // 设备type //var type = ddlEquipmentType.SelectedValue; //if (!string.IsNullOrEmpty(type)) //{ // expression = expression.And(a => a.TB_EquipmentModel.Type == ParseInt(type)); //} // 设备model //var model = selModel.Value; //if (!string.IsNullOrEmpty(model)) { expression = expression.And(a => a.Model == ParseInt(model)); } // 是否绑定卫星 // 是否绑定卫星 -1:ignore,0:not,1:bound var sat = int.Parse(selectedSatellite.Value); spanSatellite.InnerHtml = "Satellite:" + GotSelectedType(sat); if (sat >= 0) { if (sat == 0) { expression = expression.And(a => a.TB_Terminal.Satellite == null); } else { expression = expression.And(a => a.TB_Terminal.Satellite != null); } } // 号码查询 var query = txtNumber.Value.Trim(); if (!string.IsNullOrEmpty(query)) { expression = expression.And(a => a.Number.Contains(query) || a.TB_Terminal.Number.Contains(query) || a.TB_Terminal.TB_Satellite.CardNo.Contains(query)); } var list = EquipmentInstance.FindPageList <TB_Equipment>(pageIndex, PageSize, out totalRecords, expression, "Number"); var totalPages = totalRecords / PageSize + (totalRecords % PageSize > 0 ? 1 : 0); string html = ""; if (totalRecords < 1) { html = "<tr><td colspan=\"13\">No records, You can change condition and try again or " + " <a href=\"./terminal_register.aspx\">ADD</a> new one.</td></tr>"; } else { var cnt = (pageIndex - 1) * PageSize; foreach (var obj in list) { cnt++; var id = Utility.UrlEncode(Utility.Encrypt(obj.id.ToString())); html += "<tr>" + //"<td style=\"text-align: center;\" class=\"in-tab-txt-rb\"><input type=\"checkbox\" id=\"cb_" + id + "\" /></td>" + "<td style=\"text-align: center;\" class=\"in-tab-txt-rb\">" + cnt + "</td>" + "<td class=\"in-tab-txt-rb\" style=\"text-align: left !important;\"><a href=\"./terminal_register.aspx?key=" + id + "\" >" + CheckQueryString(obj.TB_Terminal.Number) + "</a></td>" + "<td class=\"in-tab-txt-rb\" style=\"text-align: left !important; cursor: pointer;\" title=\"Click to show advanced options\">" + CheckQueryString(TerminalInstance.GetSatellite(obj.TB_Terminal, true)) + "</td>" + "<td class=\"in-tab-txt-rb\">" + obj.TB_Terminal.Firmware + "</td>" + "<td class=\"in-tab-txt-rb\">" + obj.TB_Terminal.Revision.ToString() + "</td>" + "<td class=\"in-tab-txt-rb\" style=\"text-align: left !important;\">" + TerminalTypes.GetTerminalType(obj.TB_Terminal.Type.Value) + "</td>" + "<td class=\"in-tab-txt-rb\" style=\"text-align: left !important;\">" + obj.TB_Terminal.ProductionDate.Value.ToString("yyyy/MM/dd") + "</td>" + "<td class=\"in-tab-txt-rb\">yes</td>" + "<td class=\"in-tab-txt-rb\" style=\"text-align: left !important;\">" + CheckQueryString(GetEquipment(obj.TB_Terminal, obj)) + "</td>" + "<td class=\"in-tab-txt-b\">" + Utility.GetOnlineStyle(obj.OnlineStyle, obj.OnlineTime, false) + "</td>" + //"<td class=\"in-tab-txt-rb\">" + obj.TB_Terminal.Sim + "</td>" + "<td class=\"in-tab-txt-b\"></td>" + "</tr>"; } } ShowFooter(totalRecords, pageIndex, totalPages, html); }