public List <HistoryInfor> Vuabai_GetHistory(int topCount, int betType = 1)
        {
            if (CheckBlockedUser())
            {
                return(new List <HistoryInfor>());
            }
            var  lst       = new List <HistoryInfor>();
            long accountId = AccountSession.AccountID;

            if (accountId < 1)
            {
                return(lst);
            }
            //if (topCount > 200 || topCount < 1)
            //{
            //    topCount = 200;
            //}
            lst = AbstractDaoFactory.Instance().CreateEventDao().SP_SlotKingPocker_GetHisrorySpin(accountId, topCount, betType);
            if (lst != null)
            {
                //NLogLogger.LogInfo(string.Format("GetHistory =>accId: {0} | accName: {1} | currPage: {2} | recordPerPage :{3} | BetType: {4}, TopCount: {5}", AccountSession.AccountID, AccountSession.AccountID, currPage, recordPerPage, 0, recordPerPage));
                return(lst);
            }
            //NLogLogger.LogInfo(string.Format("GetHistory =>accId: {0} | accName: {1} | currPage: {2} | recordPerPage :{3} | BetType: {4}, TopCount: {5}", AccountSession.AccountID, AccountSession.AccountID, currPage, recordPerPage, 0, recordPerPage));
            return(new List <HistoryInfor>());
        }
Ejemplo n.º 2
0
        public string GetSampleData(int betType)
        {
            if (!IsDataTest)
            {
                return("Tính năng đã disabled");
            }
            var accountId   = 0;
            var accountName = string.Empty;

            try
            {
                string accountInfo = HttpContext.Current.User.Identity.Name;
                if (accountInfo.Split('|').Length >= 4)
                {
                    accountId   = int.Parse(accountInfo.Split('|')[0]);
                    accountName = string.Format(accountInfo.Split('|')[1]);
                    NLogLogger.LogInfo("acc: {0} - access: {1}");
                }

                if (accountId <= 0)
                {
                    return(string.Empty);
                }


                string l           = string.Empty;
                string accountTest = string.Empty;

                var accountFile = new StreamReader(HttpContext.Current.Server.MapPath(AccountTestFile));
                while ((l = accountFile.ReadLine()) != null)
                {
                    accountTest += l + ",";
                }
                accountFile.Close();

                //chi nhung tai khoan test moi duoc su dung data test
                if (accountTest.IndexOf("," + accountName + ",", StringComparison.Ordinal) < 0)
                {
                    return("Tài khoản của bạn có quyền truy cập");
                }
                string dataTest = string.Empty;
                dataTest = AbstractDaoFactory.Instance().CreateMiniGame().GetSlotData(accountId, betType);
                //neu du lieu trong file test khong co
                if (dataTest.Length <= 0)
                {
                    return("");
                }

                return(dataTest);
            }
            catch (Exception ex)
            {
                NLogLogger.PublishException(ex);
                return("Lỗi:" + ex.Message);
            }
        }
Ejemplo n.º 3
0
        public DataTable GetHistory()
        {
            long accountId = AccountSession.AccountID;

            if (accountId < 1)
            {
                return(null);
            }
            return(AbstractDaoFactory.Instance().CreateEventDao().GetHistory(accountId, 100));
        }
Ejemplo n.º 4
0
        public string GetSlotsDataTest()
        {
            string accountName = AccountSession.AccountName;

            if (string.IsNullOrEmpty(accountName))
            {
                return(null);
            }
            return(AbstractDaoFactory.Instance().CreateEventDao().GetSlotsDataTest(accountName));
        }
Ejemplo n.º 5
0
        public int SetSlotsDataTest(string slotData)
        {
            string accountName = AccountSession.AccountName;

            if (string.IsNullOrEmpty(accountName))
            {
                return(-33);
            }
            return(AbstractDaoFactory.Instance().CreateEventDao().SetSlotsDataTest(accountName, slotData));
        }
