public static ActionSheetPage CreatePage(ActionSheetRequest request, Color titleBarColor, Color titleColor, Color listBackgroundColor, Color listTextColor, Color footerBarColor) =>
 new ActionSheetPage(request)
 {
     TitleBarColor       = titleBarColor,
     TitleColor          = titleColor,
     ListBackgroundColor = listBackgroundColor,
     ListTextColor       = listTextColor,
     FooterBarColor      = footerBarColor
 };
Ejemplo n.º 2
0
        public void EndTest([FromBody] ActionSheetRequest actionSheetRequest)
        {
            var sheet = repoOnSite.GetSheetBySheetId(actionSheetRequest.sheetId);

            if (sheet != null)
            {
                //foreach (var item in sheet.RandomQuestions)
                //{
                //    if (item.UserAnswer != null)
                //    {
                //        item.UserAnswer.IsCorrect = item.Choices.Where(x => x._id == item.UserAnswer._id).FirstOrDefault().IsCorrect;
                //    }
                //}

                //sheet.CorrectScore = sheet.RandomQuestions.Where(x => x.UserAnswer.IsCorrect.Value).Count();
                //sheet.InCorrectScore = sheet.RandomQuestions.Where(x => !x.UserAnswer.IsCorrect.Value).Count();

                //if (sheet.CorrectScore >= sheet.Subject.PassScore)
                //{
                //    sheet.LatestStatus = "PASS";
                //}
                //else
                //{
                //    sheet.LatestStatus = "FAIL";
                //}

                var newStatus = new StatusExtension
                {
                    _id            = Guid.NewGuid().ToString(),
                    ClientId       = "admin",
                    CreateDateTime = DateTime.Now,
                    //Status = sheet.LatestStatus
                    Status = sheet.CorrectScore >= sheet.Subject.PassScore ? "PASS" : "FAIL",
                };
                sheet.StatusExtensions.Add(newStatus);
                sheet.LatestStatus = newStatus.Status;
                sheet.ExamDateTime = DateTime.Now;

                repoOnSite.UpdateSheet(sheet);

                if (sheet.LatestStatus == "PASS")
                {
                    SyncExam(sheet._id);
                }
            }
        }
Ejemplo n.º 3
0
 public void Cancel([FromBody] ActionSheetRequest actionSheetRequest)
 {
     using (var client = new WebClient())
     {
         try
         {
             var json     = Newtonsoft.Json.JsonConvert.SerializeObject(actionSheetRequest);
             var dataByte = System.Text.Encoding.UTF8.GetBytes(json);
             client.Headers[HttpRequestHeader.ContentType] = "application/json";
             dataByte = client.UploadData(this.svconfig.admindbip + "/api/OnSite/Cancel/", "POST", dataByte);
         }
         catch (Exception e)
         {
             throw new Exception(e.Message);
         }
     }
 }
Ejemplo n.º 4
0
        public void Cancel([FromBody] ActionSheetRequest actionSheetRequest)
        {
            var sheet = repoOnSite.GetSheetBySheetId(actionSheetRequest.sheetId);

            if (sheet != null)
            {
                var newStatus = new StatusExtension
                {
                    _id            = Guid.NewGuid().ToString(),
                    ClientId       = "ForTest",
                    CreateDateTime = DateTime.Now,
                    Status         = "CANCEL",
                };

                sheet.StatusExtensions.Add(newStatus);
                sheet.LatestStatus = "CANCEL";
                repoOnSite.UpdateSheet(sheet);
            }
        }
 public ActionSheetPage(ActionSheetRequest request)
     : base(request)
 {
     InitializeComponent();
 }
 public static ActionSheetPage CreatePage(ActionSheetRequest request) =>
 new ActionSheetPage(request);
Ejemplo n.º 7
0
        public static async Task DisplayActionSheetAsync(this IPageDialogService pageDialogService, ActionSheetRequest request)
        {
            if (pageDialogService is IPopupDialogService popupDialogService)
            {
                await popupDialogService.DisplayActionSheetAsync(request);
            }

            throw new NotSupportedException("The provided instance of IPageDialogService does not implement IPopupDialogService");
        }
 public ActionSheetPageBase(ActionSheetRequest request)
 {
     ActionSheetButtons  = request.Buttons;
     InvokeButtonCommand = new DelegateCommand <IActionSheetButton>(OnInvokeButtonCommandExecuted);
 }