async void cdFind(object sender, System.EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(" Clicked Find Button");
            String      myrole    = " ";
            cdCallAPI   mycallAPI = new cdCallAPI();
            Account     myaccount = new Account();
            cdQueryAttr qryAcct   = new cdQueryAttr();

            qryAcct.ColIndex  = "IndexName";
            qryAcct.IndexName = "MemberAccountIDIndex";
            qryAcct.ColName   = "MemberAccountID";
            // qryAcct.ColValue = EmailAddress.Text;
            counter = 0;

            try
            {
                getClubMembers myAccountsArray = new getClubMembers();

                var jsreponse = await mycallAPI.cdcallClubMembersGET(qryAcct);

                myAccountsArray = JsonConvert.DeserializeObject <getClubMembers>((string)jsreponse);
                //   ApplicantName.Text = "Applicant Name: " + myAccountsArray.ClubMember[counter].MemberName;

                if (myAccountsArray.ClubMember[counter].MemberRole.Contains("D"))
                {
                    myrole = myrole + " Driver ";
                }
                if (myAccountsArray.ClubMember[counter].MemberRole.Contains("P"))
                {
                    myrole = myrole + " Parent ";
                }
                if (myAccountsArray.ClubMember[counter].MemberRole.Contains("A"))
                {
                    myrole = myrole + " Admin ";
                }
                if (unClubMembers[counter].MemberRole.Contains("R"))
                {
                    myrole = myrole + " Rider ";
                }

                //  ApplicantType.Text = "Applicant Role: " + myrole;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Unable to fetch data " + ex);
                await DisplayAlert("Unable to fetch data", "Unable to fetch data", "OK");
            }
            //PreviousButton.IsEnabled = false;
            //NextButton.IsEnabled = false;
        }
