Inheritance: StringConverter
コード例 #1
0
        public IActionResult RSVPList()
        {
            List <ResponseList> rl;
            SessionList         sl;

            try
            {
                rl = new List <ResponseList>();
                sl = new SessionList(paths.Schedule, DateTime.Now.AddDays(-1));

                for (int i = 0; i < sl.sessions.Length; i++)
                {
                    if (sl.sessions[i].ac == "Active")
                    {
                        rl.Add(new ResponseList(DateTime.Now.AddDays(-1), sl.sessions[i].id, paths.Schedule, paths.Attendance));
                    }
                }

                rl = rl.OrderBy(r => r.sessionDate).ToList();
            }

            catch (System.IO.IOException)
            {
                return(View("~/Views/Errors/GenericError.cshtml", "Something happened while trying to load the list of RSVP responses. Please try again."));
            }

            return(View(rl));
        }
コード例 #2
0
        public IActionResult RSVPHistoryAdmin(Guid key)
        {
            if (key.ToString() != "5ac59a93-b1fb-4153-af95-b37e3636197d")
            {
                return(View("~/Views/Errors/GenericError.cshtml", "uh-uh-uh, you didn't say the magic word"));
            }

            List <ResponseList> rl;
            SessionList         sl;

            try
            {
                rl = new List <ResponseList>();
                sl = new SessionList(paths.Schedule, null);

                for (int i = 0; i < sl.sessions.Length; i++)
                {
                    rl.Add(new ResponseList(null, sl.sessions[i].id, paths.Schedule, paths.Attendance)
                    {
                        adminKey = key
                    });
                }

                rl = rl.OrderByDescending(r => r.sessionDate).ToList();
            }

            catch (System.IO.IOException)
            {
                return(View("~/Views/Errors/GenericError.cshtml", "Something happened while trying to load the list of RSVP responses. Please try again."));
            }

            return(View(rl));
        }
コード例 #3
0
        SessionList GetSessionList()
        {
            string      xml         = System.IO.File.ReadAllText(System.IO.Directory.GetCurrentDirectory() + "/SavedSessions.dat");
            SessionList sessionList = Utility.Serializer.XML.Deserialize <SessionList>(xml);

            return(sessionList);
        }
コード例 #4
0
        private void FinishNewSessionFunc(object o, EventArgs e)
        {
            EventArgsNewSession eventArgs = (EventArgsNewSession)e;
            Session             session   = eventArgs.Session;

            App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
            {
                SessionList.Add(session);
            }));

            if (session.Direction == Direct.input)
            {
                InputSession++;
            }
            else if (session.Direction == Direct.output)
            {
                OutputSession++;
            }
            if (session.Status == "successful")
            {
                SuccessSession++;
            }
            else if (session.Status == "terminated")
            {
                TerminatedSession++;
            }
            AllSession++;
        }
コード例 #5
0
        private List <Session> GetAllSessionsInGroup(EventRequest request)
        {
            var resultList = new List <Session>();

            foreach (var session in SessionList.ToList())
            {
                var eventSession = (EventSession)session;

                lock (_SyncLock)
                {
                    if (!_SessionGroupNameDic.ContainsKey(eventSession.Id))
                    {
                        continue;
                    }
                    if (!_SessionGroupNameDic[eventSession.Id].Contains(request.GroupName))
                    {
                        continue;
                    }
                }

                resultList.Add(session);
            }

            return(resultList);
        }
コード例 #6
0
 public OrderDialog(SessionList session)
 {
     InitializeComponent();
     _session         = session;
     FilmName.Text    = $"Сеанс: {session.Film.Name}";
     SessionDate.Text = $"Дата: {session.StartingDate}";
 }
コード例 #7
0
 public void AddTest()
 {
     SessionList.Add(new Session()
     {
         BeginLine = 4, EndLine = 5, Message = Test
     });
 }
