Пример #1
0
 public void AccountInfoWebCallResponds(Tap5050WebResponse response)
 {
     if (response.available) {
         Global.accountInfo = (Tap5050AccountInfo)response.parsedobject;
         InvokeOnMainThread (() => {
             loadingOverlayView.Hide ();
             initAccountScreenView ();
             foreach(var x in NavigationItem.RightBarButtonItems){
                 x.Enabled=true;
             }
             foreach(var x in NavigationItem.LeftBarButtonItems){
                 x.Enabled=true;
             }
         });
     } else {
         InvokeOnMainThread (() => {
             loadingOverlayView.Hide ();
             //alert
             UIAlertController Alert = UIAlertController.Create (AccountScreenData.AlertScreenInitResultTitle,
                 response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
             Alert.AddAction (UIAlertAction.Create (AccountScreenData.AlertScreenInitResultCancelBtnTitle,
                 UIAlertActionStyle.Cancel,action=>{
                     DismissViewController(true,null);
                 }));
             PresentViewController (Alert, true, null);
         });
     }
 }
Пример #2
0
 /********************************************************************************
 *Web calls responds
 ********************************************************************************/
 public void CheckTokenWebCallResponds(Tap5050WebResponse response)
 {
     if(response.available){
         if((response.parsedobject as Tap5050Result).result_success.Equals("Y")) {
             AccountInfoWebCall ();
         }
         else {
             InvokeOnMainThread (() => {
                 loadingOverlayView.Hide ();
                 //alert
                 UIAlertController Alert = UIAlertController.Create (RaffleListScreenData.AlertScreenInvalidTokenTitle,
                     (response.parsedobject as Tap5050Result).err_message, UIAlertControllerStyle.Alert);
                 Alert.AddAction (UIAlertAction.Create (RaffleListScreenData.AlertScreenInvalidTokenCancelBtnTitle,
                     UIAlertActionStyle.Cancel,action=>{
                         DismissViewController(true,null);
                     }));
                 PresentViewController (Alert, true, null);
             });
         }
     }
     else{
         InvokeOnMainThread (() => {
             loadingOverlayView.Hide ();
             //alert
             UIAlertController Alert = UIAlertController.Create (RaffleListScreenData.AlertScreenReloadFailTitle,
                 response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
             Alert.AddAction (UIAlertAction.Create (RaffleListScreenData.AlertScreenReloadFailCancelBtnTitle,
                 UIAlertActionStyle.Cancel,action=>{
                     DismissViewController(true,null);
                 }));
             PresentViewController (Alert, true, null);
         });
     }
 }
Пример #3
0
 public void AccountInfoWebCallResponds(Tap5050WebResponse response)
 {
     if (response.available) {
         Global.accountInfo = (Tap5050AccountInfo)response.parsedobject;
         InvokeOnMainThread (() => {
             loadingOverlayView.Hide ();
             //alert
             UIAlertController Alert = UIAlertController.Create (EditAccountScreenData.AlertScreenEditAccountRespondTitle,
                 EditAccountScreenData.AlertScreenEditAccountRespondSuccessMessage, UIAlertControllerStyle.Alert);
             Alert.AddAction (UIAlertAction.Create (EditAccountScreenData.AlertScreenEditAccountRespondCancelBtnTitle,
                 UIAlertActionStyle.Cancel,action=>{
                     NavigationController.PopViewController(true);
                 }));
             PresentViewController (Alert, true, null);
         });
     } else {
         InvokeOnMainThread (() => {
             loadingOverlayView.Hide ();
             //alert
             UIAlertController Alert = UIAlertController.Create (EditAccountScreenData.AlertScreenRegetAccountResultTitle,
                 response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
             Alert.AddAction (UIAlertAction.Create (EditAccountScreenData.AlertScreenRegetAccountResultCancelBtnTitle,
                 UIAlertActionStyle.Cancel,action=>{
                     DismissViewController(true,null);
                 }));
             PresentViewController (Alert, true, null);
         });
     }
 }
Пример #4
0
        /********************************************************************************
        *Web calls responds
        ********************************************************************************/
        public void CheckTokenWebCallResponds(Tap5050WebResponse response)
        {
            if(response.available){
                if((response.parsedobject as Tap5050Result).result_success.Equals("Y")) {
                    string emailOrPhone = "";
                    InvokeOnMainThread (() => {
                        emailOrPhone = reqeustTPScreenView.clientInfoTextField.Text;
                    });
                    if (FormatManager.chechinput (emailOrPhone, FormatManager.FormatOption.Phone)) {
                        checkUserByPhoneWebCall (emailOrPhone);
                    } else if (FormatManager.chechinput (emailOrPhone, FormatManager.FormatOption.Email)) {
                        checkUserByMailWebCall (emailOrPhone);
                    } else {
                        InvokeOnMainThread (() => {
                            loadingOverlayView.Hide ();
                            View.Add (reqeustTPScreenView);

                            //alert
                            UIAlertController Alert = UIAlertController.Create (RequestTPScreenData.AlertScreenFormatErrorTitle,
                                RequestTPScreenData.AlertScreenFormatErrorMessage, UIAlertControllerStyle.Alert);
                            Alert.AddAction (UIAlertAction.Create (RequestTPScreenData.AlertScreenFormatErrorCancelBtnTitle,
                                UIAlertActionStyle.Cancel,
                                null));
                            PresentViewController (Alert, true, null);
                        });
                    }
                }
                else {
                    InvokeOnMainThread (() => {
                        loadingOverlayView.Hide ();

                        //alert
                        UIAlertController Alert = UIAlertController.Create (RaffleListScreenData.AlertScreenInvalidTokenTitle,
                            (response.parsedobject as Tap5050Result).err_message, UIAlertControllerStyle.Alert);
                        Alert.AddAction (UIAlertAction.Create (RaffleListScreenData.AlertScreenInvalidTokenCancelBtnTitle,
                            UIAlertActionStyle.Cancel,action=>{
                                DismissViewController(true,null);
                            }));
                        PresentViewController (Alert, true, null);
                    });
                }
            }
            else{
                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide ();

                    //alert
                    UIAlertController Alert = UIAlertController.Create (RaffleListScreenData.AlertScreenReloadFailTitle,
                        response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
                    Alert.AddAction (UIAlertAction.Create (RaffleListScreenData.AlertScreenReloadFailCancelBtnTitle,
                        UIAlertActionStyle.Cancel,action=>{
                            DismissViewController(true,null);
                        }));
                    PresentViewController (Alert, true, null);
                });
            }
        }
Пример #5
0
        public async void Locating(MsgHandler handler){

			Tap5050WebResponse response = new Tap5050WebResponse ();
			response.available = false;
			response.parsedobject = null;  
			response.exceptionreport = new ExceptionReport ("");

			Position position;

			try{
				position=await locator.GetPositionAsync (10000);    
			}catch{ 
				response.available = false;
				response.exceptionreport = new ExceptionReport ("Can not get Info from GPS");
				response.parsedobject = null;
				if (handler != null) { 
					handler (response);
				} 
				return;
			}  

			//try to get city name 
			if (position != null) {  
 

				NetworkManager manager = new NetworkManager ();


				Dictionary<string,string> parameters = new Dictionary<string,string> ();
				parameters.Add ("lat",position.Latitude.ToString());
				parameters.Add ("lng",position.Longitude.ToString());
				parameters.Add ("username",LocationManager.geonameusername);


				manager.GetLocationfromGEO (parameters,(Tap5050WebResponse webresponse)=>{

					if(webresponse.available){
						var result=(GeonamesCountry)webresponse.parsedobject;  
						response.available = true;
						response.exceptionreport=null;
						response.parsedobject=result;
						if (handler != null) { 
							handler (response);
						}  
					}else{
						response.available = false;
						response.exceptionreport=webresponse.exceptionreport;
						if (handler != null) { 
							handler (response);
						}
					}	
				}); 
			}   
		}
Пример #6
0
 public void GetCurrentLocationWebCallResponds(Tap5050WebResponse response)
 {
     if(response.available){
         var position=(GeonamesCountry)response.parsedobject;
         GlobalVariable.currentlocation=position.adminName1;
         InvokeOnMainThread (() => {
             loadingOverlayView.Hide();
             initLoadingScreenView(RaffleListScreenData.LoadingScreenTextRaffles);
         });
         LoadRaffleWebCall();
     }
     else{
         //get locations list
         LoadLoactionsWebCall();
     }
 }
        /********************************************************************************
        *Web calls responds
        ********************************************************************************/
        public void CheckTokenWebCallResponds(Tap5050WebResponse response)
        {
            if(response.available){
                if((response.parsedobject as Tap5050Result).result_success.Equals("Y")) {
                    switch(currentWebCall){
                    case PotentialTeamMemberCurrentWebCall.InviteMember:
                        InviteUserWebCall();
                        break;
                    default:
                        InvokeOnMainThread (() => {
                            loadingOverlayView.Hide();
                            initTableView();
                        });
                        break;
                    }
                }
                else {
                    InvokeOnMainThread (() => {
                        loadingOverlayView.Hide ();

                        //alert
                        UIAlertController Alert = UIAlertController.Create (RaffleListScreenData.AlertScreenInvalidTokenTitle,
                            (response.parsedobject as Tap5050Result).err_message, UIAlertControllerStyle.Alert);
                        Alert.AddAction (UIAlertAction.Create (RaffleListScreenData.AlertScreenInvalidTokenCancelBtnTitle,
                            UIAlertActionStyle.Cancel,action=>{
                                DismissViewController(true,null);
                            }));
                        PresentViewController (Alert, true, null);
                    });
                }
            }
            else{
                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide ();

                    //alert
                    UIAlertController Alert = UIAlertController.Create (RaffleListScreenData.AlertScreenReloadFailTitle,
                        response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
                    Alert.AddAction (UIAlertAction.Create (RaffleListScreenData.AlertScreenReloadFailCancelBtnTitle,
                        UIAlertActionStyle.Cancel,action=>{
                            DismissViewController(true,null);
                        }));
                    PresentViewController (Alert, true, null);
                });
            }
        }
Пример #8
0
 public void AccpetInvitationWebCallResponds(Tap5050WebResponse response)
 {
     if(response.available){
         if((response.parsedobject as Tap5050Result).result_success.Equals("Y")) {
             InvokeOnMainThread (() => {
                 loadingOverlayView.Hide();
                 initLoadingScreenView(RelationsScreenData.LoadingScreenTextCheckGroupInvitate);
             });
             GetInvitationWebCall ();
         }
         else {
             InvokeOnMainThread (() => {
                 loadingOverlayView.Hide ();
                 foreach (var x in NavigationItem.RightBarButtonItems) {
                     x.Enabled = true;
                 }
                 Global.tabBarController.EnableTabBar ();
                 //initRelationsScreenView ();
                 //alert
                 UIAlertController Alert = UIAlertController.Create (RelationsScreenData.AlertScreenAcceptInviteFailTitle,
                     (response.parsedobject as Tap5050Result).err_message, UIAlertControllerStyle.Alert);
                 Alert.AddAction (UIAlertAction.Create (RelationsScreenData.AlertScreenAcceptInviteFailCancelBtnTitle,
                     UIAlertActionStyle.Cancel,null
                 ));
                 PresentViewController (Alert, true, null);
             });
         }
     }
     else{
         InvokeOnMainThread (() => {
             loadingOverlayView.Hide ();
             //alert
             UIAlertController Alert = UIAlertController.Create (RelationsScreenData.AlertScreenAcceptInviteFailTitle,
                 response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
             Alert.AddAction (UIAlertAction.Create (RelationsScreenData.AlertScreenAcceptInviteFailCancelBtnTitle,
                 UIAlertActionStyle.Cancel,action=>{
                     DismissViewController(true,null);
                 }));
             PresentViewController (Alert, true, null);
         });
     }
 }
Пример #9
0
        public void UpdateAccountWebCallResponds(Tap5050WebResponse response)
        {
            if(response.available){
                if((response.parsedobject as Tap5050Result).result_success.Equals("Y")) {
                    InvokeOnMainThread (() => {
                        AccountInfoWebCall();
                    });
                }
                else {
                    InvokeOnMainThread (() => {
                        loadingOverlayView.Hide();
                        View.Add(editAccountScreenView);

                        //alert
                        UIAlertController Alert = UIAlertController.Create (EditAccountScreenData.AlertScreenEditAccountRespondTitle,
                            (response.parsedobject as Register).err_message, UIAlertControllerStyle.Alert);
                        Alert.AddAction (UIAlertAction.Create (EditAccountScreenData.AlertScreenEditAccountRespondCancelBtnTitle,
                            UIAlertActionStyle.Cancel,
                            null));
                        PresentViewController (Alert, true, null);
                    });
                }
            }
            else{
                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide();
                    View.Add(editAccountScreenView);

                    //alert
                    UIAlertController Alert = UIAlertController.Create (EditAccountScreenData.AlertScreenEditAccountRespondTitle,
                        response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
                    Alert.AddAction (UIAlertAction.Create (EditAccountScreenData.AlertScreenEditAccountRespondCancelBtnTitle,
                        UIAlertActionStyle.Cancel,
                        null));
                    PresentViewController (Alert, true, null);
                });
            }
        }
Пример #10
0
        public void LoadProvinceWebCallResponds(Tap5050WebResponse response)
        {
            if(response.available){
                liststateandprovince = response.parsedobject as List<StateAndProvince>;
                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide ();
                    initEditAccountScreenView();
                });
            }
            else{
                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide ();

                    //alert
                    UIAlertController Alert = UIAlertController.Create (RegisterScreenData.AlertScreenLoadProvincesFailTitle,
                        response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
                    Alert.AddAction (UIAlertAction.Create (RegisterScreenData.AlertScreenLoadProvincesFailCancelBtnTitle,
                        UIAlertActionStyle.Cancel,action=>{
                            NavigationController.PopViewController(true);
                        }));
                    PresentViewController (Alert, true, null);
                });
            }
        }