Ejemplo n.º 6
0
        internal static ILocationDao getDao(AbstractConnection cxn)
        {
            if (!cxn.IsConnected)
            {
                throw new MdoException(MdoExceptionCode.USAGE_NO_CONNECTION, "Unable to instantiate DAO: unconnected");
            }
            AbstractDaoFactory f = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(cxn.DataSource.Protocol));

            return(f.getLocationDao(cxn));
        }
        public List <HistoryInfor> Vuabai_GetNotification(int topCount, int betType = 1)
        {
            if (CheckBlockedUser())
            {
                return(new List <HistoryInfor>());
            }
            var lst = new List <HistoryInfor>();

            lst = AbstractDaoFactory.Instance().CreateEventDao().SP_SlotKingPocker_GetNotification(betType);

            return(lst);
        }
Ejemplo n.º 8
0
        public int CreateSampleData([FromBody]
                                    dynamic data)
        {
            if (!IsDataTest)
            {
                return(-99);
            }

            var accountId   = 0;
            var accountName = string.Empty;

            try
            {
                string accountInfo = HttpContext.Current.User.Identity.Name;
                if (accountInfo.Split('|').Length >= 4)
                {
                    accountId   = int.Parse(accountInfo.Split('|')[0]);
                    accountName = string.Format(accountInfo.Split('|')[1]);
                    NLogLogger.LogInfo("acc: {0} - access: {1}");
                }

                if (accountId <= 0)
                {
                    return(-2);
                }

                string l           = string.Empty;
                string accountTest = string.Empty;

                var accountFile = new StreamReader(HttpContext.Current.Server.MapPath(AccountTestFile));
                while ((l = accountFile.ReadLine()) != null)
                {
                    accountTest += l + ",";
                }
                accountFile.Close();

                //chi nhung tai khoan test moi duoc su dung data test
                if (accountTest.IndexOf("," + accountName + ",", StringComparison.Ordinal) < 0)
                {
                    return(-1);
                }

                string cards   = data.card;
                int    betType = data.betType;
                var    result  = AbstractDaoFactory.Instance().CreateMiniGame().SetSlotData(accountId, cards, betType);
                return(result);
            }
            catch (Exception ex)
            {
                NLogLogger.PublishException(ex);
                return(-99);
            }
        }
Ejemplo n.º 9
0
        public static AbstractConnection authorizedConnect(string theUser, bool isBse)
        {
            string              securityPhrase = (isBse ? "" : "NON-BSE");
            MockApp             theApp         = getTheApp(securityPhrase);
            DataSource          src            = VistaSetups.getSrc(theApp.SiteTable, theApp.LoginSitecode);
            AbstractDaoFactory  f           = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol));
            AbstractConnection  cxn         = f.getConnection(src);
            AbstractCredentials credentials = getVisitCredentials(theApp);
            AbstractPermission  permission  = new MenuOption(theApp.User.PermissionString);

            theApp.User = (User)cxn.authorizedConnect(credentials, permission, null);
            return(cxn);
        }
Ejemplo n.º 10
0
        public UserTO loginActiveDirectory(string domain, string username, string password)
        {
            UserTO result = new UserTO();

            if (String.IsNullOrEmpty(domain) || String.IsNullOrEmpty(username) || String.IsNullOrEmpty(password))
            {
                result.fault = new FaultTO("Must supply domain, username and password");
            }

            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                DataSource src = new DataSource()
                {
                    SiteId = new SiteId("1"), Modality = "FEDUID", Protocol = "LDAP", Provider = domain
                };
                AbstractDaoFactory f   = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol));
                LdapConnection     cxn = new LdapConnection(src);
                cxn.Account = new LdapAccount(cxn);

                LdapCredentials creds = new LdapCredentials()
                {
                    AccountName = username, AccountPassword = password
                };

                using (new Impersonator(mySession.MdwsConfiguration.LdapConfiguration.RunasUser))
                {
                    string guid = cxn.Account.authenticate(creds);

                    LdapUserDao  dao = new LdapUserDao(cxn);
                    IList <User> guidLookupResult = dao.userLookupList(new KeyValuePair <string, string>("", guid));

                    if (guidLookupResult.Count != 1)
                    {
                        throw new ApplicationException("Unexpected error - more than one user returned for authenticated user's GUID");
                    }

                    return(new UserTO(guidLookupResult[0]));
                }
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }

            return(result);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Use this setup method to authenticate to a real Vista system (both production and test) for the prupose
        /// of running a 'live' test(s)
        /// </summary>
        /// <param name="siteId">The site to authenticate against - should have a corresponding 'User###' entry in your secret-testObjects.xml file with valid credentials</param>
        /// <returns>AbstractConnection</returns>
        public AbstractConnection setup(string siteId)
        {
            DataSource         source = this.SiteTable.getSite(siteId).Sources[0]; // TBD - should we loop through data sources to make sure we get VISTA protocol?
            AbstractDaoFactory f      = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(source.Protocol));

            if (String.Equals(source.Protocol, "VISTA"))
            {
                return(this.Cxn = VistaSetups.authorizedConnect("User" + siteId, false));
            }
            else
            {
                return(this.Cxn = f.getConnection(source));
            }
        }
