Exemple #1
0
        public void AddCycle_ExceptionsCheck()
        {
            TrainingManager tm = new TrainingManager(new UnitOfWork(new TrainingContextTest(false)));

            Action act = () => tm.AddCyclingTraining(new DateTime(2021, 05, 23), 500, new TimeSpan(2, 3, 5), null, 10, TrainingType.Endurance, "comment", BikeType.CityBike);

            act.Should().Throw <DomainException>().WithMessage("Training is in the future");

            act = () => tm.AddCyclingTraining(new DateTime(2020, 05, 20), -1, new TimeSpan(2, 3, 5), 10, 50, TrainingType.Endurance, "comment", BikeType.CityBike);

            act.Should().Throw <DomainException>().WithMessage("Distance invalid value");

            act = () => tm.AddCyclingTraining(new DateTime(2020, 05, 20), null, new TimeSpan(-1), 10, 50, TrainingType.Endurance, "comment", BikeType.CityBike);

            act.Should().Throw <DomainException>().WithMessage("Time invalid value");

            act = () => tm.AddCyclingTraining(new DateTime(2020, 05, 20), null, new TimeSpan(2), 6000, 50, TrainingType.Endurance, "comment", BikeType.CityBike);

            act.Should().Throw <DomainException>().WithMessage("Average speed invalid value");

            act = () => tm.AddCyclingTraining(new DateTime(2020, 05, 20), null, new TimeSpan(2), 10, 80000, TrainingType.Endurance, "comment", BikeType.CityBike);

            act.Should().Throw <DomainException>().WithMessage("Average watt invalid value");

            act = () => tm.AddCyclingTraining(new DateTime(2020, 05, 20), null, new TimeSpan(2), 10, 1, TrainingType.Endurance, "comment", BikeType.CityBike);

            act.Should().NotThrow <Exception>();
        }
Exemple #2
0
        public void AllReportTests()
        {
            TrainingManager tm = new TrainingManager(new UnitOfWork(new TrainingContextTest(false)));

            tm.AddRunningTraining(new DateTime(2019, 10, 1), 200, new TimeSpan(2, 30, 0), 20, TrainingType.Endurance, "number 1");
            tm.AddRunningTraining(new DateTime(2019, 10, 2), 300, new TimeSpan(2, 30, 0), 20, TrainingType.Endurance, "number 2");
            tm.AddRunningTraining(new DateTime(2019, 10, 3), 150, new TimeSpan(2, 30, 0), 20, TrainingType.Endurance, "number 3");
            tm.AddRunningTraining(new DateTime(2018, 10, 1), 200, new TimeSpan(2, 30, 0), 20, TrainingType.Endurance, "number 4");

            tm.AddCyclingTraining(new DateTime(2019, 10, 4), 200, new TimeSpan(2, 30, 0), 20, 2, TrainingType.Endurance, "number 1", BikeType.IndoorBike);
            tm.AddCyclingTraining(new DateTime(2019, 10, 5), 300, new TimeSpan(2, 30, 0), 20, 2, TrainingType.Endurance, "number 2", BikeType.IndoorBike);
            tm.AddCyclingTraining(new DateTime(2019, 10, 6), 150, new TimeSpan(2, 0, 0), 20, 2, TrainingType.Endurance, "number 3", BikeType.IndoorBike);
            tm.AddCyclingTraining(new DateTime(2018, 10, 2), 200, new TimeSpan(2, 30, 0), 20, 2, TrainingType.Endurance, "number 4", BikeType.IndoorBike);

            int expectedNumberOfTrainingsPerType = 3;
            int expectedNumberOfTrainingsTotal   = 6;
            int expectedDistance = 200;

            Report report = tm.GenerateMonthlyTrainingsReport(2019, 10);

            report.RunningSessions.Should().Be(expectedNumberOfTrainingsPerType);

            report.Runs[0].Distance.Should().Be(expectedDistance);

            report.CyclingSessions.Should().Be(expectedNumberOfTrainingsPerType);

            report.Rides[0].Distance.Should().Be(expectedDistance);

            report.TotalSessions.Should().Be(expectedNumberOfTrainingsTotal);
        }
