コード例 #1
0
 public static void DeleteCountry(CountryDto pCountry)
 {
     using (var _db = new Rbr_Db()) {
         using (var _tx = new Transaction(_db, pCountry)) {
             CallingPlanManager.DeleteCountry(_db, pCountry);
             _tx.Commit();
         }
     }
 }
コード例 #2
0
 public static void DeleteDialCode(DialCodeDto pDialCode)
 {
     using (var _db = new Rbr_Db()) {
         using (var _tx = new Transaction(_db, pDialCode)) {
             CallingPlanManager.DeleteDialCode(_db, pDialCode);
             _tx.Commit();
         }
     }
 }
コード例 #3
0
 public static void AddCountriesToCallingPlan(CallingPlanDto pCallingPlan, CountryDto[] pSelectedCountries)
 {
     using (var _db = new Rbr_Db()) {
         using (var _tx = new Transaction(_db, pCallingPlan, pSelectedCountries)) {
             CallingPlanManager.AddCountriesToCallingPlan(_db, pCallingPlan, pSelectedCountries);
             _tx.Commit();
         }
     }
 }
コード例 #4
0
 public static void DeleteCallingPlan(CallingPlanDto pCallingPlan)
 {
     using (var _db = new Rbr_Db()) {
         using (var _tx = new Transaction(_db, pCallingPlan)) {
             CallingPlanManager.DeleteCallingPlan(_db, pCallingPlan);
             _tx.Commit();
         }
     }
 }
コード例 #5
0
 public static void UpdateCountry(CountryDto pCountry)
 {
     //NOTE: !!! NOT status change on Country !!!
     using (var _db = new Rbr_Db()) {
         using (var _tx = new Transaction(_db, pCountry)) {
             CallingPlanManager.UpdateCountry(_db, pCountry);
             _tx.Commit();
         }
     }
 }
コード例 #6
0
 public static void DeleteDialCodes(DialCodeDto[] pDialCodes)
 {
     using (var _db = new Rbr_Db()) {
         using (var _tx = new Transaction(_db, pDialCodes)) {
             foreach (DialCodeDto _dialCode in pDialCodes)
             {
                 CallingPlanManager.DeleteDialCode(_db, _dialCode);
             }
             _tx.Commit();
         }
     }
 }
コード例 #7
0
        void importRouteDialCodes(RouteRecord pRouteRecord)
        {
            Host.ReportStatus(string.Format("Importing Dial Codes for Route: {0}", pRouteRecord.FullName));

            using (var _db = new Rbr_Db()) {
                _db.BeginTransaction();
                try {
                    int _countryId = getCountryId(_db, pRouteRecord.CountryName, pRouteRecord.CountryCode);
                    int _routeId   = getRouteId(_db, _countryId, pRouteRecord);

                    int _indexDialCode = 0;
                    foreach (long _dialCode in pRouteRecord.DialCodes.Values)
                    {
                        if (Host.CancellationPending)
                        {
                            throw new Exception("Import canceled");
                        }

                        if (!_dialCode.ToString().StartsWith(pRouteRecord.CountryCode.ToString()))
                        {
                            throw new Exception(string.Format("Invalid Dial Code={0}, CCode={1}", _dialCode, pRouteRecord.CountryCode));
                        }

                        var _dialCodeDto = new DialCodeDto();
                        _dialCodeDto.Code          = _dialCode;
                        _dialCodeDto.BaseRouteId   = _routeId;
                        _dialCodeDto.CallingPlanId = args.CallingPlanId;
                        _dialCodeDto.Version       = 0;
                        try {
                            CallingPlanManager.AddDialCode(_db, _dialCodeDto);
                        }
                        catch (Exception _ex) {
                            TimokLogger.Instance.LogRbr(LogSeverity.Debug, "", string.Format("Error inserting dial code: {0}\r\n{1}", _dialCodeDto.Code, _ex));
                        }

                        if (++_indexDialCode % 10 == 0)
                        {
                            Host.ReportProgress(_indexDialCode * 100 / pRouteRecord.DialCodes.Values.Count);
                        }
                    }

                    Host.ReportStatus(string.Format("Imported total of {0} Dial Codes for Route: {1}", pRouteRecord.DialCodes.Values.Count, pRouteRecord.FullName));
                    _db.CommitTransaction();
                }
                catch (Exception _ex) {
                    _db.RollbackTransaction();
                    reportStatus(LogSeverity.Error, "DialPlanImporter.importRouteDialCodes", _ex.Message);
                    throw;
                }
            }
        }
