public static string AlertScreenFormatErrorMessage(FormatCheckFlagObject[] flags,string [] messageArray)
 {
     string message="Please check:\n";
     for(int i=0;i<13;i++){
         if(flags[i].flag==false){
             message+=flags[i].message;
         }
     }
     return message;
 }
 /********************************************************************************
 *Btn clicks
 ********************************************************************************/
 public void sentBtnClick()
 {
     string organizationName = aboutScreenView.organizationNameTextField.Text;
     string mobilephone= aboutScreenView.phoneNumberTextField.Text;
     //check input
     string [] messageArray=new string[]{"Organization Name\n","Phone Number\n"};
     FormatCheckFlagObject[] flags=new FormatCheckFlagObject[messageArray.Length];
     for (int i = 0; i < flags.Length; i++)
     {
         flags[i]=new FormatCheckFlagObject(messageArray[i]);
     }
     if(FormatManager.chechinput(organizationName,FormatManager.FormatOption.OnlyLetter)){
         flags[0].flag=true;
     }
     if(FormatManager.chechinput(mobilephone,FormatManager.FormatOption.OnlyNumber)&&mobilephone.Length>=5){
         flags[1].flag=true;
     }
     bool totalfalg=true;
     foreach(var flagobj in flags){
         if(!flagobj.flag){
             totalfalg=false;
         }
     }
     if (totalfalg == true) {
         SocialShareIOS SocialShareIOS = new SocialShareIOS (this, Screen.RaffleDetail);
         string message = String.Format (AboutScreenData.RequestRaffleEmailBody,
                              GlobalVariable.username, GlobalVariable.currentlocation,
             organizationName, mobilephone);
         SocialShareIOS.Email (message, AboutScreenData.RequestRaffleEmailSubject, new string []{ AboutScreenData.RequestRaffleEmailTarget });
     } else {
         UIAlertController Alert = UIAlertController.Create (AboutScreenData.AlertScreenFormatErrorTitle,
             AboutScreenData.AlertScreenFormatErrorMessage(flags,messageArray), UIAlertControllerStyle.Alert);
         Alert.AddAction (UIAlertAction.Create (AboutScreenData.AlertScreenFormatErrorCancelBtnTitle,
             UIAlertActionStyle.Cancel,
             null));
         PresentViewController (Alert, true, null);
     }
 }
Exemple #3
0
        public void RetrieveEvents()
        {
            if (!string.IsNullOrEmpty (GlobalVariable.currentlocation)) {
                Dictionary<string,string> parameters =new Dictionary<string, string>();
                parameters.Add("token_id",GlobalVariable.token_id);
                App.INSTANCE.networknamager.CheckToken(parameters,(Tap5050WebResponse response)=>{
                    if(response.available){
                        var result=(Tap5050Result)response.parsedobject;
                        if(result.result_success.Equals("Y")){
                            eventlist.Clear ();
                            eventcards.Clear ();
                            confirmedcards.Clear();
                            potencialcards.Clear();
                            Dictionary<string, string> geteventsparameters = new Dictionary<string, string> ();
                            geteventsparameters.Add ("location", GlobalVariable.currentlocation);
                            geteventsparameters.Add ("token_id", GlobalVariable.token_id);
                            App.INSTANCE.networknamager.GetEvents (geteventsparameters,(Tap5050WebResponse geteventsresponse)=>{
                     			if(geteventsresponse.available){
                                 	eventlist=(List<Tap5050Event>)geteventsresponse.parsedobject;
                                    eventlist.Sort(delegate(Tap5050Event x, Tap5050Event y)
                                        {
                                            if (x.have_contract == null || y.have_contract == null) return 0;
                                            else if (x.have_contract.Equals("N")) return 1;
                                            else return -1;
                                        }
                                    );
                                        for(int i=0;i<eventlist.Count;i++){
                                            EventCard eventcard =new EventCard(eventlist[i],detaltimgsmall,detaltimgoriginal);
                                            eventcards.Add(eventcard);
                                        }
                                        for(int m=0;m<eventcards.Count;m++){

                                        if(eventcards[m].eventinfo.have_contract!=null&&eventcards[m].eventinfo.have_contract.Equals("Y")){
                                            confirmedcards.Add(eventcards[m]);
                                        }else{
                                            potencialcards.Add(eventcards[m]);
                                        }
                                            if(!String.IsNullOrEmpty(eventlist[m].image_url)){
                                                App.INSTANCE.networknamager.LoadImage(new Tap5050ImageFlag(m,eventlist[m].image_url,Tap5050ImageFlag.ImageType.OrganizationImage),
                                                    (Tap5050WebResponse imgresponse)=>{
                                                        if(imgresponse.available){
                                                            var array=(byte[])imgresponse.parsedobject;
                                                            var flag=(Tap5050ImageFlag)imgresponse.flagobject;
                                                            try{
                                                                Bitmap imageBitmap= BitmapFactory.DecodeByteArray(array, 0, array.Length);

                                                                //Bitmap imageWithBG = Bitmap.CreateBitmap(imageBitmap.Width, imageBitmap.Height, imageBitmap.GetConfig());  // Create another image the same size
                                                                //imageWithBG.EraseColor(global::Android.Graphics.Color.Transparent);
                                                                //Canvas canvas = new Canvas(imageWithBG);
                                                                //canvas.DrawBitmap(imageBitmap, 0f, 0f, null);
                                                                //imageBitmap.Recycle();

                                                                //var imageBitmaphandle=imageBitmap.Copy(imageBitmap.GetConfig(), true);
                                                                //var imageBitmaphandle = Bitmap.CreateBitmap(imageBitmap.Width, imageBitmap.Height, Bitmap.Config.Argb8888);

                                                                // for (int x = 0; x < imageBitmaphandle.Width; x++)
                                                                //{
                                                                //    for (int y = 0; y < imageBitmaphandle.Height; y++)
                                                                //    { d

                                                                //        if (imageBitmaphandle.GetPixel(x, y) == global::Android.Graphics.Color.White)
                                                                //        {
                                                                //            imageBitmaphandle.SetPixel(x, y, global::Android.Graphics.Color.Transparent);
                                                                //        }
                                                                //    }
                                                                //}

                                                                eventcards[flag.position].originalmap = Bitmap.CreateScaledBitmap(imageBitmap, TapUtil.dptodx(120), TapUtil.dptodx(120), false);
                                                                Bitmap newbitmap=Bitmap.CreateScaledBitmap (imageBitmap, TapUtil.dptodx(50), TapUtil.dptodx(50), false);
                                                                eventcards[flag.position].imagemap=newbitmap;

                                                                nn_activity.RunOnUiThread(()=>{
                                                                    adapter.NotifyDataSetChanged();
                                                                });
                                                            }
                                                            catch(Exception e){
                                                                Console.WriteLine (e);
                                                            }
                                                        }
                                                    });
                                            }
                                        }

                                    //update tap
                                    nn_activity.RunOnUiThread(()=>{
                                        if(showconfirmed){

                                            adapter.ChangeListAndUpdate(confirmedcards);
                                        }
                                        else{
                                            adapter.ChangeListAndUpdate(potencialcards);
                                        }
                                    });

                                        nn_activity.RunOnUiThread(()=>{
                                            if(eventcards.Count==0){

                                            if(noeventcard!=null&&noeventcard.Parent!=null){
                                                (noeventcard.Parent as RelativeLayout).RemoveView(noeventcard);
                                            }

                                                LayoutInflater inflator = LayoutInflater.From (nn_activity);

                                                noeventcard = (LinearLayout)inflator.Inflate (Resource.Layout.raffleroot_noeventcard, null);
                                                RelativeLayout.LayoutParams noeventcardreparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
                                                noeventcardreparam.AddRule(LayoutRules.Below,locationcontainerlayout.Id);
                                                noeventcard.LayoutParameters=noeventcardreparam;

                                                TextView hinttextview=(TextView)noeventcard.FindViewById(Resource.Id.rafflenoevent_hint_textview);
                                                hinttextview.Text=RaffleListScreenData.NoRaffleText;

                                                EditText charityinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_charityinput_edittext);
                                                charityinput.Hint=RaffleListScreenData.organizationNameTextFieldPlaceholder;

                                                EditText numberinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_phonenumber_edittext);
                                                numberinput.Hint=RaffleListScreenData.phoneNumberTextFieldPlaceholder;

                                                Button chritysubmitbutton=(Button)noeventcard.FindViewById(Resource.Id.rafflenoevent_charitysubmit_button);
                                                chritysubmitbutton.Text=RaffleListScreenData.sentBtnTitle;
                                                chritysubmitbutton.Click+= (object sender, EventArgs e) => {
                                                //set flags
                                                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[2];
                                                for(int i=0;i<flags.Length;i++){
                                                    string message="";
                                                    if(i==0){
                                                        message=AboutScreenData.organizationNameTextFieldPlaceholder;
                                                    }
                                                    if(i==1){
                                                        message=AboutScreenData.phoneNumberTextFieldPlaceholder;
                                                    }
                                                }

                                                //
                                                if(FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.OnlyLetter)){
                                                    flags[0].flag=true;
                                                }
                                                if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
                                                    flags[1].flag=true;
                                                }
                                                bool totalfalg=true;
                                                foreach(var flagobj in flags){
                                                    if(!flagobj.flag){
                                                        totalfalg=false;
                                                    }
                                                }
                                                if(totalfalg){
                                                    SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,GlobalVariable.currentlocation,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
                                                }
                                                else{
                                                    string message="Please check:\n";
                                                    for(int i=0;i<flags.Length;i++){
                                                        if(flags[i].flag==false){
                                                            if(i!=flags.Length-1){
                                                                message+=flags[i].message+",";
                                                            }else{
                                                                message+=flags[i].message;
                                                            }
                                                        }
                                                    }
                                                    nn_activity.ShowCustomAlterDialogFragment(AboutScreenData.AlertScreenFormatErrorTitle,message,GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
                                                }
                                            };
            //												if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)&&FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)&&FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //													SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,nn_location,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
            //												}
            //												else if(!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)||!FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //													nn_activity.ShowCustomAlterDialogFragment("Both input can not be empty",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
            //												}
            //												else if (!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
            //													nn_activity.ShowCustomAlterDialogFragment("Please check format of your phone number",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventcardnumber");
            //												}
            //
            //												};
                                                rootview.AddView(noeventcard);
                                        }// end of if eventcards.Count==0

                                        RemoveSpinner(rootview);
                                        });
                                    }else{
                                    nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.getevents");
                                    }

                                }); //end of getevents

                            //for pop alert for teanm events
                            popthread.ClearQueue();
                            teaminvitations.Clear();
                            teamrequests.Clear();
                            popinitialized=false;
                            //get invitation notifications
                            Dictionary<string, string> getinvitaitonsparameters = new Dictionary<string, string> ();
                            getinvitaitonsparameters.Add ("token_id", GlobalVariable.token_id);
                            App.INSTANCE.networknamager.GetTeamInvitationNotification (getinvitaitonsparameters,(Tap5050WebResponse getinviationresponse)=>{
                                if(getinviationresponse.available){
                                    teaminvitations=(List<Tap5050TeamInvitation>)getinviationresponse.parsedobject;
                                    popthread.Push(teaminvitations);
                                    if(popinitialized){
                                        popthread.SetSignal();
                                    }
                                    popinitialized=true;
                                    //									if(teaminvitations.Count>0){
                                    //										var invitaioninfo=teaminvitations[0];
                                    //										nn_activity.ShowCustomNeutralAlterDialogFragment(TeamScreenData.InvitationPopTitle,string.Format(TeamScreenData.InvitationPopDetail,invitaioninfo.leader_first_name+" "+invitaioninfo.leader_last_name,invitaioninfo.group_name,invitaioninfo.event_name),
                                    //											TeamScreenData.InvitationPopPositive,TeamScreenData.InvitationPopNegative,TeamScreenData.InvitationPopNeurtal,"invitepop.relationships.team",invitaioninfo);
                                    //										teaminvitations.RemoveAt(0);
                                    //									}
                                }
                            });
                            //get all reqeust
                            Dictionary<string, string> getreqeustsparameters = new Dictionary<string, string> ();
                            getreqeustsparameters.Add ("token_id", GlobalVariable.token_id);
                            App.INSTANCE.networknamager.GetJoinTeamRequestNotification (getreqeustsparameters,(Tap5050WebResponse getreqeustresponse)=>{
                                if(getreqeustresponse.available){
                                    teamrequests=(List<Tap5050TeamRequest>)getreqeustresponse.parsedobject;
                                    popthread.Push(teamrequests);
                                }
                                if(popinitialized){
                                    popthread.SetSignal();
                                }
                                popinitialized=true;

                            });

                        }
                        else{
                            nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.InvalidetokenTitle,GlobalScreenData.InvalidetokenMessage,GlobalScreenData.DefaultPositive,"invalidedialog.raffleroot.checktoken");
                        }
                    }//end of token available
                        else{
                        nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.raffleroot.gettoken");
                        }
                    });//end of get token

            }
        }
        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);
                });
            }
        }