Exemple #3
0
 /// <summary>
 /// 定位物体
 /// </summary>
 public void LocatObjects()
 {
     if (TrainingComponent.waitForUserInteraction && TrainingManager.getTrainingOperateState() != null)
     {
         GameObject obj = null;
         if (!InitConfigs.Instance.ReciprocalModelDic.ContainsKey(TrainingManager.getTrainingOperateState().target.targets[0]))
         {
             bool flag = false;
             foreach (ReciprocalModel model in InitConfigs.Instance.ReciprocalModelDic.Values)
             {
                 if (model.Reciprocal.ContainsKey(TrainingManager.getTrainingOperateState().target.targets[0]))
                 {
                     obj  = GameObject.Find(model.Model);
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 return;
             }
         }
         else
         {
             obj = GameObject.Find(TrainingManager.getTrainingOperateState().target.targets[0]);
         }
         if (this.currentReciprocal == null || !obj.name.Equals(currentReciprocal.Model))
         {
             clickEvent(obj);
         }
     }
 }
Exemple #4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            TrainingManager m = new TrainingManager(new UnitOfWork(new TrainingContext("Production")));

            m.AddCyclingTraining(new DateTime(2020, 4, 21, 16, 00, 00), 40, new TimeSpan(1, 20, 00), 30, null, TrainingType.Endurance, null, BikeType.RacingBike);
            m.AddCyclingTraining(new DateTime(2020, 4, 18, 18, 00, 00), 40, new TimeSpan(1, 42, 00), null, null, TrainingType.Recuperation, null, BikeType.RacingBike);
            m.AddCyclingTraining(new DateTime(2020, 4, 19, 16, 45, 00), null, new TimeSpan(1, 0, 00), null, 219, TrainingType.Interval, "5x5 min 270", BikeType.IndoorBike);
            m.AddRunningTraining(new DateTime(2020, 4, 17, 12, 30, 00), 5000, new TimeSpan(0, 27, 17), null, TrainingType.Endurance, null);
            m.AddRunningTraining(new DateTime(2020, 4, 19, 12, 30, 00), 5000, new TimeSpan(0, 25, 48), null, TrainingType.Endurance, null);
            m.AddRunningTraining(new DateTime(2020, 3, 17, 12, 0, 00), 5000, new TimeSpan(0, 28, 10), null, TrainingType.Interval, "3x700m");
            m.AddRunningTraining(new DateTime(2020, 3, 17, 11, 0, 00), 8000, new TimeSpan(0, 42, 10), null, TrainingType.Endurance, null);


            Report r1 = m.GenerateMonthlyCyclingReport(2020, 4);
            Report r2 = m.GenerateMonthlyRunningReport(2020, 4);

            Console.WriteLine("---------------------------");
            Report r3 = m.GenerateMonthlyTrainingsReport(2020, 4);

            foreach (var s in  r3.TimeLine)
            {
                Console.WriteLine($"{s.Item1.ToString()},{s.Item2}");
            }
        }
        private void DataDeleteClickEvent(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to remove those items?", "Configuration", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                List <int> runningIDs = new List <int>();
                List <int> cyclingIDs = new List <int>();

                List <int> list = DataTable.SelectedItems.Cast <DataRowView>().Select(x => dataTable.Rows.IndexOf(x.Row)).ToList();
                foreach (int i in list)
                {
                    if (dataTable.Rows.Count > i)
                    {
                        DataRow row   = dataTable.Rows[i];
                        String  sport = (string)row[1];
                        if (sport.ToLower().Equals("running"))
                        {
                            runningIDs.Add((int)row[0]);
                        }
                        else if (sport.ToLower().Equals("cycling"))
                        {
                            cyclingIDs.Add((int)row[0]);
                        }
                        dataTable.Rows.RemoveAt(i);
                    }
                }

                TrainingManager manager = new TrainingManager(new UnitOfWork(new TrainingContext("Production")));
                manager.RemoveTrainings(cyclingIDs, runningIDs);
            }
        }
        public void GenerateMonthlyRunningReportTest()
        {
            //Arrange = initialisatie objecten en kent waarden van gegevens toe aan methoden
            int year  = 1996;
            int month = 1;
            //DB testCyclingSessions
            TrainingManager t = new TrainingManager(new UnitOfWork(new TrainingContextTest(false)));

            #region runningTraining maxDistanceSessionRunning
            DateTime now = new DateTime(1996, 1, 23); int distance = 500;
            TimeSpan time = new TimeSpan(0, 15, 20); float averageSpeed = 15.00f;
            t.AddRunningTraining(now, distance, time, averageSpeed, TrainingType.Interval, "good job!");
            #endregion
            #region runningTraining maxSpeedSessionRunning
            int      distance2 = 200;
            TimeSpan time2 = new TimeSpan(0, 20, 20); float averageSpeed2 = 25.00f;
            t.AddRunningTraining(now, distance2, time2, averageSpeed2, TrainingType.Recuperation, "awesome new SpeedRecord");
            #endregion
            //Act = roept testen method op met ingestgelde parameters
            Report rapport = t.GenerateMonthlyRunningReport(year, month);
            //Assert = verifieert actie van geteste methoden
            rapport.MaxDistanceSessionRunning.Distance.Should().Be(500);
            rapport.MaxSpeedSessionRunning.AverageSpeed.Should().Be(25.00f);
            rapport.TotalSessions.Should().Be(2);
            rapport.TotalRunningDistance.Should().Be(700);
            rapport.TotalTrainingTime.Should().Be(new TimeSpan(0, 35, 40));
        }
 public AddSession(TrainingManager tm, int sessionType)
 {
     InitializeComponent();
     this.tm          = tm;
     this.sessionType = sessionType;
     setupPanels();
 }
