예제 #1
0
        protected void Session_End(Object sender, EventArgs e)
        {
            //--Michael
            Hashtable sessionIDs = (Hashtable)this.Application["SessionIDs"];

            sessionIDs = Hashtable.Synchronized(sessionIDs);

            //For multithread safety using following code
            DictionaryEntry[] userIDToSessionID = new DictionaryEntry[sessionIDs.Count];
            sessionIDs.CopyTo(userIDToSessionID, 0);
            foreach (DictionaryEntry de in userIDToSessionID)
            {
                if ((string)de.Value == this.Session.SessionID)
                {
                    sessionIDs.Remove(de.Key);
                    break;
                }
            }

            if (this.Session["Token"] != null && this.Context != null)
            {
                Token token = (Token)this.Session["Token"];
                DealingConsoleServer.SaveLog2(token, this.Context.Request.UserHostAddress.ToString(), "Logout", "Logout", Guid.Empty, "");

                this.StateServer.Logout((Token)this.Session["Token"]);
            }

            //			Hashtable sessions = (Hashtable)this.Context.Application["Sessions"];
            //			this.Context.Application.Lock();
            //			sessions.Remove(this.Context.User);
            //		    this.Context.Application.UnLock();
        }
예제 #2
0
        private DataSet GetReportData(string selectedPrice, Guid accountId)
        {
            StateServerService   stateServer          = (StateServerService)(this.Context.Application["StateServer"]);
            DealingConsoleServer dealingConsoleServer = ((DealingConsoleServer)(this.Context.Application["DealingConsoleServer"]));
            Token   token   = (Token)Session["Token"];
            DataSet dataSet = dealingConsoleServer.ReportAccountStatusAllData(stateServer, token, selectedPrice, accountId, Guid.Empty);

            return(dataSet);
        }
예제 #3
0
        protected void Application_Start(Object sender, EventArgs e)
        {
            try
            {
                AppDebug.LogEvent("DealingConsole", "Application_Start", EventLogEntryType.Information);

                //Used for kickout--Michael
                this.Context.Application["SessionIDs"] = new Hashtable();

                this.Context.Application["IsRegistered"] = false;
                this.Context.Application["Commands"]     = new Commands(new TimeSpan(0, 10, 0).TotalMilliseconds);
                this.Context.Application["Tokens"]       = new Hashtable();

                StateServerService stateServer = new StateServerService();
                this.StateServerReadyCheck(stateServer);
                this.Context.Application["StateServer"] = stateServer;

                ParticipantServices.ParticipantServices participantServices = new ParticipantServices.ParticipantServices();
                Application["ParticipantServices"] = participantServices;
                SecurityServices.SecurityServices securityServices = new SecurityServices.SecurityServices();
                Application["SecurityServices"] = securityServices;


                //			this.Context.Application["IsRegistered"]=false;
                //			this.Context.Application["Commands"]=null;
                //			this.Context.Application["Tokens"]=new Hashtable();
                ////			this.Context.Application["Sessions"]=new Hashtable();
                //
                //			StateServer.Service stateServer=new StateServer.Service();
                //			this.Context.Application["StateServer"]=stateServer;
                //
                int     commandSequence;
                Token   token   = new Token(Guid.Empty, UserType.System, AppType.DealingConsoleServer);
                DataSet dataSet = stateServer.GetInitData(token, null, out commandSequence);

                string connectionString = ConfigurationSettings.AppSettings["ConnectionString"];
                DealingConsoleServer dealingConsoleServer = new DealingConsoleServer(connectionString);
                dealingConsoleServer.Init(dataSet);
                this.Context.Application["DealingConsoleServer"] = dealingConsoleServer;

                AppDebug.LogEvent("DealingConsole", "DealingConsole started", EventLogEntryType.SuccessAudit);
            }
            catch (Exception exception)
            {
                AppDebug.LogEvent("DealingConsole", exception.ToString(), EventLogEntryType.Error);
            }
            //
            //
            //#if (PERMISSION)
            //			ParticipantServices.ParticipantServices  participantServices = new ParticipantServices.ParticipantServices();
            //			Application["ParticipantServices"] = participantServices;
            //			SecurityServices.SecurityServices securityServices = new SecurityServices.SecurityServices();
            //			Application["SecurityServices"] = securityServices;
            //#endif
        }
 public static bool SaveLog2(Token token, string ip, string objectIDs, string eventMessage, Guid transactionID, string transactionCode)
 {
     if (token == null)
     {
         return(true);
     }
     if (string.IsNullOrEmpty(eventMessage))
     {
         return(true);
     }
     return(DealingConsoleServer.SaveLog(token.UserID, ip, UserType.Dealer.ToString(), objectIDs, DateTime.Now, eventMessage, transactionID, transactionCode));
 }
        public bool IsUserExistInDealingConsoleSystem(string name)
        {
            DataSet dataSet = DealingConsoleServer.GetUserId(name);

            SecurityServices.SecurityServices securityServices = (SecurityServices.SecurityServices)Application["SecurityServices"];
            Guid   programID    = new Guid(ConfigurationSettings.AppSettings["DealingConsole"]);
            Guid   permissionID = new Guid(ConfigurationSettings.AppSettings["Run"]);
            bool   isUserExist  = false;
            string errorMsg;

            foreach (DataRow row in dataSet.Tables[0].Rows)
            {
                Guid userId      = (Guid)row["ID"];
                bool isAuthrized = securityServices.CheckPermission(userId, programID, permissionID, "", "", userId, out errorMsg);
                if (isAuthrized == true)
                {
                    isUserExist = true;
                    break;
                }
            }
            return(isUserExist);
        }
 public string GetDealingPolicyOptions()
 {
     return(DealingConsoleServer.GetDealingPolicyOptions());
 }
예제 #7
0
        public string GetAccountGroupOptions()
        {
            Token token = (Token)this.Session["Token"];

            return(DealingConsoleServer.GetAllAccountGroupOptions(token));
        }