public static int DeleteBlack(long ID) { BlackListRepository mr = new BlackListRepository(); int i = mr.DeleteBlack(ID); return(i); }
protected void Application_Start() { // Load Resources var bgresource = ObjectFactory.GetInstance <IBlogResourceServices>(); bgresource.LoadResources(); // Check if any user exists. If not, create one CheckForAdminUser(); //Register areas AreaRegistration.RegisterAllAreas(); //Get BlackListed Ips BlackListRepository.GetAllIpsInBlackList(this.Server); //Create AutoMapper Maps Mapper.CreateMap <StatsDTO, StatsModel>(); Mapper.CreateMap <ConfigOptionsDTO, ConfigOptionsModel>(); Mapper.CreateMap <ConfigOptionsModel, ConfigOptionsDTO>(); Mapper.CreateMap <AnonymousUser, AnonymousCommentViewModel>(); Mapper.CreateMap <SubscriptionViewModel, SubscriptionDTO>(); //Init Recaptcha helper ReCaptcha.PublicKey = BgResources.Recaptcha_PublicKeyHttp; //Register Global filters RegisterGlobalFilters(GlobalFilters.Filters); //Init route table RegisterRoutes(RouteTable.Routes); }
public static BlackListEntity GetBlackListEntityById(long cid) { BlackListEntity result = new BlackListEntity(); BlackListRepository mr = new BlackListRepository(); BlackListInfo info = mr.GetBlackListByKey(cid); if (info != null) { result = TranslateBlackListEntity(info); } return(result); }
public static List <BlackListEntity> GetBlackListInfoPager(PagerInfo pager) { List <BlackListEntity> all = new List <BlackListEntity>(); BlackListRepository mr = new BlackListRepository(); List <BlackListInfo> miList = mr.GetAllBlackListInfoPager(pager); foreach (BlackListInfo mInfo in miList) { BlackListEntity carEntity = TranslateBlackListEntity(mInfo); all.Add(carEntity); } return(all); }
protected override void Load(ContainerBuilder builder) { var inMemoryCacheOptions = Options.Create(new MemoryDistributedCacheOptions()); IDistributedCache cache = new MemoryDistributedCache(inMemoryCacheOptions); builder.RegisterInstance(cache) .As <IDistributedCache>() .SingleInstance(); #region Repo builder.Register(c => BlackListRepository.Create(_settings.ConnectionString(x => x.BlockchainCashoutPreconditionsCheckService.Db.DataConnString) , c.Resolve <ILogFactory>())) .As <IBlackListRepository>() .SingleInstance(); #endregion builder.RegisterType <AddressExtensionService>() .As <AddressExtensionService>() .WithParameter("cacheTime", TimeSpan.FromHours(12)) .SingleInstance(); builder.RegisterType <BlackListService>() .As <IBlackListService>() .SingleInstance(); builder.RegisterType <HealthService>() .As <IHealthService>() .SingleInstance(); builder.RegisterType <StartupManager>() .As <IStartupManager>(); builder.RegisterType <ShutdownManager>() .As <IShutdownManager>(); builder.Register(c => new BlockchainWalletsClient(_settings.CurrentValue.BlockchainWalletsServiceClient.ServiceUrl, c.Resolve <ILogFactory>())) .As <IBlockchainWalletsClient>() .SingleInstance(); builder.RegisterType <ValidationService>() .As <IValidationService>().SingleInstance(); builder.RegisterAssetsClient( AssetServiceSettings.Create(new Uri(_settings.CurrentValue.Assets.ServiceUrl), _settings.CurrentValue.Assets.CacheExpirationPeriod), true ); }
public static List <BlackListEntity> GetBlackListInfoByRule(int BlackListID, PagerInfo pager) { List <BlackListEntity> all = new List <BlackListEntity>(); BlackListRepository mr = new BlackListRepository(); List <BlackListInfo> miList = mr.GetBlackListInfoByRule(BlackListID, pager); if (!miList.IsEmpty()) { foreach (BlackListInfo mInfo in miList) { BlackListEntity storeEntity = TranslateBlackListEntity(mInfo); all.Add(storeEntity); } } return(all); }
public static List <BlackListEntity> GetBlackListAll() { List <BlackListEntity> all = new List <BlackListEntity>(); BlackListRepository mr = new BlackListRepository(); List <BlackListInfo> miList = mr.GetAllBlackList();//Cache.Get<List<BlackListInfo>>("BlackListALL"); //if (miList.IsEmpty()) //{ // miList = mr.GetAllBlackList(); // Cache.Add("BlackListALL", miList); //} if (!miList.IsEmpty()) { foreach (BlackListInfo mInfo in miList) { BlackListEntity BlackListEntity = TranslateBlackListEntity(mInfo); all.Add(BlackListEntity); } } return(all); }
public static bool ModifyBlackList(BlackListEntity entity) { long result = 0; if (entity != null) { BlackListRepository mr = new BlackListRepository(); BlackListInfo info = TranslateBlackListInfo(entity); if (entity.BlackID > 0) { info.ChangeDate = DateTime.Now; mr.ModifyBlackList(info); } else { info.ChangeDate = DateTime.Now; info.CreateDate = DateTime.Now; result = mr.CreateNew(info); } } return(result > 0); }
public string validate(SessionModel session) { BlackListRepository bl = new BlackListRepository(); WhiteListRepository wl = new WhiteListRepository(); if (!Checkers.IsPhoneNumber(session.sender)) { return("Invalid phone number"); } if (!Checkers.IsPhoneNumber(session.receiver)) { return("Invalid phone number"); } if (Checkers.checkingInputs(session.sender)) { return(Properties.Settings.Default.MESSAGE_INVALID_INPUT.Replace("%PARAM%", "MSISDN")); } if (Checkers.checkingInputs(session.receiver)) { return(Properties.Settings.Default.MESSAGE_INVALID_INPUT.Replace("%PARAM%", "receiver")); } if (Checkers.checkingInputs(session.amount)) { return(Properties.Settings.Default.MESSAGE_INVALID_INPUT.Replace("%PARAM%", "amount")); } if (Checkers.checkingInputs(session.pin)) { return(Properties.Settings.Default.MESSAGE_INVALID_INPUT.Replace("%PARAM%", "pin")); } // Only validate blaclist if (bl.CheckExists(session.sender)) { return(Properties.Settings.Default.BLACK_LIST_MESSAGE); } if (!wl.CheckExists(session.sender, 1)) { return(Properties.Settings.Default.TC_SA_LIST_MESSAGE); } if (!wl.CheckExists(session.receiver, 2)) { return(Properties.Settings.Default.DL_TL_LIST_MESSAGE.Replace("%RECEIVER%", session.receiver)); } if (Convert.ToDecimal(session.amount) < Convert.ToDecimal(Properties.Settings.Default.PARAM_MINIMUM_AMOUNT)) { return(Properties.Settings.Default.MESSAGE_MINIMUM_ALLOWED_AMOUNT.Replace("%AMOUNT%", Properties.Settings.Default.PARAM_MINIMUM_AMOUNT)); } return("ok"); }