Пример #1
0
        internal static PersonDto GetByLogin(Rbr_Db pDb, string pLogin)
        {
            PersonRow _personRow = pDb.PersonCollection.GetByLogin(pLogin);

            if (_personRow == null)
            {
                return(null);
            }

            ContactInfoDto          _contactInfo          = null;
            CustomerSupportGroupDto _customerSupportGroup = null;
            VirtualSwitchDto        _virtualSwitch        = null;

            if (!_personRow.IsContact_info_idNull)
            {
                _contactInfo = ContactInfoManager.Get(pDb, _personRow.Contact_info_id);
            }
            if (!_personRow.IsGroup_idNull)
            {
                _customerSupportGroup = CustomerSupportManager.GetCustomerSupportGroup(pDb, _personRow.Group_id);
            }
            if (!_personRow.IsVirtual_switch_idNull)
            {
                _virtualSwitch = VirtualSwitchManager.Get(pDb, _personRow.Virtual_switch_id);
            }
            return(mapToPerson(_personRow, _contactInfo, _customerSupportGroup, _virtualSwitch));
        }
Пример #2
0
        internal static PersonDto[] GetByGroupId(Rbr_Db pDb, int pGroupId)
        {
            var _list = new ArrayList();
            CustomerSupportGroupDto _customerSupportGroup = CustomerSupportManager.GetCustomerSupportGroup(pDb, pGroupId);

            PersonRow[] _personRows = pDb.PersonCollection.GetByGroup_id(pGroupId);
            foreach (PersonRow _personRow in _personRows)
            {
                ContactInfoDto _contactInfo = null;
                if (!_personRow.IsContact_info_idNull)
                {
                    _contactInfo = ContactInfoManager.Get(pDb, _personRow.Contact_info_id);
                }
                _list.Add(mapToPerson(_personRow, _contactInfo, _customerSupportGroup, null));
            }
            if (_list.Count > 1)
            {
                _list.Sort(new GenericComparer(PersonDto.Name_PropName, ListSortDirection.Ascending));
            }
            return((PersonDto[])_list.ToArray(typeof(PersonDto)));
        }