Esempio n. 1
0
        protected async internal Task <int> GetNextContentUnitID()
        {
            var bnd = this.BindingContext as clsFormBindableModel;
            List <clsSQLParam> Params = new List <clsSQLParam>();

            Params.Add(new clsSQLParam("@CourseID", bnd["CourseID"].ToString(), typeof(int), false));
            Params.Add(new clsSQLParam("@ContentUnitID", bnd["ContentUnitID"].ToString(), typeof(int), false));
            clsProcOutput oRet = await this.GenerateParamsOutput("contentunit", Params);

            return(oRet.ID);
        }
Esempio n. 2
0
        public IHttpActionResult ClearAuthInfo()
        {
            clsProcOutput oRet = AgentAuthProvider.ClearCache();

            if (oRet.Success)
            {
                return(Ok("Done"));
            }
            else
            {
                return(Ok(oRet.Message));
            }
        }
Esempio n. 3
0
        private async Task <string> GetDownloadUrl(string filePath)
        {
            List <clsSQLParam> Params = new List <clsSQLParam>();

            filePath = Base64Encode(filePath);
            Params.Add(new clsSQLParam("@serverpath", "'" + filePath + "'", typeof(string), false));
            clsProcOutput oRet = await this.GenerateParamsOutput("download", Params);

            var str1 = JsonConvert.SerializeObject(oRet.JsonData);
            var dic  = JsonConvert.DeserializeObject <Dictionary <string, string> >(str1);
            var url  = dic["Data"];

            return(url);
        }
Esempio n. 4
0
        public async Task StartAssessment(string StartType)
        {
            try
            {
                UserDialogs.Instance.ShowLoading("Rendering View...\nPlease wait");
                var bnd = this.BindingContext as clsFormBindableModel;
                List <clsSQLParam> Params = new List <clsSQLParam>();
                if (bnd.ContainsKey("CourseID"))
                {
                    Params.Add(new clsSQLParam("@CourseID", myUtils.cValTN(bnd["CourseID"]).ToString(), typeof(int), false));
                }
                if (bnd.ContainsKey("AssessTestID"))
                {
                    Params.Add(new clsSQLParam("@TestID", myUtils.cValTN(bnd["AssessTestID"]).ToString(), typeof(int), false));
                }
                if (bnd.ContainsKey("AssessSurveyID"))
                {
                    Params.Add(new clsSQLParam("@SurveyID", myUtils.cValTN(bnd["AssessSurveyID"]).ToString(), typeof(int), false));
                }
                if (bnd.ContainsKey("AssessAssignmentID"))
                {
                    Params.Add(new clsSQLParam("@AssignmentID", myUtils.cValTN(bnd["AssessAssignmentID"]).ToString(), typeof(int), false));
                }
                Params.Add(new clsSQLParam("@StartType", "'" + StartType + "'", typeof(string), false));
                var assesstype = bnd["ContentType"].ToString().Trim().ToLower();
                switch (assesstype)
                {
                case "assignment":
                {
                    clsProcOutput oRet = await this.GenerateParamsOutput("assessuser", Params);

                    if (oRet.Success)
                    {
                        FrmAssessAssignView f3 = new FrmAssessAssignView();
                        f3.Title = bnd["Title"].ToString();
                        if (await f3.PrepForm(pView, EnumfrmMode.acEditM, oRet.ID.ToString()))
                        {
                            await RSNavigationPage.Instance.PushAsync(f3);
                        }
                    }
                    else
                    {
                        await this.Controller.ShowMsg(oRet.Message, false);
                    }
                    break;
                }

                default:
                {
                    clsProcOutput oRet = await this.GenerateParamsOutput("testquestion", Params);

                    if (oRet.Success)
                    {
                        if (oRet.ID == 0)
                        {
                            UserDialogs.Instance.Toast("Test is not available anymore, Please Start New Test");
                            return;
                        }
                        else
                        {
                            string strXML          = string.Format("<PARAMS ASSESSUSERID=\"{0}\"/>", oRet.IDList[0]);
                            FrmTestQuestionView f3 = new FrmTestQuestionView();
                            f3.Title = bnd["Title"].ToString();
                            if (await f3.PrepForm(pView, EnumfrmMode.acEditM, oRet.ID.ToString(), strXML))
                            {
                                await RSNavigationPage.Instance.PushAsync(f3);
                            }
                        }
                    }
                    else
                    {
                        await this.Controller.ShowMsg(oRet.Message, false);
                    }
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                UserDialogs.Instance.HideLoading();
            }
        }