Ejemplo n.º 12
0
        //public UserTO updateActiveDirectoryProfile(string domain, string username, string password, string title,
        //    string officePhone, string faxNumber, string addressLine1, string addressLine2, string addressLine2,
        //    string city, string state, string zip, string office,

        public UserArray ldapUserLookup(string uid, string domainSearchRoot)
        {
            UserArray result = new UserArray();

            if (String.IsNullOrEmpty(uid))
            {
                result.fault = new FaultTO("Must supply domain, username and password");
            }

            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                DataSource src = new DataSource()
                {
                    SiteId = new SiteId("1"), Modality = "FEDUID", Protocol = "LDAP", Provider = "GC://dc=va,dc=gov"
                };
                if (!String.IsNullOrEmpty(domainSearchRoot))
                {
                    src.Provider = domainSearchRoot;
                }
                AbstractDaoFactory f   = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol));
                LdapConnection     cxn = new LdapConnection(src);
                cxn.Account = new LdapAccount(cxn);

                LdapUserDao dao = new LdapUserDao(cxn);

                IList <User> users = null;
                using (new Impersonator(mySession.MdwsConfiguration.LdapConfiguration.RunasUser))
                {
                    users = dao.userLookupList(new KeyValuePair <String, String>("", uid));
                }

                result = new UserArray(users);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }

            return(result);
        }
Ejemplo n.º 13
0
        void growPool()
        {
            if (_consecutiveCxnErrorCount > this.PoolSource.MaxConsecutiveErrors) // we want to recognize when a site might be down, network issues, etc. - wait to retry if we have many connection failures without success
            {
                if (DateTime.Now.Subtract(_lastSuccessfulCxn).CompareTo(this.PoolSource.WaitOnMaxConsecutiveErrors) < 0)
                {
                    // LogUtils.getInstance().Log(String.Format("{0} consecutive failed connection attempts... waiting {1} to start new cxns", _consecutiveCxnErrorCount, this.PoolSource.WaitOnMaxConsecutiveErrors.Subtract(DateTime.Now.Subtract(_lastSuccessfulCxn))));
                    return; // don't start any new cxns if we've seen a lot of errors and haven't waited at least 5 mins (or configurable timespan)
                }
                else // waited configured time, reset error vars so growPool will try creating cxns
                {
                    //LogUtils.getInstance().Log("Resetting error related vars so will re-try instantiating cxns.. " + ((ConnectionPoolSource)this.PoolSource).CxnSource.SiteId.Id);
                    _consecutiveCxnErrorCount = 0;
                    _lastSuccessfulCxn        = DateTime.Now;
                }
            }
            if ((_cleanupTasks.Count + this.TotalResources) >= this.PoolSource.MaxPoolSize)
            {
                //LogUtils.getInstance().Log("The # of cleanup tasks scheduled + the number of current resources exceeds the max pool size - waiting until cleanup tasks are addressed to grow");
                return; // too many cleanup tasks scheduled! don't grow the pool until the cxns we've attempted to start have been addressed
            }
            // i think there may be a possible race condition here where a cxn may be disconnected during the size
            int growSize = this.PoolSource.PoolExpansionSize;

            if ((this.TotalResources + growSize) > this.PoolSource.MaxPoolSize) // if the growth would expand the pool above the max pool size, only grow by the amount allowed
            {
                growSize = this.PoolSource.MaxPoolSize - this.TotalResources;
            }
            //LogUtils.getInstance().Log(String.Format("Connection pool at min size {0}/{1} - growing by {2}. Current total resources: {3} - site: {4}", this.PoolSource.MinPoolSize, this.PoolSource.MaxPoolSize, growSize, this.TotalResources, ((ConnectionPoolSource)this.PoolSource).CxnSource.SiteId.Id));
            for (int i = 0; i < growSize; i++)
            {
                ConnectionThread a = new ConnectionThread();
                _startedCxns.Add(a);
                a.Connection = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(((ConnectionPoolSource)this.PoolSource).CxnSource.Protocol))
                               .getConnection(((ConnectionPoolSource)this.PoolSource).CxnSource);
                // Task connectTask = new Task(() => connect(a));
                //  a.Thread = connectTask;
                // connectTask.Start();
                //connect(a);
                Thread t = new Thread(new ParameterizedThreadStart(connect));
                a.Thread = t;
                t.Start(a);
            }
        }
