private async Task <JToken> validateClub()
        {
            cdReadError myerror   = new cdReadError();
            cdCallAPI   mycallAPI = new cdCallAPI();
            cdQueryAttr qryAcct   = new cdQueryAttr();

            if (CubID.Text != null)
            {
                qryAcct           = new cdQueryAttr();
                qryAcct.ColIndex  = "None";
                qryAcct.IndexName = "None";
                qryAcct.ColName   = "ClubID";
                qryAcct.ColValue  = CubID.Text;
            }
            else if (getClubName.Text != null)
            {
                qryAcct           = new cdQueryAttr();
                qryAcct.ColIndex  = "IndexName";
                qryAcct.IndexName = "ClubNameIndex";
                qryAcct.ColName   = "ClubName";
                qryAcct.ColValue  = getClubName.Text;
            }
            else
            {
                await DisplayAlert("Action", "Unable to fetch the club Information ", "Ok");
            }

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

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

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

            if (jsclubs.ToString().Contains("ValidationException") || !jsclubs.ToString().Contains("ClubName"))
            {
                System.Diagnostics.Debug.WriteLine(" Get Clubs Failed " + jsclubs);
                myerror = JsonConvert.DeserializeObject <cdReadError>(jsclubs.ToString());
                await DisplayAlert("Action", "Unable to fetch the club Information ", "Ok");

                return("failed");
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(" Get Club Information Successful");
                submitButton.IsEnabled = true;
                assignButton.IsEnabled = true;
                myClub          = tempClubs.Club[0];
                ClubName.Text   = "Club Name: " + tempClubs.Club[0].ClubName;
                CubAddress.Text = "Club Address: " + tempClubs.Club[0].AddressLine1 + " " + tempClubs.Club[0].AddressLine2;
                City.Text       = "City : " + tempClubs.Club[0].City;
                myState.Text    = "State " + tempClubs.Club[0].cdState;
                PostalCode.Text = "Postal Code " + tempClubs.Club[0].PostalCode;

                return("success");
            }
        }
Esempio n. 2
0
        async void cdSubmit(object sender, System.EventArgs e)
        {
            if (assignedEvents[counter].Attr1.Contains("A") == true)
            {
                if (assignedEvents[counter].AddressLine1 != EventAddress.Text ||
                    assignedEvents[counter].City != City.Text ||
                    assignedEvents[counter].cdState != myState.Text ||
                    assignedEvents[counter].PostalCode != PostalCode.Text)
                {
                    cdReadError   myerror       = new cdReadError();
                    cdUpdateEvent updateAddress = new cdUpdateEvent();
                    updateAddress.EventID      = assignedEvents[counter].EventID;
                    updateAddress.ColumnName   = "AddressLine1";
                    updateAddress.ColumnValue  = EventAddress.Text;
                    updateAddress.ColumnName2  = "City";
                    updateAddress.ColumnValue2 = City.Text;
                    updateAddress.ColumnName3  = "cdState";
                    updateAddress.ColumnValue3 = myState.Text;
                    updateAddress.ColumnName4  = "PostalCode";
                    updateAddress.ColumnValue4 = PostalCode.Text;

                    System.Diagnostics.Debug.WriteLine(" Before calling Post API ");
                    cdCallAPI mycallAPI  = new cdCallAPI();
                    var       jsresponse = await mycallAPI.cdcallEventsPOST(updateAddress);

                    System.Diagnostics.Debug.WriteLine(" After calling Post API ");
                    if (jsresponse.ToString().Contains("ValidationException"))
                    {
                        System.Diagnostics.Debug.WriteLine(" Post API Call failed " + jsresponse);
                        myerror = JsonConvert.DeserializeObject <cdReadError>(jsresponse.ToString());
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine(" Post API Call Successful");
                    }
                }
            }

            if (cdAddAll.IsChecked == true)
            {
                var resp = await createEventSignups("Everyone");
            }
            if (cdCheckRider.IsChecked == true)
            {
                var resp = await createEventSignups("Self");
            }

            //Driver Student Allocation

            var getresp = await cdMapStdDrv(assignedEvents[counter].EventID);
        }
        private async Task <JToken> createClubMembers(Account regAccount, Club regClub, String assignRole, string parentID)
        {
            try
            {
                cdReadError myerror          = new cdReadError();
                cdCallAPI   mycallAPI        = new cdCallAPI();
                ClubMembers myclubmembership = new ClubMembers();
                myclubmembership.ClubMemberID    = regAccount.UserName + regClub.ClubID;
                myclubmembership.ClubID          = regClub.ClubID;
                myclubmembership.MemberAccountID = regAccount.UserName;
                myclubmembership.ClubName        = regClub.ClubName;
                myclubmembership.MemberName      = regAccount.FirstName + " " + regAccount.LastName;
                myclubmembership.MemberRole      = assignRole;
                myclubmembership.Attr1           = parentID;
                myclubmembership.Attr2           = regAccount.EmailAddress;
                myclubmembership.Attr3           = "NA";
                myclubmembership.Attr4           = "NA";
                myclubmembership.Attr5           = "NA";
                myclubmembership.Attr6           = "NA";
                myclubmembership.Attr7           = "NA";
                myclubmembership.Attr8           = "NA";
                myclubmembership.Attr9           = "NotApproved";
                myclubmembership.Attr10          = "NA";

                var jsresponse = await mycallAPI.cdcallClubMemberPUT(myclubmembership);

                System.Diagnostics.Debug.WriteLine(" Response is " + jsresponse);

                if (jsresponse.ToString().Contains("ValidationException"))
                {
                    System.Diagnostics.Debug.WriteLine(" Club Membership creation call failed " + jsresponse);
                    var myError = JsonConvert.DeserializeObject <cdReadError>(jsresponse.ToString());
                    return("failed");
                }
                else
                {
                    return("success");
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Unable to create data " + ex);
                return("failed");
            }
        }
        async void ieventmem(cdEventSignups iEveSign)
        {
            cdCallAPI   mycallAPI  = new cdCallAPI();
            cdReadError myerror    = new cdReadError();
            var         jsresponse = await mycallAPI.cdcallEventsMemberPUT(iEveSign);

            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");
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(" Put API Call Successful");
                await DisplayAlert("Event Signup Successful", "Event Signup Successful", "ok");
            }
            var getresp = await cdMapStdDrv(iEveSign.EventID);
        }