Пример #11
0
 public void LoadLoactionsWebCallResponds(Tap5050WebResponse response)
 {
     if(response.available){
         GlobalVariable.tap5050locationllist=(List<Tap5050Location>)response.parsedobject;
         InvokeOnMainThread (() => {
             loadingOverlayView.Hide();
             initSelectLocationView();
         });
     }
     else{
         InvokeOnMainThread (() => {
             loadingOverlayView.Hide();
             View.Add (loginScreenView);
             //alert
             UIAlertController Alert = UIAlertController.Create (RaffleListScreenData.AlertScreenLoadLocationFailTitle,
                 response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
             Alert.AddAction (UIAlertAction.Create (RaffleListScreenData.AlertScreenLoadLocationFailCancelBtnTitle,
                 UIAlertActionStyle.Cancel,null
             ));
             PresentViewController (Alert, true, null);
         });
     }
 }
Пример #12
0
 public void UpdateAccountInfo(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("token_id") && !string.IsNullOrEmpty (parameters ["token_id"])) {
         string getaccountinfo = String.Format (URLManager.UpdateAccountInfo + "?token_id={0}",  parameters ["token_id"]);
         parameters.Remove ("token_id");
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (getaccountinfo);
         webrequest.parameters = parameters;
         webrequest.verb = HTTPVerb.POST;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     }else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
Пример #13
0
        public void RequestTempPass(Dictionary<string,string> parameters, MsgHandler responsehander)
        {
            if (parameters.ContainsKey ("token_id")&&parameters.ContainsKey ("email")&&parameters.ContainsKey ("ORGANIZATION_ID") &&!string.IsNullOrEmpty (parameters ["token_id"]) &&!string.IsNullOrEmpty (parameters ["email"])&&!string.IsNullOrEmpty (parameters ["ORGANIZATION_ID"]) ) {
                string requesttemppass = String.Format (URLManager.RequestTempPass + "?token_id={0}",  parameters ["token_id"]);
                Tap5050WebRequest webrequest = new Tap5050WebRequest ();
                Dictionary<string,string> tempparameters =new Dictionary<string, string>();
                tempparameters.Add("email",parameters["email"]);
                tempparameters.Add ("ORGANIZATION_ID",parameters["ORGANIZATION_ID"]);

                webrequest.parameters = tempparameters;
                webrequest.SetURL (requesttemppass);
                webrequest.verb = HTTPVerb.POST;
                LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
                thread.Start ();
            }else {
                if(responsehander!=null){
                    Tap5050WebResponse response = new Tap5050WebResponse ();
                    response.available = false;
                    response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
                    responsehander(response);
                }
            }
        }
Пример #14
0
 public void RejectJoinTeamRequest(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("token_id") && !string.IsNullOrEmpty (parameters ["token_id"]) &&
         parameters.ContainsKey ("member_id") && !string.IsNullOrEmpty (parameters ["member_id"])) {
         string fulurl = String.Format (URLManager.JoinTeamRequest + "?token_id={0}&member_id={1}", parameters ["token_id"], parameters ["member_id"]);
         parameters.Remove ("token_id");
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (fulurl);
         webrequest.parameters = parameters;
         webrequest.verb = HTTPVerb.DELETE;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     } else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
Пример #15
0
        public void requestTPWebCallResponds(Tap5050WebResponse response)
        {
            if (response.available) {
                Tap5050Result result = (Tap5050Result)response.parsedobject;
                if (result.result_success.Equals ("Y")){
                    InvokeOnMainThread (() => {
                        loadingOverlayView.Hide ();
                        View.Add (reqeustTPScreenView);

                        //alert
                        UIAlertController Alert = UIAlertController.Create (RequestTPScreenData.AlertScreenRequestTPRespondTitle,
                            RequestTPScreenData.AlertScreenRequestTPRespondSuccessMessage, UIAlertControllerStyle.Alert);
                        Alert.AddAction (UIAlertAction.Create (RequestTPScreenData.AlertScreenRequestTPRespondCancelBtnTitle,
                            UIAlertActionStyle.Cancel,action=>{
                                reqeustTPScreenView.clientInfoTextField.Text="";
                                NavigationController.PushViewController (new WebViewController (raffle.sell_ticket_url,
                                    RequestTPScreenData.sellRaffleWebViewTitle), true);
                            }));
                        PresentViewController (Alert, true, null);

                    });
                }else  {
                    InvokeOnMainThread (() => {
                        loadingOverlayView.Hide ();
                        View.Add (reqeustTPScreenView);

                        //alert
                        UIAlertController Alert = UIAlertController.Create (RequestTPScreenData.AlertScreenRequestTPRespondTitle,
                            result.err_message, UIAlertControllerStyle.Alert);
                        Alert.AddAction (UIAlertAction.Create (RequestTPScreenData.AlertScreenRequestTPRespondCancelBtnTitle,
                            UIAlertActionStyle.Cancel,
                            null));
                        PresentViewController (Alert, true, null);
                    });
                }

            } else {
                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide ();
                    View.Add (reqeustTPScreenView);

                    //alert
                    UIAlertController Alert = UIAlertController.Create (RequestTPScreenData.AlertScreenRequestTPRespondTitle,
                        response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
                    Alert.AddAction (UIAlertAction.Create (RequestTPScreenData.AlertScreenRequestTPRespondCancelBtnTitle,
                        UIAlertActionStyle.Cancel,
                        null));
                    PresentViewController (Alert, true, null);
                });

            }
        }
