async void FetchSumaryFromServer(int testid)
        {
            CustomProgressDialog cpd = new CustomProgressDialog(Activity);

            cpd.SetCancelable(false);
            cpd.Show();
            var apiresponse        = RestService.For <ApiConnectionForTestPackage>(Utility.stapibaseUrl);
            var responseforsummary = await apiresponse.GetTestSummary(MainActivity1.userid + "", testid + "");

            List <TestSummaryDataModel> summarylist = JsonConvert.DeserializeObject <List <TestSummaryDataModel> >(responseforsummary.Data);

            cpd.DismissDialog();
            var intent = new Intent(Activity, typeof(TestSummary));

            intent.PutExtra("path", "portal");
            intent.PutExtra("testsummarylist", responseforsummary.Data);
            Activity.StartActivityForResult(intent, 102);
            Activity.OverridePendingTransition(Resource.Animation.slide_left, Resource.Animation.hold);
        }
Пример #2
0
        async void FetchSumaryFromServer(int testid, CustomProgressDialog cpd)
        {
            var apiresponse        = RestService.For <ApiConnectionForTestPackage>(Utility.stapibaseUrl);
            var responseforsummary = await apiresponse.GetTestSummary(MainActivity1.userid + "", testid + "");

            List <TestSummaryDataModel> summarylist = JsonConvert.DeserializeObject <List <TestSummaryDataModel> >(responseforsummary.Data);

            cpd.DismissDialog();
            context.Finish();
            TestInstruction.activity.Finish();
            MyTest.activity.Finish();
            var intent1 = new Intent(context, typeof(MyTest));

            intent1.PutExtra("serilizeObj", MyTest.SerilizeString);
            context.StartActivity(intent1);
            var intent = new Intent(context, typeof(TestSummary));

            intent.PutExtra("path", "portal");
            intent.PutExtra("testsummarylist", responseforsummary.Data);
            context.StartActivityForResult(intent, 102);
            context.OverridePendingTransition(Resource.Animation.slide_left, Resource.Animation.hold);
        }
Пример #3
0
        async void Callapi()
        {
            try
            {
                var apiresponse             = RestService.For <ApiConnection>(Utility.mibsapiBaseUrl);
                UserStPackageModel response = await apiresponse.GetOnlineSTCoursesr();

                listresponse = JsonConvert.DeserializeObject <List <UserPackageModel> >(response.Data);

                var apiresponseforuser             = RestService.For <ApiConnection>(Utility.mibsapiBaseUrl);
                UserStPackageModel responseforuser = await apiresponse.GetUserSTPackages(MainActivity1.userid + "");

                listresponseforuser = JsonConvert.DeserializeObject <List <UserPackageModel> >(responseforuser.Data);
                List <UserTestPostObject> mylist = new List <UserTestPostObject>();
                for (int i = 0; i < listresponseforuser.Count; i++)
                {
                    UserPackageModel   userpackagemodel = listresponseforuser[i];
                    string             iDate            = userpackagemodel.StartsFrom;
                    DateTime           oDate            = Convert.ToDateTime(iDate);
                    UserTestPostObject obj = new UserTestPostObject
                    {
                        UserId     = MainActivity1.userid,
                        PackageID  = userpackagemodel.PackageID,
                        StartsFrom = oDate,
                    };
                    mylist.Add(obj);
                }
                string mytem = JsonConvert.SerializeObject(mylist);
                var    apiresponseforgiventestpackagewise = RestService.For <ApiConnectionForTestPackage>(Utility.stapibaseUrl);
                var    responseforgiventestpackagewise    = await apiresponseforgiventestpackagewise.Getusertestgivenpackagewise(mylist);

                var listforgiventestpackagewise = JsonConvert.DeserializeObject <List <UserTestGivenPackageWiseRecord> >(responseforgiventestpackagewise.Data);
                //if (listforgiventestpackagewise.Count > 0)
                //{
                //    var l1 = listforgiventestpackagewise.Count;
                //    var l2 = listresponseforuser.Count;
                //    if (l1 > l2)
                //        l1 = l2;
                //    for (int i = 0; i < listresponseforuser.Count; i++)
                //    {

                //        listresponseforuser[i].ExamGiven = listforgiventestpackagewise[i].ExamGiven;
                //        try
                //        {
                //            listresponseforuser[i].PracticalGiven = listforgiventestpackagewise[i].PracticalGiven;
                //        }
                //        catch (Exception)
                //        {
                //            listresponseforuser[i].ExamGiven = listforgiventestpackagewise[i].ExamGiven;
                //        }
                //    }
                //}


                TestSelectionAdapter mAdapter = new TestSelectionAdapter(listresponse, listresponseforuser, colorcode, imagename, this, mRecycleView);
                mAdapter.ItemClick += MAdapter_ItemClick;
                mRecycleView.SetAdapter(mAdapter);
                cp.DismissDialog();
                try
                {
                    listresponseforuser.Add(TestSelectionAdapter.finallist[listresponseforuser.Count]);
                }
                catch (Exception e)
                {
                    // Toast.MakeText(this, "mahendras-->"+e.Message, ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                cp.DismissDialog();
                Toast.MakeText(this, e.Message, ToastLength.Short).Show();
            }
        }