Exemple #5
0
        public void RetrieveEvents()
        {
            if (!string.IsNullOrEmpty (GlobalVariable.currentlocation)) {
                Dictionary<string,string> parameters =new Dictionary<string, string>();
                parameters.Add("token_id",GlobalVariable.token_id);
                App.INSTANCE.networknamager.CheckToken(parameters,(Tap5050WebResponse response)=>{
                    if(response.available){
                        var result=(Tap5050Result)response.parsedobject;
                        if(result.result_success.Equals("Y")){
                            eventlist.Clear ();
                            eventcards.Clear ();
                            Dictionary<string, string> geteventsparameters = new Dictionary<string, string> ();
                            geteventsparameters.Add ("location", GlobalVariable.currentlocation);
                            geteventsparameters.Add ("token_id", GlobalVariable.token_id);
                            App.INSTANCE.networknamager.GetEvents (geteventsparameters,(Tap5050WebResponse geteventsresponse)=>{
                            if(geteventsresponse.available){
                                    eventlist=(List<Tap5050Event>)geteventsresponse.parsedobject;
                                    eventlist.Sort(delegate(Tap5050Event x, Tap5050Event y){
                                            if (x.have_contract == null || y.have_contract == null) return 0;
                                            else if (x.have_contract.Equals("N")) return 1;
                                            else return -1;
                                        }
                                    );
                                    for(int i=0;i<eventlist.Count;i++){
                                            EventCard eventcard =new EventCard(eventlist[i],detaltimgsmall,detaltimgoriginal);
                                            eventcards.Add(eventcard);
                                    }
                                    for(int m=0;m<eventcards.Count;m++){
                                        if(!String.IsNullOrEmpty(eventlist[m].image_url)){
                                            App.INSTANCE.networknamager.LoadImage(new Tap5050ImageFlag(m,eventlist[m].image_url,Tap5050ImageFlag.ImageType.OrganizationImage),
                                                (Tap5050WebResponse imgresponse)=>{
                                                    if(imgresponse.available){
                                                        var array=(byte[])imgresponse.parsedobject;
                                                        var flag=(Tap5050ImageFlag)imgresponse.flagobject;
                                                        try{
                                                            Bitmap imageBitmap= BitmapFactory.DecodeByteArray(array, 0, array.Length);
                                                            eventcards[flag.position].originalmap=Bitmap.CreateScaledBitmap (imageBitmap, TapUtil.dptodx(120), TapUtil.dptodx(120), false);
                                                            Bitmap newbitmap=Bitmap.CreateScaledBitmap (imageBitmap, TapUtil.dptodx(40), TapUtil.dptodx(40), false);
                                                            eventcards[flag.position].imagemap=newbitmap;

                                                            nn_activity.RunOnUiThread(()=>{
                                                                adapter.NotifyDataSetChanged();
                                                            });
                                                        }
                                                        catch(Exception e){
                                                            Console.WriteLine (e);
                                                        }
                                                    }
                                                });
                                        }
                                    }
                                        nn_activity.RunOnUiThread(()=>{
                                            if(eventcards.Count==0){
                                            if(noeventcard!=null&&noeventcard.Parent!=null){
                                                (noeventcard.Parent as RelativeLayout).RemoveView(noeventcard);
                                            }
                                                LayoutInflater inflator = LayoutInflater.From (nn_activity);
                                                noeventcard = (LinearLayout)inflator.Inflate (Resource.Layout.raffleroot_noeventcard, null);
                                                RelativeLayout.LayoutParams noeventcardreparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
                                                noeventcardreparam.AddRule(LayoutRules.Below,locationcontainerlayout.Id);
                                                noeventcard.LayoutParameters=noeventcardreparam;
                                                TextView hinttextview=(TextView)noeventcard.FindViewById(Resource.Id.rafflenoevent_hint_textview);
                                                hinttextview.Text=RaffleListScreenData.NoRaffleText;
                                                EditText charityinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_charityinput_edittext);
                                                charityinput.Hint=RaffleListScreenData.organizationNameTextFieldPlaceholder;
                                                EditText numberinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_phonenumber_edittext);
                                                numberinput.Hint=RaffleListScreenData.phoneNumberTextFieldPlaceholder;
                                                Button chritysubmitbutton=(Button)noeventcard.FindViewById(Resource.Id.rafflenoevent_charitysubmit_button);
                                                chritysubmitbutton.Text=RaffleListScreenData.sentBtnTitle;
                                                chritysubmitbutton.Click+= (object sender, EventArgs e) => {
                                                //set flags
                                                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[2];
                                                for(int i=0;i<flags.Length;i++){
                                                    string message="";
                                                    if(i==0){
                                                        message=AboutScreenData.organizationNameTextFieldPlaceholder;
                                                    }
                                                    if(i==1){
                                                        message=AboutScreenData.phoneNumberTextFieldPlaceholder;
                                                    }
                                                }

                                                //
                                                if(FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.OnlyLetter)){
                                                    flags[0].flag=true;
                                                }
                                                if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
                                                    flags[1].flag=true;
                                                }
                                                bool totalfalg=true;
                                                foreach(var flagobj in flags){
                                                    if(!flagobj.flag){
                                                        totalfalg=false;
                                                    }
                                                }
                                                if(totalfalg){
                                                    SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,GlobalVariable.currentlocation,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
                                                }
                                                else{
                                                    string message="Please check:\n";
                                                    for(int i=0;i<flags.Length;i++){
                                                        if(flags[i].flag==false){
                                                            if(i!=flags.Length-1){
                                                                message+=flags[i].message+",";
                                                            }else{
                                                                message+=flags[i].message;
                                                            }
                                                        }
                                                    }
                                                    nn_activity.ShowCustomAlterDialogFragment(AboutScreenData.AlertScreenFormatErrorTitle,message,"OK",null,"invalidedialog.raffleroot.noeventinput");
                                                }
                                            };
            //												if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)&&FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)&&FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //													SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,nn_location,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
            //												}
            //												else if(!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)||!FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //													nn_activity.ShowCustomAlterDialogFragment("Both input can not be empty","OK",null,"invalidedialog.raffleroot.noeventinput");
            //												}
            //												else if (!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
            //													nn_activity.ShowCustomAlterDialogFragment("Please check format of your phone number","OK",null,"invalidedialog.raffleroot.noeventcardnumber");
            //												}
            //
            //												};
                                                rootview.AddView(noeventcard);
                                            }
                                        adapter.NotifyListChange();
                                        RemoveSpinner(rootview);
                                        });
                                    }else{
                                    nn_activity.ShowCustomAlterDialogFragment(RaffleListScreenData.AlertScreenLoadRafflesFailTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.getevents");
                                    }

                                }); //end of getevents
                        }
                        else{
                            nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.InvalidetokenTitle,GlobalScreenData.InvalidetokenMessage,"Ok",null,"invalidedialog.raffleroot.checktoken");
                        }
                    }//end of token available
                        else{
                        nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.raffleroot.gettoken");
                        }
                    });//end of get token

            }
        }
        public override global::Android.Views.View OnCreateView(global::Android.Views.LayoutInflater inflater,  global::Android.Views.ViewGroup container,  global::Android.OS.Bundle savedInstanceState)
        {
            var view = (RelativeLayout)inflater.Inflate (Resource.Layout.signup_fragment, container, false);

            rootlayout = (RelativeLayout)view.FindViewById (Resource.Id.rootlayout);
            loadingcontainer = new RelativeLayout (nn_activity);
            loadingcontainer.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
            loadingcontainer.SetBackgroundColor(Color.White);

            var detailcontainer = new LinearLayout (nn_activity);

            detailcontainer.Orientation = Orientation.Vertical;
            RelativeLayout.LayoutParams param=new RelativeLayout.LayoutParams((int)TapUtil.dptodx(100), RelativeLayout.LayoutParams.WrapContent);
            param.AddRule (LayoutRules.CenterInParent);
            detailcontainer.LayoutParameters = param;

            LinearLayout.LayoutParams linearlayoutparm=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
            linearlayoutparm.Gravity=GravityFlags.CenterHorizontal;

            ProgressBar progressbar = new ProgressBar (nn_activity);
            progressbar.LayoutParameters =  linearlayoutparm;

            TextView tectview = new TextView (nn_activity);
            tectview.LayoutParameters = linearlayoutparm;
            tectview.Text = RaffleBuyerSignUpScreenData.LoadingScreenTextInit;
            tectview.Gravity = GravityFlags.CenterHorizontal;

            detailcontainer.AddView (progressbar);
            detailcontainer.AddView (tectview);

            loadingcontainer.AddView (detailcontainer);
            rootlayout.AddView (loadingcontainer);

            picktimebutton = view.FindViewById<Button> (Resource.Id.signup_birthday_button);
            picktimebutton.Hint=RaffleBuyerSignUpScreenData.BirthDateTextFieldPlaceholder;
            picktimebutton.Click += (object sender, EventArgs e) => {
                showDatePickerDialog ();
            };
            countryspinner = view.FindViewById<Spinner> (Resource.Id.signup_country_spinner);
            countryspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                if(stateandprovincespinneradapter!=null){
                    stateandprovincespinneradapter.ChangeShowList(provincespinner,listcountry[e.Position].country_code);
                    stateandprovincespinneradapter.NotifyDataSetChanged ();
                }
                countryspinner.Tag=e.Position;
            };
            provincespinner= view.FindViewById<Spinner> (Resource.Id.signup_province_spinner);
            provincespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                provincespinner.Tag=e.Position;
            };

            raffleresultspinner= view.FindViewById<Spinner> (Resource.Id.signup_raffleresult_spinner);
            resultadapter = new CustomResultAndMessageSpinnerAdapter (nn_activity, GlobalVariable.ResultAndMessageList);
            raffleresultspinner.Adapter = resultadapter;
            resultadapter.NotifyDataSetChanged ();
            raffleresultspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                raffleresultspinner.Tag=e.Position;
            };

            marketmesagespinner= view.FindViewById<Spinner> (Resource.Id.signup_marketingmessage_spinner);

            messaegadapter = new CustomResultAndMessageSpinnerAdapter (nn_activity, GlobalVariable.ResultAndMessageList);
            marketmesagespinner.Adapter = messaegadapter;
            messaegadapter.NotifyDataSetChanged ();

            marketmesagespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                marketmesagespinner.Tag=e.Position;
            };

            firstname_edittext = view.FindViewById<EditText> (Resource.Id.signup_firstname_edittext);
            SetEditTextMaximumLength (firstname_edittext,100);
            firstname_edittext.Hint = RaffleBuyerSignUpScreenData.FirstNameTextFieldPlaceholder;

            lastname_edittext = view.FindViewById<EditText> (Resource.Id.signup_lastname_edittext);
            SetEditTextMaximumLength (lastname_edittext,100);
            lastname_edittext.Hint = RaffleBuyerSignUpScreenData.LastNameTextFieldPlaceholder;

            mobilephone_edittext = view.FindViewById<EditText> (Resource.Id.signup_mobilephone_edittext);
            SetEditTextMaximumLength (mobilephone_edittext,20);
            mobilephone_edittext.InputType = global::Android.Text.InputTypes.ClassPhone;
            mobilephone_edittext.Hint = RaffleBuyerSignUpScreenData.MobilePhoneTextFieldPlaceholder;

            email_edittext = view.FindViewById<EditText> (Resource.Id.signup_email_edittext);
            SetEditTextMaximumLength (email_edittext,60);
            if(!string.IsNullOrEmpty(nn_email)){
                email_edittext.Text = nn_email;
            }
            email_edittext.Hint = RaffleBuyerSignUpScreenData.EmailTextFieldPlaceholder;

            confirmemail_edittext = view.FindViewById<EditText> (Resource.Id.signup_reemail_edittext);
            SetEditTextMaximumLength (confirmemail_edittext,60);
            confirmemail_edittext.Hint=RaffleBuyerSignUpScreenData.EmailConfirmTextFieldPlaceholder;

            address1_edittext = view.FindViewById<EditText> (Resource.Id.signup_address1_edittext);
            SetEditTextMaximumLength (address1_edittext,100);
            address1_edittext.Hint = RaffleBuyerSignUpScreenData.Address1TextFieldPlaceholder;

            address2_edittext = view.FindViewById<EditText> (Resource.Id.signup_address2_edittext);
            SetEditTextMaximumLength (address2_edittext,100);
            address2_edittext.Hint = RaffleBuyerSignUpScreenData.Address2TextFieldPlaceholder;

            city_edittext = view.FindViewById<EditText> (Resource.Id.signup_city_edittext);
            SetEditTextMaximumLength (city_edittext,50);
            city_edittext.Hint=RaffleBuyerSignUpScreenData.CityTextFieldPlaceholder;

            postcode_edittext = view.FindViewById<EditText> (Resource.Id.signup_postal_edittext);
            SetEditTextMaximumLength (postcode_edittext,20);
            postcode_edittext.Hint=RaffleBuyerSignUpScreenData.ZipcodeTextFieldPlaceholder;

            TextView basicinfo=view.FindViewById<TextView> (Resource.Id.signup_basicinfo_textview);
            basicinfo.Text = RaffleBuyerSignUpScreenData.BasicInfoLabelText;

            TextView contactinfo=view.FindViewById<TextView> (Resource.Id.signup_contactinfo_textview);
            contactinfo.Text = RaffleBuyerSignUpScreenData.ContactInfoLabelText;

            TextView address=view.FindViewById<TextView> (Resource.Id.signup_addressinfo_textview);
            address.Text = RaffleBuyerSignUpScreenData.AddressInfoLabelText;

            TextView communicateraffle=view.FindViewById<TextView> (Resource.Id.signup_communicateraffle_textview);
            communicateraffle.Text = RaffleBuyerSignUpScreenData.RaffleResultsLabelText;

            TextView receivecharity=view.FindViewById<TextView> (Resource.Id.signup_receivecharity_textview);
            receivecharity.Text = RaffleBuyerSignUpScreenData.CharityMarketingMessagesLabelText;

            Button createaccountbutton = view.FindViewById<Button> (Resource.Id.signup_createaccount_button);
            createaccountbutton.Text = RaffleBuyerSignUpScreenData.CreateAccountBtnTitle;
            createaccountbutton.Click+= (object sender, EventArgs e) => {

                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[14];
                for(int i=0;i<flags.Length;i++){
                    string message="";
                    if(i==0){
                        message="First Name";
                    }
                    if(i==1){
                        message="Last Name";
                    }
                    if(i==2){
                        message="Mobile Phone";
                    }
                    if(i==3){
                        message="Email";
                    }
                    if(i==4){
                        message="Email Confirm";
                    }
                    if(i==5){
                        message="Address1";
                    }
                    if(i==6){
                        message="Address2";
                    }
                    if(i==7){
                        message="City";
                    }
                    if(i==8){
                        message="Postcode";
                    }
                    if(i==9){
                        message="Country";
                    }
                    if(i==10){
                        message="State And Province";
                    }
                    if(i==11){
                        message="Raffle Results";
                    }
                    if(i==12){
                        message="Market Message";
                    }
                    if(i==13){
                        message="Birthdate";
                    }
                    flags[i]=new FormatCheckFlagObject(message);
                }

                string firstname = firstname_edittext.Text;
                string lastname=lastname_edittext.Text;
                string mobilephone=mobilephone_edittext.Text;
                string email=email_edittext.Text;
                string reemail=confirmemail_edittext.Text;
                string address1=address1_edittext.Text;
                string address2=address2_edittext.Text;
                string city=city_edittext.Text;
                string postcode=postcode_edittext.Text;

                string country=countryspinner.Tag==null?"":listcountry[(int)countryspinner.Tag].country_code;
                string stateandprovince=provincespinner.Tag==null?"":stateandprovincespinneradapter.showlist[(int)provincespinner.Tag].state_province_abbrev;

                string raffleresults=raffleresultspinner.Tag==null?"":GlobalVariable.ResultAndMessageList[(int)raffleresultspinner.Tag];
                string marketmesage=marketmesagespinner.Tag==null?"":GlobalVariable.ResultAndMessageList[(int)marketmesagespinner.Tag];

                string datetime=picktimebutton.Text;

                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(reemail,FormatManager.FormatOption.Email)){
                    flags[4].flag=true;
                }
                if(!email.Equals(reemail)){
                    flags[4].flag=false;
                }
                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(postcode.Equals("")){
                    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;
                    }
                }
                if(totalfalg==true){

                    AddSpinner(rootlayout,RaffleBuyerSignUpScreenData.LoadingScreenTextCreate);

                    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);

                    App.INSTANCE.networknamager.Register (paramdic,(Tap5050WebResponse response)=>{
                        nn_activity.RunOnUiThread(()=>{
                            RemoveSpinner (rootlayout);
                        });
                        if(response.available){
                            if((response.parsedobject as Register).result_success.Equals("Y")) {
                                nn_activity.ShowCustomAlterDialogFragment(RaffleBuyerSignUpScreenData.AlertScreenCreateAccountRespondTitle,RaffleBuyerSignUpScreenData.AlertScreenCreateAccountRespondSuccessMessage,"OK",null,"successdialog.buyersignup.success");
                            }
                            else if((response.parsedobject as Register).result_success.Equals("N")){
                                nn_activity.ShowCustomAlterDialogFragment((response.parsedobject as Register).err_message,"OK",null,"invalidedialog.buyersignup.failed");
                            }
                        }
                        else{
                            nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,"Ok",null,"exceptiondialog.buyersignup.failed");
                        }
                    });

                }
                else if(!email.Equals(reemail)){
                    Toast.MakeText(nn_activity,RaffleBuyerSignUpScreenData.AlertScreenEmailNotMatchTitle+"\n"+RaffleBuyerSignUpScreenData.AlertScreenEmailNotMatchMessage,ToastLength.Long).Show();
                }
                else if(totalfalg==false){
                    string message="Please check:\n";
                    for(int i=0;i<flags.Length;i++){
                        if(flags[i].flag==false){
                            if(i!=flags.Length-1){
                                message+=flags[i].message+"\n";
                            }else{
                                message+=flags[i].message+".";
                            }
                        }
                    }
                    nn_activity.ShowCustomAlterDialogFragment(RaffleBuyerSignUpScreenData.AlertScreenFormatErrorTitle,message,"OK",null,"formatcheckdialog");
                }

            };

            return view;
        }
