Example #1
0
        PhoneCardDto mapToPhoneCard(PhoneCardRow pPhoneCardRow)
        {
            var _phoneCard = new PhoneCardDto();

            _phoneCard.Pin             = pPhoneCardRow.Pin;
            _phoneCard.SerialNumber    = pPhoneCardRow.Serial_number;
            _phoneCard.ServiceId       = pPhoneCardRow.Service_id;
            _phoneCard.InventoryStatus = pPhoneCardRow.InventoryStatus;
            _phoneCard.Status          = pPhoneCardRow.CardStatus;
            _phoneCard.RetailAcctId    = pPhoneCardRow.Retail_acct_id;

            _phoneCard.DateLoaded   = pPhoneCardRow.Date_loaded;
            _phoneCard.DateToExpire = pPhoneCardRow.Date_to_expire;

            if (pPhoneCardRow.IsDate_activeNull)
            {
                _phoneCard.DateActive = pPhoneCardRow.Date_active;
            }
            else
            {
                _phoneCard.DateActive = Configuration.Instance.Db.SqlSmallDateTimeMaxValue;
            }
            if (pPhoneCardRow.IsDate_deactivatedNull)
            {
                _phoneCard.DateDeactivated = pPhoneCardRow.Date_deactivated;
            }
            else
            {
                _phoneCard.DateDeactivated = Configuration.Instance.Db.SqlSmallDateTimeMaxValue;
            }
            if (pPhoneCardRow.IsDate_archivedNull)
            {
                _phoneCard.DateArchived = pPhoneCardRow.Date_archived;
            }
            else
            {
                _phoneCard.DateArchived = Configuration.Instance.Db.SqlSmallDateTimeMaxValue;
            }
            if (pPhoneCardRow.IsDate_first_usedNull)
            {
                _phoneCard.DateFirstUsed = pPhoneCardRow.Date_first_used;
            }
            else
            {
                _phoneCard.DateFirstUsed = Configuration.Instance.Db.SqlSmallDateTimeMaxValue;
            }
            if (pPhoneCardRow.IsDate_last_usedNull)
            {
                _phoneCard.DateLastUsed = pPhoneCardRow.Date_last_used;
            }
            else
            {
                _phoneCard.DateLastUsed = Configuration.Instance.Db.SqlSmallDateTimeMaxValue;
            }

            return(_phoneCard);
        }
        void parsePhoneCard(string pLine)
        {
            string[] _fields = pLine.Split(Constants.CommaDelimiter[0]);

            PhoneCardDto _phoneCard = new PhoneCardDto();

            _phoneCard.SerialNumber    = long.Parse(_fields[0]);
            _phoneCard.Pin             = long.Parse(_fields[1]);
            _phoneCard.ServiceId       = phoneCardBatch.ServiceId;
            _phoneCard.InventoryStatus = phoneCardBatch.InventoryStatus;

            phoneCardBatch.PhoneCards.Add(_phoneCard);
        }
