Ejemplo n.º 1
0
        private void ShowTerminals()
        {
            var totalRecords = 0;
            var pageIndex    = "" == hidPageIndex.Value ? 1 : int.Parse(hidPageIndex.Value);
            var list         = TerminalInstance.FindPageList <TB_Terminal>(pageIndex, PageSize, out totalRecords,
                                                                           f => f.Delete == false && f.HasBound == false && f.Type == TerminalType, "Number");
            var totalPages = totalRecords / PageSize + (totalRecords % PageSize > 0 ? 1 : 0);

            string html = "";

            if (totalRecords < 1)
            {
                html = "<tr><td colspan=\"6\">No records</tr>";
            }
            else
            {
                var cnt = (pageIndex - 1) * PageSize;
                var n   = (int?)null;
                foreach (var obj in list)
                {
                    cnt++;
                    var id = Utility.UrlEncode(Utility.Encrypt(obj.id.ToString()));
                    html += "<tr>" +
                            "<td style=\"text-align: center;\"><input type=\"radio\" name=\"satId\" id=\"cb_" + id + "\" /></td>" +
                            "<td style=\"text-align: center;\">" + cnt + "</td>" +
                            "<td><a>" + obj.Number + "</a></td>" +
                            "<td>" + obj.Sim + "</td>" +
                            "<td>" + (n == obj.Satellite ? "-" : obj.TB_Satellite.CardNo) + "</td>" +
                            "<td>" + TerminalTypes.GetTerminalType(obj.Type.Value) + "</td>" +
                            "<td></td>" +
                            "</tr>";
                }
            }
            tbodyBody.InnerHtml  = html;
            divPagging.InnerHtml = "";
            if (totalRecords > 0)
            {
                ShowPaggings(pageIndex, totalPages, totalRecords, "./terminals.aspx", divPagging);
            }
        }
Ejemplo n.º 2
0
        private void ShowFlow()
        {
            var month = int.Parse(selectedMonths.Value);

            spanMonthly.InnerText = string.Format("for {0}{1:00}", selectedYears.Value, (month == 0 ? " full year" : ("/" + month.ToString("00"))));

            var query = txtQueryNumber.Value.Trim();

            // 模糊查询时页码置为空
            if (!string.IsNullOrEmpty(query))
            {
                hidPageIndex.Value = "";
            }

            var totalRecords = 0;
            var pageIndex    = "" == hidPageIndex.Value ? 1 : int.Parse(hidPageIndex.Value);
            var list         = TerminalInstance.FindPageList <TB_Terminal>(pageIndex, PageSize, out totalRecords,
                                                                           f => f.Delete == false && (f.Sim.Contains(query) || f.TB_Satellite.CardNo.Contains(query)), "Number");
            var totalPages = totalRecords / PageSize + (totalRecords % PageSize > 0 ? 1 : 0);

            var    monthly = int.Parse(string.Format("{0}{1:00}", selectedYears.Value, month));
            string html    = "";

            if (totalRecords < 1)
            {
                html = "<tr><td colspan=\"13\">No records, Change condition and try again.</td></tr>";
            }
            else
            {
                var cnt = (pageIndex - 1) * PageSize;
                var n   = (int?)null;
                foreach (var obj in list)
                {
                    cnt++;
                    // var id = Utility.UrlEncode(Utility.Encrypt(obj.id.ToString()));
                    // 查找绑定的设备信息
                    var equipment = obj.TB_Equipment.FirstOrDefault();
                    // 查找选定月的流量统计
                    var flow = obj.TB_TerminalFlow.Where <TB_TerminalFlow>(o => (month == 0 ?
                                                                                 (o.Monthly >= monthly && o.Monthly <= monthly + 100) :
                                                                                 o.Monthly == monthly));

                    var _flow = FlowInstance.GetObject();
                    _flow.GPRSDeliver = flow.Select(s => s.GPRSDeliver).Sum();
                    _flow.GPRSReceive = flow.Select(s => s.GPRSReceive).Sum();
                    _flow.SMSDeliver  = flow.Select(s => s.SMSDeliver).Sum();
                    _flow.SMSReceive  = flow.Select(s => s.SMSReceive).Sum();
                    // 查找选定月的铱星流量
                    var _sat = IridiumInstance.GetObject();
                    if (obj.Satellite != n)
                    {
                        var sat = obj.TB_Satellite.TB_IridiumFlow.Where(w => (month == 0 ?
                                                                              (w.Monthly >= monthly && w.Monthly <= monthly + 100) : w.Monthly == monthly));
                        _sat.MOPayload = sat.Select(s => s.MOPayload).Sum();
                        _sat.MOTimes   = sat.Select(s => s.MOTimes).Sum();
                        _sat.MTPayload = sat.Select(s => s.MTPayload).Sum();
                        _sat.MTTimes   = sat.Select(s => s.MTTimes).Sum();
                    }

                    html += "<tr>" +
                            "<td class=\"in-tab-txt-b\">" + cnt + "</td>" +
                            "<td class=\"in-tab-txt-b\" style=\"text-align: left;\">" + (null == equipment ? "not bind" : EquipmentInstance.GetFullNumber(equipment)) + "</td>" +
                            "<td class=\"in-tab-txt-rb\" style=\"text-align: left;\">" + obj.Number + "</td>" +
                            "<td class=\"in-tab-txt-b\">" + CustomConvert.FormatSize(_flow.GPRSReceive.Value) + "</td>" +
                            "<td class=\"in-tab-txt-rb\">" + CustomConvert.FormatSize(_flow.GPRSDeliver.Value) + "</td>" +
                            "<td class=\"in-tab-txt-b\">" + _flow.SMSReceive.Value.ToString() + "</td>" +
                            "<td class=\"in-tab-txt-rb\">" + _flow.SMSDeliver.Value.ToString() + "</td>" +
                            "<td class=\"in-tab-txt-rb\" style=\"text-align: left;\">" + (n == obj.Satellite ? "not bind" : obj.TB_Satellite.CardNo) + "</td>" +
                            "<td class=\"in-tab-txt-b\">" + _sat.MOTimes.Value.ToString() + "</td>" +
                            "<td class=\"in-tab-txt-rb\">" + CustomConvert.FormatSize(_sat.MOPayload.Value) + "</td>" +
                            "<td class=\"in-tab-txt-b\">" + _sat.MTTimes.Value.ToString() + "</td>" +
                            "<td class=\"in-tab-txt-b\">" + CustomConvert.FormatSize(_sat.MTPayload.Value) + "</td>" +
                            "<td class=\"in-tab-txt-b\"></td>" +
                            "</tr>";
                }
            }
            tbodyBody.InnerHtml  = html;
            divPagging.InnerHtml = "";
            if (totalRecords > 0)
            {
                ShowPaggings(pageIndex, totalPages, totalRecords, "./terminal_flow.aspx", divPagging);
            }
        }