Ejemplo n.º 14
0
        public void testIsAlive()
        {
            VistaPoolConnection cxn = (VistaPoolConnection)AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant("PVISTA")).getConnection(_localSource.CxnSource);

            cxn.connect();
            login(cxn);

            cxn.setTimeout(new TimeSpan(0, 0, 1)); // set this low - one second - so the test can run quickly

            Assert.IsTrue(cxn.isAlive());

            System.Threading.Thread.Sleep(500); // sleep for less than timeout     \
            //                                                                      \
            cxn.heartbeat();
            Assert.IsTrue(cxn.isAlive());

            System.Threading.Thread.Sleep(500); // sleep for less than timeout     --  These three add up to more than timeout

            cxn.heartbeat();
            Assert.IsTrue(cxn.isAlive());
            //                                                                      /
            System.Threading.Thread.Sleep(500); // sleep for less than timeout     /

            cxn.heartbeat();
            Assert.IsTrue(cxn.isAlive());


            System.Threading.Thread.Sleep(1100);// sleep for more than timeout

            Assert.IsFalse(cxn.isAlive());

            Assert.IsFalse(cxn.IsConnected);

            try
            {
                new VistaPatientDao(cxn).match("m1234");
                Assert.Fail("Uh-oh! Previous line should have thrown exception!");
            }
            catch (Exception)
            {
                // cool!
            }
        }
Ejemplo n.º 15
0
        // This is the core visit method the others are using. The permission must have been set before
        // getting here.
        internal User doTheVisit(string sitecode, AbstractCredentials credentials, AbstractPermission permission)
        {
            Site       site = mySession.SiteTable.getSite(sitecode);
            DataSource src  = site.getDataSourceByModality("HIS");

            if (src == null)
            {
                throw new Exception("No HIS data source at site " + sitecode);
            }

            AbstractDaoFactory factory = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol));

            myCxn = factory.getConnection(src);
            myCxn.Account.AuthenticationMethod = mySession.DefaultVisitMethod;

            if (!MdwsUtils.isValidCredentials(myCxn.Account.AuthenticationMethod, credentials, permission))
            {
                throw new Exception("Invalid credentials");
            }

            object result = null;

            if (myCxn.Account.AuthenticationMethod == VistaConstants.BSE_CREDENTIALS_V2WEB)
            {
                result = myCxn.authorizedConnect(credentials, permission,
                                                 new DataSource()
                {
                    ConnectionString = mySession.MdwsConfiguration.BseValidatorConnectionString
                });
            }
            else
            {
                result = myCxn.authorizedConnect(credentials, permission, null);
            }
            if (result.GetType().Name.EndsWith("Exception"))
            {
                throw (Exception)result;
            }
            else
            {
                return((User)result);
            }
        }
