Beispiel #1
0
 async void completeDrive(object sender, System.EventArgs e)
 {
     exitloop = 1;
     System.Diagnostics.Debug.WriteLine(" Trip Completed ");
     var tpage = new cdHome(loginAccount);
     await Navigation.PushModalAsync(tpage);
 }
 async void cdHome(object sender, System.EventArgs e)
 {
     System.Diagnostics.Debug.WriteLine(" Clicked Home Button");
     var tpage = new cdHome(loginAccount);
     await Navigation.PushModalAsync(tpage);
 }
Beispiel #3
0
 async void cdHome(object sender, System.EventArgs e)
 {
     var tpage = new cdHome(myAccount);
     await Navigation.PushModalAsync(tpage);
 }
Beispiel #4
0
 async void completeTrack(object sender, System.EventArgs e)
 {
     exitloop = 1;
     var tpage = new cdHome(loginAccount);
     await Navigation.PushModalAsync(tpage);
 }
Beispiel #5
0
 async void cdMainPage(object sender, System.EventArgs e)
 {
     System.Diagnostics.Debug.WriteLine(" Main Page button clicked");
     var bpage = new cdHome(regAccount);
     await Navigation.PushModalAsync(bpage);
 }
Beispiel #6
0
        async void cdSubmit(object sender, System.EventArgs e)
        {
            System.Diagnostics.Debug.WriteLine(" Clicked Submit Button");
            if (EventName.Text == null || EventAddress.Text == null || City.Text == null || myState.Text == null || PostalCode.Text == null || picker.SelectedItem.ToString() == null)
            {
                await DisplayAlert("Enterable fields cannot be null. ", "Please enter all the fields", "ok");
            }
            else
            {
                cdEvents  thisEvent = new cdEvents();
                cdCallAPI mycallAPI = new cdCallAPI();

                thisEvent.EventName    = EventName.Text;
                thisEvent.AddressLine1 = EventAddress.Text;
                thisEvent.City         = City.Text;
                thisEvent.cdState      = myState.Text;
                thisEvent.PostalCode   = PostalCode.Text;
                thisEvent.EventID      = EventName.Text.Substring(0, 3) + (Math.Abs(DateTime.Now.ToBinary()).ToString());
                if (EventAddress2.Text == null)
                {
                    thisEvent.AddressLine2 = "None";
                }
                else
                {
                    thisEvent.AddressLine2 = EventAddress2.Text;
                }

                thisEvent.AddressLine3 = "NA";
                thisEvent.Notes        = cdNotes.Text;
                thisEvent.ClubAdmin    = myAccount.UserName;
                String[] mysa  = new string[2];
                char[]   mysep = "|".ToCharArray();
                mysa = picker.SelectedItem.ToString().Split(mysep);
                System.Diagnostics.Debug.WriteLine(" Club Name " + mysa[0] + " Club ID " + mysa[1]);
                thisEvent.ClubName    = mysa[0];
                thisEvent.ClubID      = mysa[1];
                thisEvent.EventDate   = myEventDate;
                thisEvent.PhoneNumber = "0000000000";
                thisEvent.Attr1       = DateTime.Today.Date.ToShortDateString();
                thisEvent.Attr2       = "NA";
                thisEvent.Attr3       = "NA";
                thisEvent.Attr4       = "NA";
                thisEvent.Attr5       = "NA";
                thisEvent.Attr6       = "NA";
                thisEvent.Attr7       = "NA";
                thisEvent.Attr8       = "NA";
                thisEvent.Attr9       = "NA";
                thisEvent.Attr10      = "NA";

                try
                {
                    var jsresponse = await mycallAPI.cdcallEventsPUT(thisEvent);

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

                    if (jsresponse.ToString().Contains("ValidationException"))
                    {
                        System.Diagnostics.Debug.WriteLine(" Event creation call failed " + jsresponse);
                        var myerror = JsonConvert.DeserializeObject <cdReadError>(jsresponse.ToString());
                        createStatus.Text = "Event Creation Failed. " + myerror.message;
                    }

                    var eresp = mycallAPI.cdcallEmailPUT(thisEvent.EventID, thisEvent.EventName, thisEvent.ClubID, thisEvent.ClubName, thisEvent.EventDate);
                    await DisplayAlert("Event creation Successful", "Event creation Successful", "ok");

                    var tpage = new cdHome(myAccount);
                    await Navigation.PushModalAsync(tpage);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(" Exception is " + ex);
                    await DisplayAlert("Event creation failed", ex.ToString(), "ok");
                }
            }
        }
Beispiel #7
0
        async void cdLeaderboard(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 cdHome(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");
            }
        }