Exemple #7
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            nn_email = Intent.GetStringExtra ("autofillemail") ?? "";

            getcountryflag = false;
            getprovincestate = false;

            SetContentView (Resource.Layout.signup);

            rootlayout = (RelativeLayout)FindViewById (Resource.Id.rootlayout);

            SetTitleBarText (RegisterScreenData.Screentitle);
            SetTitleLeftImg (TapUtil.defaulticon);
            AddSpinner (RegisterScreenData.LoadingScreenTextInit);

            RelativeLayout backcontainer=(RelativeLayout)rootlayout.FindViewById (Resource.Id.header_back_relativelayout);
            backcontainer.Visibility = ViewStates.Visible;
            backimg = (ImageView)rootlayout.FindViewById (Resource.Id.header_backimg_imageview);
            backimg.Click+= (object sender, EventArgs e) => {
                Finish();
            };

            TextView basicinfo=FindViewById<TextView> (Resource.Id.signup_basicinfo_textview);
            basicinfo.Text = RegisterScreenData.BasicInfoLabelText;

            TextView contactinfo=FindViewById<TextView> (Resource.Id.signup_contactinfo_textview);
            contactinfo.Text = RegisterScreenData.ContactInfoLabelText;

            TextView address=FindViewById<TextView> (Resource.Id.signup_address_textview);
            address.Text = RegisterScreenData.AddressInfoLabelText;

            TextView communicateraffle=FindViewById<TextView> (Resource.Id.signup_communicateraffle_textview);
            communicateraffle.Text = RegisterScreenData.RaffleResultsLabelText;

            TextView receivecharity=FindViewById<TextView> (Resource.Id.signup_receivecharity_textview);
            receivecharity.Text = RegisterScreenData.CharityMarketingMessagesLabelText;

            picktimebutton = FindViewById<Button> (Resource.Id.signup_birthday_button);
            picktimebutton.Hint=RegisterScreenData.BirthDateTextFieldPlaceholder;
            picktimebutton.Click += (object sender, EventArgs e) => {
                showDatePickerDialog ();
            };

            countryspinner = FindViewById<Spinner> (Resource.Id.signup_country_spinner);
            countryspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                if(stateandprovincespinneradapter!=null){
                stateandprovincespinneradapter.ChangeShowList(provincespinner,listcountry[e.Position].country_code);
                stateandprovincespinneradapter.NotifyDataSetChanged ();
                }
                countryspinner.Tag=e.Position;
            };

            provincespinner= FindViewById<Spinner> (Resource.Id.signup_province_spinner);
            provincespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                provincespinner.Tag=e.Position;
            };

            raffleresultspinner= FindViewById<Spinner> (Resource.Id.signup_raffleresult_spinner);

            resultadapter = new CustomResultAndMessageSpinnerAdapter (this, GlobalVariable.ResultAndMessageList);
            raffleresultspinner.Adapter = resultadapter;
            resultadapter.NotifyDataSetChanged ();

            raffleresultspinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                raffleresultspinner.Tag=e.Position;
            };

            marketmesagespinner= FindViewById<Spinner> (Resource.Id.signup_marketingmessage_spinner);

            messaegadapter = new CustomResultAndMessageSpinnerAdapter (this, GlobalVariable.ResultAndMessageList);
            marketmesagespinner.Adapter = messaegadapter;
            messaegadapter.NotifyDataSetChanged ();

            marketmesagespinner.ItemSelected+= (object sender, AdapterView.ItemSelectedEventArgs e) => {
                marketmesagespinner.Tag=e.Position;
            };

            firstname_edittext = FindViewById<EditText> (Resource.Id.signup_firstname_edittext);
            SetEditTextMaximumLength (firstname_edittext,100);
            firstname_edittext.Hint = RegisterScreenData.FirstNameTextFieldPlaceholder;

            lastname_edittext = FindViewById<EditText> (Resource.Id.signup_lastname_edittext);
            SetEditTextMaximumLength (lastname_edittext,100);
            lastname_edittext.Hint = RegisterScreenData.LastNameTextFieldPlaceholder;

            mobilephone_edittext = FindViewById<EditText> (Resource.Id.signup_mobilephone_edittext);
            SetEditTextMaximumLength (mobilephone_edittext,20);
            mobilephone_edittext.InputType = global::Android.Text.InputTypes.ClassPhone;
            mobilephone_edittext.Hint = RegisterScreenData.MobilePhoneTextFieldPlaceholder;

            email_edittext = FindViewById<EditText> (Resource.Id.signup_email_edittext);
            SetEditTextMaximumLength (email_edittext,60);
            if(!string.IsNullOrEmpty(nn_email)){
                email_edittext.Text = nn_email;
            }
            email_edittext.Hint = RegisterScreenData.EmailTextFieldPlaceholder;

            confirmemail_edittext = FindViewById<EditText> (Resource.Id.signup_reemail_edittext);
            SetEditTextMaximumLength (confirmemail_edittext,60);
            confirmemail_edittext.Hint = RegisterScreenData.EmailConfirmTextFieldPlaceholder;

            address1_edittext = FindViewById<AutoCompleteTextView> (Resource.Id.signup_address1_edittext);
            SetEditTextMaximumLength (address1_edittext,100);
            address1_edittext.Hint = RegisterScreenData.Address1TextFieldPlaceholder;
            address1_edittext.Adapter=new GooglePlacesAutocompleteAdapter(this);
            address1_edittext.OnItemClickListener = this;
            address1_edittext.Threshold = 3;

            address2_edittext = FindViewById<EditText> (Resource.Id.signup_address2_edittext);
            SetEditTextMaximumLength (address2_edittext,100);
            address2_edittext.Hint = RegisterScreenData.Address2TextFieldPlaceholder;

            city_edittext = FindViewById<EditText> (Resource.Id.signup_city_edittext);
            SetEditTextMaximumLength (city_edittext,50);
            city_edittext.Hint = RegisterScreenData.CityTextFieldPlaceholder;

            postcode_edittext = FindViewById<EditText> (Resource.Id.signup_postal_edittext);
            SetEditTextMaximumLength (postcode_edittext,20);
            postcode_edittext.Hint = RegisterScreenData.ZipcodeTextFieldPlaceholder;

            MobileBarcodeScanner.Initialize (Application);
            scanner = new MobileBarcodeScanner();

            //			Button scanlicencebut=FindViewById<Button> (Resource.Id.signup_scanlicence_button);
            //			scanlicencebut.Click+=async delegate {
            //				//Tell our scanner to use the default overlay
            //				scanner.UseCustomOverlay = false;
            //
            //				//We can customize the top and bottom text of the default overlay
            //				scanner.TopText = "Hold the camera up to the barcode\nAbout 6 inches away";
            //				scanner.BottomText = "Wait for the barcode to automatically scan!";
            //
            //				//Start scanning
            //				var result = await scanner.Scan();
            //
            //				HandleScanResult(result);
            //			};

            Button createaccountbutton = FindViewById<Button> (Resource.Id.signup_createaccount_button);
            createaccountbutton.Text = RegisterScreenData.CreateAccountBtnTitle;
            createaccountbutton.Click+= (object sender, EventArgs e) => {

                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[14];
                for(int i=0;i<flags.Length;i++){
                    string message="";
                    if(i==0){
                        message="First Name";
                    }
                    if(i==1){
                        message="Last Name";
                    }
                    if(i==2){
                        message="Mobile Phone";
                    }
                    if(i==3){
                        message="Email";
                    }
                    if(i==4){
                        message="Email Confirm";
                    }
                    if(i==5){
                        message="Address1";
                    }
                    if(i==6){
                        message="Address2";
                    }
                    if(i==7){
                        message="City";
                    }
                    if(i==8){
                        message="Postcode";
                    }
                    if(i==9){
                        message="Country";
                    }
                    if(i==10){
                        message="State And Province";
                    }
                    if(i==11){
                        message="Raffle Results";
                    }
                    if(i==12){
                        message="Market Message";
                    }
                    if(i==13){
                        message="Birthdate";
                    }
                    flags[i]=new FormatCheckFlagObject(message);
                }

                string firstname = firstname_edittext.Text;
                string lastname=lastname_edittext.Text;
                string mobilephone=mobilephone_edittext.Text;
                string email=email_edittext.Text;
                string reemail=confirmemail_edittext.Text;
                string address1=address1_edittext.Text;
                string address2=address2_edittext.Text;
                string city=city_edittext.Text;
                string postcode=postcode_edittext.Text;

                string country=countryspinner.Tag==null?"":listcountry[(int)countryspinner.Tag].country_code;
                string stateandprovince=provincespinner.Tag==null?"":stateandprovincespinneradapter.showlist[(int)provincespinner.Tag].state_province_abbrev;

                string raffleresults=raffleresultspinner.Tag==null?"":GlobalVariable.ResultAndMessageList[(int)raffleresultspinner.Tag];
                string marketmesage=marketmesagespinner.Tag==null?"":GlobalVariable.ResultAndMessageList[(int)marketmesagespinner.Tag];

                string datetime=picktimebutton.Text;

                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(reemail,FormatManager.FormatOption.Email)){
                    flags[4].flag=true;
                }
                if(!email.Equals(reemail)){
                    flags[4].flag=false;
                }
                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;
                }
                //postcode can be empty
                if(postcode.Equals("")){
                    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;
                    }
                }
                if(totalfalg==true && email.Equals(reemail)){

                    AddSpinner(RegisterScreenData.LoadingScreenTextCreate);

                    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);
            //					//try to create new user
                    App.INSTANCE.networknamager.Register (paramdic,(Tap5050WebResponse response)=>{
                        this.RunOnUiThread(()=>{
                            RemoveSpinner ();
                        });
                        if(response.available){
                            if((response.parsedobject as Register).result_success.Equals("Y")) {
                                ShowCustomAlterDialogFragment(RegisterScreenData.AlertScreenCreateAccountRespondTitle,RegisterScreenData.AlertScreenCreateAccountRespondSuccessMessage,GlobalScreenData.DefaultPositive,null,"registersuccessdialog");
                            }
                            else if((response.parsedobject as Register).result_success.Equals("N")){
                                ShowCustomAlterDialogFragment((response.parsedobject as Register).err_message,GlobalScreenData.DefaultPositive,null,"registerfailedsdialog");
                            }
                        }
                        else{
                            ShowCustomAlterDialogFragment(response.exceptionreport.errormessage,GlobalScreenData.DefaultPositive,null,"registerexceptiondialog");
                        }
                    });

                }
                else if(!email.Equals(reemail)){
                    Toast.MakeText(this,RegisterScreenData.AlertScreenEmailNotMatchTitle+"\n"+RegisterScreenData.AlertScreenEmailNotMatchMessage,ToastLength.Long).Show();
                }
                else if(totalfalg==false){
                    string message="Please check:\n";
                    for(int i=0;i<flags.Length;i++){
                        if(flags[i].flag==false){
                            if(i!=flags.Length-1){
                                message+=flags[i].message+"\n";
                            }else{
                                message+=flags[i].message+".";
                            }
                        }
                    }
                    ShowCustomAlterDialogFragment(RegisterScreenData.AlertScreenFormatErrorTitle,message,GlobalScreenData.DefaultPositive,null,"formatcheckdialog");
                }

            };
            GetCountryStateAndProivince ();
        }
        public void ResetPassWord()
        {
            string renewpass = renewpassedittext.Text;
            string newpass = newpassedittext.Text;
            string oldpass =oldpassedittext.Text;
            bool formaterror = false;
            if(oldpass.Equals(newpass)){
                nn_activity.ShowCustomAlterDialogFragment(ResetPasswordScreenData.NewPassCanNotBeSame,GlobalScreenData.DefaultPositive,null,"invalide.account.newpasscannotbesame");
                return;
            }
            if (renewpass.Equals (newpass)) {

                FormatCheckFlagObject[] itemstatus=new FormatCheckFlagObject[4];
                itemstatus [0] = new FormatCheckFlagObject (ResetPasswordScreenData.FormatErrorLength);
                itemstatus [1] = new FormatCheckFlagObject (ResetPasswordScreenData.FormatErrorDigit);
                itemstatus [2] = new FormatCheckFlagObject (ResetPasswordScreenData.FormatErrorLowerCase);
                itemstatus [3] = new FormatCheckFlagObject (ResetPasswordScreenData.FormatErrorUpperCase);
                if (FormatManager.chechinput (newpass, FormatManager.FormatOption.Passwordlength)) {
                    itemstatus [0].flag = true;
                } else {
                    formaterror = true;
                }
                if (FormatManager.chechinput (newpass,FormatManager.FormatOption.Passwordcontainsdigit)) {
                    itemstatus [1].flag= true;
                } else {
                    formaterror = true;
                }
                if (FormatManager.chechinput (newpass,FormatManager.FormatOption.Passwordlowercase)) {
                    itemstatus [2].flag= true;
                }  else {
                    formaterror = true;
                }
                if (FormatManager.chechinput (newpass,FormatManager.FormatOption.Passworduppercase)) {
                    itemstatus [3].flag= true;
                }  else {
                    formaterror = true;
                }

                if(formaterror){
                    string formaterrorinfo = ResetPasswordScreenData.FormatErrorPrefix;

                    for(int i=0;i<itemstatus.Length;i++){
                        if(itemstatus[i].flag==false){
                            if(i!=itemstatus.Length-1){
                                formaterrorinfo+=itemstatus[i].message+","+"\n";
                            }else{
                                formaterrorinfo+=itemstatus[i].message+".";
                            }
                        }
                    }
                    nn_activity.ShowCustomAlterDialogFragment(ResetPasswordScreenData.AlertScreenFormatErrorTitle,formaterrorinfo,GlobalScreenData.DefaultPositive,null,"formatcheckdialog");
                }

                //call web functions
                else {

                    nn_activity.AddSpinner (ResetPasswordScreenData.ResetLoadingScreenText);

                    Dictionary<string,string> parameters =new Dictionary<string, string>();
                    parameters.Add("token_id",GlobalVariable.token_id);
                    parameters.Add("new_password",newpass);
                    parameters.Add("old_password",oldpass);

                    //change pass
                    App.INSTANCE.networknamager.InAppResetPassword (parameters,(Tap5050WebResponse response)=>{
                        nn_activity.RunOnUiThread(()=>{
                            nn_activity.RemoveSpinner();
                        });

                        if(response.available){
                            var result=(Tap5050Result)response.parsedobject;
                            if(result.result_success.Equals("Y")){
                                nn_activity.ShowCustomAlterDialogFragment(ResetPasswordScreenData.SuccessResetTitle,ResetPasswordScreenData.SuccessResetMessage,GlobalScreenData.DefaultPositive,null,"success.account.updated");
                            }else{
                                nn_activity.ShowCustomAlterDialogFragment(result.err_message,GlobalScreenData.DefaultPositive,null,"invalide.account.resetfailed");
                            }
                        }
                        else{
                            nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.account.resetpass");
                        }

                    });

                }

            }else {
                nn_activity.ShowCustomAlterDialogFragment(ResetPasswordScreenData.NewPassNotMatch,GlobalScreenData.DefaultPositive,null,"invalide.account.passdonotmatch");
            }
        }