Пример #16
0
        public void LoadRaffleWebCallResponds(Tap5050WebResponse response)
        {
            if(response.available){
                Global.eventlist=(List<Tap5050Event>)response.parsedobject;
                if (Global.eventlist == null)
                {
                    Global.eventlist = new List<Tap5050Event> ();
                }
                //comment this line************************************
                //Global.eventlist = new List<Tap5050Event> ();
                //***************************************************
                Global.eventImageList = new List<UIImage> ();

                //insert default image
                for(int i=0;i<Global.eventlist.Count;i++)
                {
                    Global.eventImageList.Add (UIImage.FromFile (RaffleListScreenData.TableViewDefaulImageFileName));
                }

                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide ();
                    View.Add (loginScreenView);
                    PresentViewController (new TabBarController (), animated: true, completionHandler: null);
                });

            }
            else{
                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide ();
                    View.Add (loginScreenView);
                    //alert
                    UIAlertController Alert = UIAlertController.Create (RaffleListScreenData.AlertScreenLoadRafflesFailTitle,
                        response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
                    Alert.AddAction (UIAlertAction.Create (RaffleListScreenData.AlertScreenLoadRafflesFailCancelBtnTitle,
                        UIAlertActionStyle.Cancel,null
                    ));
                    PresentViewController (Alert, true, null);
                });
            }
        }