Ejemplo n.º 16
0
        public DataSourceArray connectToLoginSite(string sitecode)
        {
            DataSourceArray result = new DataSourceArray();

            if (String.IsNullOrEmpty(sitecode))
            {
                result.fault = new FaultTO(NO_SITECODE);
            }
            else if (mySession.SiteTable == null)
            {
                result.fault = new FaultTO(NO_SITE_TABLE);
            }
            else if (mySession.SiteTable.getSite(sitecode) == null)
            {
                result.fault = new FaultTO(SITE_NOT_IN_SITE_TABLE);
            }
            else if (mySession.ConnectionSet != null && mySession.ConnectionSet.Count > 0 && mySession.ConnectionSet.HasConnection(sitecode))
            {
                result.fault = new FaultTO(ALREADY_CONNECTED_TO_SITE);
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                Site               site    = mySession.SiteTable.getSite(sitecode);
                DataSource         src     = site.getDataSourceByModality("HIS");
                AbstractDaoFactory factory = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol));
                AbstractConnection c       = factory.getConnection(src);
                c.connect();
                result = new DataSourceArray(src);
                result.items[0].welcomeMessage = c.getWelcomeMessage();
                mySession.ConnectionSet.Add(c);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Ejemplo n.º 17
0
        void growPool()
        {
            //Console.WriteLine("Connection pool at min size {0} - growing by {1}", this.PoolSource.MinPoolSize, this.PoolSource.PoolExpansionSize);
            int growSize = this.PoolSource.PoolExpansionSize;

            if (this.TotalResources + growSize > this.PoolSource.MaxPoolSize) // if the growth would expand the pool above the max pool size, only grow by the amount allowed
            {
                growSize = this.PoolSource.MaxPoolSize - this.TotalResources;
            }
            for (int i = 0; i < growSize; i++)
            {
                ConnectionThread a = new ConnectionThread();
                a.Connection = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(((ConnectionPoolSource)this.PoolSource).CxnSource.Protocol))
                               .getConnection(((ConnectionPoolSource)this.PoolSource).CxnSource);
                Thread t = new Thread(new ParameterizedThreadStart(connect));
                a.Thread = t;
                t.Start(a);
                _startedCxns.Add(a);
            }
        }
Ejemplo n.º 18
0
        public DataSourceArray connectToLoginSite(string sitecode)
        {
            // TODO - FIX!!! This is very ugly - here so that SOAP and REST services can both be stateful or stateless
            if (!Convert.ToBoolean(_mySession.MdwsConfiguration.AllConfigs[MdwsConfigConstants.CONNECTION_POOL_CONFIG_SECTION][MdwsConfigConstants.CONNECTION_POOLING]))
            {
                return(new gov.va.medora.mdws.ConnectionLib(_mySession).connectToLoginSite(sitecode));
            }

            DataSourceArray result = new DataSourceArray();

            try
            {
                MdwsUtils.checkNullArgs(MdwsUtils.getArgsDictionary(System.Reflection.MethodInfo.GetCurrentMethod().GetParameters(), new List <object>()
                {
                    sitecode
                }));
                MdwsUtils.checkSiteTable(_mySession, sitecode);
                MdwsUtils.checkConnections(_mySession, sitecode);

                Site               site    = _mySession.SiteTable.getSite(sitecode);
                DataSource         src     = site.getDataSourceByModality("HIS");
                AbstractDaoFactory factory = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol));

                // REST
                SessionMgr.getInstance().setConnection(_mySession, sitecode);
                // END REST
                result = new DataSourceArray(src);

                result.items[0].welcomeMessage = "TODO - implement cached connection messages in pool";
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            finally
            {
                //RestSessionMgr.getInstance().returnConnections(_mySession);
            }
            return(result);
        }