Esempio n. 5
0
        async void cdSubmit(object sender, System.EventArgs e)
        {
            try
            {
                System.Diagnostics.Debug.WriteLine(" Clicked Submit Button");
                cdReadError         myerror         = new cdReadError();
                cdUpdateClubMembers updatemyAccount = new cdUpdateClubMembers();
                updatemyAccount.ClubMemberID = unClubMembers[counter].ClubMemberID;
                updatemyAccount.ColumnName   = "Attr9";
                //updatemyAccount.ColumnValue = picker.SelectedItem.ToString();
                updatemyAccount.ColumnName1  = "Attr6";
                updatemyAccount.ColumnValue1 = unClubMembers[counter].Attr6;
                updatemyAccount.ColumnName2  = "Attr7";
                updatemyAccount.ColumnValue2 = unClubMembers[counter].Attr7;
                updatemyAccount.ColumnName3  = "Attr8";
                updatemyAccount.ColumnValue3 = unClubMembers[counter].Attr8;
                updatemyAccount.ColumnName4  = "Attr5";
                updatemyAccount.ColumnValue4 = unClubMembers[counter].Attr9;

                System.Diagnostics.Debug.WriteLine(" Before calling Post API ");
                cdCallAPI mycallAPI  = new cdCallAPI();
                var       jsresponse = await mycallAPI.cdcallClubMembersPOST(updatemyAccount);

                System.Diagnostics.Debug.WriteLine(" After calling Post API ");
                if (jsresponse.ToString().Contains("ValidationException"))
                {
                    System.Diagnostics.Debug.WriteLine(" Post API Call failed " + jsresponse);
                    myerror = JsonConvert.DeserializeObject <cdReadError>(jsresponse.ToString());
                    await DisplayAlert("Update Failed", "Update Failed. " + myerror.message, "OK");
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine(" Post API Call Successful");
                    await DisplayAlert("Update Successful", "Update Successful", "OK");
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(" Unable to update " + ex);
            }
        }
        async void cdSubmit(object sender, System.EventArgs e)
        {
            try
            {
                cdReadError     myerror       = new cdReadError();
                cdUpdateAccount updateAddress = new cdUpdateAccount();
                //updateAddress.AccountID = mystudAccounts.Account[counter].AccountID;
                //updateAddress.ColumnName = "AddressLine1";
                //updateAddress.ColumnValue = DestinationAddress1.Text;
                //updateAddress.ColumnName1 = "AddressLine2" ;
                //updateAddress.ColumnValue1 = DestinationAddress2.Text;
                //updateAddress.ColumnName2 = "City";
                //updateAddress.ColumnValue2 = City.Text;
                //updateAddress.ColumnName3 = "cdState";
                //updateAddress.ColumnValue3 = State.Text;
                //updateAddress.ColumnName4 = "PostalCode";
                //updateAddress.ColumnValue4 = PostalCode.Text;

                System.Diagnostics.Debug.WriteLine(" Before calling Post API ");
                cdCallAPI mycallAPI  = new cdCallAPI();
                var       jsresponse = await mycallAPI.cdcallAccountsPOST(updateAddress);

                System.Diagnostics.Debug.WriteLine(" After calling Post API ");
                if (jsresponse.ToString().Contains("ValidationException"))
                {
                    System.Diagnostics.Debug.WriteLine(" Post API Call failed " + jsresponse);
                    myerror = JsonConvert.DeserializeObject <cdReadError>(jsresponse.ToString());
                    //updateStatus.Text = "Update Failed. "+myerror.message;
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine(" Post API Call Successful");
                    //updateStatus.Text = "Update Successful";
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("End of Clubs Loop " + ex);
                await DisplayAlert("Action", "Update Status Failed", "OK");
            }
        }
Esempio n. 7
0
        async void cdSubmit(object sender, System.EventArgs e)
        {
            try
            {
                cdReadError  myerror       = new cdReadError();
                cdUpdateClub updateAddress = new cdUpdateClub();
                updateAddress.ClubID       = assignedClubs[counter].ClubID;
                updateAddress.ColumnName   = "AddressLine1";
                updateAddress.ColumnValue  = CubAddress.Text;
                updateAddress.ColumnName2  = "City";
                updateAddress.ColumnValue2 = City.Text;
                updateAddress.ColumnName3  = "cdState";
                updateAddress.ColumnValue3 = myState.Text;
                updateAddress.ColumnName4  = "PostalCode";
                updateAddress.ColumnValue4 = PostalCode.Text;

                System.Diagnostics.Debug.WriteLine(" Before calling Post API ");
                cdCallAPI mycallAPI  = new cdCallAPI();
                var       jsresponse = await mycallAPI.cdcallClubsPOST(updateAddress);

                System.Diagnostics.Debug.WriteLine(" After calling Post API ");
                if (jsresponse.ToString().Contains("ValidationException"))
                {
                    System.Diagnostics.Debug.WriteLine(" Post API Call failed " + jsresponse);
                    myerror           = JsonConvert.DeserializeObject <cdReadError>(jsresponse.ToString());
                    updateStatus.Text = "Update Failed. " + myerror.message;
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine(" Post API Call Successful");
                    updateStatus.Text = "Update Successful";
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("End of Array " + ex);
                await DisplayAlert("Action", "Unable to update data. Please try later.", "OK");
            }
        }
Esempio n. 8
0
        async void cdSubmit(object sender, System.EventArgs e)
        {
            cdReadError myerror   = new cdReadError();
            cdCallAPI   mycallAPI = new cdCallAPI();

            try
            {
                cdUpdateAccount updateAddress = new cdUpdateAccount();
                updateAddress.AccountID    = mystudAccounts.Account[counter].AccountID;
                updateAddress.ColumnName   = "FirstName";
                updateAddress.ColumnValue  = cdFirstName.Text;
                updateAddress.ColumnName1  = "LastName";
                updateAddress.ColumnValue1 = cdLastName.Text;
                updateAddress.ColumnName2  = "MiddleName";
                updateAddress.ColumnValue2 = cdMiddleName.Text;
                updateAddress.ColumnName3  = "cdPhone";
                updateAddress.ColumnValue3 = cdPhone.Text;
                updateAddress.ColumnName4  = "EmailAddress";
                updateAddress.ColumnValue4 = cdEmail.Text;

                var jsresponse = await mycallAPI.cdcallAccountsPOST(updateAddress);

                System.Diagnostics.Debug.WriteLine(" After calling Post API 1 ");
                if (jsresponse.ToString().Contains("ValidationException"))
                {
                    System.Diagnostics.Debug.WriteLine(" Post API Call failed " + jsresponse);
                    myerror           = JsonConvert.DeserializeObject <cdReadError>(jsresponse.ToString());
                    updateStatus.Text = "Update Failed. " + myerror.message;
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine(" Post API Call Successful");
                    updateStatus.Text = "Update Successful";
                }

                updateAddress.ColumnName   = "AddressLine1";
                updateAddress.ColumnValue  = cdAddress1.Text;
                updateAddress.ColumnName1  = "AddressLine2";
                updateAddress.ColumnValue1 = cdAddress2.Text;
                updateAddress.ColumnName2  = "City";
                updateAddress.ColumnValue2 = cdCity.Text;
                updateAddress.ColumnName3  = "cdState";
                updateAddress.ColumnValue3 = cdState.Text;
                updateAddress.ColumnName4  = "PostalCode";
                updateAddress.ColumnValue4 = cdPostalCode.Text;

                System.Diagnostics.Debug.WriteLine(" Before calling Post API ");

                jsresponse = await mycallAPI.cdcallAccountsPOST(updateAddress);

                System.Diagnostics.Debug.WriteLine(" After calling Post API 2 ");
                if (jsresponse.ToString().Contains("ValidationException"))
                {
                    System.Diagnostics.Debug.WriteLine(" Post API Call failed " + jsresponse);
                    myerror           = JsonConvert.DeserializeObject <cdReadError>(jsresponse.ToString());
                    updateStatus.Text = "Update Failed. " + myerror.message;
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine(" Post API Call Successful");
                    updateStatus.Text = "Update Successful";
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("End of Clubs Loop " + ex);
            }
        }
Esempio n. 9
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);
                }
            }
        }
