Example #1
0
        public Session(
            IApplication app, IMessageStoreFactory storeFactory, SessionID sessID, DataDictionaryProvider dataDictProvider,
            SessionSchedule sessionSchedule, int heartBtInt, ILogFactory logFactory, IMessageFactory msgFactory, string senderDefaultApplVerID)
        {
            this.Application = app;
            this.SessionID = sessID;
            this.DataDictionaryProvider = new DataDictionaryProvider(dataDictProvider);
            this.schedule_ = sessionSchedule;
            this.msgFactory_ = msgFactory;

            this.SenderDefaultApplVerID = senderDefaultApplVerID;

            this.SessionDataDictionary = this.DataDictionaryProvider.GetSessionDataDictionary(this.SessionID.BeginString);
            if (this.SessionID.IsFIXT)
                this.ApplicationDataDictionary = this.DataDictionaryProvider.GetApplicationDataDictionary(this.SenderDefaultApplVerID);
            else
                this.ApplicationDataDictionary = this.SessionDataDictionary;

            ILog log;
            if (null != logFactory)
                log = logFactory.Create(sessID);
            else
                log = new NullLog();

            state_ = new SessionState(log, heartBtInt)
            {
                MessageStore = storeFactory.Create(sessID)
            };

            // Configuration defaults.
            // Will be overridden by the SessionFactory with values in the user's configuration.
            this.PersistMessages = true;
            this.ResetOnDisconnect = false;
            this.SendRedundantResendRequests = false;
            this.ValidateLengthAndChecksum = true;
            this.CheckCompID = true;
            this.MillisecondsInTimeStamp = true;
            this.EnableLastMsgSeqNumProcessed = false;
            this.MaxMessagesInResendRequest = 0;
            this.SendLogoutBeforeTimeoutDisconnect = false;
            this.IgnorePossDupResendRequests = false;
            this.RequiresOrigSendingTime = true;
            this.CheckLatency = true;
            this.MaxLatency = 120;

            if (!IsSessionTime)
                Reset("Out of SessionTime (Session construction)");
            else if (IsNewSession)
                Reset("New session");

            lock (sessions_)
            {
                sessions_[this.SessionID] = this;
            }

            this.Application.OnCreate(this.SessionID);
            this.Log.OnEvent("Created session");
        }
Example #2
0
        private static void GetScheduleCellContent(UITableViewCell cell, SessionSchedule schedule, NSIndexPath index)
        {
            var loc = ServiceLocator.Current.GetInstance <ILocalizedStringProvider>();

            cell.TextLabel.Text       = schedule.StartTime.HasValue ? schedule.StartTime.Value.ToString("g") + " - " : "";
            cell.TextLabel.Text      += schedule.EndTime?.ToString("t") ?? "...";
            cell.DetailTextLabel.Text =
                $"{schedule.ClassRoom.Name} ({loc.GetLocalizedString(Localized.Instructor_Text)} {schedule.Instructor.FirstName} {schedule.Instructor.LastName})";
        }
Example #3
0
        private View GetSessionScheduleTemplate(int arg1, SessionSchedule schedule, View arg3)
        {
            var view = arg3 ?? Activity.LayoutInflater.Inflate(Resource.Layout.SessionScheduleListItem, null);

            var tvStarTime   = view.FindViewById <TextView>(Resource.Id.TvStartTime);
            var tvEndTime    = view.FindViewById <TextView>(Resource.Id.TvEndTime);
            var tvClassRoom  = view.FindViewById <TextView>(Resource.Id.TvClassRoom);
            var tvInstructor = view.FindViewById <TextView>(Resource.Id.TvInstructor);

            tvStarTime.Text   = schedule.StartTime?.ToString("U") ?? "";
            tvEndTime.Text    = schedule.EndTime?.ToString("U") ?? "";
            tvClassRoom.Text  = schedule.ClassRoom.Name;
            tvInstructor.Text = schedule.Instructor.FirstName + " " + schedule.Instructor.LastName;

            return(view);
        }
Example #4
0
        // Carries the sample out.
        public void Run()
        {
            // Acceptor is being maintained manually.
            // Therefore, reset of sequence numbers
            // must be done manually before logon.
            acceptor.ResetLocalSequenceNumbers();

            // Comment this call if you want to check
            // how scheduler notifies about errors.
            acceptor.LogonAsAcceptor();

            SessionSchedule scheduleForInitiator =
                ConstructShortTimeActivitySchedule();

            // Let's play the party...

            scheduler.Register(
                initiator,
                scheduleForInitiator,
                scheduler.ConnectionSettings["LocalInitiator"]);

            Console.WriteLine(
                "Session {0} scheduled for automatic connection.",
                initiator);

            // Since session is initially in disconnected state
            // we can't simply wait for logout. Instead, we have
            // to give time for scheduler to activate session.
            // The best and simplest approach is to wait till time
            // of logout as it's specified in constructed schedule.

            PauseUntil(
                scheduleForInitiator.LogoutTimes[
                    (int)DateTime.Now.DayOfWeek]);

            // Make sure that initiator is shutdown.
            WaitUntilLogout(initiator);

            // Don't forget that once initiator disconnects from
            // the acceptor, acceptor starts waiting for next logon.
            // Since we manage it manually, we have to call logout.

            acceptor.Logout();
            WaitUntilLogout(acceptor);
        }
        public static SessionSchedule GenerateFakeSessionSchedule(int sessionId, Random random = null)
        {
            if (random == null)
            {
                random = new Random();
            }

            var fakeSchedule = new SessionSchedule
            {
                Id         = random.Next(),
                ClassRoom  = GenerateFakeClassRoom(random),
                StartTime  = DateTime.UtcNow.AddDays(1),
                EndTime    = DateTime.UtcNow.AddDays(1).AddHours(2),
                SessionId  = sessionId,
                Instructor = GenerateFakeInstructor(random)
            };

            return(fakeSchedule);
        }
        public ActionResult AddNewSession(AddSessionScheduleDto model)
        {
            var time          = model.StartHour.Split(':');
            var startDateTime = model.StartDayJalali.ToGeorgianDateTimeFromJalali(Convert.ToDouble(time[0]), Convert.ToDouble(time[1]));

            var sessionSchedule = new SessionSchedule
            {
                CourseId           = model.CourseId,
                ClassroomId        = model.ClassroomId,
                StartDateTime      = startDateTime,
                StartDayJalali     = model.StartDayJalali,
                StartTimeJalali    = model.StartHour,
                StartDayTimeJalali = model.StartDayJalali + " " + model.StartHour,
                StartDayName       = model.StartDayJalali.ToJalaliDateName()
            };

            _db.Set <SessionSchedule>().Add(sessionSchedule);

            _db.SaveChanges();


            return(RedirectToAction("Index", new { id = model.CourseId }));
        }