Пример #17
0
        public void GetHistoryWebCallResponds(Tap5050WebResponse response)
        {
            if(response.available){
                Global.historyList=(List<Tap5050HistoryEvents>)response.parsedobject;
                Global.historyImageList = new List<UIImage> ();
                //insert default image
                for(int i=0;i<Global.historyList.Count;i++)
                {
                    Global.historyImageList.Add (UIImage.FromFile (HistoryScreenData.TableViewDefaulImageFileName));
                }

                //start loading image
                for(int i=0;i<Global.historyList.Count;i++){
                    if(!String.IsNullOrEmpty(Global.historyList[i].image_url)){
                        LoadImageWebCall (i);
                    }
                }

                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide();
                    initHistoryScreenView();
                });
            }
            else{
                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide();
                    //alert
                    UIAlertController Alert = UIAlertController.Create (HistoryScreenData.AlertScreenLoadHistoryFailTitle,
                        response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
                    Alert.AddAction (UIAlertAction.Create (HistoryScreenData.AlertScreenLoadHistoryFailCancelBtnTitle,
                        UIAlertActionStyle.Cancel,action=>{
                            NavigationController.PopViewController(true);
                        }));
                    PresentViewController (Alert, true, null);
                });
            }
        }
Пример #18
0
 /**
  * @return indicate if successfully construct URL
  **/
 public void GetEvents(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("location") && parameters.ContainsKey ("token_id") && !string.IsNullOrEmpty (parameters ["token_id"]) && !string.IsNullOrEmpty (parameters ["location"])) {
         var url = String.Format (URLManager.Events + "?location={0}&token_id={1}", parameters ["location"], parameters ["token_id"]);
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (url);
         webrequest.verb = HTTPVerb.GET;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     } else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
Пример #19
0
 public void CheckUserByPhone(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("mphone") && parameters.ContainsKey ("token_id") && !string.IsNullOrEmpty (parameters ["token_id"]) && !string.IsNullOrEmpty (parameters ["mphone"])) {
         string checkuser = String.Format (URLManager.CheckUser + "?token_id={0}&mphone={1}", parameters ["token_id"], parameters ["mphone"]);
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (checkuser);
         webrequest.verb = HTTPVerb.GET;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     } else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
Пример #20
0
        public void LoginWebCallResponds(Tap5050WebResponse response)
        {
            if(response.available){
                if ((response.parsedobject as Login).loginsuccess.Equals ("Y")) {
                    Login loginreturn = (Login)response.parsedobject;
                    GlobalVariable.token_id = loginreturn.token_id;
                    InvokeOnMainThread (() => {
                        GlobalVariable.username= loginScreenView.userNameTextField.Text;
                        Global.DatabaseManager.SaveUsername (loginScreenView.userNameTextField.Text);
                        loginScreenView.passwordTextField.Text = "";
                        loadingOverlayView.Hide ();
                        initLoadingScreenView (RaffleListScreenData.LoadingScreenTextLocation);

                        //Uncomment these code to test manual location selection********************************
                        //LoadLoactionsWebCall();
                        //Uncomment these code to test manual location selection********************************
                        GetCurrentLocationWebCall ();

                    });
                } else {
                    InvokeOnMainThread (() => {
                        loadingOverlayView.Hide ();
                        View.Add (loginScreenView);
                        //alert
                        UIAlertController Alert = UIAlertController.Create (LoginScreenData.AlertScreenLoginRespondTitle,
                            (response.parsedobject as Login).err_message, UIAlertControllerStyle.Alert);
                        Alert.AddAction (UIAlertAction.Create (LoginScreenData.AlertScreenLoginRespondCancelBtnTitle,
                            UIAlertActionStyle.Cancel,
                            null));
                        PresentViewController (Alert, true, null);
                    });
                }
            } else {
                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide();
                    View.Add(loginScreenView);
                    //alert
                    UIAlertController Alert = UIAlertController.Create (LoginScreenData.AlertScreenLoginRespondTitle,
                        response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
                    Alert.AddAction (UIAlertAction.Create (LoginScreenData.AlertScreenLoginRespondCancelBtnTitle,
                        UIAlertActionStyle.Cancel,
                        null));
                    PresentViewController (Alert, true, null);
                });
            }
        }