Exemple #9
0
        public void OnLoginClick(object sender, EventArgs e)
        {
            ThreadPool.QueueUserWorkItem((object obj) =>
            {
                this.RunOnUiThread(() =>
                {
                    AddSpinner(LoginScreenData.LoadingScreenTextLogin);
                });
                MainActivity.serversem.Wait();
                FormatCheckFlagObject[] flagarray = new FormatCheckFlagObject[2];
                for (int i = 0; i < flagarray.Length; i++)
                {
                    string message = "";
                    switch (i)
                    {
                        case 0:
                            message = "Username";
                            break;
                        case 1:
                            message = "Password";
                            break;
                    }
                    flagarray[i] = new FormatCheckFlagObject(message);
                }
                if (FormatManager.chechinput(loginusername.Text, FormatManager.FormatOption.Email))
                {
                    flagarray[0].flag = true;
                }
                if (FormatManager.chechinput(loginpass.Text, FormatManager.FormatOption.Regular))
                {
                    flagarray[1].flag = true;
                }
                bool totalflag = true;
                foreach (var flagobj in flagarray)
                {
                    if (!flagobj.flag)
                    {
                        totalflag = false;
                    }
                }
                if (totalflag == true)
                {

                    Dictionary<string, string> parameters = new Dictionary<string, string>();
                    parameters.Add("username", loginusername.Text);
                    parameters.Add("password", loginpass.Text);
                    parameters.Add("app_device_number", TapUtil.GetDeviceID());

                    App.INSTANCE.networknamager.Login(parameters, (Tap5050WebResponse response) =>
                    {

                        if (response.available)
                        {
                            if ((response.parsedobject as Login).loginsuccess.Equals("Y"))
                            {
                                GlobalVariable.username = loginusername.Text;
                                App.INSTANCE.databasemanager.SaveUsername(loginusername.Text);
                                Login loginreturn = (Login)response.parsedobject;
                                GlobalVariable.token_id = loginreturn.token_id;
                                Intent intent = new Intent(this, typeof(HomeScreen));
                                intent.AddFlags(ActivityFlags.NoAnimation);
                                StartActivity(intent);
                                this.Finish();
                            }
                            else if ((response.parsedobject as Login).loginsuccess.Equals("N"))
                            {
                                RunOnUiThread(() =>
                                {
                                    RemoveSpinner();
                                });
                                ShowCustomAlterDialogFragment((response.parsedobject as Login).err_message, GlobalScreenData.DefaultPositive, null, "loginresultdialog");
                            }

                        }
                        else
                        {
                            RunOnUiThread(() =>
                            {
                                RemoveSpinner();
                            });
                            ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle, response.exceptionreport.errormessage, GlobalScreenData.DefaultPositive, null, "exception.login.login");
                        }

                    });
                }
                else
                {
                    RunOnUiThread(() =>
                    {
                        RemoveSpinner();
                    });
                    ShowCustomAlterDialogFragment(LoginScreenData.LoginPassCheckInvalidTitle, GlobalScreenData.DefaultPositive, null, "formatcheckdialog");
                }
                MainActivity.serversem.TryRelease();
            });
        }
