Example #1
0
        private bool HideOrShowJackpotGameForSys(long baseId, string gameId, bool hideFlag = true)
        {
            bool result = false;
            SqlQuery <ceCasinoJackpotBase> query   = new SqlQuery <ceCasinoJackpotBase>();
            ceCasinoJackpotBase            jackpot = query.SelectByKey(baseId);

            if (!jackpot.GameIDs.Contains(gameId))
            {
                return(result);
            }
            else
            {
                var hiddenGames = !string.IsNullOrEmpty(jackpot.HiddenGameIDs) ? jackpot.HiddenGameIDs.Split(',').ToList() : new List <string>();

                if (hideFlag && hiddenGames.IndexOf(gameId) < 0)
                {
                    hiddenGames.Add(gameId);
                    jackpot.HiddenGameIDs = string.Join(",", hiddenGames);
                }
                else if (!hideFlag && hiddenGames.IndexOf(gameId) >= 0)
                {
                    hiddenGames.Remove(gameId);
                    jackpot.HiddenGameIDs = string.Join(",", hiddenGames);
                    if (string.IsNullOrEmpty(jackpot.HiddenGameIDs))
                    {
                        jackpot.HiddenGameIDs = null;
                    }
                }
                query.Update(jackpot);

                result = true;
            }
            return(result);
        }
Example #2
0
        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));
        }
Example #3
0
        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 }));
        }