Пример #21
0
 /********************************************************************************
 *Web calls responds
 ********************************************************************************/
 public void ResetPasswordWebCallResponds(Tap5050WebResponse response)
 {
     if (response.available) {
         if ((response.parsedobject as ResetPass).result_success.Equals ("Y")) {
             InvokeOnMainThread (() => {
                 loadingOverlayView.Hide ();
                 View.Add (loginScreenView);
                 //alert
                 UIAlertController Alert = UIAlertController.Create (LoginScreenData.AlertScreenForgetPasswordRespondTitle,
                     LoginScreenData.AlertScreenForgetPasswordRespondSuccessMessage, UIAlertControllerStyle.Alert);
                 Alert.AddAction (UIAlertAction.Create (LoginScreenData.AlertScreenForgetPasswordRespondCancelBtnTitle,
                     UIAlertActionStyle.Cancel,
                     null));
                 PresentViewController (Alert, true, null);
             });
         } else {
             InvokeOnMainThread (() => {
                 loadingOverlayView.Hide ();
                 View.Add (loginScreenView);
                 //alert
                 UIAlertController Alert = UIAlertController.Create (LoginScreenData.AlertScreenForgetPasswordRespondTitle,
                     (response.parsedobject as ResetPass).err_message, UIAlertControllerStyle.Alert);
                 Alert.AddAction (UIAlertAction.Create (LoginScreenData.AlertScreenForgetPasswordRespondCancelBtnTitle,
                     UIAlertActionStyle.Cancel,
                     null));
                 PresentViewController (Alert, true, null);
             });
         }
     }
     else
     {
         InvokeOnMainThread (() => {
             loadingOverlayView.Hide();
             View.Add(loginScreenView);
             //alert
             UIAlertController Alert = UIAlertController.Create (LoginScreenData.AlertScreenForgetPasswordRespondTitle,
                 response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
             Alert.AddAction (UIAlertAction.Create (LoginScreenData.AlertScreenForgetPasswordRespondCancelBtnTitle,
                 UIAlertActionStyle.Cancel,
                 null));
             PresentViewController (Alert, true, null);
         });
     }
 }
Пример #22
0
        public void CheckTokenWebCallResponds(Tap5050WebResponse response)
        {
            if(response.available){
                if((response.parsedobject as Tap5050Result).result_success.Equals("Y")) {

                    string firstname="", lastname="", datetime="",
                    mobilephone="", email="",emailConfirm="",
                    address1="", address2="", country="", stateandprovince="", city="", postcode="",
                    raffleresults="", marketmesage="";
                    InvokeOnMainThread (() => {

                        //get all input****************************************************************************************
                        firstname = editAccountScreenView.firstNameTextField.Text;
                        lastname = editAccountScreenView.lastNameTextField.Text;
                        datetime = editAccountScreenView.birthDateTextField.Text.Length == 0 ?
                            "" : ((DateTime)editAccountScreenView.birthDatePickerView.datePicker.Date).ToString (@"yyyy\/MM\/dd");
                        mobilephone = editAccountScreenView.mobilePhoneTextField.Text;
                        email = editAccountScreenView.emailTextField.Text;
                        emailConfirm = editAccountScreenView.emailConfirmTextField.Text;
                        address1 = editAccountScreenView.address1TextField.Text;
                        address2 = editAccountScreenView.address2TextField.Text;
                        country = editAccountScreenView.countryTextField.Text.Length == 0 ?
                            "" : ((CustomPickerModel<Country>)editAccountScreenView.countryPickerView.pickerView.Model).selectedObject.country_code;
                        stateandprovince = editAccountScreenView.provanceTextField.Text.Length == 0 ?
                            "" : ((CustomPickerModel<StateAndProvince>)editAccountScreenView.provincePickerView.pickerView.Model).selectedObject.state_province_abbrev;
                        city = editAccountScreenView.cityTextField.Text;
                        postcode = editAccountScreenView.zipcodeTextField.Text;
                        raffleresults = editAccountScreenView.raffleResultTextField.Text.Length == 0 ?
                            "" : ((CustomPickerModel<string>)editAccountScreenView.raffleResultsPickerView.pickerView.Model).selectedObject;
                        if (String.Equals (raffleresults, editAccountScreenView.listRaffleResultContactMethod [0])) {
                            raffleresults = "NOCONTACT";
                        }
                        marketmesage = editAccountScreenView.CharityMarketingMessagesTextField.Text.Length == 0 ?
                            "" : ((CustomPickerModel<string>)editAccountScreenView.CharityMarketingMessagesPickerView.pickerView.Model).selectedObject;
                        if (String.Equals (marketmesage, editAccountScreenView.listCharityMarketingMessageContactMethod [0])) {
                            marketmesage = "NOCONTACT";
                        }
                    });

                    //check input*************************************************************
                    string [] messageArray=new string[]{"First Name\n","Last Name\n","Mobile Phone\n","Email\n","Email Confirm\n","Address1\n","Address2\n","City\n",
                        "Postcode\n","Country\n","State And Province\n","Raffle Results\n","Market Message\n","Birthdate\n"};
                    FormatCheckFlagObject[] flags=new FormatCheckFlagObject[messageArray.Length];
                    for (int i = 0; i < flags.Length; i++)
                    {
                        flags[i]=new FormatCheckFlagObject(messageArray[i]);
                    }

                    if(FormatManager.chechinput(firstname,FormatManager.FormatOption.OnlyLetter)){
                        flags[0].flag=true;
                    }
                    if(FormatManager.chechinput(lastname,FormatManager.FormatOption.OnlyLetter)){
                        flags[1].flag=true;
                    }
                    if(FormatManager.chechinput(mobilephone,FormatManager.FormatOption.OnlyNumber)&&mobilephone.Length>=5){
                        flags[2].flag=true;
                    }
                    if(FormatManager.chechinput(email,FormatManager.FormatOption.Email)){
                        flags[3].flag=true;
                    }
                    if(FormatManager.chechinput(emailConfirm,FormatManager.FormatOption.Email)){
                        flags[4].flag=true;
                    }
                    if(FormatManager.chechinput(address1,FormatManager.FormatOption.Regular)){
                        flags[5].flag=true;
                    }
                    if(FormatManager.chechinput(address2,FormatManager.FormatOption.Regular)){
                        flags[6].flag=true;
                    }
                    //address2 can be empty
                    if(address2.Equals("")){
                        flags[6].flag=true;
                    }
                    if(FormatManager.chechinput(city,FormatManager.FormatOption.Regular)){
                        flags[7].flag=true;
                    }
                    if(FormatManager.chechinput(postcode,FormatManager.FormatOption.Regular)){
                        flags[8].flag=true;
                    }
                    if(FormatManager.chechinput(country,FormatManager.FormatOption.Regular)){
                        flags[9].flag=true;
                    }
                    if(FormatManager.chechinput(stateandprovince,FormatManager.FormatOption.Regular)){
                        flags[10].flag=true;
                    }
                    if(FormatManager.chechinput(raffleresults,FormatManager.FormatOption.Regular)){
                        flags[11].flag=true;
                    }
                    if(FormatManager.chechinput(marketmesage,FormatManager.FormatOption.Regular)){
                        flags[12].flag=true;
                    }
                    if(FormatManager.chechinput(datetime,FormatManager.FormatOption.Date)){
                        flags[13].flag=true;
                    }
                    bool totalfalg=true;
                    foreach(var flagobj in flags){
                        if(!flagobj.flag){
                            totalfalg=false;
                        }
                    }

                    //check if anything has changed
                    bool[] checkChanges=new bool[messageArray.Length];
                    for (int i = 0; i < checkChanges.Length; i++)
                    {
                        checkChanges[i]=false;
                    }

                    if(String.Compare(firstname,Global.accountInfo.first_name)!=0){
                        checkChanges[0]=true;
                    }
                    if(String.Compare(lastname,Global.accountInfo.last_name)!=0){
                        checkChanges[1]=true;
                    }
                    if(String.Compare(mobilephone,Global.accountInfo.phone_mobile)!=0){
                        checkChanges[2]=true;
                    }

                    if(String.Compare(address1,Global.accountInfo.mail_address_line_1)!=0){
                        checkChanges[5]=true;
                    }
                    if(String.Compare(address2,Global.accountInfo.mail_address_line_2)!=0){
                        checkChanges[6]=true;
                    }

                    if(String.Compare(city,Global.accountInfo.mail_city)!=0){
                        checkChanges[7]=true;
                    }
                    if(String.Compare(postcode,Global.accountInfo.mail_postal)!=0){
                        checkChanges[8]=true;
                    }
                    if(String.Compare(country,Global.accountInfo.mail_country)!=0){
                        checkChanges[9]=true;
                    }
                    if(String.Compare(stateandprovince,Global.accountInfo.mail_prov_state)!=0){
                        checkChanges[10]=true;
                    }
                    if(String.Compare(raffleresults,Global.accountInfo.prefered_contact_method)!=0){
                        checkChanges[11]=true;
                    }
                    if(String.Compare(marketmesage,Global.accountInfo.prefered_contact_methodcharity)!=0){
                        checkChanges[12]=true;
                    }

                    if(DateTime.Compare(DateTime.ParseExact (datetime.Substring (0, 10),@"yyyy\/MM\/dd", null),
                        DateTime.ParseExact (Global.accountInfo.user_birthdate.Substring (0, 10),"yyyy-MM-dd", null))!=0){
                        checkChanges[13]=true;
                    }
                    bool totalChanges=false;
                    foreach(var x in checkChanges){
                        if(x){
                            totalChanges=true;
                            break;
                        }
                    }
                    //sent to the server if all input checking pass and two email input are identical******
                    //show error dialog if more than one input fail the checking***************************
                    if (totalfalg == true && email.CompareTo (emailConfirm) == 0 && totalChanges) {
                        Dictionary<string,string> paramdic = new Dictionary<string, string> ();
                        paramdic.Add ("email", email);
                        paramdic.Add ("firstname", firstname);
                        paramdic.Add ("lastname", lastname);
                        paramdic.Add ("birthdate", datetime);
                        paramdic.Add ("m_phone", mobilephone);
                        paramdic.Add ("add1", address1);
                        paramdic.Add ("add2", address2);
                        paramdic.Add ("city", city);
                        paramdic.Add ("province", stateandprovince);
                        paramdic.Add ("postal", postcode);
                        paramdic.Add ("country", country);
                        paramdic.Add ("raffle_result", raffleresults);
                        paramdic.Add ("charity_marketing_message", marketmesage);
                        paramdic.Add("token_id",GlobalVariable.token_id);
                        UpdateAccountWebCall (paramdic);

                    } else if (totalfalg == false) {
                        InvokeOnMainThread (() => {
                            loadingOverlayView.Hide ();
                            View.Add(editAccountScreenView);

                            //alert
                            UIAlertController Alert = UIAlertController.Create (EditAccountScreenData.AlertScreenFormatErrorTitle,
                                EditAccountScreenData.AlertScreenFormatErrorMessage (flags, messageArray), UIAlertControllerStyle.Alert);
                            Alert.AddAction (UIAlertAction.Create (EditAccountScreenData.AlertScreenFormatErrorCancelBtnTitle,
                                UIAlertActionStyle.Cancel,
                                null));
                            PresentViewController (Alert, true, null);
                        });
                    } else if (email.CompareTo (emailConfirm) != 0) {
                        InvokeOnMainThread (() => {
                            loadingOverlayView.Hide ();
                            View.Add(editAccountScreenView);

                            //alert
                            UIAlertController Alert = UIAlertController.Create (EditAccountScreenData.AlertScreenEmailNotMatchTitle,
                                EditAccountScreenData.AlertScreenEmailNotMatchCancelBtnTitle, UIAlertControllerStyle.Alert);
                            Alert.AddAction (UIAlertAction.Create (EditAccountScreenData.AlertScreenFormatErrorCancelBtnTitle,
                                UIAlertActionStyle.Cancel,
                                null));
                            PresentViewController (Alert, true, null);
                        });
                    } else {
                        InvokeOnMainThread (() => {
                            loadingOverlayView.Hide ();
                            NavigationController.PopViewController (true);//nothing changes
                        });
                    }
                }
                else {
                    InvokeOnMainThread (() => {
                        loadingOverlayView.Hide ();

                        //alert
                        UIAlertController Alert = UIAlertController.Create (RaffleListScreenData.AlertScreenInvalidTokenTitle,
                            (response.parsedobject as Tap5050Result).err_message, UIAlertControllerStyle.Alert);
                        Alert.AddAction (UIAlertAction.Create (RaffleListScreenData.AlertScreenInvalidTokenCancelBtnTitle,
                            UIAlertActionStyle.Cancel,action=>{
                                DismissViewController(true,null);
                            }));
                        PresentViewController (Alert, true, null);
                    });
                }
            }
            else{
                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide ();

                    //alert
                    UIAlertController Alert = UIAlertController.Create (RaffleListScreenData.AlertScreenReloadFailTitle,
                        response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
                    Alert.AddAction (UIAlertAction.Create (RaffleListScreenData.AlertScreenReloadFailCancelBtnTitle,
                        UIAlertActionStyle.Cancel,action=>{
                            DismissViewController(true,null);
                        }));
                    PresentViewController (Alert, true, null);
                });
            }
        }