コード例 #8
0
        //public static void AddDialCodes(DialCodeDto[] pDialCodes) {
        //  using (var _db = new Rbr_Db()) {
        //    using (var _tx = new Transaction(_db, pDialCodes)) {
        //      foreach (DialCodeDto _dialCode in pDialCodes) {
        //        CallingPlanManager.AddDialCode(_db, _dialCode);
        //      }
        //      _tx.Commit();
        //    }
        //  }
        //}

        public static void MoveDialCodes(DialCodeDto[] pDialCodes, BaseRouteDto pFromRoute, BaseRouteDto pToRoute)
        {
            using (var _db = new Rbr_Db()) {
                using (var _tx = new Transaction(_db, pDialCodes, pFromRoute, pToRoute)) {
                    //NOTE: not used?					RouteRow _fromRouteRow = RoutingManager.MapToRouteRow(pFromRoute);
                    RouteRow _toRouteRow = RoutingManager.MapToRouteRow(pToRoute);
                    foreach (DialCodeDto _dialCode in pDialCodes)
                    {
                        CallingPlanManager.MoveDialCode(_db, _dialCode, _toRouteRow);
                    }
                    _tx.Commit();
                }
            }
        }
コード例 #9
0
        protected int getCountryId(Rbr_Db pDb, string pCountryName, int pCountryCode)
        {
            CountryDto _country = CallingPlanManager.GetCountry(pDb, pCountryName);

            if (_country != null)
            {
                return(_country.CountryId);
            }

            _country             = new CountryDto();
            _country.Name        = pCountryName;
            _country.CountryCode = pCountryCode;
            _country.Status      = Status.Active;
            return(CallingPlanManager.AddCountry(pDb, _country));
        }
コード例 #10
0
        //public static CountryDto GetCountryByCountryId(int pCountryId) {
        //  using (var _db = new Rbr_Db()) {
        //    return CallingPlanManager.GetCountry(_db, pCountryId);
        //  }
        //}

        public static CountryDto GetCountryByName(string pName)
        {
            using (var _db = new Rbr_Db()) {
                return(CallingPlanManager.GetCountry(_db, pName));
            }
        }
コード例 #11
0
        //public static CountryDto[] GetCountries(short pAccountId, ViewContext pContext) {
        //  using (var _db = new Rbr_Db()) {
        //    CustomerAcctDto _customerAcct = CustomerAcctManager.GetAcct(_db, pAccountId);
        //    if (_customerAcct == null) {
        //      return new CountryDto[0];
        //    }
        //    return CallingPlanManager.GetCountries(_db, pAccountId, _customerAcct.ServiceDto.CallingPlanId, pContext);
        //  }
        //}

        public static CountryDto[] GetCountries(short pAccountId, int pCallingPlanId, ViewContext pContext)
        {
            using (var _db = new Rbr_Db()) {
                return(CallingPlanManager.GetCountries(_db, pAccountId, pCallingPlanId, pContext));
            }
        }
コード例 #12
0
 public static CountryDto[] GetCountriesByRoutingPlan(int pRoutingPlanId)
 {
     using (var _db = new Rbr_Db()) {
         return(CallingPlanManager.GetCountriesByRoutingPlan(_db, pRoutingPlanId));
     }
 }
