public CustomerAcct(CustomerAcctRow pCustomerAcctRow) { customerAcctRow = pCustomerAcctRow; status = (Status)customerAcctRow.Status; email = string.Empty; //-- using (var _db = new Rbr_Db()) { partnerRow = _db.PartnerCollection.GetByPrimaryKey(customerAcctRow.Partner_id); } if (partnerRow == null) { throw new Exception("Couldn't FIND PartnerRow for Customer: " + customerAcctRow.Customer_acct_id); } //-- ServiceRow _serviceRow; using (var _db = new Rbr_Db()) { _serviceRow = _db.ServiceCollection.GetByPrimaryKey(customerAcctRow.Service_id); } if (_serviceRow == null) { throw new Exception("Couldn't FIND ServiceRow for Customer: " + customerAcctRow.Customer_acct_id); } serviceType = _serviceRow.ServiceType; retailType = _serviceRow.RetailType; isPrepaid = customerAcctRow.IsPrepaid; isRatingEnabled = _serviceRow.IsRatingEnabled; callingPlanId = _serviceRow.Calling_plan_id; //TODO: set max number of calls from db MaxNumberOfCalls = 1000; if (isPrepaid) //get email, so we can send balance warnings to Partners as well { using (var _db = new Rbr_Db()) { var _partnerRow = _db.PartnerCollection.GetByPrimaryKey(customerAcctRow.Partner_id); if (_partnerRow == null) { throw new Exception("Couldn't FIND PartnerRow for Customer: " + customerAcctRow.Customer_acct_id); } var _contactInfoRow = _db.ContactInfoCollection.GetByPrimaryKey(_partnerRow.Contact_info_id); if (_contactInfoRow != null) { email = _contactInfoRow.Email; } } } }
internal static ServiceDto[] GetSharedServices(Rbr_Db pDb, RetailType pRetailType) { var _list = new List <ServiceDto>(); ServiceRow[] _serviceRows = pDb.ServiceCollection.GetSharedByRetailType(pRetailType); if (_serviceRows != null) { foreach (ServiceRow _serviceRow in _serviceRows) { _list.Add(getService(pDb, _serviceRow, 0)); } } return(_list.ToArray()); }
public ServiceRow[] GetSharedByRetailType(RetailType pRetailType) { string _wherSql = ServiceRow.type_DbName + " = " + Database.CreateSqlParameterName(ServiceRow.type_PropName) + " AND " + ServiceRow.is_shared_DbName + " = " + Database.CreateSqlParameterName(ServiceRow.is_shared_PropName) + " AND " + ServiceRow.retail_type_DbName + " = " + Database.CreateSqlParameterName(ServiceRow.retail_type_PropName); IDbCommand _cmd = base.CreateGetCommand(_wherSql, ServiceRow.name_DbName); AddParameter(_cmd, ServiceRow.type_PropName, (byte)ServiceType.Retail); AddParameter(_cmd, ServiceRow.is_shared_PropName, 1); AddParameter(_cmd, ServiceRow.retail_type_PropName, (int)pRetailType); using (IDataReader _reader = _cmd.ExecuteReader()) { return(MapRecords(_reader)); } }
public static void AddDialPeersForEndpoint(short pEndpointId, string pPrefix, short pCustomerAcctId, RetailType pRetailType) { using (var _db = new Rbr_Db()) { using (var _tx = new Transaction(_db, pEndpointId, pPrefix, pCustomerAcctId, pRetailType)) { var _endpointRow = EndpointManager.Get(_db, pEndpointId); if (_endpointRow == null) { throw new Exception(string.Format("Endpoint NOT FOUND, EndpointId={0}", pEndpointId)); } var _dialPeerRow = CustomerAcctManager.GetDialPeerRow(_db, pEndpointId, pPrefix); if (_dialPeerRow == null) { _dialPeerRow = new DialPeerRow { End_point_id = pEndpointId, Prefix_in = pPrefix, Customer_acct_id = pCustomerAcctId }; CustomerAcctManager.AddDialPeer(_db, _dialPeerRow, _endpointRow); } //-- If Retail, add accessNumber DialPeers if (pRetailType == RetailType.PhoneCard || pRetailType == RetailType.Residential) { var _accessNumberRows = ServiceManager.GetAccessNumbers(_db, pCustomerAcctId); foreach (var _accessNumberRow in _accessNumberRows) { _dialPeerRow = new DialPeerRow { End_point_id = pEndpointId, Prefix_in = _accessNumberRow.Access_number.ToString(), Customer_acct_id = pCustomerAcctId }; CustomerAcctManager.AddDialPeer(_db, _dialPeerRow, _endpointRow); } } _tx.Commit(); } } }
internal static ServiceRow[] GetAllShared(Rbr_Db pDb, RetailType pRetailType) { return(pDb.ServiceCollection.GetSharedByRetailType(pRetailType)); }
public static ServiceDto[] GetShared(RetailType pRetailType) { using (Rbr_Db _db = new Rbr_Db()) { return(ServiceManager.GetSharedServices(_db, pRetailType)); } }