Пример #23
0
        public void checkUserWebCallResponds(Tap5050WebResponse response)
        {
            if (response.available) {
                Tap5050CheckUser result = (Tap5050CheckUser)response.parsedobject;
                if (result.result_success.Equals ("Y")){
                    if (!String.IsNullOrEmpty (result.email)) {
                        requestTPWebCall (result.email);
                    } else {
                        string email = "";
                        InvokeOnMainThread (() => {
                            email = reqeustTPScreenView.clientInfoTextField.Text;
                        });
                        requestTPWebCall (email);
                    }
                }else {
                    InvokeOnMainThread (() => {
                        loadingOverlayView.Hide ();
                        View.Add (reqeustTPScreenView);
                        if(String.Equals(result.err_message,"Not a registered user.")){

                            //alert
                            UIAlertController Alert = UIAlertController.Create (RequestTPScreenData.AlertScreenRedirectToRegisterTitle,
                                RequestTPScreenData.AlertScreenRedirectToRegisterMessage, UIAlertControllerStyle.Alert);
                            Alert.AddAction (UIAlertAction.Create (RequestTPScreenData.AlertScreenRedirectToRegisterCancelBtnTitle,
                                UIAlertActionStyle.Cancel,action=>{
                                    string	clientInfoText = reqeustTPScreenView.clientInfoTextField.Text;
                                    NavigationController.PushViewController (new RegisterScreenController (clientInfoText), true);
                                }));
                            PresentViewController (Alert, true, null);

                        }else{

                            //alert
                            UIAlertController Alert = UIAlertController.Create (RequestTPScreenData.AlertScreenRespondCheckUserFailTitle,
                                result.err_message, UIAlertControllerStyle.Alert);
                            Alert.AddAction (UIAlertAction.Create (RequestTPScreenData.AlertScreenRequestCheckUserFailCancelBtnTitle,
                                UIAlertActionStyle.Cancel,
                                null));
                            PresentViewController (Alert, true, null);
                        }
                    });
                }

            } else {
                InvokeOnMainThread (() => {
                    loadingOverlayView.Hide ();
                    View.Add (reqeustTPScreenView);
                    //alert
                    UIAlertController Alert = UIAlertController.Create (RequestTPScreenData.AlertScreenRespondCheckUserFailTitle,
                        response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
                    Alert.AddAction (UIAlertAction.Create (RequestTPScreenData.AlertScreenRequestCheckUserFailCancelBtnTitle,
                        UIAlertActionStyle.Cancel,
                        null));
                    PresentViewController (Alert, true, null);
                });
            }
        }
Пример #24
0
        public void Run(object a)
        {
            string jsonstr = "";
            System.Net.ServicePointManager.Expect100Continue = false;

            Tap5050WebResponse tap5050response = new Tap5050WebResponse ();

            try{
                if (nn_webrequest.verb.Equals(NetworkManager.HTTPVerb.GET))
                {
                    if(nn_flagobject is Tap5050ImageFlag){
                        HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(nn_webrequest.fullurl);
                        webRequest.ProtocolVersion = HttpVersion.Version10;
                        webRequest.Method = "GET";
                        webRequest.ContentType = "application/x-www-form-urlencoded";
                        webRequest.Timeout = 15000;//15 sec

                        byte[] parsedarray;
                        using (WebResponse response = webRequest.GetResponse())
                        {
                            using (BinaryReader br = new BinaryReader(response.GetResponseStream()))
                            {
                                //4mb
                                parsedarray = br.ReadBytes(500000);
                                br.Close();
                            }
                        }

                        tap5050response.webrequest=nn_webrequest;
                        tap5050response.flagobject=nn_flagobject;
                        tap5050response.parsedobject=parsedarray;
                        if(parsedarray!=null){
                        tap5050response.available=true;
                        }

                    } else{
                        HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(nn_webrequest.fullurl);
                        webRequest.ProtocolVersion = HttpVersion.Version10;
                        webRequest.Method = "GET";
                        webRequest.ContentType = "application/x-www-form-urlencoded";
                        webRequest.Timeout = 15000;//15 sec
                        using (WebResponse response = webRequest.GetResponse())
                        {
                            StringBuilder stringbuilder = new StringBuilder();
                            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                            {
                                string line;
                                while ((line = reader.ReadLine()) != null)
                                {
                                    stringbuilder.Append(line);
                                }
                            }
                            jsonstr=stringbuilder.ToString();
                        }
                    }
                }
                else if (nn_webrequest.verb.Equals(NetworkManager.HTTPVerb.POST))
                {
                    string param = "";
                    foreach (var pair in nn_webrequest.parameters)
                    {
                        if (param.Equals(""))
                        {
                            param += Uri.EscapeDataString(pair.Key) + "=" + Uri.EscapeDataString(pair.Value);
                        }
                        else
                        {
                            param += "&" + Uri.EscapeDataString(pair.Key) + "=" + Uri.EscapeDataString(pair.Value);
                        }
                    }
                    var request = (HttpWebRequest)WebRequest.Create(nn_webrequest.fullurl);
                    var data = Encoding.ASCII.GetBytes(param);
                    request.ProtocolVersion = HttpVersion.Version10;
                    request.Method = "POST";
                    request.Timeout = 15000;//15 sec
                    request.ContentType = "application/x-www-form-urlencoded";
                    request.ContentLength = data.Length;
                    using (var stream = request.GetRequestStream())
                    {
                        stream.Write(data, 0, data.Length);
                    }
                    var response = (HttpWebResponse)request.GetResponse();
                    StringBuilder stringbuilder = new StringBuilder();
                    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                    {
                        string line;
                        while ((line = reader.ReadLine()) != null)
                        {
                            stringbuilder.Append(line);
                        }
                    }
                    jsonstr=stringbuilder.ToString();
                }
                else if(nn_webrequest.verb.Equals(NetworkManager.HTTPVerb.DELETE)){
                    HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(nn_webrequest.fullurl);
                    webRequest.ProtocolVersion = HttpVersion.Version10;
                    webRequest.Method = "DELETE";
                    webRequest.ContentType = "application/x-www-form-urlencoded";
                    webRequest.Timeout = 15000;//15 sec
                    using (WebResponse response = webRequest.GetResponse())
                    {
                        StringBuilder stringbuilder = new StringBuilder();
                        using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                        {
                            string line;
                            while ((line = reader.ReadLine()) != null)
                            {
                                stringbuilder.Append(line);
                            }
                        }
                        jsonstr=stringbuilder.ToString();
                    }
                }

                if(!(nn_flagobject is Tap5050ImageFlag)){
                //jsonstr, nn_webrequest, exceptionreport
                tap5050response.available=false;
                tap5050response.responsestr=jsonstr;
                tap5050response.webrequest=nn_webrequest;
                tap5050response.flagobject=nn_flagobject;
                tap5050response.TryParse();
                //if not exception happend in parse procedure
                tap5050response.available=true;
                }
            }
            catch (WebException we){
                tap5050response.available = false;
                tap5050response.exceptionreport = ExceptionManager.buildreport (we);
                tap5050response.exceptionreport.errormessage="We are unable to connect to the internet. Please check your connection and try again.";
            }
            catch(Exception e){
                tap5050response.available = false;
                tap5050response.exceptionreport = ExceptionManager.buildreport (e);
                tap5050response.exceptionreport.errormessage="We are unable to parse data. Please contact us to report bug";
            }
            finally{
                if (nn_responsehander != null) {
                    nn_responsehander (tap5050response);
                }
            }
        }
Пример #25
0
 //get location when initialize Homescreen
 public void GetLocationfromGEO(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("lat") && parameters.ContainsKey ("lng")&&parameters.ContainsKey ("username") && !string.IsNullOrEmpty (parameters ["lat"]) && !string.IsNullOrEmpty (parameters ["lng"])&& !string.IsNullOrEmpty (parameters ["username"])) {
         string fulurl = String.Format (URLManager.BaseLocationURL+"?lat={0}&lng={1}&username={2}", parameters ["lat"], parameters ["lng"], parameters ["username"]);
         parameters.Remove ("lat");
         parameters.Remove ("lng");
         parameters.Remove ("username");
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (fulurl);
         webrequest.parameters = parameters;
         webrequest.verb = HTTPVerb.GET;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     }else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
Пример #26
0
 public void InAppResetPassword(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("token_id") && !string.IsNullOrEmpty (parameters ["token_id"])&&
         parameters.ContainsKey ("new_password") && !string.IsNullOrEmpty (parameters ["new_password"])&&
         parameters.ContainsKey ("old_password") && !string.IsNullOrEmpty (parameters ["old_password"])) {
         string checkuser = String.Format (URLManager.InAppResetPWD + "?token_id={0}",  parameters["token_id"]);
         parameters.Remove ("token_id");
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (checkuser);
         webrequest.parameters = parameters;
         webrequest.verb = HTTPVerb.POST;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     } else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
Пример #27
0
 public void LoadImageWebCallResponds(Tap5050WebResponse response)
 {
     if(response.available&&(response.flagobject as Tap5050ImageFlag).type==Tap5050ImageFlag.ImageType.HistoryImage){
         var array=(byte[])response.parsedobject;
         try{
             NSData data = NSData.FromArray (array);
             UIImage uiImage = UIImage.LoadFromData (data);
             int position=(response.flagobject as Tap5050ImageFlag).position;
             Global.historyImageList[position] = uiImage;
             InvokeOnMainThread (() => {
                 HistoryScreenView.tableView.ReloadData();
             });
         }
         catch(Exception e){
             Console.WriteLine (e);
         }
     }
 }
Пример #28
0
 //load different image with differnt type, somethimes there may have many image to load with same position.
 //types in
 public void LoadImage(Tap5050ImageFlag imageflag,MsgHandler responsehander)
 {
     if (!string.IsNullOrEmpty(imageflag.url)) {
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (imageflag.url);
         webrequest.verb = HTTPVerb.GET;
         LoadContentThread thread = new LoadContentThread (webrequest,imageflag,responsehander);
         thread.Start ();
     }else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }
Пример #29
0
 public void RequestRelationWebCallResponds(Tap5050WebResponse response)
 {
     if(response.available){
         if((response.parsedobject as Tap5050Result).result_success.Equals("Y")) {
             InvokeOnMainThread (() => {
                 //alert
                 UIAlertController Alert = UIAlertController.Create (RelationsScreenData.AlertScreenRequestRelationTitle,
                     RelationsScreenData.AlertScreenRequestRelationSuccessTitle, UIAlertControllerStyle.Alert);
                 Alert.AddAction (UIAlertAction.Create (RelationsScreenData.AlertScreenRequestRelationCancelBtnTitle,
                     UIAlertActionStyle.Cancel,action=>{
                         GetRelationsWebCall ();
                     }));
                 PresentViewController (Alert, true, null);
             });
         }
         else {
             InvokeOnMainThread (() => {
                 //alert
                 UIAlertController Alert = UIAlertController.Create (RelationsScreenData.AlertScreenRequestRelationTitle,
                     (response.parsedobject as Tap5050Result).err_message, UIAlertControllerStyle.Alert);
                 Alert.AddAction (UIAlertAction.Create (RelationsScreenData.AlertScreenRequestRelationCancelBtnTitle,
                     UIAlertActionStyle.Cancel,action=>{
                         GetRelationsWebCall ();
                     }));
                 PresentViewController (Alert, true, null);
             });
         }
     }
     else{
         InvokeOnMainThread (() => {
             loadingOverlayView.Hide ();
             View.Add(relationsScreenView);
             //alert
             UIAlertController Alert = UIAlertController.Create (RelationsScreenData.AlertScreenRequestRelationTitle,
                 response.exceptionreport.errormessage, UIAlertControllerStyle.Alert);
             Alert.AddAction (UIAlertAction.Create (RelationsScreenData.AlertScreenRequestRelationCancelBtnTitle,
                 UIAlertActionStyle.Cancel,action=>{
                     DismissViewController(true,null);
                 }));
             PresentViewController (Alert, true, null);
         });
     }
 }
Пример #30
0
 //need organization_id
 public void PostRelationship(Dictionary<string,string> parameters, MsgHandler responsehander)
 {
     if (parameters.ContainsKey ("token_id") && parameters.ContainsKey ("location")&&parameters.ContainsKey ("ORGANIZATION_ID") && !string.IsNullOrEmpty (parameters ["token_id"]) && !string.IsNullOrEmpty (parameters ["location"])&& !string.IsNullOrEmpty (parameters ["ORGANIZATION_ID"])) {
         string fulurl = String.Format (URLManager.Relationship+"?token_id={0}&location={1}", parameters ["token_id"], parameters ["location"]);
         parameters.Remove ("token_id");
         parameters.Remove ("location");
         Tap5050WebRequest webrequest = new Tap5050WebRequest ();
         webrequest.SetURL (fulurl);
         webrequest.parameters = parameters;
         webrequest.verb = HTTPVerb.POST;
         LoadContentThread thread = new LoadContentThread (webrequest, responsehander);
         thread.Start ();
     }else {
         if(responsehander!=null){
             Tap5050WebResponse response = new Tap5050WebResponse ();
             response.available = false;
             response.exceptionreport = new ExceptionReport ("Error:Can not build Request");
             responsehander(response);
         }
     }
 }