Exemple #8
0
        public void previousRunning()
        {
            TrainingManager m = new TrainingManager(new UnitOfWork(new TrainingContext("Production")));
            // m.AddRunningTraining(new DateTime(2020, 4, 17, 12, 30, 00), 5000, new TimeSpan(0, 27, 17), 20, TrainingType.Endurance, null);
            //m.AddRunningTraining(new DateTime(2020, 4, 19, 12, 30, 00), 5000, new TimeSpan(0, 25, 48), 25, TrainingType.Endurance, null);

            var date1     = new DateTime(2020, 4, 17, 12, 30, 00);
            var distance1 = 5000;
            var time1     = new TimeSpan(0, 27, 17);
            var type1     = TrainingType.Endurance;
            var comment1  = "";

            var date2     = new DateTime(2020, 4, 19, 12, 30, 00);
            var distance2 = 5000;
            var time2     = new TimeSpan(0, 25, 48);
            var type2     = TrainingType.Endurance;
            var comment2  = "";

            List <RunningSession> tranings = m.GetPreviousRunningSessions(2);

            tranings[0].When.Should().Be(date1);
            tranings[0].Distance.Should().Be(distance1);
            tranings[0].Time.Should().Be(time1);
            tranings[0].AverageSpeed.Should().Be(20);
            tranings[0].TrainingType.Should().Be(type1);
            tranings[0].Comments.Should().Be(null);


            tranings[1].When.Should().Be(date2);
            tranings[1].Distance.Should().Be(distance2);
            tranings[1].Time.Should().Be(time2);
            tranings[1].AverageSpeed.Should().Be(25);
            tranings[1].TrainingType.Should().Be(type2);
            tranings[1].Comments.Should().Be(null);
        }