Example #3
0
        PhoneCardDto[] mapToPhoneCards(IEnumerable <PhoneCardRow> pPhoneCardRows)
        {
            var _list = new ArrayList();

            if (pPhoneCardRows != null)
            {
                foreach (PhoneCardRow _phoneCardRow in pPhoneCardRows)
                {
                    PhoneCardDto _phoneCard = mapToPhoneCard(_phoneCardRow);
                    _list.Add(_phoneCard);
                }
            }
            return((PhoneCardDto[])_list.ToArray(typeof(PhoneCardDto)));
        }
        static void importPhoneCardAndRetailAccount(Rbr_Db pDb, PhoneCardDto pPhoneCard, InventoryStatus pInitialInventoryStatus, PhoneCardBatch pPhoneCardBatch)
        {
            var _retailAccountRow = new RetailAccountRow();

            _retailAccountRow.AccountStatus         = Status.Active;     //NOTE
            _retailAccountRow.Start_balance         = pPhoneCardBatch.StartBalance;
            _retailAccountRow.Start_bonus_minutes   = pPhoneCardBatch.StartBonusMinutes;
            _retailAccountRow.Current_balance       = pPhoneCardBatch.StartBalance;
            _retailAccountRow.Current_bonus_minutes = pPhoneCardBatch.StartBonusMinutes;
            _retailAccountRow.Customer_acct_id      = pPhoneCardBatch.CustomerAcctId;
            _retailAccountRow.Date_created          = pPhoneCardBatch.DateCreated;   //NOTE
            _retailAccountRow.Date_active           = pPhoneCardBatch.DateCreated;   //NOTE
            _retailAccountRow.Date_to_expire        = pPhoneCardBatch.DateToExpire;
            _retailAccountRow.Date_expired          = Configuration.Instance.Db.SqlSmallDateTimeMaxValue;

            RetailAccountManager.Instance.Add(pDb, _retailAccountRow);
            pPhoneCard.RetailAcctId = _retailAccountRow.Retail_acct_id;

            var _phoneCardRow = new PhoneCardRow();

            _phoneCardRow.InventoryStatus = pInitialInventoryStatus;
            if (pInitialInventoryStatus == InventoryStatus.Activated)
            {
                _phoneCardRow.CardStatus = Status.Active;
            }
            else
            {
                _phoneCardRow.CardStatus = Status.Pending;
            }
            _phoneCardRow.Pin            = pPhoneCard.Pin;
            _phoneCardRow.Serial_number  = pPhoneCard.SerialNumber;
            _phoneCardRow.Service_id     = pPhoneCard.ServiceId;
            _phoneCardRow.Retail_acct_id = pPhoneCard.RetailAcctId;

            _phoneCardRow.Date_loaded            = pPhoneCardBatch.DateCreated;
            _phoneCardRow.Date_active            = pPhoneCardBatch.DateCreated;
            _phoneCardRow.Date_to_expire         = pPhoneCardBatch.DateToExpire;
            _phoneCardRow.IsDate_deactivatedNull = true;
            _phoneCardRow.IsDate_archivedNull    = true;

            RetailAccountManager.AddPhoneCard(pDb, _phoneCardRow);
        }
Example #5
0
        internal static PhoneCardRow MapToPhoneCardRow(PhoneCardDto pPhoneCard)
        {
            var _phoneCardRow = new PhoneCardRow();

            _phoneCardRow.InventoryStatus = pPhoneCard.InventoryStatus;
            _phoneCardRow.CardStatus      = pPhoneCard.Status;
            _phoneCardRow.Pin             = pPhoneCard.Pin;
            _phoneCardRow.Serial_number   = pPhoneCard.SerialNumber;
            _phoneCardRow.Service_id      = pPhoneCard.ServiceId;
            _phoneCardRow.Retail_acct_id  = pPhoneCard.RetailAcctId;

            _phoneCardRow.Date_loaded    = pPhoneCard.DateLoaded;
            _phoneCardRow.Date_to_expire = pPhoneCard.DateToExpire;
            if (pPhoneCard.DateActive < Configuration.Instance.Db.SqlSmallDateTimeMaxValue && pPhoneCard.DateActive > DateTime.MinValue)
            {
                _phoneCardRow.Date_active = pPhoneCard.DateActive;
            }
            if (pPhoneCard.DateDeactivated < Configuration.Instance.Db.SqlSmallDateTimeMaxValue && pPhoneCard.DateDeactivated > DateTime.MinValue)
            {
                _phoneCardRow.Date_deactivated = pPhoneCard.DateDeactivated;
            }
            if (pPhoneCard.DateArchived < Configuration.Instance.Db.SqlSmallDateTimeMaxValue && pPhoneCard.DateArchived > DateTime.MinValue)
            {
                _phoneCardRow.Date_archived = pPhoneCard.DateArchived;
            }
            if (pPhoneCard.DateFirstUsed < Configuration.Instance.Db.SqlSmallDateTimeMaxValue && pPhoneCard.DateFirstUsed > DateTime.MinValue)
            {
                _phoneCardRow.Date_first_used = pPhoneCard.DateFirstUsed;
            }
            if (pPhoneCard.DateLastUsed < Configuration.Instance.Db.SqlSmallDateTimeMaxValue && pPhoneCard.DateLastUsed > DateTime.MinValue)
            {
                _phoneCardRow.Date_last_used = pPhoneCard.DateLastUsed;
            }

            return(_phoneCardRow);
        }