コード例 #8
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            FactoryConfigurationItem item = new FactoryConfigurationItem();

            item.Key       = "test";
            item.ClassInfo = "dsfas";
            item.ClassName = "asdfa";
            item.DllName   = "sadfasdf";

            List <FactoryConfigurationItem> items = new List <FactoryConfigurationItem>();

            items.Add(item);
            string xml = Utility.Serializer.XML.Serialize(items);
            //System.IO.File.WriteAllText("test.dat", xml);

            SessionList  list    = new SessionList();
            SavedSession session = new SavedSession();

            session.ConfigFile  = System.IO.Directory.GetCurrentDirectory() + "/test.dat";
            session.CreatedDate = DateTime.Now;
            session.SessionName = "Test";

            list.Sessions.Add(session);
            xml = Utility.Serializer.XML.Serialize(list);
            //System.IO.File.WriteAllText("SavedSessions.dat", xml);
            InitComboSession();
            LoadSessions();
            this.WindowState = FormWindowState.Maximized;
        }
コード例 #9
0
 private static void HandleClientDisconnect(SocketAsyncEventArgs socketArgs)
 {
     try
     {
         var connection = socketArgs.UserToken as ClientConnection;
         var session    = SessionList.Find(x => x.ConnectedClients.Contains(connection));
         if (session != null)
         {
             session.ConnectedClients.RemoveAll(x => x.ID == connection.ID);
             if (session.ConnectedClients.Count == 0)
             {
                 SessionList.Remove(session);
             }
             else if (session.ConnectedClients.Count == 1 && session.ConnectedClients[0].ConnectionType == ConnectionTypes.ElevatedClient)
             {
                 ClientList.RemoveAll(x => x.ID == session.ConnectedClients[0].ID);
                 session.ConnectedClients[0].Socket.Close();
             }
             else
             {
                 session.ConnectedClients[0].SocketMessageHandler.SendParticipantList(session);
             }
         }
         ClientList.Remove(connection);
         connection.Close();
         Pages.Server.Current?.RefreshUICall();
     }
     catch { }
 }
コード例 #10
0
 private async void LoadSessions()
 {
     SessionList.ClearValue(ItemsControl.ItemsSourceProperty);
     SessionList.DisplayMemberPath = "SessionDesc";
     SessionList.SelectedValuePath = "SessionId";
     SessionList.ItemsSource       = await sessionCore.GetSessionsAsync(UserCredentials.Conference.ConferenceId);
 }
コード例 #11
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Topic.Length != 0)
            {
                hash ^= Topic.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Client)
            {
                hash ^= Client.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Device)
            {
                hash ^= Device.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.TopicSubscription)
            {
                hash ^= TopicSubscription.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Session)
            {
                hash ^= Session.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.SessionList)
            {
                hash ^= SessionList.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Interaction)
            {
                hash ^= Interaction.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.InteractionList)
            {
                hash ^= InteractionList.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.TopicMux)
            {
                hash ^= TopicMux.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.TopicMuxList)
            {
                hash ^= TopicMuxList.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.TopicDemux)
            {
                hash ^= TopicDemux.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.TopicDemuxList)
            {
                hash ^= TopicDemuxList.GetHashCode();
            }
            hash ^= (int)typeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #12
0
ファイル: Session.xaml.cs プロジェクト: 2644783865/ssd-cms
        private async void LoadData()
        {
            SessionList.ClearValue(ItemsControl.ItemsSourceProperty);
            SessionList.ItemsSource = await core.GetSessionsAsync(UserCredentials.Conference.ConferenceId);

            SpecialSessionList.ClearValue(ItemsControl.ItemsSourceProperty);
            SpecialSessionList.ItemsSource = await core.GetSpecialSessionsAsync(UserCredentials.Conference.ConferenceId);
        }
コード例 #13
0
ファイル: MainForm.cs プロジェクト: DmitGR/BlockChecker
        private void newSessionBtn_Click(object sender, EventArgs e)
        {
            SessionList.ClearSelected();
            newSessionBtn.Checked = true;
            sessionFile.Text      = "";

            SessionCotroller.newPath();
        }
コード例 #14
0
 public static void Stop()
 {
     tcpListener.Stop();
     ClientList.Clear();
     SessionList.Clear();
     tcpListener.Server.Close();
     Pages.Server.Current.RefreshUICall();
 }