Ejemplo n.º 19
0
        protected void TestVistaSettingsClick(object sender, EventArgs e)
        {
            int port = 0;

            if (String.IsNullOrEmpty(textboxVistaIp.Text) || String.IsNullOrEmpty(textboxVistaPort.Text) ||
                !Int32.TryParse(textboxVistaPort.Text, out port))
            {
                labelMessage.Text = "Invalid Vista connection parameters. Please be sure to enter a valid IP address and port number";
                return;
            }

            DataSource testSrc = new DataSource();

            testSrc.Provider = textboxVistaIp.Text;
            testSrc.Modality = "HIS";
            testSrc.Port     = port;
            testSrc.Protocol = "VISTA";
            testSrc.SiteId   = new SiteId("900", "Test"); // this site id doesn't matter - it's just there because a site ID is expected by the code below

            string welcomeMsg = "";

            try
            {
                AbstractDaoFactory factory = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(testSrc.Protocol));
                AbstractConnection cxn     = factory.getConnection(testSrc);
                cxn.connect();
                welcomeMsg = cxn.getWelcomeMessage();
                cxn.disconnect();
            }
            catch (Exception exc)
            {
                labelMessage.Text = "Unable to connect to that datasource. Please check your test system and try again." +
                                    "This might help figure out why:</p><p>" + exc.ToString() + "</p>";
                return;
            }

            labelMessage.Text = "<p>You rock. Connection successfully established. You should put this site in your VhaSites.xml " +
                                "file is you'd like it to be available later on via MDWS.</p><p>" + welcomeMsg + "</p>";
        }
Ejemplo n.º 20
0
        public DataSourceTO connectSite(string sitecode)
        {
            DataSourceTO result = new DataSourceTO();

            if (String.IsNullOrEmpty(sitecode))
            {
                result.fault = new FaultTO(NO_SITECODE);
            }
            else if (mySession.SiteTable == null || mySession.SiteTable.getSite(sitecode) == null)
            {
                result.fault = new FaultTO(NO_SITE_TABLE);
            }
            else if (mySession.ConnectionSet != null && mySession.ConnectionSet.Count > 0 && mySession.ConnectionSet.HasConnection(sitecode))
            {
                result.fault = new FaultTO(ALREADY_CONNECTED_TO_SITE);
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                Site               site       = (Site)mySession.SiteTable.Sites[sitecode];
                DataSource         dataSource = site.getDataSourceByModality("HIS");
                AbstractDaoFactory factory    = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(dataSource.Protocol));
                AbstractConnection c          = factory.getConnection(dataSource);
                c.connect();
                result = new DataSourceTO(dataSource);
                result.welcomeMessage = c.getWelcomeMessage();
                mySession.ConnectionSet.Add(c);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Ejemplo n.º 21
0
        internal static IOrdersDao getDao(AbstractConnection cxn)
        {
            AbstractDaoFactory f = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(cxn.DataSource.Protocol));

            return(f.getOrdersDao(cxn));
        }
Ejemplo n.º 22
0
 public void SetUp()
 {
     _transaction = new DefaultTransactionStrategy();
     _daoFactory = new HibernateDaoFactory();
 }
Ejemplo n.º 23
0
        internal AbstractConnection initializeVistaConnection()
        {
            DataSource vistaDataSource = new DataSource();

            vistaDataSource.Provider = Cxn.DataSource.Provider;
            vistaDataSource.Port     = Cxn.DataSource.Port;
            vistaDataSource.SiteId   = new SiteId("CDW");

            // Use the factory to ensure that the vista connection is initialized with the right Factory-defined Connection Strategy
            gov.va.medora.mdo.dao.vista.VistaDaoFactory factory         = (vista.VistaDaoFactory)AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.VISTA);
            gov.va.medora.mdo.dao.vista.VistaConnection vistaConnection = (vista.VistaConnection)factory.getConnection(vistaDataSource);

            vistaConnection.connect();

            return(vistaConnection);
        }