Esempio n. 10
0
        async void cdSubmit(object sender, System.EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(" Submit button clicked");
            int             firstUpdate    = 0;
            int             secondUpdate   = 0;
            cdReadError     myerror        = new cdReadError();
            cdUpdateAccount updateAccount  = new cdUpdateAccount();
            cdUpdateAccount updateAccount2 = new cdUpdateAccount();

            updateAccount.AccountID = regAccount.AccountID;

            if (cdEmail.Text == regAccount.EmailAddress)
            {
                updateAccount.ColumnName  = "EmailAddress";
                updateAccount.ColumnValue = cdEmail.Text;
                firstUpdate = 1;
            }
            if (cdAddress1.Text == regAccount.AddressLine1)
            {
                updateAccount.ColumnName3  = "AddressLine1";
                updateAccount.ColumnValue3 = cdAddress1.Text;
                firstUpdate = 1;
            }
            if (cdCity.Text == regAccount.City)
            {
                updateAccount.ColumnName4  = "City";
                updateAccount.ColumnValue4 = cdCity.Text;
                firstUpdate = 1;
            }
            if (cdState.Text == regAccount.cdState)
            {
                updateAccount.ColumnName1  = "cdState";
                updateAccount.ColumnValue1 = cdState.Text;
                firstUpdate = 1;
            }
            if (cdPostalCode.Text == regAccount.PostalCode)
            {
                updateAccount.ColumnName2  = "PostalCode";
                updateAccount.ColumnValue2 = cdPostalCode.Text;
                firstUpdate = 1;
            }
            if (cdFirstName.Text == regAccount.FirstName)
            {
                updateAccount2.ColumnName  = "FirstName";
                updateAccount2.ColumnValue = cdFirstName.Text;
                secondUpdate = 1;
            }
            if (cdLastName.Text == regAccount.LastName)
            {
                updateAccount2.ColumnName1  = "LastName";
                updateAccount2.ColumnValue1 = cdFirstName.Text;
                secondUpdate = 1;
            }
            if (cdPhone.Text == regAccount.Phone)
            {
                updateAccount2.ColumnName2  = "Phone";
                updateAccount2.ColumnValue2 = cdPhone.Text;
                secondUpdate = 1;
            }
            if (cdCheckAdmin.IsChecked == true && regAccount.Role.Contains("A") == false)
            {
                updateAccount2.ColumnName3  = "AccountStatus";
                updateAccount2.ColumnValue3 = "NotApproved";
                updateAccount2.ColumnName3  = "Role";
                updateAccount2.ColumnValue3 = regAccount.Role + "A";
                secondUpdate = 1;
            }

            System.Diagnostics.Debug.WriteLine(" Before calling Post API ");
            cdCallAPI mycallAPI = new cdCallAPI();

            try {
                if (firstUpdate == 1)
                {
                    var jsresponse = await mycallAPI.cdcallAccountsPOST(updateAccount);

                    System.Diagnostics.Debug.WriteLine(" After calling Post API ");
                    if (jsresponse.ToString().Contains("ValidationException"))
                    {
                        System.Diagnostics.Debug.WriteLine(" Post API Call failed " + jsresponse);
                        myerror           = JsonConvert.DeserializeObject <cdReadError>(jsresponse.ToString());
                        updateStatus.Text = "Update Failed. " + myerror.message;
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine(" Post API Call Successful");
                        updateStatus.Text = "Update Successful";
                    }
                }
                if (secondUpdate == 1)
                {
                    var jsresponse = await mycallAPI.cdcallAccountsPOST(updateAccount2);

                    System.Diagnostics.Debug.WriteLine(" After calling Post API ");
                    if (jsresponse.ToString().Contains("ValidationException"))
                    {
                        System.Diagnostics.Debug.WriteLine(" Post API Call failed " + jsresponse);
                        myerror           = JsonConvert.DeserializeObject <cdReadError>(jsresponse.ToString());
                        updateStatus.Text = "Update Failed. " + myerror.message;
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine(" Post API Call Successful");
                        updateStatus.Text = "Update Successful";
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(" In Exception " + ex);
                await DisplayAlert("Action", "Unable to update data", "OK");
            }
        }