Beispiel #2
0
        async void getPickerClubInfo()
        {
            cdQueryAttr qryAcct = new cdQueryAttr();

            qryAcct.ColIndex  = "IndexName";
            qryAcct.IndexName = "MemberAccountIDIndex";
            qryAcct.ColName   = "MemberAccountID";
            qryAcct.ColValue  = myAccount.UserName;

            System.Diagnostics.Debug.WriteLine(" Getting clubs from club members");

            getClubMembers myClubMembers = new getClubMembers();
            cdCallAPI      mycallAPI     = new cdCallAPI();

            try
            {
                var jsreponse = await mycallAPI.cdcallClubMembersGET(qryAcct);

                myClubMembers = JsonConvert.DeserializeObject <getClubMembers>((string)jsreponse);

                System.Diagnostics.Debug.WriteLine(" Club Member payload is " + jsreponse);

                foreach (var stacc in myClubMembers.ClubMember)
                {
                    maxarray = maxarray + 1;
                    if (myClubMembers.ClubMember[maxarray].MemberRole.Contains("A") == true)
                    {
                        picker.Items.Add(myClubMembers.ClubMember[maxarray].ClubName + "|" + myClubMembers.ClubMember[maxarray].ClubID);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("End of Array " + ex);
            }
        }
Beispiel #3
0
        async Task <JToken> createEventSignups(String fwho)
        {
            if (fwho == "Self")
            {
                cdCallAPI      mycallAPI          = new cdCallAPI();
                cdReadError    myerror            = new cdReadError();
                cdEventSignups insertEventMembers = new cdEventSignups();
                insertEventMembers.EventID          = assignedEvents[counter].EventID;
                insertEventMembers.EventName        = assignedEvents[counter].EventName;
                insertEventMembers.ClubName         = assignedEvents[counter].ClubName;
                insertEventMembers.ClubID           = assignedEvents[counter].ClubID;
                insertEventMembers.AllocationStatus = "UNALLOCATED";
                insertEventMembers.DriverCar        = CarType.Text;
                insertEventMembers.RiderCount       = CarAllowance.Text;
                insertEventMembers.PickupLocation   = assignedEvents[counter].AddressLine1 + " " + assignedEvents[counter].City + " " + assignedEvents[counter].cdState + " " + assignedEvents[counter].PostalCode;
                insertEventMembers.Attr1            = assignedEvents[counter].AddressLine1 + " " + assignedEvents[counter].AddressLine2;
                insertEventMembers.Attr2            = assignedEvents[counter].City + " " + assignedEvents[counter].cdState + " " + assignedEvents[counter].PostalCode;
                insertEventMembers.Attr3            = "None";
                insertEventMembers.Attr4            = "None";
                insertEventMembers.Attr5            = "None";
                insertEventMembers.Attr6            = "None";
                insertEventMembers.Attr7            = "None";
                insertEventMembers.Attr8            = "None";
                insertEventMembers.Attr9            = "None";
                insertEventMembers.Attr10           = "None";
                insertEventMembers.EventMemberID    = myAccount.UserName + assignedEvents[counter].ClubName.Substring(0, 3) + assignedEvents[counter].EventName.Substring(0, 3) + (Math.Abs(DateTime.Now.ToBinary()).ToString());
                insertEventMembers.MemberName       = myAccount.FirstName + " " + myAccount.LastName;
                insertEventMembers.MemberAccountID  = myAccount.UserName;
                if (cdCheckRider.IsChecked == true)
                {
                    insertEventMembers.MemberRole = "D";
                    insertEventMembers.Attr3      = CarType.Text;
                    insertEventMembers.Attr4      = CarLicense.Text;
                }
                else
                {
                    insertEventMembers.MemberRole = "R";
                }
                var jsresponse = await mycallAPI.cdcallEventsMemberPUT(insertEventMembers);

                if (jsresponse.ToString().Contains("ValidationException"))
                {
                    System.Diagnostics.Debug.WriteLine(" Put API Call failed " + jsresponse);
                    myerror = JsonConvert.DeserializeObject <cdReadError>(jsresponse.ToString());
                    await DisplayAlert("Event Signup Failed", jsresponse.ToString(), "ok");

                    return("failed");
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine(" Put API Call Successful");
                    await DisplayAlert("Event Signup Successful", "Event Signup Successful", "ok");

                    return("success");
                }
            }
            else
            {
                cdQueryAttr qryAcct = new cdQueryAttr();
                qryAcct.ColIndex  = "IndexName";
                qryAcct.IndexName = "ParentIDIndex";
                qryAcct.ColName   = "Attr1";
                qryAcct.ColValue  = myAccount.UserName;

                System.Diagnostics.Debug.WriteLine(" Getting Students from login user");

                getClubMembers myClubMembers = new getClubMembers();
                cdCallAPI      mycallAPI     = new cdCallAPI();

                var jsreponse = await mycallAPI.cdcallClubMembersGET(qryAcct);

                myClubMembers = JsonConvert.DeserializeObject <getClubMembers>((string)jsreponse);

                System.Diagnostics.Debug.WriteLine(" Club Member payload is " + jsreponse);

                try
                {
                    foreach (var stacc in myClubMembers.ClubMember)
                    {
                        cdCallAPI      myscallAPI         = new cdCallAPI();
                        cdReadError    myerror            = new cdReadError();
                        cdEventSignups insertEventMembers = new cdEventSignups();
                        insertEventMembers.EventID          = assignedEvents[counter].EventID;
                        insertEventMembers.EventName        = assignedEvents[counter].EventName;
                        insertEventMembers.ClubName         = assignedEvents[counter].ClubName;
                        insertEventMembers.ClubID           = assignedEvents[counter].ClubID;
                        insertEventMembers.AllocationStatus = "UNALLOCATED";
                        insertEventMembers.DriverCar        = "NA";
                        insertEventMembers.RiderCount       = "0";
                        insertEventMembers.PickupLocation   = assignedEvents[counter].AddressLine1 + " " + assignedEvents[counter].City + " " + assignedEvents[counter].cdState + " " + assignedEvents[counter].PostalCode;
                        insertEventMembers.Attr1            = assignedEvents[counter].AddressLine1 + " " + assignedEvents[counter].AddressLine2;
                        insertEventMembers.Attr2            = assignedEvents[counter].City + " " + assignedEvents[counter].cdState + " " + assignedEvents[counter].PostalCode;
                        insertEventMembers.Attr3            = "None";
                        insertEventMembers.Attr4            = "None";
                        insertEventMembers.Attr5            = "None";
                        insertEventMembers.Attr6            = "None";
                        insertEventMembers.Attr7            = "None";
                        insertEventMembers.Attr8            = "None";
                        insertEventMembers.Attr9            = "None";
                        insertEventMembers.Attr10           = "None";
                        insertEventMembers.EventMemberID    = stacc.MemberAccountID + stacc.ClubName.Substring(0, 3) + assignedEvents[counter].EventName.Substring(0, 3) + (Math.Abs(DateTime.Now.ToBinary()).ToString());
                        insertEventMembers.MemberName       = stacc.MemberName;
                        insertEventMembers.MemberRole       = "R";
                        var jsresponse = await myscallAPI.cdcallEventsMemberPUT(insertEventMembers);

                        if (jsresponse.ToString().Contains("ValidationException"))
                        {
                            System.Diagnostics.Debug.WriteLine(" Put API Call failed " + jsresponse);
                            myerror = JsonConvert.DeserializeObject <cdReadError>(jsresponse.ToString());
                            await DisplayAlert("Create Event Members", "Unable to create event members", "ok");

                            returnError = returnError + " " + stacc.MemberName;
                        }
                        else
                        {
                            System.Diagnostics.Debug.WriteLine(" Put API Call Successful for " + stacc.MemberName);
                        }
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("End of Clubs Loop " + ex);
                }

                System.Diagnostics.Debug.WriteLine(" Looped through all students assigned to the club ");
                if (returnError == "NA")
                {
                    await DisplayAlert("Event Signup Successful", "Event Signup Successful for all members", "ok");

                    return("success");
                }
                else
                {
                    await DisplayAlert("Event Signup Failed", "Event Signup failed for " + returnError + ". Sign up individual members", "ok");

                    return("failed for " + returnError);
                }
            }
        }
Beispiel #4
0
        async void getEvents()
        {
            cdQueryAttr qryAcct = new cdQueryAttr();

            qryAcct.ColIndex  = "IndexName";
            qryAcct.IndexName = "MemberAccountIDIndex";
            qryAcct.ColName   = "MemberAccountID";
            qryAcct.ColValue  = myAccount.UserName;

            System.Diagnostics.Debug.WriteLine(" Getting Clubs from login user");

            getClubMembers myClubMembers = new getClubMembers();
            cdCallAPI      mycallAPI     = new cdCallAPI();

            var jsreponse = await mycallAPI.cdcallClubMembersGET(qryAcct);

            myClubMembers = JsonConvert.DeserializeObject <getClubMembers>((string)jsreponse);

            System.Diagnostics.Debug.WriteLine(" Club Member payload is " + jsreponse);

            try
            {
                foreach (var stacc in myClubMembers.ClubMember)
                {
                    maxarray          = maxarray + 1;
                    qryAcct.ColIndex  = "IndexName";
                    qryAcct.IndexName = "ClubIDIndex";
                    qryAcct.ColName   = "ClubID";
                    qryAcct.ColValue  = stacc.ClubID;

                    if (prevclub == stacc.ClubID)
                    {
                        prevclub = stacc.ClubID;
                    }
                    else
                    {
                        try
                        {
                            getEvents myTempEvents = new getEvents();

                            var jsereponse = await mycallAPI.cdcallEventsGET(qryAcct);

                            myTempEvents = JsonConvert.DeserializeObject <getEvents>((string)jsereponse);
                            System.Diagnostics.Debug.WriteLine(" response pay load is " + jsereponse);

                            foreach (var mte in myTempEvents.cdEvents)
                            {
                                System.Diagnostics.Debug.WriteLine(" Event counter is " + eventcounter);
                                mte.Attr1 = stacc.MemberRole;
                                assignedEvents.Add(mte);
                                eventcounter = eventcounter + 1;
                            }
                        }
                        catch (Exception ex)
                        {
                            System.Diagnostics.Debug.WriteLine("No events for this club " + stacc.ClubID + " " + ex);
                        }

                        System.Diagnostics.Debug.WriteLine(" Events added ");
                        prevclub = stacc.ClubID;
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("End of Clubs Loop " + ex);
            }



            System.Diagnostics.Debug.WriteLine("Populating global strings ");

            myClubName     = assignedEvents[0].ClubName;
            myClubID       = assignedEvents[0].ClubID;
            myEventID      = assignedEvents[0].EventID;
            myEventName    = assignedEvents[0].EventName;
            myEventAddress = assignedEvents[0].AddressLine1 + " " + assignedEvents[0].AddressLine2 + " ," + assignedEvents[0].City + " ," + assignedEvents[0].cdState + " " + assignedEvents[0].PostalCode;

            System.Diagnostics.Debug.WriteLine("Populating event fields ");

            EventName.Text    = "Event Name: " + assignedEvents[0].EventName;
            EventID.Text      = "Event ID: " + assignedEvents[0].EventID;
            EventAddress.Text = assignedEvents[0].AddressLine1;
            if (assignedEvents[0].AddressLine2 == "None" || assignedEvents[0].AddressLine2 == "NA")
            {
                EventAddress2.Text = "";
            }
            else
            {
                EventAddress2.Text = assignedEvents[0].AddressLine2;
            }
            City.Text            = assignedEvents[0].City;
            myState.Text         = assignedEvents[0].cdState;
            PostalCode.Text      = assignedEvents[0].PostalCode;
            ClubName.Text        = assignedEvents[0].ClubName;
            cdNotes.Text         = assignedEvents[0].Notes;
            eventDatePicker.Date = Convert.ToDateTime(assignedEvents[0].EventDate);

            maxarray = eventcounter - 1;
            System.Diagnostics.Debug.WriteLine(" Max Array is " + maxarray);

            if (assignedEvents[0].Attr1.Contains("A") == false)
            {
                EventName.IsEnabled       = false;
                EventID.IsEnabled         = false;
                EventAddress.IsEnabled    = false;
                EventAddress2.IsEnabled   = false;
                City.IsEnabled            = false;
                myState.IsEnabled         = false;
                PostalCode.IsEnabled      = false;
                cdNotes.IsEnabled         = false;
                eventDatePicker.IsEnabled = false;
            }
            else
            {
                EventName.IsEnabled       = true;
                EventID.IsEnabled         = true;
                EventAddress.IsEnabled    = true;
                EventAddress2.IsEnabled   = true;
                City.IsEnabled            = true;
                myState.IsEnabled         = true;
                PostalCode.IsEnabled      = true;
                cdNotes.IsEnabled         = true;
                eventDatePicker.IsEnabled = true;
            }

            if (counter == maxarray)
            {
                PreviousButton.IsEnabled = false;
                NextButton.IsEnabled     = false;
            }
            else
            {
                PreviousButton.IsEnabled = false;
                NextButton.IsEnabled     = true;
            }
        }
        async void cdqueryAll()
        {
            String      myrole    = " ";
            int         clubUACM  = 0;
            cdCallAPI   mycallAPI = new cdCallAPI();
            Account     myaccount = new Account();
            cdQueryAttr qryAcct   = new cdQueryAttr();

            qryAcct.ColIndex  = "IndexName";
            qryAcct.IndexName = "MemberAccountIDIndex";
            qryAcct.ColName   = "MemberAccountID";
            qryAcct.ColValue  = loginAccount.AccountID;

            getClubMembers myClubs             = new getClubMembers();
            getClubMembers myUnApprovedMembers = new getClubMembers();

            var jsreponse = await mycallAPI.cdcallClubMembersGET(qryAcct);

            myClubs = JsonConvert.DeserializeObject <getClubMembers>((string)jsreponse);

            System.Diagnostics.Debug.WriteLine("Getting Clubs. Response received is " + jsreponse);

            try
            {
                foreach (var myc in myClubs.ClubMember)
                {
                    if (myc.MemberRole.Contains("A"))
                    {
                        cdQueryAttr qryAcctUACM = new cdQueryAttr();
                        qryAcctUACM.ColIndex  = "IndexName";
                        qryAcctUACM.IndexName = "AccountStatusIndex";
                        qryAcctUACM.ColName   = "ClubID";
                        qryAcctUACM.ColValue  = myc.ClubID;

                        System.Diagnostics.Debug.WriteLine("Getting unapproved members for Club ID " + myc.ClubID);

                        var jsreponseUACM = await mycallAPI.cdcallClubMembersUAGET(qryAcctUACM);

                        myUnApprovedMembers = JsonConvert.DeserializeObject <getClubMembers>((string)jsreponseUACM);

                        System.Diagnostics.Debug.WriteLine("Getting Unapproved club members. Response received is " + jsreponseUACM);

                        foreach (var mycuam in myUnApprovedMembers.ClubMember)
                        {
                            System.Diagnostics.Debug.WriteLine("Adding Club Member to the list " + mycuam.MemberAccountID);
                            unClubMembers.Add(mycuam);
                            maxarray = maxarray + 1;
                            clubUACM = clubUACM + 1;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("End of Array " + ex);
            }

            System.Diagnostics.Debug.WriteLine("Max Array " + maxarray + " club ua array " + clubUACM + " Counter " + counter);

            if (clubUACM > 0)
            {
                //  ApplicantName.Text = "Applicant Name: " + unClubMembers[counter].MemberName;

                if (unClubMembers[counter].MemberRole.Contains("D"))
                {
                    myrole = myrole + " Driver ";
                }
                if (unClubMembers[counter].MemberRole.Contains("P"))
                {
                    myrole = myrole + " Parent ";
                }
                if (unClubMembers[counter].MemberRole.Contains("A"))
                {
                    myrole = myrole + " Admin ";
                }
                if (unClubMembers[counter].MemberRole.Contains("R"))
                {
                    myrole = myrole + " Rider ";
                }
                // ApplicantType.Text = "Applicant Role: " + myrole;
            }


            if (counter == maxarray)
            {
                //PreviousButton.IsEnabled = false;
                //NextButton.IsEnabled = false;
            }
            else if (counter < maxarray)
            {
                //PreviousButton.IsEnabled = false;
                //NextButton.IsEnabled = true;
            }
            else
            {
                //PreviousButton.IsEnabled = false;
                //NextButton.IsEnabled = false;
            }
        }
Beispiel #6
0
        async void getClubs()
        {
            cdQueryAttr qryAcct = new cdQueryAttr();

            qryAcct.ColIndex  = "IndexName";
            qryAcct.IndexName = "MemberAccountIDIndex";
            qryAcct.ColName   = "MemberAccountID";
            qryAcct.ColValue  = myAccount.UserName;
            String clubRetrived = "";

            System.Diagnostics.Debug.WriteLine(" Getting clubs from club members");

            getClubMembers myClubMembers = new getClubMembers();
            cdCallAPI      mycallAPI     = new cdCallAPI();

            var jsreponse = await mycallAPI.cdcallClubMembersGET(qryAcct);

            myClubMembers = JsonConvert.DeserializeObject <getClubMembers>((string)jsreponse);

            System.Diagnostics.Debug.WriteLine(" Club Member payload is " + jsreponse);

            try
            {
                foreach (var stacc in myClubMembers.ClubMember)
                {
                    maxarray          = maxarray + 1;
                    qryAcct           = new cdQueryAttr();
                    qryAcct.ColIndex  = "None";
                    qryAcct.IndexName = "None";
                    qryAcct.ColName   = "ClubID";
                    qryAcct.ColValue  = myClubMembers.ClubMember[maxarray].ClubID;

                    System.Diagnostics.Debug.WriteLine(" Populating Club for " + myClubMembers.ClubMember[maxarray].ClubID);

                    getClubs tempClubs = new getClubs();
                    var      jsclubs   = await mycallAPI.cdcallClubsGET(qryAcct);

                    tempClubs    = JsonConvert.DeserializeObject <getClubs>((string)jsclubs);
                    clubRetrived = (string)jsclubs;

                    System.Diagnostics.Debug.WriteLine(" Club is retrived " + jsclubs);

                    System.Diagnostics.Debug.WriteLine(" Before Initializing club " + tempClubs.Club[0].ClubID + "  " + tempClubs.Club[0].ClubName);
                    assignedClubs.Add(tempClubs.Club[0]);
                    System.Diagnostics.Debug.WriteLine(" After Initializing club ");

                    System.Diagnostics.Debug.WriteLine(" Added to assigned clubs ");
                }

                if (clubRetrived.Contains("ClubName"))
                {
                    ClubName.Text   = "Club Name: " + assignedClubs[0].ClubName;
                    ClubID.Text     = "Clud ID: " + assignedClubs[0].ClubID;
                    CubAddress.Text = assignedClubs[0].AddressLine1 + " " + assignedClubs[0].AddressLine2;
                    City.Text       = assignedClubs[0].City;
                    myState.Text    = assignedClubs[0].cdState;
                    PostalCode.Text = assignedClubs[0].PostalCode;
                }
                else
                {
                    PreviousButton.IsEnabled = false;
                    NextButton.IsEnabled     = false;
                    SubmitButton.IsEnabled   = false;
                }

                System.Diagnostics.Debug.WriteLine(" Max Array is " + maxarray);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("End of Array " + ex);
                await DisplayAlert("Action", "Unable to fetch data. Please try later.", "OK");
            }
            if (counter == maxarray)
            {
                PreviousButton.IsEnabled = false;
                NextButton.IsEnabled     = false;
            }
            else
            {
                PreviousButton.IsEnabled = false;
                NextButton.IsEnabled     = true;
            }
        }