コード例 #13
0
 public static CountryDto[] GetCountries()
 {
     using (var _db = new Rbr_Db()) {
         return(CallingPlanManager.GetCountries(_db));
     }
 }
コード例 #14
0
 public static CountryDto[] GetUnusedCountries(int pCallingPlanId)
 {
     using (var _db = new Rbr_Db()) {
         return(CallingPlanManager.GetUnusedCountries(_db, pCallingPlanId));
     }
 }
コード例 #15
0
 public static bool ValidateCountry(int pCountryCode, int pExcludingCountryId, out string pMsg)
 {
     using (var _db = new Rbr_Db()) {
         return(CallingPlanManager.Validate(_db, pCountryCode, pExcludingCountryId, out pMsg));
     }
 }
コード例 #16
0
 public static bool ValidateCountry(string pCountryName, out string pMsg)
 {
     using (var _db = new Rbr_Db()) {
         return(CallingPlanManager.Validate(_db, pCountryName, out pMsg));
     }
 }
コード例 #17
0
 public static CallingPlanDto[] GetAllCallingPlans()
 {
     using (var _db = new Rbr_Db()) {
         return(CallingPlanManager.GetCallingPlans(_db));
     }
 }
コード例 #18
0
        //public static DialCodeDto[] GetDialCodes(int pCallingPlanId, int pBaseRouteId) {
        //  using (var _db = new Rbr_Db()) {
        //    return CallingPlanManager.GetDialCodes(_db, pCallingPlanId, pBaseRouteId);
        //  }
        //}

        //public static DialCodeDto GetDialCode(int pCallingPlanId, long pDialCode) {
        //  using (var _db = new Rbr_Db()) {
        //    return CallingPlanManager.GetDialCode(_db, pCallingPlanId, pDialCode);
        //  }
        //}

        //public static DialCodeDto[] GetByDialedNumbers(string pDialCode) {
        //  using (var _db = new Rbr_Db()) {
        //    return CallingPlanManager.GetByDialedNumber(_db, pDialCode);
        //  }
        //}

        public static int GetDialCodeRowNumber(int pCallingPlanId, int pRouteId, long pDialCode)
        {
            using (var _db = new Rbr_Db()) {
                return(CallingPlanManager.GetRowNumber(_db, pCallingPlanId, pRouteId, pDialCode));
            }
        }
コード例 #19
0
 public static CountryDto GetCountryByCountryCode(int pCountryCode)
 {
     using (var _db = new Rbr_Db()) {
         return(CallingPlanManager.GetByCountryCode(_db, pCountryCode));
     }
 }
コード例 #20
0
 public static CallingPlanDto GetCallingPlan(int pCallingPlanId)
 {
     using (var _db = new Rbr_Db()) {
         return(CallingPlanManager.GetCallingPlan(_db, pCallingPlanId));
     }
 }
コード例 #21
0
 public static DialCodeDto[] GetDialCodesByCallingPlanIdCountryIdPaged(int pCallingPlanId, int pCountryId, int pPageNumber, int pPageSize, out int pTotalCount)
 {
     using (var _db = new Rbr_Db()) {
         return(CallingPlanManager.GetByCallingPlanIdCountryIdPaged(_db, pCallingPlanId, pCountryId, pPageNumber, pPageSize, out pTotalCount));
     }
 }
コード例 #22
0
 public static DialCodeDto GetFirstDialCodeByCallingPlanIdRouteId(int pCallingPlanId, int pRouteId)
 {
     using (var _db = new Rbr_Db()) {
         return(CallingPlanManager.GetFirstByCallingPlanIdRouteId(_db, pCallingPlanId, pRouteId));
     }
 }
コード例 #23
0
 public static DialCodeDto GetFirstDialCodeByCallingPlanIdDialedNumber(int pCallingPlanId, long pDialedNumber)
 {
     using (var _db = new Rbr_Db()) {
         return(CallingPlanManager.GetFirstByCallingPlanIdDialedNumber(_db, pCallingPlanId, pDialedNumber));
     }
 }