コード例 #1
0
        List <UnitPhone> INovaAlertService.GetUnitPhones(int?groupId, eTaskType taskType, bool includeTask)
        {
            if (groupId.HasValue)
            {
                List <UnitPhone> list = new List <UnitPhone>();
                var ids = NovaAlertCommon.GetUnitsInGroup(groupId.Value);
                foreach (var u in _resources.UnitPhones)
                {
                    var g = ids.FirstOrDefault(gu => gu.UnitId == u.Id);
                    if (g != null)
                    {
                        var up = new UnitPhone(u.Id, u.Name)
                        {
                            PhoneNumberId = u.PhoneNumberId,
                            AreaCode      = u.AreaCode,
                            Number        = u.Number,
                            Password      = u.Password,
                            ListOrder     = g.ListOrder,
                        };

                        if (includeTask)
                        {
                            up.Task = NovaAlertCommon.GetLastestTask(u.PhoneNumberId, taskType);
                        }

                        list.Add(up);
                    }
                }
                return(list);
            }
            else
            {
                return(_resources.UnitPhones.Select(vm => vm.Phone).OfType <UnitPhone>().ToList());
            }
        }
コード例 #2
0
        UnitPhone INovaAlertService.GetUnitPhone(int id, eTaskType taskType)
        {
            var item = _resources.UnitPhones.FirstOrDefault(u => u.Id == id);

            if (item != null)
            {
                var unit = item.UnitPhone;
                return(new UnitPhone(unit.Id, unit.Name)
                {
                    PhoneNumberId = unit.PhoneNumberId,
                    AreaCode = unit.AreaCode,
                    Number = unit.Number,
                    Password = unit.Password,
                    ListOrder = unit.ListOrder,
                    Task = NovaAlertCommon.GetLastestTask(unit.PhoneNumberId, taskType)
                });
            }

            return(null);
        }