public ActionResult RevertToDefaultTable(long id) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } try { if (DomainManager.CurrentDomainID != Constant.SystemDomainID) { LiveCasinoTableAccessor lta = LiveCasinoTableAccessor.CreateInstance <LiveCasinoTableAccessor>(); ceLiveCasinoTable table = lta.GetTable(DomainManager.CurrentDomainID, id); bool isExist = table != null; SqlQuery <ceLiveCasinoTable> query2 = new SqlQuery <ceLiveCasinoTable>(); if (isExist) { query2.Delete(table); return(this.Json(new { success = true }, JsonRequestBehavior.AllowGet)); } return(this.Json(new { success = false, error = "Table not found!" }, JsonRequestBehavior.AllowGet)); } return(this.Json(new { success = false }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Logger.Exception(ex); return(this.Json(new { success = false, error = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public JsonResult SavePlayerCasinoConfigurationDefaultSetting( int lastPlayedGamesMaxRecords , bool lastPlayedGamesIsDuplicated , int lastPlayedGamesLastDayNum , int mostPlayedGamesLastDayNum , int mostPlayedGamesMinRoundCounts , bool playerBiggestWinGamesIsDuplicated , int playerBiggestWinGamesLastDayNum , decimal playerBiggestWinGamesMinWinEURAmounts ) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } SqlQuery<ceDomainConfig> query = new SqlQuery<ceDomainConfig>(); ceDomainConfig config = EnsureDomainConfigExists(); config.LastPlayedGamesMaxRecords = lastPlayedGamesMaxRecords; config.LastPlayedGamesIsDuplicated = lastPlayedGamesIsDuplicated; config.LastPlayedGamesLastDayNum = lastPlayedGamesLastDayNum; config.MostPlayedGamesLastDayNum = mostPlayedGamesLastDayNum; config.MostPlayedGamesMinRoundCounts = mostPlayedGamesMinRoundCounts; config.PlayerBiggestWinGamesIsDuplicated = playerBiggestWinGamesIsDuplicated; config.PlayerBiggestWinGamesLastDayNum = playerBiggestWinGamesLastDayNum; config.PlayerBiggestWinGamesMinWinEURAmounts = playerBiggestWinGamesMinWinEURAmounts; query.Update(config); CacheManager.ClearCache(Constant.DomainCacheKey); return this.Json(new { @success = true }); }
public JsonResult DeleteJackpot(long baseId, long jackpotId) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } if (DomainManager.CurrentDomainID == Constant.SystemDomainID) { SqlQuery <ceCasinoJackpotBase> query = new SqlQuery <ceCasinoJackpotBase>(); ceCasinoJackpotBase jackpot = null; jackpot = query.SelectByKey(baseId); jackpot.IsDeleted = true; query.Update(jackpot); } else { bool insertFlag = false; SqlQuery <ceCasinoJackpot> query = new SqlQuery <ceCasinoJackpot>(); ceCasinoJackpot domainJackpot = null; if (baseId > 0) { domainJackpot = CasinoJackpotAccessor.QueryDomainJackpot(DomainManager.CurrentDomainID, baseId); } else { domainJackpot = query.SelectByKey(jackpotId); } if (domainJackpot == null) { insertFlag = true; domainJackpot = new ceCasinoJackpot() { Ins = DateTime.Now, DomainID = DomainManager.CurrentDomainID, SessionUserID = CurrentUserSession.UserID, }; } domainJackpot = initJackpot(domainJackpot); if (baseId > 0) { domainJackpot.CasinoJackpotBaseID = baseId; } domainJackpot.IsDeleted = true; if (insertFlag) { query.Insert(domainJackpot); } else { query.Update(domainJackpot); } } CacheManager.ClearLocalCache(Constant.JackpotListCachePrefix); return(this.Json(new { @success = true }, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveVendors(VendorID[] enabledVendors , VendorID[] liveCasinoVendors , string cashierUrl , string lobbyUrl , string accountHistoryUrl , string mobileCashierUrl , string mobileLobbyUrl , string mobileAccountHistoryUrl , string domainDefaultCurrencyCode , string googleAnalyticsAccount , string gameLoaderDomain , string gameResourceDomain , short newStatusCasinoGameExpirationDays , short newStatusLiveCasinoGameExpirationDays ) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } CasinoVendorAccessor.SetEnabledVendors(DomainManager.CurrentDomainID , Constant.SystemDomainID , enabledVendors , liveCasinoVendors ); if (enabledVendors != null && enabledVendors.Length > 0) { SqlQuery<ceDomainConfig> query = new SqlQuery<ceDomainConfig>(); ceDomainConfig config = EnsureDomainConfigExists(); config.MobileCashierUrl = mobileCashierUrl; config.MobileLobbyUrl = mobileLobbyUrl; config.MobileAccountHistoryUrl = mobileAccountHistoryUrl; config.CashierUrl = cashierUrl; config.LobbyUrl = lobbyUrl; config.AccountHistoryUrl = accountHistoryUrl; config.DomainDefaultCurrencyCode = domainDefaultCurrencyCode; config.GoogleAnalyticsAccount = googleAnalyticsAccount; config.GameLoaderDomain = gameLoaderDomain; config.GameResourceDomain = gameResourceDomain; config.NewStatusCasinoGameExpirationDays = newStatusCasinoGameExpirationDays; config.NewStatusLiveCasinoGameExpirationDays = newStatusLiveCasinoGameExpirationDays; query.Update(config); } //CacheManager.ClearCache(Constant.GameListCachePrefix); //CacheManager.ClearCache(Constant.JackpotListCachePrefix); //CacheManager.ClearCache(Constant.VendorListCachePrefix); //CacheManager.ClearCache(Constant.DomainCacheKey); return this.Json(new { @success = true }); }
public JsonResult SaveWcfApiCredentials(string wcfApiUsername, string wcfApiPassword) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } SqlQuery<ceDomainConfig> query = new SqlQuery<ceDomainConfig>(); ceDomainConfig config = EnsureDomainConfigExists(); config.WcfApiUsername = wcfApiUsername; config.WcfApiPassword = wcfApiPassword; query.Update(config); CacheManager.ClearCache(Constant.DomainCacheKey); return this.Json(new { @success = true }); }
public JsonResult RemoveDataItem(string type, long id) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } DataDictionaryAccessor dda = DataDictionaryAccessor.CreateInstance<DataDictionaryAccessor>(); var item = dda.GetById(id); SqlQuery<ceDataItem> query = new SqlQuery<ceDataItem>(); query.DeleteByKey(id); ChangeLogAccessor cla = ChangeLogAccessor.CreateInstance<ChangeLogAccessor>(); cla.BackupChangeLog(CurrentUserSession.UserSessionID, CurrentUserSession.UserID, "CeDataDictionary", id, DateTime.Now, "DELETE", Newtonsoft.Json.JsonConvert.SerializeObject(item), null); return this.Json(new { @success = true }, JsonRequestBehavior.AllowGet); }
public JsonResult SaveRecommendationConfig(string recommendationExcludeGames ,int recommendationMaxPlayerRecords , int recommendationMaxGameRecords) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } SqlQuery<ceDomainConfig> query = new SqlQuery<ceDomainConfig>(); ceDomainConfig config = EnsureDomainConfigExists(); config.RecommendationExcludeGames = recommendationExcludeGames; config.RecommendationMaxPlayerRecords = recommendationMaxPlayerRecords; config.RecommendationMaxGameRecords = recommendationMaxGameRecords; query.Update(config); CE.BackendThread.ScalableThumbnailProcessor.Begin(); CacheManager.ClearCache(Constant.DomainCacheKey); return this.Json(new { @success = true }); }
public JsonResult SaveScalableThumbnailSetting(bool enableScalableThumbnail , int scalableThumbnailWidth , int scalableThumbnailHeight ) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } SqlQuery<ceDomainConfig> query = new SqlQuery<ceDomainConfig>(); ceDomainConfig config = EnsureDomainConfigExists(); config.EnableScalableThumbnail = enableScalableThumbnail; config.ScalableThumbnailWidth = scalableThumbnailWidth; config.ScalableThumbnailHeight = scalableThumbnailHeight; query.Update(config); CE.BackendThread.ScalableThumbnailProcessor.Begin(); CacheManager.ClearCache(Constant.DomainCacheKey); return this.Json(new { @success = true }); }
public JsonResult AddDataItem(string type, string text) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } SqlQuery<ceDataItem> query = new SqlQuery<ceDataItem>(); if (!string.IsNullOrWhiteSpace(text)) { ceDataItem dataItem = new ceDataItem(); dataItem.DomainID = 0; dataItem.Text = text.Trim(); dataItem.Ins = DateTime.Now; dataItem.Type = type; dataItem.DataValue = Regex.Replace(text, @"[^\w]", string.Empty, RegexOptions.Compiled).ToUpperInvariant(); query.Insert(dataItem); } return this.Json(new { @success = true }, JsonRequestBehavior.AllowGet); }
public JsonResult SaveDomainConfig(string typeName) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } Type type = null; foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { type = assembly.GetType(typeName); if (type != null) break; } if (type == null) throw new CeException("Can not find type [{0}]", typeName); DomainConfigAccessor dca = DomainConfigAccessor.CreateInstance<DomainConfigAccessor>(); FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Static); foreach (FieldInfo field in fields) { ConfigAttribute attr = field.GetCustomAttribute<ConfigAttribute>(); if (attr == null) continue; string itemName = field.GetValue(null) as string; string itemValue = Request.Form[itemName]; string countrySpecificCfg = null; if (itemValue == null) continue; if (attr.AllowCountrySpecificValue) { countrySpecificCfg = Request.Form[string.Format("{0}_CountrySpecificCfg", itemName)]; } dca.SetConfigurationItemValue(DomainManager.CurrentDomainID, itemName, itemValue, countrySpecificCfg); } ceDomainConfigEx.ClearCfgCache(DomainManager.CurrentDomainID); return this.Json(new { @success = true }); }
public JsonResult SaveRecentWinnersDefaultSetting(int recentWinnersMaxRecords , decimal recentWinnersMinAmount , bool recentWinnersExcludeOtherOperators , bool recentWinnersReturnDistinctUserOnly ) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } SqlQuery<ceDomainConfig> query = new SqlQuery<ceDomainConfig>(); ceDomainConfig config = EnsureDomainConfigExists(); config.RecentWinnersExcludeOtherOperators = recentWinnersExcludeOtherOperators; config.RecentWinnersMaxRecords = recentWinnersMaxRecords; config.RecentWinnersMinAmount = recentWinnersMinAmount; config.RecentWinnersReturnDistinctUserOnly = recentWinnersReturnDistinctUserOnly; query.Update(config); CacheManager.ClearCache(Constant.DomainCacheKey); return this.Json(new { @success = true }); }
public JsonResult HideJackpotGame(long baseId, long jackpotId, string gameId) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } bool dbResult = false; if (DomainManager.CurrentDomainID == Constant.SystemDomainID) { dbResult = HideOrShowJackpotGameForSys(baseId, gameId, true); } else { dbResult = HideOrShowJackpotGameForOperator(baseId, jackpotId, gameId, true); } if (!dbResult) { return(this.Json(new { @success = false })); } CacheManager.ClearLocalCache(Constant.JackpotListCachePrefix); return(this.Json(new { @success = true })); }
public JsonResult SaveTopWinnersDefaultSetting(int topWinnersDaysBack , int topWinnersMaxRecords , decimal topWinnersMinAmount , bool topWinnersExcludeOtherOperators ) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } SqlQuery<ceDomainConfig> query = new SqlQuery<ceDomainConfig>(); ceDomainConfig config = EnsureDomainConfigExists(); config.TopWinnersDaysBack = topWinnersDaysBack; config.TopWinnersExcludeOtherOperators = topWinnersExcludeOtherOperators; config.TopWinnersMaxRecords = topWinnersMaxRecords; config.TopWinnersMinAmount = topWinnersMinAmount; query.Update(config); CacheManager.ClearCache(Constant.TopWinnersCachePrefix); CacheManager.ClearCache(Constant.DomainCacheKey); return this.Json(new { @success = true }); }
public JsonResult SaveApiCredentials(string apiUsername , string apiPassword , string apiWhitelistIP , string gameListChangedNotificationUrl ) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } SqlQuery<ceDomainConfig> query = new SqlQuery<ceDomainConfig>(); ceDomainConfig config = EnsureDomainConfigExists(); config.ApiUsername = apiUsername; if( !string.IsNullOrWhiteSpace(apiPassword) ) config.ApiPassword = apiPassword.MD5Hash(); config.ApiWhitelistIP = apiWhitelistIP; config.GameListChangedNotificationUrl = gameListChangedNotificationUrl; query.Update(config); CacheManager.ClearCache(Constant.DomainCacheKey); return this.Json(new { @success = true }); }
public JsonResult SavePopularitySetting(bool popularityExcludeOtherOperators , PopularityCalculationMethod popularityCalculationMethod , int popularityDaysBack , bool popularityNotByCountry , string popularityConfigurationByCountry ) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } SqlQuery<ceDomainConfig> query = new SqlQuery<ceDomainConfig>(); ceDomainConfig config = EnsureDomainConfigExists(); config.PopularityExcludeOtherOperators = popularityExcludeOtherOperators; config.PopularityCalculationMethod = popularityCalculationMethod; config.PopularityDaysBack = popularityDaysBack; config.PopularityNotByCountry = popularityNotByCountry; config.PopularityConfigurationByCountry = popularityConfigurationByCountry; query.Update(config); CacheManager.ClearCache(Constant.DomainCacheKey); return this.Json(new { @success = true }); }
public JsonResult Save() { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } if (!CurrentUserSession.IsSuperUser) { throw new HttpException(503, "Access Denied"); } using (DbManager db = new DbManager()) { CasinoVendorAccessor cva = CasinoVendorAccessor.CreateInstance <CasinoVendorAccessor>(db); List <ceCasinoVendor> vendors = cva.GetEnabledVendorList(DomainManager.CurrentDomainID, Constant.SystemDomainID); List <ceCasinoVendor> enabledGmGamingAPI = new List <ceCasinoVendor>(); List <ceCasinoVendor> enabledLogging = new List <ceCasinoVendor>(); foreach (string key in Request.Form.AllKeys) { Match m = Regex.Match(key, @"^(BonusDeduction_)(?<VendorID>\d+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); if (m.Success) { ceCasinoVendor vendor = vendors.FirstOrDefault(v => (int)v.VendorID == int.Parse(m.Groups["VendorID"].Value)); decimal bonusDeduction = 0.00M; if (vendor != null && decimal.TryParse(Request.Form[key], out bonusDeduction)) { vendor.BonusDeduction = bonusDeduction; } continue; } m = Regex.Match(key, @"^(RestrictedTerritories_)(?<VendorID>\d+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); if (m.Success) { ceCasinoVendor vendor = vendors.FirstOrDefault(v => (int)v.VendorID == int.Parse(m.Groups["VendorID"].Value)); if (vendor != null) { vendor.RestrictedTerritories = Request.Form[key]; } continue; } m = Regex.Match(key, @"^(Languages_)(?<VendorID>\d+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); if (m.Success) { ceCasinoVendor vendor = vendors.FirstOrDefault(v => (int)v.VendorID == int.Parse(m.Groups["VendorID"].Value)); if (vendor != null) { vendor.Languages = Request.Form[key]; } continue; } m = Regex.Match(key, @"^(Currencies_)(?<VendorID>\d+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); if (m.Success) { ceCasinoVendor vendor = vendors.FirstOrDefault(v => (int)v.VendorID == int.Parse(m.Groups["VendorID"].Value)); if (vendor != null) { vendor.Currencies = Request.Form[key]; } continue; } m = Regex.Match(key, @"^(EnableGmGamingAPI_)(?<VendorID>\d+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); if (m.Success) { ceCasinoVendor vendor = vendors.FirstOrDefault(v => (int)v.VendorID == int.Parse(m.Groups["VendorID"].Value)); if (vendor != null) { vendor.EnableGmGamingAPI = true; enabledGmGamingAPI.Add(vendor); } continue; } m = Regex.Match(key, @"^(EnableLogging_)(?<VendorID>\d+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled); if (m.Success) { ceCasinoVendor vendor = vendors.FirstOrDefault(v => (int)v.VendorID == int.Parse(m.Groups["VendorID"].Value)); if (vendor != null) { vendor.EnableLogging = true; enabledLogging.Add(vendor); } continue; } } SqlQuery <ceCasinoVendor> query = new SqlQuery <ceCasinoVendor>(); foreach (ceCasinoVendor vendor in vendors) { if (!enabledGmGamingAPI.Exists(v => v.VendorID == vendor.VendorID)) { vendor.EnableGmGamingAPI = false; } if (!enabledLogging.Exists(v => v.VendorID == vendor.VendorID)) { vendor.EnableLogging = false; } query.Update(vendor); } CacheManager.ClearCache(Constant.VendorListCachePrefix); CacheManager.ClearCache(Constant.DomainVendorsCachePrefix); } return(this.Json(new { @success = true })); }
public JsonResult SaveJackpot(ceCasinoJackpotBaseEx updatedJackpot) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } if (DomainManager.CurrentDomainID == Constant.SystemDomainID) { SqlQuery <ceCasinoJackpotBase> query = new SqlQuery <ceCasinoJackpotBase>(); ceCasinoJackpotBase jackpot = null; if (updatedJackpot.BaseID > 0) { jackpot = query.SelectByKey(updatedJackpot.BaseID); } if (jackpot == null) { jackpot = new ceCasinoJackpotBase() { VendorID = updatedJackpot.VendorID, Ins = DateTime.Now, DomainID = DomainManager.CurrentDomainID, SessionUserID = CurrentUserSession.UserID, } } ; jackpot.ID = updatedJackpot.BaseID; jackpot.Name = updatedJackpot.Name; jackpot.VendorID = updatedJackpot.VendorID; jackpot.GameIDs = updatedJackpot.GameIDs.DefaultIfNullOrEmpty(string.Empty).Trim(','); jackpot.IsFixedAmount = false; jackpot.MappedJackpotID = updatedJackpot.MappedJackpotID; jackpot.CustomVendorConfig = InitCustomVendorConfig(updatedJackpot.CustomVendorConfig); if (updatedJackpot.BaseID > 0) { query.Update(jackpot); } else { query.Insert(jackpot); } } else { SqlQuery <ceCasinoJackpot> query = new SqlQuery <ceCasinoJackpot>(); ceCasinoJackpotBaseEx domainJackpot = null; ceCasinoJackpot ceCasinoJackpot; long ceJackpotId = updatedJackpot.JackpotID; if (updatedJackpot.BaseID > 0) { ceCasinoJackpot = CasinoJackpotAccessor.QueryDomainJackpot(DomainManager.CurrentDomainID, updatedJackpot.BaseID); } else { ceCasinoJackpot = query.SelectByKey(updatedJackpot.JackpotID); } if (ceCasinoJackpot != null) { ceJackpotId = ceCasinoJackpot.ID; } if (updatedJackpot.BaseID > 0 || ceJackpotId > 0) { domainJackpot = CasinoJackpotAccessor.GetByKey(DomainManager.CurrentDomainID, updatedJackpot.BaseID, ceJackpotId); } if (ceCasinoJackpot == null) { ceCasinoJackpot = new ceCasinoJackpot(); ceCasinoJackpot.Ins = DateTime.Now; ceCasinoJackpot.DomainID = DomainManager.CurrentDomainID; ceCasinoJackpot.SessionUserID = CurrentUserSession.UserID; } if (domainJackpot == null) { ceCasinoJackpot.CasinoJackpotBaseID = updatedJackpot.BaseID; ceCasinoJackpot.Name = updatedJackpot.Name.Trim(); ceCasinoJackpot.VendorID = updatedJackpot.VendorID; ceCasinoJackpot.IsDeleted = false; if (!(updatedJackpot.GameIDs.DefaultIfNullOrEmpty(string.Empty).Trim(',')).Equals(string.Empty)) { ceCasinoJackpot.GameIDs = updatedJackpot.GameIDs.DefaultIfNullOrEmpty(string.Empty).Trim(','); } if (!string.IsNullOrEmpty(updatedJackpot.MappedJackpotID)) { ceCasinoJackpot.MappedJackpotID = updatedJackpot.MappedJackpotID; } if (!string.IsNullOrEmpty(updatedJackpot.CustomVendorConfig)) { ceCasinoJackpot.CustomVendorConfig = InitCustomVendorConfig(updatedJackpot.CustomVendorConfig); } } else { if (updatedJackpot.BaseID != 0) { ceCasinoJackpot.CasinoJackpotBaseID = updatedJackpot.BaseID; } if (!(updatedJackpot.Name.Trim()).Equals(domainJackpot.Name.DefaultIfNullOrEmpty(string.Empty).Trim())) { ceCasinoJackpot.Name = updatedJackpot.Name.Trim(); } if (domainJackpot.VendorID != updatedJackpot.VendorID) { ceCasinoJackpot.VendorID = updatedJackpot.VendorID; } if (!(updatedJackpot.GameIDs.DefaultIfNullOrEmpty(string.Empty).Trim(',')).Equals(domainJackpot.GameIDs.DefaultIfNullOrEmpty(string.Empty).Trim(','))) { ceCasinoJackpot.GameIDs = updatedJackpot.GameIDs.DefaultIfNullOrEmpty(string.Empty).Trim(','); } if (!(updatedJackpot.BaseCurrency.DefaultIfNullOrEmpty(string.Empty).Trim()).Equals(domainJackpot.BaseCurrency)) { ceCasinoJackpot.BaseCurrency = updatedJackpot.BaseCurrency.DefaultIfNullOrWhiteSpace(null); } if (!(updatedJackpot.MappedJackpotID.DefaultIfNullOrEmpty(string.Empty)).Equals(domainJackpot.MappedJackpotID)) { ceCasinoJackpot.MappedJackpotID = updatedJackpot.MappedJackpotID.DefaultIfNullOrWhiteSpace(null); } if (!(updatedJackpot.HiddenGameIDs.DefaultIfNullOrEmpty(string.Empty).Trim(',')).Equals(domainJackpot.HiddenGameIDs.DefaultIfNullOrEmpty(string.Empty).Trim(','))) { ceCasinoJackpot.HiddenGameIDs = updatedJackpot.HiddenGameIDs.DefaultIfNullOrEmpty(string.Empty).Trim(','); } if (!(updatedJackpot.CustomVendorConfig.DefaultIfNullOrEmpty(string.Empty)).Equals(domainJackpot.CustomVendorConfig)) { ceCasinoJackpot.CustomVendorConfig = InitCustomVendorConfig(updatedJackpot.CustomVendorConfig); } } ceCasinoJackpot = initJackpot(ceCasinoJackpot); if (ceJackpotId > 0) { query.Update(ceCasinoJackpot); } else { query.Insert(ceCasinoJackpot); } } CacheManager.ClearLocalCache(Constant.JackpotListCachePrefix); return(this.Json(new { @success = true })); }
public JsonResult Enable(long[] providerIDs, bool enable) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } try { if (!CurrentUserSession.IsSystemUser) { throw new CeException("You are not allowed to perform this operation."); } SqlQuery <ceContentProviderBase> query1 = new SqlQuery <ceContentProviderBase>(); SqlQuery <ceContentProvider> query2 = new SqlQuery <ceContentProvider>(); ContentProviderAccessor cpa = ContentProviderAccessor.CreateInstance <ContentProviderAccessor>(); foreach (int providerID in providerIDs) { if (CurrentUserSession.IsSystemUser && DomainManager.CurrentDomainID == Constant.SystemDomainID) { ceContentProviderBase baseProvider = query1.SelectByKey(providerID); baseProvider.Enabled = enable; query1.Update(baseProvider); } else { ceContentProvider provider = cpa.QueryDomainProvider(providerID, DomainManager.CurrentDomainID); if (provider == null) { provider = new ceContentProvider(); provider.DomainID = DomainManager.CurrentDomainID; provider.ContentProviderBaseID = providerID; provider.Logo = null; provider.Ins = DateTime.Now; provider.Enabled = enable; query2.Insert(provider); } else { if (string.IsNullOrWhiteSpace(provider.Logo)) { provider.Logo = null; } provider.Enabled = enable; query2.Update(provider); } } } return(this.Json(new { success = true }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Logger.Exception(ex); return(this.Json(new { success = false, error = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ContentResult Save(ceContentProviderBase updatedProvider , HttpPostedFileBase logoFile) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } try { string logoImageFilePath = null; string imageFileName; byte[] imageBuffer; if (ImageAsset.ParseImage(logoFile, out imageFileName, out imageBuffer)) { logoImageFilePath = ImageAsset.GetImageFtpFilePath(imageFileName); FTP.UploadFile(DomainManager.CurrentDomainID, logoImageFilePath, imageBuffer); } using (DbManager db = new DbManager()) { if (DomainManager.CurrentDomainID == Constant.SystemDomainID) { if (string.IsNullOrWhiteSpace(updatedProvider.Identifying)) { throw new ArgumentNullException("Identifying"); } if (string.IsNullOrWhiteSpace(updatedProvider.Name)) { throw new ArgumentNullException("Name"); } if (!string.IsNullOrWhiteSpace(updatedProvider.Name)) { updatedProvider.Name = Regex.Replace(updatedProvider.Name, @"[^a-z_\-\d]", string.Empty, RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.ECMAScript | RegexOptions.Compiled); if (Regex.IsMatch(updatedProvider.Name, "^(\\d+)$", RegexOptions.CultureInvariant | RegexOptions.Compiled)) { throw new Exception("The name can not only contain digits."); } } SqlQuery <ceContentProviderBase> query = new SqlQuery <ceContentProviderBase>(db); ceContentProviderBase provider = null; if (updatedProvider.ID > 0) { provider = query.SelectByKey(updatedProvider.ID); } if (provider == null) { provider = new ceContentProviderBase(); provider.Ins = DateTime.Now; provider.Enabled = true; } bool changed = false; if (string.IsNullOrWhiteSpace(provider.Identifying) && provider.Identifying != updatedProvider.Identifying) { provider.Identifying = updatedProvider.Identifying; changed = true; } if (provider.Name != updatedProvider.Name) { provider.Name = updatedProvider.Name; changed = true; } if (!string.IsNullOrWhiteSpace(logoImageFilePath)) { if (provider.Logo != logoImageFilePath) { provider.Logo = logoImageFilePath; changed = true; } } if (provider.ID > 0) { if (changed) { query.Update(db, provider); } } else { query.Insert(db, provider); } } else if (updatedProvider.ID > 0) { SqlQuery <ceContentProviderBase> queryBase = new SqlQuery <ceContentProviderBase>(db); ceContentProviderBase providerBase = queryBase.SelectByKey(updatedProvider.ID); SqlQuery <ceContentProvider> query = new SqlQuery <ceContentProvider>(db); ContentProviderAccessor cpa = ContentProviderAccessor.CreateInstance <ContentProviderAccessor>(); ceContentProvider provider = cpa.QueryDomainProvider(updatedProvider.ID, DomainManager.CurrentDomainID); if (provider == null) { provider = new ceContentProvider(); provider.ContentProviderBaseID = providerBase.ID; provider.Enabled = null; provider.Ins = DateTime.Now; provider.Logo = null; provider.DomainID = DomainManager.CurrentDomainID; } bool changed = false; if (!string.IsNullOrWhiteSpace(logoImageFilePath)) { if (providerBase.Logo != updatedProvider.Logo) { provider.Logo = logoImageFilePath; } else { provider.Logo = null; } changed = true; } if (provider.ID > 0) { if (changed) { query.Update(db, provider); } } else { query.Insert(db, provider); } } } string script = "<script language=\"javascript\" type=\"text/javascript\">top.onSaved(true, '');</script>"; return(this.Content(script, "text/html")); } catch (Exception ex) { Logger.Exception(ex); string script = string.Format("<script language=\"javascript\" type=\"text/javascript\">top.onSaved(false, '{0}');</script>", ex.Message.SafeJavascriptStringEncode()); return(this.Content(script, "text/html")); } }
public JsonResult EnableTables(long[] tableIDs, bool enable) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } try { if (!CurrentUserSession.IsSystemUser) { throw new CeException("You are not allowed to perform this operation."); } SqlQuery <ceLiveCasinoTableBase> query1 = new SqlQuery <ceLiveCasinoTableBase>(); SqlQuery <ceLiveCasinoTable> query2 = new SqlQuery <ceLiveCasinoTable>(); LiveCasinoTableAccessor lta = LiveCasinoTableAccessor.CreateInstance <LiveCasinoTableAccessor>(); foreach (long tableID in tableIDs) { if (CurrentUserSession.IsSystemUser && DomainManager.CurrentDomainID == Constant.SystemDomainID) { ceLiveCasinoTableBase baseTable = query1.SelectByKey(tableID); baseTable.Enabled = enable; query1.Update(baseTable); } else { ceLiveCasinoTable table = lta.GetTable(DomainManager.CurrentDomainID, tableID); if (table == null) { table = new ceLiveCasinoTable() { DomainID = DomainManager.CurrentDomainID, LiveCasinoTableBaseID = tableID }; table.Ins = DateTime.Now; table.SessionUserID = CurrentUserSession.UserID; table.SessionID = CurrentUserSession.UserSessionID; table.Enabled = enable; table.ClientCompatibility = null; table.TableName = null; table.ShortName = null; table.Category = null; table.Thumbnail = null; table.Logo = null; table.BackgroundImage = null; table.ExtraParameter1 = null; table.ExtraParameter2 = null; table.ExtraParameter3 = null; table.ExtraParameter4 = null; table.LaunchParams = null; table.LimitationXml = null; query2.Insert(table); } else { if (string.IsNullOrWhiteSpace(table.ClientCompatibility)) { table.ClientCompatibility = null; } if (string.IsNullOrWhiteSpace(table.TableName)) { table.TableName = null; } if (string.IsNullOrWhiteSpace(table.ShortName)) { table.ShortName = null; } if (string.IsNullOrWhiteSpace(table.Category)) { table.Category = null; } if (string.IsNullOrWhiteSpace(table.Thumbnail)) { table.Thumbnail = null; } if (string.IsNullOrWhiteSpace(table.Logo)) { table.Logo = null; } if (string.IsNullOrWhiteSpace(table.BackgroundImage)) { table.BackgroundImage = null; } if (string.IsNullOrWhiteSpace(table.ExtraParameter1)) { table.ExtraParameter1 = null; } if (string.IsNullOrWhiteSpace(table.ExtraParameter2)) { table.ExtraParameter2 = null; } if (string.IsNullOrWhiteSpace(table.ExtraParameter3)) { table.ExtraParameter3 = null; } if (string.IsNullOrWhiteSpace(table.ExtraParameter4)) { table.ExtraParameter4 = null; } if (string.IsNullOrWhiteSpace(table.LaunchParams)) { table.LaunchParams = null; } if (string.IsNullOrWhiteSpace(table.LimitationXml)) { table.LimitationXml = null; } table.Enabled = enable; query2.Update(table); } } } return(this.Json(new { success = true }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Logger.Exception(ex); return(this.Json(new { success = false, error = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult RegisterTable(long gameID , string extraParameter1 , string extraParameter2 , string extraParameter3 , string extraParameter4 , string ClientCompatibility , string launchParams ) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } try { var domain = DomainManager.GetDomains().FirstOrDefault(d => d.DomainID == DomainManager.CurrentDomainID); if (domain == null && DomainManager.GetSysDomain().DomainID == DomainManager.CurrentDomainID) { domain = DomainManager.GetSysDomain(); } using (DbManager db = new DbManager()) { ceCasinoGameBaseEx game = CasinoGameAccessor.GetDomainGame(Constant.SystemDomainID, gameID); SqlQuery <ceLiveCasinoTableBase> query = new SqlQuery <ceLiveCasinoTableBase>(db); ceLiveCasinoTableBase table = new ceLiveCasinoTableBase(); table.CasinoGameBaseID = gameID; table.Enabled = true; table.NewTableExpirationDate = DateTime.Now.AddDays(domain.NewStatusLiveCasinoGameExpirationDays); table.Ins = DateTime.Now; table.SessionUserID = CurrentUserSession.UserID; table.SessionID = CurrentUserSession.SessionID; table.TableName = game.GameName; table.ExtraParameter1 = extraParameter1; table.ExtraParameter2 = extraParameter2; table.ExtraParameter3 = extraParameter3; table.ExtraParameter4 = extraParameter4; table.LaunchParams = launchParams; table.OpenHoursStart = 0; table.OpenHoursEnd = 0; table.ClientCompatibility = ClientCompatibility ?? ",PC,"; #region TableID switch (game.VendorID) { case VendorID.Microgaming: table.ID = gameID; break; case VendorID.XProGaming: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.EvolutionGaming: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.Tombala: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.NetEnt: { table.ID = gameID * 1000000 + int.Parse(extraParameter1); table.Limit = NetEntAPI.LiveCasinoTable.Get(DomainManager.CurrentDomainID, game.GameID, table.ExtraParameter1).Limitation; break; } case VendorID.Ezugi: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.ISoftBet: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.Vivo: { int l = 999999; int.TryParse(extraParameter2, out l); if (l > 1000000) { l = l % 1000000; } Random r = new Random(); int i = r.Next(l); table.ID = gameID * 1000000 + int.Parse(extraParameter1) + l; break; } case VendorID.BetGames: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.PokerKlas: table.ID = gameID; break; case VendorID.LuckyStreak: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.Authentic: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.ViG: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.HoGaming: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.TTG: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.LiveGames: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } case VendorID.Entwine: { Random r = new Random(); table.ID = gameID * 1000000 + r.Next(100000); break; } default: Random rnd = new Random(); table.ID = gameID * 1000000 + rnd.Next(100000); break; } #endregion query.Insert(table); } return(this.Json(new { success = true }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Logger.Exception(ex); return(this.Json(new { success = false, error = ex.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult SaveTable(ceLiveCasinoTableBaseEx updatedTable , HttpPostedFileBase thumbnailFile ) { if (!DomainManager.AllowEdit()) { throw new Exception("Data modified is not allowed"); } try { string imageFileName; byte[] imageBuffer; if (ImageAsset.ParseImage(thumbnailFile, out imageFileName, out imageBuffer)) { imageFileName = ImageAsset.GetImageFtpFilePath(imageFileName); FTP.UploadFile(DomainManager.CurrentDomainID, imageFileName, imageBuffer); } SqlQuery <ceLiveCasinoTableBase> query = new SqlQuery <ceLiveCasinoTableBase>(); ceLiveCasinoTableBase baseTable = query.SelectByKey(updatedTable.ID); ceCasinoGameBaseEx game = CasinoGameAccessor.GetDomainGame(Constant.SystemDomainID, baseTable.CasinoGameBaseID); if (CurrentUserSession.IsSystemUser && DomainManager.CurrentDomainID == Constant.SystemDomainID) { baseTable.TableName = updatedTable.TableName; baseTable.Category = updatedTable.Category; baseTable.ExtraParameter1 = updatedTable.ExtraParameter1; baseTable.ExtraParameter2 = updatedTable.ExtraParameter2; baseTable.ExtraParameter3 = updatedTable.ExtraParameter3; baseTable.ExtraParameter4 = updatedTable.ExtraParameter4; baseTable.LaunchParams = updatedTable.LaunchParams; baseTable.OpenHoursStart = updatedTable.OpenHoursStart; baseTable.OpenHoursEnd = updatedTable.OpenHoursEnd; baseTable.OpenHoursTimeZone = updatedTable.OpenHoursTimeZone; baseTable.Limit = ParseLimit(); baseTable.VIPTable = updatedTable.VIPTable; baseTable.NewTable = updatedTable.NewTable; baseTable.NewTableExpirationDate = updatedTable.NewTable ? updatedTable.NewTableExpirationDate : DateTime.Now.AddDays(-1); baseTable.ExcludeFromRandomLaunch = updatedTable.ExcludeFromRandomLaunch; baseTable.TurkishTable = updatedTable.TurkishTable; baseTable.BetBehindAvailable = updatedTable.BetBehindAvailable; baseTable.SeatsUnlimited = updatedTable.SeatsUnlimited; baseTable.DealerGender = updatedTable.DealerGender; baseTable.DealerOrigin = updatedTable.DealerOrigin; baseTable.TableStudioUrl = updatedTable.TableStudioUrl; //if (game.VendorID == VendorID.EvolutionGaming) { baseTable.ClientCompatibility = updatedTable.ClientCompatibility; } if (!string.IsNullOrWhiteSpace(imageFileName)) { baseTable.Thumbnail = imageFileName; } query.Update(baseTable); //updating properties that are inherited from basetable and disabled for edit in child tables var propertiesValues = new Dictionary <string, object> { { "BetBehindAvailable", updatedTable.BetBehindAvailable }, { "SeatsUnlimited", updatedTable.SeatsUnlimited }, { "DealerGender", updatedTable.DealerGender }, { "DealerOrigin", updatedTable.DealerOrigin } }; LiveCasinoTableAccessor.UpdateChildTablesProperties(propertiesValues, baseTable.ID); } else if (DomainManager.CurrentDomainID != Constant.SystemDomainID) { LiveCasinoTableAccessor lta = LiveCasinoTableAccessor.CreateInstance <LiveCasinoTableAccessor>(); ceLiveCasinoTable table = lta.GetTable(DomainManager.CurrentDomainID, updatedTable.ID); bool isExist = table != null; bool isModified = false; if (!isExist) { table = new ceLiveCasinoTable() { DomainID = DomainManager.CurrentDomainID, LiveCasinoTableBaseID = updatedTable.ID }; table.Ins = DateTime.Now; table.SessionUserID = CurrentUserSession.UserID; table.SessionID = CurrentUserSession.UserSessionID; table.OpVisible = baseTable.OpVisible; table.ClientCompatibility = null; table.NewTableExpirationDate = baseTable.NewTableExpirationDate == DateTime.MinValue ? DateTime.Now.Date.AddDays(-1) : baseTable.NewTableExpirationDate; table.BetBehindAvailable = baseTable.BetBehindAvailable; table.SeatsUnlimited = baseTable.SeatsUnlimited; table.DealerGender = baseTable.DealerGender; table.DealerOrigin = baseTable.DealerOrigin; } table.ShortName = null; table.Logo = null; table.BackgroundImage = null; if (!string.IsNullOrWhiteSpace(updatedTable.ExtraParameter1) && !string.Equals(baseTable.ExtraParameter1, updatedTable.ExtraParameter1)) { isModified = true; table.ExtraParameter1 = updatedTable.ExtraParameter1; } else { table.ExtraParameter1 = null; } if (!string.IsNullOrWhiteSpace(updatedTable.ExtraParameter2) && !string.Equals(baseTable.ExtraParameter2, updatedTable.ExtraParameter2)) { isModified = true; table.ExtraParameter2 = updatedTable.ExtraParameter2; } else { table.ExtraParameter2 = null; } if (!string.IsNullOrWhiteSpace(updatedTable.ExtraParameter3) && !string.Equals(baseTable.ExtraParameter3, updatedTable.ExtraParameter3)) { isModified = true; table.ExtraParameter3 = updatedTable.ExtraParameter3; } else { table.ExtraParameter3 = null; } if (!string.IsNullOrWhiteSpace(updatedTable.ExtraParameter4) && !string.Equals(baseTable.ExtraParameter4, updatedTable.ExtraParameter4)) { isModified = true; table.ExtraParameter4 = updatedTable.ExtraParameter4; } else { table.ExtraParameter4 = null; } if (!string.IsNullOrEmpty(updatedTable.LaunchParams) && !string.Equals(baseTable.LaunchParams, updatedTable.LaunchParams)) { isModified = true; table.LaunchParams = updatedTable.LaunchParams; } else { table.LaunchParams = null; } if (!string.IsNullOrWhiteSpace(updatedTable.TableName) && !string.Equals(baseTable.TableName, updatedTable.TableName)) { isModified = true; table.TableName = updatedTable.TableName; } else { table.TableName = null; } if (!string.IsNullOrWhiteSpace(updatedTable.Category) && !string.Equals(baseTable.Category, updatedTable.Category)) { isModified = true; table.Category = updatedTable.Category; } else { table.Category = null; } if (!string.IsNullOrWhiteSpace(imageFileName) && !string.Equals(baseTable.Thumbnail, updatedTable.Thumbnail)) { isModified = true; table.Thumbnail = imageFileName; } else { table.Thumbnail = null; } //if (game.VendorID == VendorID.EvolutionGaming) { if (updatedTable.ClientCompatibility != null && !string.Equals(table.ClientCompatibility, updatedTable.ClientCompatibility)) { isModified = true; if (!string.Equals(baseTable.ClientCompatibility, updatedTable.ClientCompatibility)) { table.ClientCompatibility = updatedTable.ClientCompatibility; } else { table.ClientCompatibility = null; } } } string limitationXml = table.LimitationXml; LiveCasinoTableLimit limit = table.Limit; table.Limit = ParseLimit(); if (table.Limit.Equals(baseTable.Limit)) { table.LimitationXml = null; } if (!(string.IsNullOrWhiteSpace(table.LimitationXml) && string.IsNullOrWhiteSpace(limitationXml))) { if (table.LimitationXml == null) { isModified = true; } else if (!table.LimitationXml.Equals(limitationXml, StringComparison.InvariantCultureIgnoreCase)) { isModified = true; } } if (table.VIPTable != updatedTable.VIPTable) { table.VIPTable = updatedTable.VIPTable; isModified = true; } if (table.NewTable != updatedTable.NewTable || table.NewTableExpirationDate.CompareTo(updatedTable.NewTableExpirationDate) != 0) { table.NewTable = updatedTable.NewTable; table.NewTableExpirationDate = updatedTable.NewTable ? updatedTable.NewTableExpirationDate : DateTime.Now.AddDays(-1); isModified = true; } if (table.TurkishTable != updatedTable.TurkishTable) { table.TurkishTable = updatedTable.TurkishTable; isModified = true; } if (table.ExcludeFromRandomLaunch != updatedTable.ExcludeFromRandomLaunch) { table.ExcludeFromRandomLaunch = updatedTable.ExcludeFromRandomLaunch; isModified = true; } if (table.TableStudioUrl != updatedTable.TableStudioUrl) { table.TableStudioUrl = updatedTable.TableStudioUrl; isModified = true; } if (isModified) { SqlQuery <ceLiveCasinoTable> query2 = new SqlQuery <ceLiveCasinoTable>(); if (isExist) { query2.Update(table); } else { query2.Insert(table); } } } return(this.Json(new { success = true }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { Logger.Exception(ex); return(this.Json(new { success = false, error = ex.Message }, JsonRequestBehavior.AllowGet)); } }