Exemple #9
0
        public void AddCyclingAverageWatt()
        {
            TrainingManager m = new TrainingManager(new UnitOfWork(new TrainingContext("Production")));
            Action          a = () => m.AddCyclingTraining(new DateTime(2020, 01, 01), null, new TimeSpan(1), 30, 100000, TrainingType.Endurance, "comment", BikeType.CityBike);

            a.Should().Throw <DomainException>().WithMessage("Average watt invalid value");
        }
Exemple #10
0
        public void AddRunningAverageSpeed()
        {
            TrainingManager m = new TrainingManager(new UnitOfWork(new TrainingContext("Production")));
            Action          a = () => m.AddRunningTraining(new DateTime(2020, 01, 01), 200, new TimeSpan(1), 100000, TrainingType.Endurance, "test");

            a.Should().Throw <DomainException>().WithMessage("Average speed invalid value");
        }
Exemple #11
0
        public void TestRemovingRunningSessionFromDatabase()
        {
            //Arrange
            TrainingManager m                      = new TrainingManager(new UnitOfWork(new TrainingContextTest()));
            DateTime        now                    = DateTime.Now;
            RunningSession  runSession             = new RunningSession(now, 10000, new TimeSpan(2, 0, 0), null, TrainingType.Endurance, "");
            RunningSession  toDeleteRunningSession = new RunningSession(new DateTime(2010, 5, 12), 10000, new TimeSpan(2, 0, 0), null, TrainingType.Endurance, null);

            m.AddRunningTraining(toDeleteRunningSession.When, toDeleteRunningSession.Distance, toDeleteRunningSession.Time, toDeleteRunningSession.AverageSpeed, toDeleteRunningSession.TrainingType, toDeleteRunningSession.Comments);
            m.AddRunningTraining(runSession.When, runSession.Distance, runSession.Time, runSession.AverageSpeed, runSession.TrainingType, runSession.Comments);
            TrainingManager m2 = new TrainingManager(new UnitOfWork(new TrainingContextTest(true)));

            //Act
            m2.RemoveTrainings(new List <int>(), new List <int> {
                1
            });
            var            runningSessions = m.GetAllRunningSessions();
            RunningSession retrievedRun    = runningSessions[0];

            //Assert
            Assert.IsTrue(runningSessions.Count == 1, "The Running Session was not deleted");
            Assert.AreEqual(retrievedRun.AverageSpeed, runSession.AverageSpeed, "AverageSpeed did not match up");
            Assert.AreEqual(retrievedRun.Comments, runSession.Comments, "Comments did not match up");
            Assert.AreEqual(retrievedRun.Distance, runSession.Distance, "Distance did not match up");
            Assert.AreEqual(retrievedRun.Time, runSession.Time, "Time did not match up");
            Assert.AreEqual(retrievedRun.TrainingType, runSession.TrainingType, "TrainingType did not match up");
            Assert.AreEqual(retrievedRun.When, runSession.When, "When did not match up");
        }
Exemple #12
0
        // GET: Student
        public ActionResult Index()
        {
            //invokig business logic layer
            List <Student> students = TrainingManager.GetAllStudents();

            return(View(students));
        }
Exemple #13
0
        public void AddCyclingTraining_ShouldThrowDomainException_WhenTimeInvalid()
        {
            TrainingManager TM = new TrainingManager(new UnitOfWork(new TrainingContextTest(true)));

            try
            {
                TM.AddCyclingTraining(new DateTime(2020, 4, 19, 16, 45, 00), null, new TimeSpan(-1), null, 219, TrainingType.Interval, "5x5 min 270", BikeType.IndoorBike);
            }
            catch (DomainException ex)
            {
                StringAssert.Contains(ex.Message, "Time invalid value");
                return;
            }

            try
            {
                TM.AddCyclingTraining(new DateTime(2020, 4, 19, 16, 45, 00), null, new TimeSpan(21, 0, 0), null, 219, TrainingType.Interval, "5x5 min 270", BikeType.IndoorBike);
            }
            catch (DomainException ex)
            {
                StringAssert.Contains(ex.Message, "Time invalid value");
                return;
            }

            Assert.Fail("The expected exception was not thrown");
        }
