public SingleResponeMessage <PracticeInfo> Get(string id) { SingleResponeMessage <PracticeInfo> ret = new SingleResponeMessage <PracticeInfo>(); try { PracticeInfo item = PracticeService.GetInstance().GetDetail(id); if (item == null) { ret.isSuccess = false; ret.err.msgCode = "001"; ret.err.msgString = "no User found"; return(ret); } ret.item = item; ret.isSuccess = true; } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
private async void StartButton_Clicked(object sender, EventArgs e) { IsLoading = true; var user = CurrentUser.User; var hasPractice = await PracticeService.CheckDayOfPractice(user.Id); if (hasPractice) { List <Drill> drills = await PracticeService.GetFullTrainingProgramById(user.Id); foreach (var drill in drills) { Drills.Add(drill); } (sender as Button).IsVisible = false; ListView listView = (ListView)FindByName("DrillListView"); listView.IsVisible = true; IsLoading = false; } else { (sender as Button).IsVisible = false; IsLoading = false; await DisplayAlert("", "Today is not your practice day.", "OK"); } }
public Benchmarks(DataInitFixture fixture, ITestOutputHelper output) { //Initialize the output this._output = output; //Initialize DbContext in memory this._fixture = fixture; var builder = new ConfigurationBuilder() .AddJsonFile("testsettings.json") .AddEnvironmentVariables(); Configuration = builder.Build(); this._apibaseUrl = Configuration["AAD:Url"]; //Create the all services _svcBenchmark = new BenchmarkService(_fixture.Context); _svcAuth = new AuthService(_fixture.Context); _svcMsg = new MessageService(_fixture.Context); _svcPlayerResponse = new PlayerResponseService(_fixture.Context); _svcPractice = new PracticeService(_fixture.Context); _svcQuestionnaire = new QuestionnaireService(_fixture.Context); _svcSession = new SessionService(_fixture.Context); _svcCognitive = new CognitiveService(_fixture.Context); _svcDrill = new DrillService(_fixture.Context); _svcSettings = new SettingsService(_fixture.Context); _svcTeam = new TeamService(_fixture.Context); _svcWorkout = new WorkoutService(_fixture.Context); }
public PracticeTests(DataInitFixture fixture, ITestOutputHelper output) { //Initialize the output this._output = output; //Initialize DbContext in memory this._fixture = fixture; //Create the test service _service = new PracticeService(_fixture.Context); }
private async void ViewResultButton_Clicked(object sender, EventArgs e) { var res = await PracticeService.GetDrillStatsById(CurrentUser.User.Id, Drill.DrillId); //TODO var randomTip = tips[new Random().Next() % tips.Count]; await DisplayAlert( "Your result:", $"Average speed: {Math.Round(res.AverageSpeed, 2)}\n" + $"Repetitions per sec: {Math.Round(res.RepsPerSec, 2)}\n" + $"Your grade: {Math.Round(res.Accuracy, 2)}\n" + $"Tips: {randomTip}", "Ok"); }
// POST api/Confirm public ActionMessage Post([FromBody] ConfirmInfo item) { ActionMessage ret = new ActionMessage(); ret.isSuccess = true; try { PracticeService.GetInstance().CreateConfirm(item); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage Put([FromBody] PracticeInfo model) { ActionMessage ret = new ActionMessage(); ret.isSuccess = true; try { PracticeService.GetInstance().UpdateUser(model); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
public ActionMessage DeleteAll(string ids) { ActionMessage ret = new ActionMessage(); ret.isSuccess = true; try { PracticeService.GetInstance().DeleteAllUser(ids); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "Internal Error !!!"; ret.err.msgString = ex.ToString(); } return(ret); }
private async void DisplayTime() { //var res = await PracticeService.StartDrillPractice(CurrentUser.User.Id, Drill.DrillId); var res = PracticeService.StartDrillPractice(CurrentUser.User.Id, Drill.DrillId); while (CurrentTime > 0) { await Task.Delay(100); CurrentTime -= 100; } await Task.Delay(5000); Drill.IsCompleted = true; CompletedDrill.Drill = Drill; TimeTextLabel.IsVisible = false; TimeLabel.IsVisible = false; }
public ListResponeMessage <PracticeInfo> GetList([FromQuery] PracticeCriteria criteria) { ListResponeMessage <PracticeInfo> ret = new ListResponeMessage <PracticeInfo>(); try { ret.isSuccess = true; ret.data = PracticeService.GetInstance().GetList(criteria); ret.totalRecords = PracticeService.GetInstance().getTotalRecords(criteria); } catch (Exception ex) { ret.isSuccess = false; ret.err.msgCode = "005"; ret.err.msgString = ex.ToString(); } return(ret); }
private async void PracticeWasStarted() { IsLoading = true; var res = await PracticeService.PracticeWasStarted(CurrentUser.User.Id); if (res) { List <Drill> drills = await PracticeService.GetFullTrainingProgramById(CurrentUser.User.Id); foreach (var drill in drills) { Drills.Add(drill); } ListView listView = (ListView)FindByName("DrillListView"); listView.IsVisible = true; } else { StartButton.IsVisible = true; } IsLoading = false; }
public PracticeController(TPPContext context) : base(context) { _service = new PracticeService(context); }
public PracticeTest() { this.practiceService = new PracticeService(); }
public JsonResult listLoaiTT(long?id = null) { PracticeService thucTapService = new PracticeService(); return(Json(thucTapService.GetAllLoaiTT(), JsonRequestBehavior.AllowGet)); }