Exemplo n.º 1
0
        static PartnerDto getInfo(Rbr_Db pDb, PartnerRow pPartnerRow)
        {
            if (pPartnerRow == null)
            {
                return(null);
            }

            ScheduleDto    _billingSchedule = ScheduleManager.Get(pDb, pPartnerRow.Billing_schedule_id);
            ContactInfoDto _contactInfo     = ContactInfoManager.Get(pDb, pPartnerRow.Contact_info_id);

            PersonDto[] _employees = PersonManager.GetByPartnerId(pDb, pPartnerRow.Partner_id);
            return(MapToPartner(pPartnerRow, _billingSchedule, _contactInfo, _employees));
        }
Exemplo n.º 2
0
        RetailAccountDto get(Rbr_Db pDb, short pServiceId, RetailAccountRow pRetailAccountRow)
        {
            if (pRetailAccountRow != null)
            {
                ServiceRow       _serviceRow    = ServiceManager.Get(pDb, pServiceId);
                RetailAccountDto _retailAccount = mapToRetailAccount(pRetailAccountRow);
                _retailAccount.ServiceId  = pServiceId;
                _retailAccount.RetailType = _serviceRow.RetailType;

                _retailAccount.Person = PersonManager.GetByRetailAcctId(pDb, pRetailAccountRow.Retail_acct_id);

                PhoneCardDto[] _phoneCards = mapToPhoneCards(pDb.PhoneCardCollection.GetByRetail_acct_id(_retailAccount.RetailAcctId));
                if (_phoneCards != null && _phoneCards.Length > 0)
                {
                    _retailAccount.PhoneCards = _phoneCards;
                    foreach (PhoneCardDto _phoneCard in _phoneCards)
                    {
                        if (_retailAccount.ServiceId != _phoneCard.ServiceId)
                        {
                            throw new Exception("Retail Account has a card from a different Service. [RetailAcctId=" + _retailAccount.RetailAcctId + "] [RetailAccount.ServiceId=" + _retailAccount.ServiceId + "] [PhoneCard.ServiceId=" + _phoneCard.ServiceId + "]");
                        }
                    }
                }

                ResidentialPSTNDto[] _residentialPSTNs = mapToResidentialPSTNs(pDb.ResidentialPSTNCollection.GetByRetail_acct_id(_retailAccount.RetailAcctId));
                if (_residentialPSTNs != null && _residentialPSTNs.Length > 0)
                {
                    _retailAccount.ResidentialPSTNs = _residentialPSTNs;
                    foreach (ResidentialPSTNDto _residentialPSTN in _residentialPSTNs)
                    {
                        if (_retailAccount.ServiceId != _residentialPSTN.ServiceId)
                        {
                            throw new Exception("Retail Account has a ResidentialPSTN from a different Service. [RetailAcctId=" + _retailAccount.RetailAcctId + "] [RetailAccount.ServiceId=" + _retailAccount.ServiceId + "] [ResidentialPSTN.ServiceId=" + _residentialPSTN.ServiceId + "]");
                        }
                    }
                }

                //ResidentialVoIP[] _residentialVoIPs = mapToResidentialVoIPs(pDb.ResidentialVoIPCollection.GetByRetail_acct_id(_retailAccount.RetailAcctId));
                //if (_residentialVoIPs != null && _residentialVoIPs.Length > 0) {
                //  _retailAccount.ResidentialVoIPs = _residentialVoIPs;
                //  foreach (ResidentialVoIP _residentialVoIP in _residentialVoIPs) {
                //    if (_retailAccount.ServiceId != _residentialVoIP.ServiceId) {
                //      throw new Exception("Retail Account has a ResidentialVoIP from a different Service. [RetailAcctId=" + _retailAccount.RetailAcctId + "] [RetailAccount.ServiceId=" + _retailAccount.ServiceId + "] [ResidentialVoIP.ServiceId=" + _residentialVoIP.ServiceId + "]");
                //    }
                //  }
                //}
                return(_retailAccount);
            }
            return(null);
        }
Exemplo n.º 3
0
        internal static RetailAccountPaymentDto[] GetByRetailAcctId(Rbr_Db pDb, int pRetailAcctId)
        {
            var _list = new ArrayList();

            RetailAccountPaymentRow[] _retailAccountPaymentRows = pDb.RetailAccountPaymentCollection.GetByRetail_acct_id(pRetailAcctId);
            foreach (RetailAccountPaymentRow _retailAccountPaymentRow in _retailAccountPaymentRows)
            {
                BalanceAdjustmentReasonDto _balanceAdjustmentReason = BalanceAdjustmentReasonManager.Get(pDb, _retailAccountPaymentRow.Balance_adjustment_reason_id);
                PersonDto _person = PersonManager.Get(pDb, _retailAccountPaymentRow.Person_id);
                _list.Add(mapToRetailAccountPayment(_retailAccountPaymentRow, _person, _balanceAdjustmentReason));
            }
            if (_list.Count > 1)
            {
                _list.Sort(new GenericComparer(RetailAccountPaymentDto.DateTime_PropName, ListSortDirection.Descending));
            }
            return((RetailAccountPaymentDto[])_list.ToArray(typeof(RetailAccountPaymentDto)));
        }
Exemplo n.º 4
0
        internal static CustomerAcctPaymentDto[] GetByPersonId(Rbr_Db pDb, int pPersonId)
        {
            var _list = new ArrayList();
            var _customerAcctPaymentRows = pDb.CustomerAcctPaymentCollection.GetByPerson_id(pPersonId);

            foreach (var _customerAcctPaymentRow in _customerAcctPaymentRows)
            {
                var _balanceAdjustmentReason = BalanceAdjustmentReasonManager.Get(pDb, _customerAcctPaymentRow.Balance_adjustment_reason_id);
                var _person          = PersonManager.Get(pDb, _customerAcctPaymentRow.Person_id);
                var _customerAcctRow = Get(pDb, _customerAcctPaymentRow.Customer_acct_id);
                _list.Add(mapToCustomerAcctPayment(_customerAcctPaymentRow, _customerAcctRow.Name, _person, _balanceAdjustmentReason));
            }
            if (_list.Count > 1)
            {
                _list.Sort(new GenericComparer(CustomerAcctPaymentDto.DateTime_PropName, ListSortDirection.Descending));
            }
            return((CustomerAcctPaymentDto[])_list.ToArray(typeof(CustomerAcctPaymentDto)));
        }