Exemple #14
0
 public RemoveWindow(TrainingManager tm)
 {
     InitializeComponent();
     this.tm  = tm;
     runIds   = new List <int>();
     cycleIds = new List <int>();
 }
Exemple #15
0
    public void EndMyRank()
    {
        TrainingManager _trainingManager = GameObject.Find("TrainingManager").GetComponent <TrainingManager>();

        _trainingManager.EndTraining();
        GameManager.Instance.InitTrigger();
    }
Exemple #16
0
        public void ShowResults(int year, int month)
        {
            TrainingManager trainingManager = new TrainingManager(new UnitOfWork(new TrainingContext(_databaseString)));
            Report          report          = trainingManager.GenerateMonthlyTrainingsReport(year, month);

            dataGridShowResults.ItemsSource = report.TimeLine;
            dataGridShowFastest.ItemsSource = new List <object>()
            {
                report.MaxSpeedSessionCycling, report.MaxSpeedSessionRunning
            };
            dataGridShowLongest.ItemsSource = new List <object>()
            {
                report.MaxDistanceSessionCycling, report.MaxDistanceSessionRunning
            };
            dataGridShowWattest.ItemsSource = new List <CyclingSession>()
            {
                report.MaxWattSessionCycling
            };
            startDateReport.Text = $"{report.StartDate.Year}/{report.StartDate.Month:00}/{report.StartDate.Day:00}";
            endDateReport.Text   = $"{report.EndDate.Year}/{report.EndDate.Month:00}/{report.EndDate.Day:00}";

            AmountOfRunSessions.Text     = report.RunningSessions.ToString();
            AmountOfCyclingSessions.Text = report.CyclingSessions.ToString();
            AmountOfTotalSessions.Text   = report.TotalSessions.ToString();

            TotalRunTime.Text      = report.TotalRunningTrainingTime.ToString();
            TotalCyclingTime.Text  = report.TotalCyclingTrainingTime.ToString();
            TotalTrainingTime.Text = report.TotalTrainingTime.ToString();

            TotalRunDistance.Text      = report.TotalRunningDistance.ToString() + " m";
            TotalCyclingDistance.Text  = report.TotalCyclingDistance.ToString() + " km";
            TotalTrainingDistance.Text = (report.TotalRunningDistance / 1000 + report.TotalCyclingDistance).ToString() + " km";
        }