Ejemplo n.º 24
0
        public int VuaBai_Spins(int id, int betType, string linesData)
        {
            if (betType != 1 & betType != 2)
            {
                // Loại tiền không đúng
                return(-2);
            }

            //var roomLst = Room.RoomList.Where(x => x.BetType == betType).ToList();

            //if (id <= 0 && id > roomLst.Count)
            //{
            //    return -1;
            //}

            //var currentRoom = roomLst.ElementAt(id - 1);

            if (!CheckLinesInput(linesData))
            {
                return(-3);
            }

            var inputSpin = new InputSpin();

            inputSpin.ServiceId   = _serviceId;
            inputSpin.AccessToken = string.Empty;
            inputSpin.AccountId   = AccountSession.AccountID;
            inputSpin.UserName    = AccountSession.AccountName;
            inputSpin.BetType     = betType;
            inputSpin.RoomId      = id;
            inputSpin.LinesData   = linesData;
            inputSpin.ClientIp    = Utils.GetIp();
            inputSpin.SourceId    = _sourceId;
            inputSpin.MerchantId  = _merchantId;
            var objReturn = new SpinsInfo();

            try
            {
                long   accountId   = AccountSession.AccountID;
                string accountName = AccountSession.AccountName;
                if (accountId > 0)
                {
                    var blockBet         = false;
                    int countInvalidSpin = CachingHandler.CheckAccountAction(accountName, "InvalidSpin");
                    if (countInvalidSpin > 4)
                    {
                        if (countInvalidSpin == 5)
                        {
                            NLogManager.LogMessage(string.Format("Blocked_InvalidSpin => accId: {0} | accName: {1} | ip: {2}", inputSpin.AccountId, inputSpin.UserName, inputSpin.ClientIp));
                        }
                        CachingHandler.AddAccountAction(accountName, "InvalidSpin", 120);
                        blockBet = true;
                    }
                    int countNumOfPlays = CachingHandler.CheckAccountAction(accountName, "UserSpin");
                    if (countNumOfPlays > 0)
                    {
                        if (countNumOfPlays == 1)
                        {
                            NLogManager.LogMessage(string.Format("Blocked_FastSpin => accId: {0} | accName: {1} | ip: {2}", inputSpin.AccountId, inputSpin.UserName, inputSpin.ClientIp));
                        }
                        blockBet = true;
                    }
                    if (!blockBet)
                    {
                        var spinData = AbstractDaoFactory.Instance().CreateEventDao()
                                       .SP_SlotsKingPoker_Spin(inputSpin);
                        objReturn._SpinID          = spinData.SpinId;
                        objReturn._SlotsData       = spinData.SlotData;
                        objReturn._PrizesData      = spinData.PrizesData;
                        objReturn._TotalBetValue   = spinData.TotalBetValue;
                        objReturn._TotalPrizeValue = spinData.TotalPrizeValue;
                        objReturn._IsJackpot       = spinData.IsJackpot;
                        objReturn._Jackpot         = spinData.Jackpot;
                        objReturn._Balance         = spinData.Balance;
                        objReturn._ResponseStatus  = spinData.ResponseStatus;
                        objReturn.LuckyData        = spinData.LuckyData;
                        objReturn.TotalJackPot     = spinData.TotalJackPot;
                        NLogManager.LogMessage(string.Format("Spin => accId: {0} | accname: {1} | ip: {2} | SpinId: {7} | Balance: {8}| response: {3} | TotalPrize: {4}|PrizeValue: {5} | lineBet: {6}|TotalSo10:{9}|IsX2:{10}",
                                                             inputSpin.AccountId, inputSpin.UserName, inputSpin.ClientIp, spinData.ResponseStatus, spinData.TotalPrizeValue, spinData.PrizesData, linesData, spinData.SpinId, spinData.Balance, spinData.LuckyData, spinData.TotalJackPot));
                        Clients.Caller.ResultSpin(objReturn);
                        if (spinData.ResponseStatus < 0)
                        {
                            CachingHandler.AddAccountAction(accountName, "InvalidSpin", 1);
                            return(spinData.ResponseStatus);
                        }
                        else
                        {
                            CachingHandler.AddAccountAction(accountName, "UserSpin", 1);
                        }
                        ConnectionHandler.Instance.UpdateJackpot(id, betType, spinData.Jackpot);
                        //Clients.Group("room" + (roomId + 4 * (betType - 1))).UpdateJackPot(spinData.Jackpot);
                    }
                    else
                    {
                        objReturn._ResponseStatus = -10002;
                        return(-10002);
                    }
                }
                else
                {
                    objReturn._ResponseStatus = -999;//Chua dang nhap
                    return(-999);
                }
                return(1);
            }
            catch (Exception ex)
            {
                NLogManager.PublishException(ex);
                return(-10000); //Loi he thong web
            }
        }