Exemple #10
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            string deviceid = TapUtil.GetDeviceID ();

            ScrollView rootscroller = new ScrollView (nn_activity);
            rootscroller.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            rootscroller.SetBackgroundResource (Resource.Color.soarnix_bg_gray);
            RelativeLayout relativelayout = new RelativeLayout (nn_activity);
            RelativeLayout.LayoutParams relativelayoutparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.MatchParent);
            relativelayout.LayoutParameters=relativelayoutparam;
            relativelayout.SetPadding(TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5), TapUtil.dptodx (5));
            relativelayout.SetBackgroundResource (Resource.Color.soarnix_bg_gray);

            //raffle request Card

            LayoutInflater inflator = LayoutInflater.From (nn_activity);

            LinearLayout noeventcard = (LinearLayout)inflator.Inflate (Resource.Layout.raffleroot_noeventcard, null);
            RelativeLayout.LayoutParams noeventcardreparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            noeventcard.LayoutParameters=noeventcardreparam;
            noeventcard.Id = TapUtil.generateViewId ();

            TextView hinttextview=(TextView)noeventcard.FindViewById(Resource.Id.rafflenoevent_hint_textview);
            hinttextview.Text=AboutScreenData.AboutnoraffleLabel;

            EditText charityinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_charityinput_edittext);
            charityinput.Hint=RaffleListScreenData.organizationNameTextFieldPlaceholder;

            EditText numberinput=(EditText)noeventcard.FindViewById(Resource.Id.rafflenoevent_phonenumber_edittext);
            numberinput.Hint=RaffleListScreenData.phoneNumberTextFieldPlaceholder;

            Button chritysubmitbutton=(Button)noeventcard.FindViewById(Resource.Id.rafflenoevent_charitysubmit_button);
            chritysubmitbutton.Text=RaffleListScreenData.sentBtnTitle;
            chritysubmitbutton.Click+= (object sender, EventArgs e) => {

                //set flags
                FormatCheckFlagObject[] flags=new FormatCheckFlagObject[2];
                for(int i=0;i<flags.Length;i++){
                    string message="";
                    if(i==0){
                        message=AboutScreenData.organizationNameTextFieldPlaceholder;
                    }
                    if(i==1){
                        message=AboutScreenData.phoneNumberTextFieldPlaceholder;
                    }
                    flags[i]=new FormatCheckFlagObject(message);
                }

                //
                if(FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.OnlyLetter)){
                    flags[0].flag=true;
                }
                if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
                    flags[1].flag=true;
                }
                bool totalfalg=true;
                foreach(var flagobj in flags){
                    if(!flagobj.flag){
                        totalfalg=false;
                    }
                }
                if(totalfalg){
                    SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,GlobalVariable.currentlocation,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
                }
                else{
                    string message="Please check:\n";
                    for(int i=0;i<flags.Length;i++){
                        if(flags[i].flag==false){
                            if(i!=flags.Length-1){
                                message+=flags[i].message+",";
                            }else{
                                message+=flags[i].message;
                            }
                        }
                    }
                    nn_activity.ShowCustomAlterDialogFragment(AboutScreenData.AlertScreenFormatErrorTitle,message,GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
                }
            //				if(FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)&&FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)&&FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //					SocialShareAndroid.Email (string.Format(RaffleListScreenData.RequestRaffleEmailBody,GlobalVariable.username,GlobalVariable.currentlocation,charityinput.Text,numberinput.Text),RaffleListScreenData.RequestRaffleEmailSubject,new string[]{RaffleListScreenData.RequestRaffleEmailTarget});
            //				}
            //				else if(!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Regular)||!FormatManager.chechinput(charityinput.Text,FormatManager.FormatOption.Regular)){
            //					nn_activity.ShowCustomAlterDialogFragment("Both input can not be empty",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventinput");
            //				}
            //				else if (!FormatManager.chechinput(numberinput.Text,FormatManager.FormatOption.Phone)){
            //					nn_activity.ShowCustomAlterDialogFragment("Please check format of your phone number",GlobalScreenData.DefaultPositive,null,"invalidedialog.raffleroot.noeventcardnumber");
            //				}

            };
            relativelayout.AddView (noeventcard);
            //tutorial card
            RelativeLayout tutorialcard = new RelativeLayout(nn_activity);
            RelativeLayout.LayoutParams tutorialcardparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            tutorialcardparam.AddRule (LayoutRules.Below,noeventcard.Id);
            tutorialcardparam.TopMargin = TapUtil.dptodx(10);
            tutorialcard.LayoutParameters=tutorialcardparam;
            tutorialcard.Id = TapUtil.generateViewId ();
            tutorialcard.SetBackgroundResource (Resource.Drawable.bg_relativelayout_grayround);
            tutorialcard.SetPadding(TapUtil.dptodx (20), TapUtil.dptodx (20), TapUtil.dptodx (20), TapUtil.dptodx (20));

            //tutorial label
            TextView tutoriallabel =new TextView(nn_activity);
            var tutorialparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            tutoriallabel.LayoutParameters = tutorialparam;
            tutoriallabel.Gravity = GravityFlags.CenterHorizontal;
            tutoriallabel.Text=AboutScreenData.TutorialLabel;
            tutoriallabel.TextSize=TapUtil.dptodx(6);
            tutoriallabel.SetTypeface (Typeface.Default, TypefaceStyle.Bold);
            tutoriallabel.Id = TapUtil.generateViewId ();

            LinearLayout tutorialcontainer = new LinearLayout (nn_activity);
            var tutorialcontainerparam=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            tutorialcontainerparam.AddRule (LayoutRules.Below, tutoriallabel.Id);
            tutorialcontainerparam.SetMargins (0, TapUtil.dptodx (5), 0, 0);
            tutorialcontainer.LayoutParameters = tutorialcontainerparam;
            tutorialcontainer.Orientation = global::Android.Widget.Orientation.Vertical;

            var tutorialitemparam=new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            tutorialitemparam.SetMargins (0,TapUtil.dptodx(15),0,0);
            tutorialitemparam.Gravity = GravityFlags.Center;

            TextView tutorial0label=new TextView(nn_activity);
            tutorial0label.Text=AboutScreenData.Tutorial0Label;
            tutorial0label.LayoutParameters = tutorialitemparam;
            tutorial0label.Gravity = GravityFlags.CenterHorizontal;
            tutorial0label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial0label.Tag = 0;
            tutorial0label.Click-=OnShowTutorialTextClick;
            tutorial0label.Click+=OnShowTutorialTextClick;

            TextView tutorial1label=new TextView(nn_activity);
            tutorial1label.Text=AboutScreenData.Tutorial1Label;
            tutorial1label.LayoutParameters = tutorialitemparam;
            tutorial1label.Gravity = GravityFlags.CenterHorizontal;
            tutorial1label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial1label.Tag = 1;
            tutorial1label.Click-=OnShowTutorialTextClick;
            tutorial1label.Click+=OnShowTutorialTextClick;

            TextView tutorial2label=new TextView(nn_activity);
            tutorial2label.Text=AboutScreenData.Tutorial2Label;
            tutorial2label.LayoutParameters = tutorialitemparam;
            tutorial2label.Gravity = GravityFlags.CenterHorizontal;
            tutorial2label.Tag = 2;
            tutorial2label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial2label.Click-=OnShowTutorialTextClick;
            tutorial2label.Click+=OnShowTutorialTextClick;

            TextView tutorial3label=new TextView(nn_activity);
            tutorial3label.Text=AboutScreenData.Tutorial3Label;
            tutorial3label.LayoutParameters = tutorialitemparam;
            tutorial3label.Gravity = GravityFlags.CenterHorizontal;
            tutorial3label.Tag = 3;
            tutorial3label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial3label.Click-=OnShowTutorialTextClick;
            tutorial3label.Click+=OnShowTutorialTextClick;

            TextView tutorial4label=new TextView(nn_activity);
            tutorial4label.Text=AboutScreenData.Tutorial4Label;
            tutorial4label.LayoutParameters = tutorialitemparam;
            tutorial4label.Gravity = GravityFlags.CenterHorizontal;
            tutorial4label.Tag = 4;
            tutorial4label.SetTextColor (Resources.GetColor(Resource.Color.iosblue));
            tutorial4label.Click-=OnShowTutorialTextClick;
            tutorial4label.Click+=OnShowTutorialTextClick;

            //version7 add tutorial
            TextView tutorial5label = new TextView(nn_activity);
            tutorial5label.Text = AboutScreenData.Tutorial5Label;
            tutorial5label.LayoutParameters = tutorialitemparam;
            tutorial5label.Gravity = GravityFlags.CenterHorizontal;
            tutorial5label.Tag = 5;
            tutorial5label.SetTextColor(Resources.GetColor(Resource.Color.iosblue));
            tutorial5label.Click -= OnShowTutorialTextClick;
            tutorial5label.Click += OnShowTutorialTextClick;

            tutorialcontainer.AddView (tutorial0label);
            tutorialcontainer.AddView (tutorial1label);
            tutorialcontainer.AddView (tutorial2label);
            tutorialcontainer.AddView (tutorial3label);
            tutorialcontainer.AddView (tutorial4label);
            tutorialcontainer.AddView(tutorial5label);

            tutorialcard.AddView (tutoriallabel);
            tutorialcard.AddView (tutorialcontainer);

            relativelayout.AddView (tutorialcard);

            //			LikeView likeview = new LikeView (nn_activity);
            //			var likeviewparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent,RelativeLayout.LayoutParams.WrapContent);
            //			likeviewparam.AddRule (LayoutRules.Below, tutorialcard.Id);
            //			likeview.LayoutParameters = likeviewparam;
            //			likeview.SetLikeViewStyle (LikeView.Style.Button);
            //			likeview.AlwaysDrawnWithCacheEnabled = true;
            //			likeview.SetFragment (this);
            //			likeview.SetObjectIdAndType( "https://www.facebook.com/tap5050/?ref=ts&fref=ts",LikeView.ObjectType.Page);
            //			relativelayout.AddView (likeview);
            TextView uniqueidtextview = new TextView (nn_activity);
            uniqueidtextview.SetTextColor (Color.LightGray);
            RelativeLayout.LayoutParams textparam=new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent,RelativeLayout.LayoutParams.WrapContent);
            textparam.AddRule (LayoutRules.CenterHorizontal);
            textparam.AddRule (LayoutRules.AlignParentBottom);
            textparam.AddRule (LayoutRules.Below,tutorialcard.Id);
            textparam.TopMargin = TapUtil.dptodx(20);
            uniqueidtextview.LayoutParameters = textparam;
            uniqueidtextview.Text=deviceid;
            uniqueidtextview.Id = TapUtil.generateViewId ();
            relativelayout.AddView (uniqueidtextview);
            //			Button showtutorialbut = new Button (nn_activity);
            //			RelativeLayout.LayoutParams showtutorialbutparam = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent,RelativeLayout.LayoutParams.WrapContent);
            //			showtutorialbutparam.AddRule (LayoutRules.Below, uniqueidtextview.Id);
            //			showtutorialbutparam.AddRule (LayoutRules.CenterHorizontal);
            //			showtutorialbut.LayoutParameters=showtutorialbutparam;
            //			showtutorialbut.SetBackgroundResource (Resource.Drawable.bg_button_bluebutton);
            //			showtutorialbut.SetTextColor (Color.White);
            //			showtutorialbut.Typeface = Typeface.DefaultBold;
            //			showtutorialbut.Id= TapUtil.generateViewId ();
            //			showtutorialbut.Text="Show Tutorial Video";
            //
            //			showtutorialbut.Click -= OnShowTutorialButtonClick;
            //			showtutorialbut.Click += OnShowTutorialButtonClick;
            //
            //			relativelayout.AddView (showtutorialbut);
            rootscroller.AddView (relativelayout);
            return rootscroller;
        }
		/********************************************************************************
		*Btn clicks
		********************************************************************************/

		public void CreateAccountClick()
		{
			//get all input****************************************************************************************
			string firstname = registerScreenView.firstNameTextField.Text;
			string lastname= registerScreenView.lastNameTextField.Text;
			string datetime=registerScreenView.birthDateTextField.Text.Length==0?
				"":((DateTime)registerScreenView.birthDatePickerView.datePicker.Date).ToString(@"yyyy\/MM\/dd");

			string mobilephone= registerScreenView.mobilePhoneTextField.Text;
			string email= registerScreenView.emailTextField.Text;
			string emailConfirm=registerScreenView.emailConfirmTextField.Text;

			string address1= registerScreenView.address1TextField.Text;
			string address2= registerScreenView.address2TextField.Text;
			string country=registerScreenView.countryTextField.Text.Length==0?
				"":((CustomPickerModel<Country>)registerScreenView.countryPickerView.pickerView.Model).selectedObject.country_code;
			string stateandprovince=registerScreenView.provanceTextField.Text.Length==0?
				"":((CustomPickerModel<StateAndProvince>)registerScreenView.provincePickerView.pickerView.Model).selectedObject.state_province_abbrev;
			string city=registerScreenView.cityTextField.Text;
			string postcode=registerScreenView.zipcodeTextField.Text;

			string raffleresults=registerScreenView.raffleResultTextField.Text.Length==0?
				"":((CustomPickerModel<string>)registerScreenView.raffleResultsPickerView.pickerView.Model).selectedObject;
			if (String.Equals (raffleresults, registerScreenView.listRaffleResultContactMethod [0])) {
				raffleresults = "NOCONTACT";
			}	
			string marketmesage=registerScreenView.CharityMarketingMessagesTextField.Text.Length==0?
				"":((CustomPickerModel<string>)registerScreenView.CharityMarketingMessagesPickerView.pickerView.Model).selectedObject;
			if (String.Equals (marketmesage, registerScreenView.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;
			}
			//zipcode can be empty 
			if(postcode.Equals("")){
				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;
				}
			}
				
			//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){  
				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);

				registerScreenView.Hide();
				initLoadingScreenView (RegisterScreenData.LoadingScreenTextCreate);
				CreateAccountWebCall (paramdic);  
			}
			else if(totalfalg==false)
			{
				//alert
				UIAlertController Alert = UIAlertController.Create (RegisterScreenData.AlertScreenFormatErrorTitle,
					RegisterScreenData.AlertScreenFormatErrorMessage(flags,messageArray), UIAlertControllerStyle.Alert);
				Alert.AddAction (UIAlertAction.Create (RegisterScreenData.AlertScreenFormatErrorCancelBtnTitle,
					UIAlertActionStyle.Cancel,
					null));
				PresentViewController (Alert, true, null);
			}	
			else{ 
				//alert
				UIAlertController Alert = UIAlertController.Create (RegisterScreenData.AlertScreenEmailNotMatchTitle,
					RegisterScreenData.AlertScreenEmailNotMatchMessage, UIAlertControllerStyle.Alert);
				Alert.AddAction (UIAlertAction.Create (RegisterScreenData.AlertScreenEmailNotMatchCancelBtnTitle,
					UIAlertActionStyle.Cancel,
					null));
				PresentViewController (Alert, true, null);
			} 
		}