Exemple #17
0
        private void DialogGenerateClickEevent(object sender, RoutedEventArgs e)
        {
            DateTime inputDate = new DateTime();

            try
            {
                inputDate = InputDate.SelectedDate.Value;
            }
            catch (Exception)
            {
                MessageBox.Show("You must fill in the date");
                return;
            }

            if (inputDate > DateTime.Now)
            {
                MessageBox.Show("You can't select a date in the future");
                return;
            }

            TrainingManager manager = new TrainingManager(new UnitOfWork(new TrainingContext("Production")));
            Report          rapport = manager.GenerateMonthlyTrainingsReport(inputDate.Year, inputDate.Month);


            if (rapport.TotalTrainingTime.ToString(@"h\h") != "0h")
            {
                CountTime.Text = rapport.TotalTrainingTime.ToString(@"h\h") + " " + rapport.TotalTrainingTime.ToString(@"m\m");
            }
            else
            {
                CountTime.Text = rapport.TotalCyclingTrainingTime.ToString(@"m\m");
            }

            CountRunning.Text  = (rapport.CyclingSessions + rapport.RunningSessions).ToString();
            CountDistance.Text = (rapport.TotalCyclingDistance + (rapport.TotalRunningDistance / 1000)) + "km";

            dataTable.Clear();

            RunningSession maxRunDistance = rapport.MaxDistanceSessionRunning;

            addDataLine("Distance", "Running", maxRunDistance.TrainingType.ToString(), maxRunDistance.Distance + " m", maxRunDistance.Time, Math.Round(maxRunDistance.AverageSpeed, 2) + " km/h", "", "", maxRunDistance.When, maxRunDistance.Comments);

            RunningSession maxRunSpeed = rapport.MaxSpeedSessionRunning;

            addDataLine("Speed", "Running", maxRunSpeed.TrainingType.ToString(), maxRunSpeed.Distance + " m", maxRunSpeed.Time, Math.Round(maxRunSpeed.AverageSpeed, 2) + " km/h", "", "", maxRunSpeed.When, maxRunSpeed.Comments);

            CyclingSession maxDistance = rapport.MaxDistanceSessionCycling;

            addDataLine("Distance", "Cycling", maxDistance.TrainingType.ToString(), maxDistance.Distance + " km", maxDistance.Time, Math.Round(Convert.ToDecimal(maxDistance.AverageSpeed), 2) + " km/h", maxDistance.AverageWatt.ToString(), maxDistance.BikeType.ToString(), maxDistance.When, maxDistance.Comments);

            CyclingSession maxSpeed = rapport.MaxSpeedSessionCycling;

            addDataLine("Speed", "Cycling", maxSpeed.TrainingType.ToString(), maxSpeed.Distance + " km", maxSpeed.Time, Math.Round(Convert.ToDecimal(maxSpeed.AverageSpeed), 2) + " km/h", maxSpeed.AverageWatt.ToString(), maxSpeed.BikeType.ToString(), maxSpeed.When, maxSpeed.Comments);

            CyclingSession maxWatt = rapport.MaxWattSessionCycling;

            addDataLine("Watt", "Cycling", maxWatt.TrainingType.ToString(), maxWatt.Distance + " km", maxWatt.Time, Math.Round(Convert.ToDecimal(maxWatt.AverageSpeed), 2) + " km/h", maxWatt.AverageWatt.ToString(), maxWatt.BikeType.ToString(), maxWatt.When, maxWatt.Comments);

            Dialog.IsOpen = false;
        }
Exemple #18
0
        public void hintClick()
        {
            toolMenu.cancelToolFollow();
            List <string> valueString = new List <string>(TrainingManager.GetVaraiableStringValue("工具").ToString().Split(','));

            if (valueString.Count == 1)
            {
                string toolName = valueString[0];
                if (toolName.Equals("wanyongbiao"))
                {
                    //if (alertMSG != null)
                    //    Destroy(alertMSG.gameObject);
                    multimeter.gameObject.SetActive(true);
                    multimeter.setShowNumber(circuitTopics[currentCircuit][0].ShowValue);
                    hintBtn.GetComponent <UIButton>().enabled = false;
                }
                else
                {
                    error();
                    showAlertMSG("操作错误!");
                }
            }
            else
            {
                error();
                showAlertMSG("操作错误!");
            }
            PluginEventManager.FireEvent("RecordTools", "");
        }
