Example #1
0
        async void cdAssign(object sender, System.EventArgs e)
        {
            try
            {
                if (myAccount.Role.Contains("R") & myAccount.ParentID != "None")
                {
                    Account     paccount  = new Account();
                    cdCallAPI   mycallAPI = new cdCallAPI();
                    cdQueryAttr qryAcct   = new cdQueryAttr();
                    qryAcct.ColIndex  = "IndexName";
                    qryAcct.IndexName = "UserNameindex";
                    qryAcct.ColName   = "UserName";
                    qryAcct.ColValue  = myAccount.ParentID;

                    getAccounts myAccountsArray = new getAccounts();

                    var jsreponse = await mycallAPI.cdcallAccountsGET(qryAcct);

                    myAccountsArray = JsonConvert.DeserializeObject <getAccounts>((string)jsreponse);
                    paccount        = myAccountsArray.Account[0];
                    var tpage = new cdAssignClubs(paccount, myAccount);
                    await Navigation.PushModalAsync(tpage);
                }
                else
                {
                    var tpage = new cdAssignClubs(myAccount, myAccount);
                    await Navigation.PushModalAsync(tpage);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("End of Array " + ex);
                await DisplayAlert("Action", "Unable to fetch data. Please try later.", "OK");
            }
        }
Example #2
0
        async void getStudentInfo(Account logAccount)
        {
            cdQueryAttr qryAcct = new cdQueryAttr();

            qryAcct.ColIndex  = "IndexName";
            qryAcct.IndexName = "ParentIDindex";
            qryAcct.ColName   = "ParentID";
            qryAcct.ColValue  = logAccount.UserName;

            getAccounts myStudentArray = new getAccounts();
            cdCallAPI   mycallAPI      = new cdCallAPI();

            var jsreponse = await mycallAPI.cdcallAccountsGET(qryAcct);

            myStudentArray = JsonConvert.DeserializeObject <getAccounts>((string)jsreponse);
            mystudAccounts = myStudentArray;

            try
            {
                foreach (var stacc in myStudentArray.Account)
                {
                    maxarray = maxarray + 1;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("End of Array " + ex);
            }

            UserName.Text     = "User Name: " + mystudAccounts.Account[0].UserName;
            cdEmail.Text      = mystudAccounts.Account[0].EmailAddress;
            cdFirstName.Text  = mystudAccounts.Account[0].FirstName;
            cdMiddleName.Text = mystudAccounts.Account[0].MiddleName;
            cdLastName.Text   = mystudAccounts.Account[0].LastName;
            cdAddress1.Text   = mystudAccounts.Account[0].AddressLine1;
            cdAddress2.Text   = mystudAccounts.Account[0].AddressLine2;
            cdCity.Text       = mystudAccounts.Account[0].City;
            cdState.Text      = mystudAccounts.Account[0].cdState;
            cdPostalCode.Text = mystudAccounts.Account[0].PostalCode;
            cdPhone.Text      = mystudAccounts.Account[0].Phone;

            System.Diagnostics.Debug.WriteLine(" Max Array is " + maxarray);

            if (counter == maxarray)
            {
                PreviousButton.IsEnabled = false;
                NextButton.IsEnabled     = false;
            }
            else
            {
                PreviousButton.IsEnabled = false;
                NextButton.IsEnabled     = true;
            }
        }
        async void getStudentInfo(Account logAccount)
        {
            cdQueryAttr qryAcct = new cdQueryAttr();

            qryAcct.ColIndex  = "IndexName";
            qryAcct.IndexName = "ParentIDindex";
            qryAcct.ColName   = "ParentID";
            qryAcct.ColValue  = logAccount.UserName;

            cdCallAPI mycallAPI = new cdCallAPI();

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

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

                foreach (var stacc in myStudentArray.Account)
                {
                    maxarray = maxarray + 1;
                }
                UserName.Text           = "User Name: " + myStudentArray.Account[0].FirstName + " " + myStudentArray.Account[0].LastName;
                cdEmail.Text            = "Email Address: " + myStudentArray.Account[0].EmailAddress;
                cdFirstName.Text        = "First Name: " + myStudentArray.Account[0].FirstName;
                cdMiddleName.Text       = "Middle Name: " + myStudentArray.Account[0].MiddleName;
                cdLastName.Text         = "Last Name: " + myStudentArray.Account[0].LastName;
                cdSignupRider.IsChecked = true;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("End of Array " + ex);
            }

            System.Diagnostics.Debug.WriteLine(" Max Array is " + maxarray);

            if (counter == maxarray)
            {
                PreviousButton.IsEnabled = false;
                NextButton.IsEnabled     = false;
            }
            else
            {
                PreviousButton.IsEnabled = false;
                NextButton.IsEnabled     = true;
            }
        }
Example #4
0
        async void cdLogin(object sender, System.EventArgs e)
        {
            String        myusername = eusername.Text;
            String        mypassword = epassword.Text;
            cdCallAPI     mycallAPI  = new cdCallAPI();
            loginResponse lresp      = new loginResponse();

            //Authenticating user
            System.Diagnostics.Debug.WriteLine(" Authenticating user");
            System.Diagnostics.Debug.WriteLine(" Long string " + Math.Abs(DateTime.Now.ToBinary()).ToString());
            System.Diagnostics.Debug.WriteLine(" Hash Code " + Math.Abs(DateTime.Now.GetHashCode()));

            var jsreponse = await mycallAPI.cdLoginAccount(myusername, mypassword);

            lresp       = JsonConvert.DeserializeObject <loginResponse>((string)jsreponse);
            App.mylresp = lresp;

            if (lresp.status == "success")
            {
                try
                {
                    System.Diagnostics.Debug.WriteLine(" Authentication Successful ");
                    loginMessage.Text = "Login is Successful";
                    //Getting Account information
                    //Set Query Object
                    Account     myaccount = new Account();
                    cdQueryAttr qryAcct   = new cdQueryAttr();
                    qryAcct.ColIndex  = "IndexName";
                    qryAcct.IndexName = "UserNameindex";
                    qryAcct.ColName   = "UserName";
                    qryAcct.ColValue  = myusername;

                    getAccounts myAccountsArray = new getAccounts();

                    jsreponse = await mycallAPI.cdcallAccountsGET(qryAcct);

                    myAccountsArray = JsonConvert.DeserializeObject <getAccounts>((string)jsreponse);

                    System.Diagnostics.Debug.WriteLine(" Before Account array " + jsreponse);

                    myaccount = myAccountsArray.Account[0];

                    System.Diagnostics.Debug.WriteLine(" After Account array ");

                    System.Diagnostics.Debug.WriteLine("Role for " + myaccount.FirstName + " " + myaccount.LastName + " is " + myaccount.Role);

                    var tpage = new cdAdminDrive(myaccount);
                    await Navigation.PushModalAsync(tpage);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(" Invalid login " + ex);
                    await DisplayAlert("Unable to Login", "Unable to Login", "OK");
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(" Authentication Failed ");
                await DisplayAlert("Invalid Username or Password", "Invalid Username or Password", "OK");
            }
        }