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(); } } }
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(); } } }
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(); } } }
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(); } } }
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(); } } }
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(); } } }
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; } } }
//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(); } } }
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)); }
//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)); } }
//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)); } }
public static CountryDto[] GetCountriesByRoutingPlan(int pRoutingPlanId) { using (var _db = new Rbr_Db()) { return(CallingPlanManager.GetCountriesByRoutingPlan(_db, pRoutingPlanId)); } }
public static CountryDto[] GetCountries() { using (var _db = new Rbr_Db()) { return(CallingPlanManager.GetCountries(_db)); } }
public static CountryDto[] GetUnusedCountries(int pCallingPlanId) { using (var _db = new Rbr_Db()) { return(CallingPlanManager.GetUnusedCountries(_db, pCallingPlanId)); } }
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)); } }
public static bool ValidateCountry(string pCountryName, out string pMsg) { using (var _db = new Rbr_Db()) { return(CallingPlanManager.Validate(_db, pCountryName, out pMsg)); } }
public static CallingPlanDto[] GetAllCallingPlans() { using (var _db = new Rbr_Db()) { return(CallingPlanManager.GetCallingPlans(_db)); } }
//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)); } }
public static CountryDto GetCountryByCountryCode(int pCountryCode) { using (var _db = new Rbr_Db()) { return(CallingPlanManager.GetByCountryCode(_db, pCountryCode)); } }
public static CallingPlanDto GetCallingPlan(int pCallingPlanId) { using (var _db = new Rbr_Db()) { return(CallingPlanManager.GetCallingPlan(_db, pCallingPlanId)); } }
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)); } }
public static DialCodeDto GetFirstDialCodeByCallingPlanIdRouteId(int pCallingPlanId, int pRouteId) { using (var _db = new Rbr_Db()) { return(CallingPlanManager.GetFirstByCallingPlanIdRouteId(_db, pCallingPlanId, pRouteId)); } }
public static DialCodeDto GetFirstDialCodeByCallingPlanIdDialedNumber(int pCallingPlanId, long pDialedNumber) { using (var _db = new Rbr_Db()) { return(CallingPlanManager.GetFirstByCallingPlanIdDialedNumber(_db, pCallingPlanId, pDialedNumber)); } }