Exemple #19
0
        public void TestRemovingCyclingSessionFromDatabase()
        {
            //Arrange
            TrainingManager m   = new TrainingManager(new UnitOfWork(new TrainingContextTest()));
            DateTime        now = DateTime.Now;
            CyclingSession  cS  = new CyclingSession(now, null, new TimeSpan(2, 0, 0), null, null, TrainingType.Endurance, null, BikeType.CityBike);
            CyclingSession  ToDeleteSessions = new CyclingSession(new DateTime(2010, 5, 12), null, new TimeSpan(2, 0, 0), null, null, TrainingType.Endurance, null, BikeType.IndoorBike);

            m.AddCyclingTraining(ToDeleteSessions.When, ToDeleteSessions.Distance, ToDeleteSessions.Time, ToDeleteSessions.AverageSpeed, ToDeleteSessions.AverageWatt, ToDeleteSessions.TrainingType, ToDeleteSessions.Comments, ToDeleteSessions.BikeType);
            m.AddCyclingTraining(cS.When, cS.Distance, cS.Time, cS.AverageSpeed, cS.AverageWatt, cS.TrainingType, cS.Comments, cS.BikeType);

            //Act
            TrainingManager m2 = new TrainingManager(new UnitOfWork(new TrainingContextTest(true)));

            m2.RemoveTrainings(new List <int>()
            {
                1
            }, new List <int>());
            var            cyclingSessions = m2.GetAllCyclingSessions();
            CyclingSession retrievedCycle  = cyclingSessions[0];

            //Assert
            Assert.IsTrue(cyclingSessions.Count == 1, "The Running Session was not deleted");
            Assert.AreEqual(retrievedCycle.AverageSpeed, cS.AverageSpeed, "AverageSpeed did not match up");
            Assert.AreEqual(retrievedCycle.Comments, cS.Comments, "Comments did not match up");
            Assert.AreEqual(retrievedCycle.Distance, cS.Distance, "Distance did not match up");
            Assert.AreEqual(retrievedCycle.Time, cS.Time, "Time did not match up");
            Assert.AreEqual(retrievedCycle.TrainingType, cS.TrainingType, "TrainingType did not match up");
            Assert.AreEqual(retrievedCycle.When, cS.When, "When did not match up");
            Assert.AreEqual(retrievedCycle.BikeType, cS.BikeType, "BikeType did not match up");
        }
Exemple #20
0
        private void SetUpForAddRunningSessionExceptions()
        {
            var mockUoW = new Mock <IUnitOfWork>();

            mockUoW.Setup(x => x.RunningTrainings.AddTraining(It.IsAny <RunningSession>()));
            tm = new TrainingManager(new Mock <IUnitOfWork>().Object);
        }
Exemple #21
0
        private void SetTrainBackground(string empId)
        {
            TrainingManager     mTrainManager = new TrainingManager();
            List <TrainingItem> trainList     = new List <TrainingItem>();

            if (trainCollection.Count != 0)
            {
                trainCollection.Remove(selectedTrainItem);

                foreach (var item in trainCollection)
                {
                    trainList.Add(item);
                }
            }

            if (!string.IsNullOrEmpty(tbTitle.Text))
            {
                var trainItem = new TrainingItem();
                trainItem._EMP_ID            = empId;
                trainItem._TITLE             = tbTitle.Text;
                trainItem._INSTITUTION       = tbInstitution.Text;
                trainItem._TRAINING_LOCATION = tbLocation.Text;
                trainItem._TRAINING_DATE     = dpTrainingFinished.Text;

                trainList.Add(trainItem);
            }

            mTrainManager.DeleteTrainData(empId);

            foreach (var item in trainList)
            {
                mTrainManager.SaveTrainingData(item);
            }
        }
 public RunningSessionAddWindow(TrainingManager trainingmg, RunningSessionWindow parent)
 {
     InitializeComponent();
     m           = trainingmg;
     this.parent = parent;
     DatePickerRunning.BlackoutDates.Add(new CalendarDateRange(DateTime.Now.AddDays(1), DateTime.MaxValue));
     trainingTypeRunningSession.ItemsSource = Enum.GetNames(typeof(TrainingType)); // insert trainingtypes
 }
        public static List <OverviewData> GetAllRunningData()
        {
            List <OverviewData> datas = new List <OverviewData>();
            TrainingManager     TM    = new TrainingManager(new UnitOfWork(new TrainingContext()));

            TM.GetAllRunningSessions().ForEach(x => datas.Add(new OverviewData(x)));
            return(datas);
        }
        // GET: api/Product
        public IEnumerable <Student> Get()
        {
            List <Student> students = TrainingManager.GetAllStudents();

            return(students);

            //return new string[] { "value1", "value2" };
        }
