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. 2
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. 3
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");
            }
        }