Exemple #12
0
        public void OnUpdateAccount(object sender, EventArgs e)
        {
            FormatCheckFlagObject[] flags=new FormatCheckFlagObject[13];
            for(int i=0;i<flags.Length;i++){
                string message="";
                if(i==0){
                    message="First Name";
                }
                if(i==1){
                    message="Last Name";
                }
                if(i==2){
                    message="Mobile Phone";
                }
                if(i==3){
                    message="Email";
                }
                if(i==4){
                    message="Address1";
                }
                if(i==5){
                    message="Address2";
                }
                if(i==6){
                    message="City";
                }
                if(i==7){
                    message="Postcode";
                }
                if(i==8){
                    message="Country";
                }
                if(i==9){
                    message="State And Province";
                }
                if(i==10){
                    message="Raffle Results";
                }
                if(i==11){
                    message="Market Message";
                }
                if(i==12){
                    message="Birthdate";
                }
                flags[i]=new FormatCheckFlagObject(message);
            }

            string firstname = firstnameedittext.Text;
            string lastname=lasetnameedittext.Text;
            string mobilephone=mobilephoneedittext.Text;
            string email=emailedittext.Text;
            string address1=address1edittext.Text;
            string address2=address2edittext.Text;
            string city=cityedittext.Text;
            string postcode=postaledittext.Text;

            string country=countryspinner.Tag==null?"":listcountry[(int)countryspinner.Tag].country_code;
            string stateandprovince=provincespinner.Tag==null?"":stateandprovincespinneradapter.showlist[(int)provincespinner.Tag].state_province_abbrev;

            string raffleresults=raffleresultspinner.Tag==null?"":GlobalVariable.ResultAndMessageList[(int)raffleresultspinner.Tag];
            string marketmesage=charitymessagespinner.Tag==null?"":GlobalVariable.ResultAndMessageList[(int)charitymessagespinner.Tag];

            string datetime=birthdatebutton.Text;

            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(address1,FormatManager.FormatOption.Regular)){
                flags[4].flag=true;
            }
            if(FormatManager.chechinput(address2,FormatManager.FormatOption.Regular)||address2.Equals("")){
                flags[5].flag=true;
            }
            if(FormatManager.chechinput(city,FormatManager.FormatOption.Regular)){
                flags[6].flag=true;
            }
            if(FormatManager.chechinput(postcode,FormatManager.FormatOption.Regular)){
                flags[7].flag=true;
            }
            if(FormatManager.chechinput(country,FormatManager.FormatOption.Regular)){
                flags[8].flag=true;
            }
            if(FormatManager.chechinput(stateandprovince,FormatManager.FormatOption.Regular)){
                flags[9].flag=true;
            }
            if(FormatManager.chechinput(raffleresults,FormatManager.FormatOption.Regular)){
                flags[10].flag=true;
            }
            if(FormatManager.chechinput(marketmesage,FormatManager.FormatOption.Regular)){
                flags[11].flag=true;
            }
            if(FormatManager.chechinput(datetime,FormatManager.FormatOption.Date)){
                flags[12].flag=true;
            }
            bool totalfalg=true;
            foreach(var flagobj in flags){
                if(!flagobj.flag){
                    totalfalg=false;
                }
            }
            if(totalfalg==true){

                AddSpinner (rootview,EditAccountScreenData.LoadingScreenTextUpdate);

                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);

                //check token
                Dictionary<string,string> checktokenparameters =new Dictionary<string, string>();
                checktokenparameters.Add("token_id",GlobalVariable.token_id);
                App.INSTANCE.networknamager.CheckToken (checktokenparameters, (Tap5050WebResponse checktokenresponse)=>{
                    nn_activity.RunOnUiThread(()=>{
                        RemoveSpinner(rootview);
                    });
                    if (checktokenresponse.available) {
                        var result = (Tap5050Result)checktokenresponse.parsedobject;
                        if (result.result_success.Equals ("Y")) {
                            App.INSTANCE.networknamager.UpdateAccountInfo (paramdic,(Tap5050WebResponse response)=>{
                                if(response.available){
                                    if((response.parsedobject as Tap5050Result).result_success.Equals("Y")) {
                                        nn_activity.ShowCustomAlterDialogFragment(EditAccountScreenData.AlertScreenEditAccountRespondTitle,EditAccountScreenData.AlertScreenEditAccountRespondSuccessMessage,"OK",null,"editaccount.registersuccessdialog");
                                    }
                                    else if((response.parsedobject as Tap5050Result).result_success.Equals("N")){
                                        nn_activity.ShowCustomAlterDialogFragment(EditAccountScreenData.AlertScreenEditAccountRespondTitle,(response.parsedobject as Tap5050Result).err_message,"OK",null,"editaccount.registerfailedsdialog");
                                    }
                                }
                                else{
                                    nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,response.exceptionreport.errormessage,"Ok",null,"exceptiondialog.editaccount.update");
                                }
                            });
                        }
                        else {
                            nn_activity.ShowCustomAlterDialogFragment (GlobalScreenData.InvalidetokenTitle, GlobalScreenData.InvalidetokenMessage, "Ok", null,"invalidedialog.raffledetail.checktoken");
                        }
                    } else {
                        nn_activity.ShowCustomAlterDialogFragment(GlobalScreenData.WebExceptionTitle,checktokenresponse.exceptionreport.errormessage,GlobalScreenData.WebExceptionPositive,GlobalScreenData.WebExceptionNegative,"exceptiondialog.editaccount.update");
                    }

                });
            }
            else{
                string message="Pelase check:\n";
                for(int i=0;i<flags.Length;i++){
                    if(flags[i].flag==false){
                        if(i!=flags.Length-1){
                            message+=flags[i].message+",";
                        }else{
                            message+=flags[i].message;
                        }
                    }
                }
                nn_activity.ShowCustomAlterDialogFragment(EditAccountScreenData.AlertScreenFormatErrorTitle,message,"OK",null,"editaccount.formatcheckdialog");
            }
        }