コード例 #15
0
        private void Search(object parameter)
        {
            int?SearchCourseID   = (SearchCourse == null) ? 0 : SearchCourse.ID;
            int?SearchTrainerID  = (SearchTrainer == null) ? 0 : SearchTrainer.ID;
            int?SearchLocationID = (SearchLocation == null) ? 0 : SearchLocation.ID;

            SessionList     = db.search_session(SearchCourseID, SearchTrainerID, SearchLocationID, SearchFrom, SearchTo, SearchExternal, SearchObselete, SearchParis, SearchAvailable).ToList();
            SelectedSession = SessionList.FirstOrDefault();
        }
コード例 #16
0
 public void ReadLogBeginExecute()
 {
     _sessionListCopy.Clear();
     SessionList.Clear();
     SearchString = "";
     OnPropertyChanged(nameof(SearchString));
     SearchTableEnable = false;
     LogText           = String.Empty;
     ResetCounts();
 }
コード例 #17
0
        void InitComboSession()
        {
            DontRunEvent = true;
            SessionList list = GetSessionList();

            cmbSession.DataSource    = list.Sessions;
            cmbSession.DisplayMember = "SessionName";
            cmbSession.ValueMember   = "SessionName";
            DontRunEvent             = false;
        }
コード例 #18
0
        public void SendAndForget <T>(T message, TimeSpan?timeout = null)
        {
            var sessionList = SessionList
                              .ToList();

            foreach (var session in sessionList)
            {
                _Impl.Send <T, object>(session, message, timeout: timeout, wait: false);
            }
        }
コード例 #19
0
        private StudioEntityRegistry(IStorage storage)
            : base(storage)
        {
            Prepare();

            var delayAction = new DelayAction(storage, exception => exception.LogError());

            Sessions = new SessionList(Storage)
            {
                DelayAction = delayAction
            };

            _boards = new ExchangeBoardListEx(Storage);

            _securities = new StudioSecurityList(this)
            {
                DelayAction = delayAction
            };
            _portfolios = new PortfolioList(Storage)
            {
                BulkLoad = true, DelayAction = delayAction
            };

            //FavoriteSecurities = new FavoriteSecurityList(this) { BulkLoad = true, DelayAction = delayAction };
            IndexSecurities = new IndexSecurityList(storage)
            {
                BulkLoad = true, DelayAction = delayAction
            };
            ContinuousSecurities = new ContinuousSecurityList(this)
            {
                DelayAction = delayAction
            };

            var session = Sessions.Battle;

            if (session == null)
            {
                session = new Session
                {
                    Type      = SessionType.Battle,
                    StartTime = DateTime.Today,
                    EndTime   = DateTime.MaxValue,
                    Settings  = new SettingsStorage(),
                };

                Sessions.Add(session);
                Sessions.DelayAction.WaitFlush();
            }

            DelayAction = delayAction;

            CreateCommonData();

            Strategies = new StrategyInfoList(this, session);
        }
コード例 #20
0
        public bool EndSession(string SessionName)
        {
            HttpSession ASession = SessionList.GetSession(SessionName, "");

            if (ASession != null)
            {
                ASession.SessionEnd();
                return(true);
            }
            return(false);
        }
コード例 #21
0
 private void Disconnect()
 {
     lock (SessionList)
     {
         if (SessionList.Contains(this))
         {
             SessionList.Remove(this);
         }
     }
     Core.ThreadManager.UnregisterThread(Thread.CurrentThread);
 }