Ejemplo n.º 25
0
        internal void buildConnectionSetForGetClaimants()
        {
            Dictionary <string, AbstractConnection> cxns = new Dictionary <string, AbstractConnection>(3);

            //DataSource nptSrc = new DataSource();
            //nptSrc.Protocol = "NPT";
            //nptSrc.SiteId = new SiteId("NPT", "National Patient Table");
            //AbstractConnection nptCxn = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.NPT).getConnection(nptSrc);
            //try
            //{
            //    nptCxn.connect();
            //    cxns.Add("NPT", nptCxn);
            //}
            //catch (Exception ex)
            //{
            //}

            DataSource adrSrc = new DataSource();

            adrSrc.Protocol         = "ADR";
            adrSrc.SiteId           = new SiteId("ADR", "Administrative Data Repository");
            adrSrc.ConnectionString = gov.va.medora.mdo.dao.oracle.adr.AdrConstants.DEFAULT_CXN_STRING;
            AbstractConnection adrCxn = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.ADR).getConnection(adrSrc);

            try
            {
                adrCxn.connect();
                cxns.Add("ADR", adrCxn);
            }
            catch (Exception ex)
            {
            }

            DataSource vadirSrc = new DataSource();

            vadirSrc.Protocol         = "VADIR";
            vadirSrc.SiteId           = new SiteId("VADIR", "VA-DoD Information Repository");
            vadirSrc.ConnectionString = gov.va.medora.mdo.dao.oracle.vadir.VadirConstants.DEFAULT_CXN_STRING;
            AbstractConnection vadirCxn = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.VADIR).getConnection(vadirSrc);

            try
            {
                vadirCxn.connect();
                cxns.Add("VADIR", vadirCxn);
            }
            catch (Exception ex)
            {
            }

            DataSource vbacorpSrc = new DataSource();

            vbacorpSrc.Protocol         = "VBACORP";
            vbacorpSrc.SiteId           = new SiteId("VBACORP", "VBA Corp");
            vbacorpSrc.ConnectionString = gov.va.medora.mdo.dao.oracle.vbacorp.VbacorpConstants.DEFAULT_CXN_STRING;
            AbstractConnection vbacorpCxn = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.VBACORP).getConnection(vbacorpSrc);

            try
            {
                vbacorpCxn.connect();
                cxns.Add("VBACORP", vbacorpCxn);
            }
            catch (Exception ex)
            {
            }

            mySession.ConnectionSet = new ConnectionSet(cxns);
        }
Ejemplo n.º 26
0
 public void SetUp()
 {
     _transaction = new DefaultTransactionStrategy();
     _daoFactory  = new HibernateDaoFactory();
 }
Ejemplo n.º 27
0
 public ServiceFacade()
 {
     cDao = AbstractDaoFactory.getFactory().getCommentDao();
     mDao = AbstractDaoFactory.getFactory().getMovieDao();
     uDao = AbstractDaoFactory.getFactory().GetUserDao();
 }
Ejemplo n.º 28
0
 public DataTable GetBigWinData()
 {
     return(AbstractDaoFactory.Instance().CreateEventDao().GetBigWinData(100));
 }
Ejemplo n.º 29
0
 public DataTable GetJackpotHistory()
 {
     return(AbstractDaoFactory.Instance().CreateEventDao().GetJackpotHistory(100));
 }
Ejemplo n.º 30
0
 public DataTable GetSpinDetails(int spinId)
 {
     return(AbstractDaoFactory.Instance().CreateEventDao().GetSpinDetails(spinId));
 }