Ejemplo n.º 1
0
        async void callGetDriver(Account logAccount)
        {
            try
            {
                cdQueryAttr qryAcct = new cdQueryAttr();
                qryAcct.ColIndex  = "IndexName";
                qryAcct.IndexName = "StudentIDindex";
                qryAcct.ColName   = "StudentID";
                qryAcct.ColValue  = logAccount.UserName;

                getDriver        myDriverArray = new getDriver();
                DriverAllocation pubDriverInfo = new DriverAllocation();
                cdCallAPI        mycallAPI     = new cdCallAPI();

                var jsreponse = await mycallAPI.cdcallDriverAllocGET(qryAcct);

                myDriverArray = JsonConvert.DeserializeObject <getDriver>((string)jsreponse);

                pubDriverInfo = myDriverArray.DriverAllocation[0];

                DriverName.Text          = "Driver Name: " + pubDriverInfo.DriverName;
                CarType.Text             = "Car Type: " + pubDriverInfo.Attr3;
                LicensePlate.Text        = "License Plate: " + pubDriverInfo.Attr4;
                DestinationAddress.Text  = "Address: " + pubDriverInfo.Attr1;
                DestinationAddress2.Text = "               " + pubDriverInfo.Attr2;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("End of Clubs Loop " + ex);
                await DisplayAlert("Action", "Update Status Failed", "OK");
            }
        }
Ejemplo n.º 2
0
        async void cdTrack(object sender, System.EventArgs e)
        {
            try
            {
                System.Diagnostics.Debug.WriteLine(" Clicked Track Button");
                cdQueryAttr qryAcct = new cdQueryAttr();
                qryAcct.ColIndex  = "IndexName";
                qryAcct.IndexName = "StudentIDindex";
                qryAcct.ColName   = "StudentID";
                qryAcct.ColValue  = mystudAccounts.Account[counter].UserName;

                getDriver        myDriverArray = new getDriver();
                DriverAllocation pubDriverInfo = new DriverAllocation();
                cdCallAPI        mycallAPI     = new cdCallAPI();

                var jsreponse = await mycallAPI.cdcallDriverAllocGET(qryAcct);

                myDriverArray = JsonConvert.DeserializeObject <getDriver>((string)jsreponse);

                pubDriverInfo = myDriverArray.DriverAllocation[0];

                String trackkey = pubDriverInfo.DriverID + DateTime.Now.ToShortDateString();
                System.Diagnostics.Debug.WriteLine(" Tracking " + mystudAccounts.Account[counter].UserName + "with the key " + trackkey);

                var tpage = new cdTrackRiders(trackkey, loginAccount);
                await Navigation.PushModalAsync(tpage);
            }
            catch (Exception ex)
            {
                await DisplayAlert("No Tracking", "No Tracking information available for this student", "OK");

                System.Diagnostics.Debug.WriteLine("Exception is " + ex);
            }
        }
Ejemplo n.º 3
0
        async void getStudentData(Account logAccount)
        {
            //Getting Student Information
            try
            {
                cdQueryAttr qryAcct = new cdQueryAttr();
                qryAcct.ColIndex  = "IndexName";
                qryAcct.IndexName = "DriverIDAllocationIDindex";
                qryAcct.ColName   = "DriverID";
                qryAcct.ColValue  = logAccount.UserName;
                counter           = 0;

                getDriver        myStudentArray = new getDriver();
                DriverAllocation pubStudentInfo = new DriverAllocation();
                cdCallAPI        mycallAPI      = new cdCallAPI();

                var jsreponse = await mycallAPI.cdcallDriverAllocGET(qryAcct);

                myStudentArray = JsonConvert.DeserializeObject <getDriver>((string)jsreponse);
                mystudArray    = myStudentArray;

                System.Diagnostics.Debug.WriteLine("Get response for students is " + jsreponse);
                try {
                    foreach (var dalloc in myStudentArray.DriverAllocation)
                    {
                        maxarray = maxarray + 1;
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("End of Array " + ex);
                }

                System.Diagnostics.Debug.WriteLine("Assigning student name. Max array " + maxarray);

                StudentName.Text         = "Student Name: " + mystudArray.DriverAllocation[counter].StudentName;
                DestinationAddress.Text  = "Destination Address : " + mystudArray.DriverAllocation[counter].Attr1;
                DestinationAddress2.Text = "                       " + mystudArray.DriverAllocation[counter].Attr2;
                System.Diagnostics.Debug.WriteLine("Assigned dest address ");
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("End of Array " + ex);
                await DisplayAlert("No Student Allocation Found", "No Student Allocation Found " + ex, "ok");
            }
            if (counter >= maxarray)
            {
                PreviousButton.IsEnabled = false;
                NextButton.IsEnabled     = false;
            }
            else
            {
                PreviousButton.IsEnabled = false;
                NextButton.IsEnabled     = true;
            }
        }