コード例 #22
0
 private void RemoveSession(object parameter)
 {
     if (SelectedSession != null && (MessageBox.Show("Are you sure you want to delete " + SelectedSession.Course.CourseName + " on " + ((DateTime)SelectedSession.Strt).ToShortDateString(), "Training Database", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes))
     {
         IEnumerable <int> idlist = SessionList.Select(s => s.ID);
         db.Sesses.Remove(SelectedSession);
         //SaveDataChanges(null);
         SessionList     = db.Sesses.Local.Where(s => idlist.Contains(s.ID)).OrderBy(s => s.Strt).ToList();
         SelectedSession = SessionList.FirstOrDefault();
         NotifyPropertyChanged("Changed");
     }
 }
コード例 #23
0
 private void Disconnect(string text)
 {
     Write(text);
     connection.Close();
     lock (SessionList)
     {
         if (SessionList.Contains(this))
         {
             SessionList.Remove(this);
         }
     }
     Core.ThreadManager.UnregisterThread(Thread.CurrentThread);
 }
コード例 #24
0
ファイル: Server.cs プロジェクト: modulexcite/awesome-game-2
        public Server(string uriPrefix, DatabaseConnection connection)
        {
            if (string.IsNullOrEmpty(uriPrefix)) throw new ArgumentNullException("uriPrefix");
            if (connection == null) throw new ArgumentNullException("connection");

            System.Threading.ThreadPool.SetMaxThreads(5, 1000);
            System.Threading.ThreadPool.SetMinThreads(5, 5);
            _listener = new HttpListener();
            _listener.Prefixes.Add(uriPrefix);

            _connection = connection;

            _sessions = new SessionList();
        }
コード例 #25
0
        public Task SendAsync <T>(T message, TimeSpan?timeout = null)
        {
            var sessionList = SessionList
                              .ToList();

            var taskList = new List <Task>();

            foreach (var session in sessionList)
            {
                var task = _Impl.Send <T, object>(session, message, timeout: timeout);
                taskList.Add(task);
            }

            return(Task.WhenAll(taskList));
        }
コード例 #26
0
        void DeleteSession()
        {
            string      sessionName = (string)cmbSession.SelectedValue;
            SessionList list        = GetSessionList();

            foreach (SavedSession session in list.Sessions)
            {
                if (session.SessionName == sessionName)
                {
                    list.Sessions.Remove(session);
                    break;
                }
            }
            SaveSessionList(list);
            InitComboSession();
        }
コード例 #27
0
        public IActionResult SessionIndex()
        {
            SessionList sl;

            try
            {
                sl = new SessionList(paths.Schedule, DateTime.Now.AddDays(-1));
            }

            catch (System.IO.IOException)
            {
                return(View("~/Views/Errors/GenericError.cshtml", "Something happened while trying to read the session list. Please try again."));
            }

            return(View(sl));
        }
コード例 #28
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            SavedSession session = new SavedSession();

            session.CreatedDate = DateTime.Now;
            session.SessionName = txtSessionName.Text;
            session.ConfigFile  = this.ConfigFile;

            SessionList list = GetSessionList();

            list.Sessions.Add(session);

            SaveSessionList(list);
            this.IsCanceled = false;
            SavedSession    = session;
            this.Close();
        }
コード例 #29
0
        private void On_Btn_Login(object sender, RibbonControlEventArgs e)
        {
            DialogResult result = DialogResult.OK;

            result = mLoginForm.ShowDialog();
            if (result == DialogResult.OK)
            {
                ///Create the Default document
                Aplication_CreateDefault();

                AppsSettings.GetInstance().isLogin = true;
                Btn_ListSession.Enabled = true;

                ///Create form
                mSessionListForm    = new SessionList();
                mRepresentativeForm = new RepresentativeForm();
            }
        }
コード例 #30
0
 private void Start()
 {
     _logger = new UnityEngine.Logger(new LabyrinthLogHandler());
     _logger.Log(_tag, "SessionResultAnimation Start.");
     try
     {
         if (File.Exists(Path.Combine(Application.dataPath, "session_list.xml")))
         {
             SessionList = SessionList.Load();//read data from xml
         }
         else
         {
             SessionList = new SessionList();
         }
     }
     catch (System.Exception e)
     {
         _logger.LogException(e);
     }
 }
コード例 #31
0
        private void Start()
        {
            _logger = new UnityEngine.Logger(new LabyrinthLogHandler());
            _logger.Log(_tag, "Statistics Start.");

            try
            {
                _textResult = GetComponent <Text>();

                if (File.Exists(Path.Combine(Application.dataPath, "session_list.xml")))
                {
                    _textResult.text = getTable(SessionList.Load().Sessions);
                }
                else
                {
                    _textResult.text = "No data";
                }
            }
            catch (System.Exception e)
            {
                _logger.LogException(e);
            }
        }