Ejemplo n.º 3
0
        private void ShowTerminalsNotBind(int pageIndex)
        {
            var totalRecords = 0;

            // 表达式
            Expression <Func <TB_Terminal, bool> > expression = PredicateExtensions.True <TB_Terminal>();

            expression = expression.And(a => a.Delete == false);
            // 是否绑定卫星 -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.Satellite == null);
                }
                else
                {
                    expression = expression.And(a => a.Satellite != null);
                }
            }
            // 是否绑定设备-1:ignore,0:not,1:bound
            var equ = int.Parse(selectedEquipment.Value);

            spanEquipment.InnerHtml = "Equipment:" + GotSelectedType(equ);
            if (equ >= 0)
            {
                if (equ == 0)
                {
                    expression = expression.And(a => a.HasBound == false);
                }
            }
            // 模糊查询
            var query = txtNumber.Value.Trim();

            if (!string.IsNullOrEmpty(query))
            {
                expression = expression.And(a => a.Number.Contains(query) || a.TB_Satellite.CardNo.Contains(query));
            }

            var list       = TerminalInstance.FindPageList <TB_Terminal>(pageIndex, PageSize, out totalRecords, expression, "Number");
            var totalPages = totalRecords / PageSize + (totalRecords % PageSize > 0 ? 1 : 0);

            string html = "";

            if (totalRecords < 1)
            {
                html = "<tr><td colspan=\"11\">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;
                //var n = (int?)null;
                foreach (var obj in list)
                {
                    cnt++;
                    var id = Utility.UrlEncode(Utility.Encrypt(obj.id.ToString()));
                    //-1:ignore,0:not,1:bound
                    var equipment = EquipmentInstance.Find(f => f.TB_Terminal.id == obj.id && f.Deleted == false);
                    //if(equ==0&&equi)
                    html += "<tr>" +
                            //"<td class=\"in-tab-txt-rb\"><input type=\"checkbox\" id=\"cb_" + id + "\" /></td>" +
                            "<td 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.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, true)) + "</td>" +
                            "<td class=\"in-tab-txt-rb\">" + obj.Firmware + "</td>" +
                            "<td class=\"in-tab-txt-rb\">" + obj.Revision.ToString() + "</td>" +
                            "<td style=\"text-align: left !important;\" class=\"in-tab-txt-rb\">" + TerminalTypes.GetTerminalType(obj.Type.Value) + "</td>" +
                            "<td class=\"in-tab-txt-rb\" style=\"text-align: left !important;\">" + obj.ProductionDate.Value.ToString("yyyy/MM/dd") + "</td>" +
                            "<td class=\"in-tab-txt-rb\">" + (obj.HasBound == true ? "yes" : "no") + "</td>" +
                            "<td class=\"in-tab-txt-rb\" style=\"text-align: left !important;\">" + CheckQueryString(GetEquipment(obj, equipment)) + "</td>" +
                            "<td class=\"in-tab-txt-b\">" + Utility.GetOnlineStyle(obj.OnlineStyle, obj.OnlineTime, false) + "</td>" +
                            //"<td class=\"in-tab-txt-rb\" style=\"text-align: left !important;\">" + obj.Sim + "</td>" +
                            "<td class=\"in-tab-txt-b\"></td>" +
                            "</tr>";
                }
            }
            ShowFooter(totalRecords, pageIndex, totalPages, html);
        }