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)); }
internal static PersonDto[] GetByVirtualSwitchId(Rbr_Db pDb, int pVirtualSwitchId) { var _list = new ArrayList(); VirtualSwitchDto _virtualSwitch = VirtualSwitchManager.Get(pDb, pVirtualSwitchId); PersonRow[] _personRows = pDb.PersonCollection.GetByVirtual_switch_id(pVirtualSwitchId); 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, null, _virtualSwitch)); } if (_list.Count > 1) { _list.Sort(new GenericComparer(PersonDto.Name_PropName, ListSortDirection.Ascending)); } return((PersonDto[])_list.ToArray(typeof(PersonDto))); }