Exemple #25
0
 //更新菜单栏信息,更新弹出菜单栏信息
 public void updateTrainingFlow(int index)
 {
     indexNumber = index;
     uitool.setShiwaiSliderValue(Convert.ToSingle(indexNumber + 1) / Convert.ToSingle(count), indexNumber + 1, count);
     flowOperateMenu.switchFlow(index);
     dynamiclistUI.reset();
     dynamiclistUI.updateTitle((index + 1).ToString().PadLeft(2, '0'), TrainingManager.getCurrentTrainingBigFow().getTrainingFlow(index).name);
 }
Exemple #26
0
 private void Awake()
 {
     manager       = GetComponent <TrainingManager>();
     visualiser    = GetComponent <TrainingVisualiser>();
     instances     = new List <TrainingManagerEndpoint>();
     available     = new List <TrainingManagerEndpoint>();
     WatchInstance = -1;
 }
Exemple #27
0
 /// <summary>
 /// refresh exam
 /// </summary>
 public void afreshExam()
 {
     examGrade.GetComponent <Camera>().depth = -50;
     CoherentUISystem.Instance.UIViews.Remove(examGrade);
     flowOperateMenuClick(0);
     examCountDown.onRestart();
     TrainingManager.initCircuitUI();
 }
Exemple #28
0
 private void Awake()
 {
     manager = GetComponent <TrainingManager>();
     worker  = GetComponent <TrainingWorker>();
     state   = new TrainingState();
     worker.OnTrainingFrame           += OnTrainingFrame;
     worker.OnTrainingRequestComplete += OnTrainingRequestComplete;
 }
Exemple #29
0
 public AddWindow(TrainingManager tm)
 {
     _tm = tm;
     InitializeComponent();
     bikeType.ItemsSource         = Enum.GetValues(typeof(BikeType)).Cast <BikeType>();
     bikeTrainingType.ItemsSource = Enum.GetValues(typeof(TrainingType)).Cast <TrainingType>();
     runType.ItemsSource          = Enum.GetValues(typeof(TrainingType)).Cast <TrainingType>();
 }
Exemple #30
0
        public void changeMode()
        {
            ouebutton.SetActive(false);
            info.gameObject.SetActive(false);
            errorCount = 0;
            examCountDown.onStop();
            uitool.setShiwaiSliderValue((float)(1) / (float)circuitFlows.Count, 1, circuitFlows.Count);
            cleanUI();
            movieManager.OnStop();
            circuitUIStart.SetActive(true);
            circuitUIIsStart = false;
            switch (tempMode)
            {
            case TrainUI.TrainMode.Study:
                info.gameObject.SetActive(true);
                if (alertMSG != null)
                {
                    Destroy(alertMSG.gameObject);
                }
                examCountDown.gameObject.SetActive(false);
                currentTrainMode = TrainUI.TrainMode.Study;
                if (coverTab[coverTab.Length - 1].activeSelf)
                {
                    coverTab[coverTab.Length - 1].SetActive(false);
                    Title[Title.Length - 1].SetActive(false);
                }
                Title[0].SetActive(true);
                coverTab[0].SetActive(true);
                skipButton.SetActive(false);
                mask.SetActive(true);
                uitool.gameObject.SetActive(true);
                movieText.text = "二维电路图原理动画";
                break;

            case TrainUI.TrainMode.Exam:
                ouebutton.SetActive(true);
                //examCountDown.gameObject.SetActive(true);
                //examCountDown.startTimer();
                currentTrainMode = TrainUI.TrainMode.Exam;
                if (coverTab[0].activeSelf)
                {
                    coverTab[0].SetActive(false);
                    Title[0].SetActive(false);
                }
                Title[Title.Length - 1].SetActive(true);
                coverTab[coverTab.Length - 1].SetActive(true);
                skipButton.SetActive(true);
                mask.SetActive(false);
                uitool.gameObject.SetActive(false);
                TrainingManager.initCircuitUI();
                movieText.text = "二维电路图考试";
                break;

            default:
                break;
            }
            flowOperateMenu.initFlowMenu(circuitFlows, flowOperateMenuClick, currentTrainMode);
        }