コード例 #32
0
        public Hashtable ProcessModel(Hashtable pParams)
        {
            Hashtable modeldata = new Hashtable();
            modeldata.Add("Scenes", pParams["Scenes"]);
            modeldata.Add("Reports", pParams["Reports"]);
            SqliteConnection dbConn = (SqliteConnection)pParams["DatabaseConnection"];
            List<SessionList> lstSessions = new List<SessionList>();
            Hashtable requestvars = (Hashtable) pParams["RequestVars"];
            

            string puserUUID = string.Empty;
            string clientVersionString = string.Empty;
            int queryparams = 0;

            if (requestvars != null)
            {
                if (requestvars.ContainsKey("UserID"))
                {
                    UUID testUUID = UUID.Zero;
                    if (UUID.TryParse(requestvars["UserID"].ToString(), out testUUID))
                    {
                        puserUUID = requestvars["UserID"].ToString();

                    }
                }

                if (requestvars.ContainsKey("VersionString"))
                {
                    clientVersionString = requestvars["VersionString"].ToString();
                }
            }

            lock (dbConn)
            {
                string sql =
                    "SELECT distinct a.name_f, a.name_l, a.Agent_ID, b.Session_ID, b.client_version, b.last_updated, b.start_time FROM stats_session_data a LEFT OUTER JOIN stats_session_data b ON a.Agent_ID = b.Agent_ID";

                if (puserUUID.Length > 0)
                {
                    if (queryparams == 0)
                        sql += " WHERE";
                    else
                        sql += " AND";

                    sql += " b.agent_id=:agent_id";
                    queryparams++;
                }

                if (clientVersionString.Length > 0)
                {
                    if (queryparams == 0)
                        sql += " WHERE";
                    else
                        sql += " AND";

                    sql += " b.client_version=:client_version";
                    queryparams++;
                }

                sql += " ORDER BY a.name_f, a.name_l, b.last_updated;";

                SqliteCommand cmd = new SqliteCommand(sql, dbConn);

                if (puserUUID.Length > 0)
                    cmd.Parameters.Add(new SqliteParameter(":agent_id", puserUUID));
                if (clientVersionString.Length > 0)
                    cmd.Parameters.Add(new SqliteParameter(":client_version", clientVersionString));

                SqliteDataReader sdr = cmd.ExecuteReader();
                
                if (sdr.HasRows)
                {
                    UUID userUUID = UUID.Zero;

                    SessionList activeSessionList = new SessionList();
                    activeSessionList.user_id=UUID.Random();
                    while (sdr.Read())
                    {
                        UUID readUUID = UUID.Parse(sdr["agent_id"].ToString());
                        if (readUUID != userUUID)
                        {
                            activeSessionList = new SessionList();
                            activeSessionList.user_id = readUUID;
                            activeSessionList.firstname = sdr["name_f"].ToString();
                            activeSessionList.lastname = sdr["name_l"].ToString();
                            activeSessionList.sessions = new List<ShortSessionData>();
                            lstSessions.Add(activeSessionList);
                        }

                        ShortSessionData ssd = new ShortSessionData();
                        
                        ssd.last_update = Utils.UnixTimeToDateTime((uint)Convert.ToInt32(sdr["last_updated"]));
                        ssd.start_time = Utils.UnixTimeToDateTime((uint)Convert.ToInt32(sdr["start_time"]));
                        ssd.session_id = UUID.Parse(sdr["session_id"].ToString());
                        ssd.client_version = sdr["client_version"].ToString();
                        activeSessionList.sessions.Add(ssd);

                        userUUID = activeSessionList.user_id;
                    }
                }
                sdr.Close();
                sdr.Dispose();
                
            }
            modeldata["SessionData"] = lstSessions;
            return modeldata;
        }
コード例 #33
0
 public Model()
 {
     Sessions = new SessionList();
 }