Ejemplo n.º 1
0
        async void FirstTimeBindData()
        {
            try
            {
                if (!CommonLib.checkconnection())
                {
                    RacoonAlertPopup.textmsg = "Check your internet connection.";

                    await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());

                    return;
                }


                await App.Current.MainPage.Navigation.PushPopupAsync(new LoadPopup());



                var result = await CommonLib.CompanyListWithoutLogin(CommonLib.ws_MainUrl + "AccountApi/GetCompanyDetail?Id=1" + "");

                if (result != null)
                {
                    LoadPopup.CloseAllPopup();

                    fbUrl    = result.company.FacebookLink;
                    instaUrl = result.company.InstagramLink;

                    emailTxt.Text   = "Email: " + result.company.Email;
                    adrressTxt.Text = "Address: " + result.company.Address;

                    phoneTxt.Text = "Tlf: " + result.company.Tlf;
                }


                else
                {
                    LoadPopup.CloseAllPopup();
                    RacoonAlertPopup.textmsg = "Servor Error,Please after sometimes!";
                    await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());
                }
            }
            catch (Exception ex)
            {
                LoadPopup.CloseAllPopup();
                await App.Current.MainPage.DisplayAlert("", ex.Message, "OK");
            }
            finally
            {
            }
        }
        async void BindData()
        {
            try
            {
                if (!CommonLib.checkconnection())
                {
                    RacoonAlertPopup.textmsg = "Check your internet connection.";

                    await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());

                    return;
                }


                await App.Current.MainPage.Navigation.PushPopupAsync(new LoadPopup());



                emailID = Email.Text;

                password = Password.Text;

                string postData = "&email=" + emailID + "&password="******"";



                var result = await CommonLib.LoginUser(CommonLib.ws_MainUrl + "AccountApi/Login?" + postData);

                if (result != null && result.Status != 0)
                {
                    if (result.User.MainUserGrp == 2)
                    {
                        LoadPopup.CloseAllPopup();

                        loggedInUser objUser = new loggedInUser();
                        objUser.UserGroup = Convert.ToString(result.User.MainUserGrp);

                        objUser.userId = Convert.ToString(result.User.UserID);

                        objUser.UserName = result.User.UserName;

                        objUser.WifiInfo = result.User.Company.WifiInfo;

                        objUser.TotalCoffeeCups = Convert.ToString(result.User.TotalCoffeeCups);

                        objUser.UserCreateDate = result.User.UserCreateDate.ToString("MM/dd/yyyy");

                        objUser.BarcodeImageUrl = result.User.BarcodeImageUrl;

                        objUser.InstagramLink = result.User.Company.InstagramLink;

                        objUser.FacebookLink = result.User.Company.FacebookLink;

                        objUser.Address      = result.User.Company.Address;
                        objUser.OpeningHours = result.User.Company.OpeningHours;

                        objUser.lat = result.User.Company.lat;
                        objUser.lng = result.User.Company.lng;

                        App.Database.SaveLoggedUser(objUser);

                        LoginDetails.userId = Convert.ToString(result.User.UserID);

                        //RacoonAlertPopup.textmsg = result.msg;

                        //await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());
                        await Application.Current.MainPage.Navigation.PushAsync(new HomePage());
                    }
                    else
                    {
                        LoadPopup.CloseAllPopup();

                        loggedInUser objUser = new loggedInUser();
                        objUser.UserGroup     = Convert.ToString(result.User.MainUserGrp);
                        objUser.userId        = Convert.ToString(result.User.UserID);
                        objUser.InstagramLink = result.User.Company.InstagramLink;

                        objUser.FacebookLink = result.User.Company.FacebookLink;

                        App.Database.SaveLoggedUser(objUser);

                        LoginDetails.userId = Convert.ToString(result.User.UserID);



                        //RacoonAlertPopup.textmsg = result.msg;

                        //await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());

                        await Application.Current.MainPage.Navigation.PushAsync(new CompanyLogin());
                    }
                }

                else
                {
                    LoadPopup.CloseAllPopup();
                    RacoonAlertPopup.textmsg = result.msg;
                    await App.Current.MainPage.Navigation.PushPopupAsync(new RacoonAlertPopup());
                }
            }
            catch (Exception ex)
            {
                LoadPopup.CloseAllPopup();
                await App.Current.MainPage.DisplayAlert("", ex.Message, "OK");
            }
            finally
            {
            }
        }
Ejemplo n.º 3
0
        private void Popup_Disappearing(object sender, EventArgs e)
        {
            if (Device.RuntimePlatform == "iOS")
            {
                if (ConfirmVotePopup.isSave)
                {
                    for (int i = 0; i < Items.Count; i++)
                    {
                        Items[i].voteImag = "votepartiesNew1.png";
                    }
                }
                else
                {
                    Items[row_index].voteImag = "vote_button_green1.png";
                }
            }
            else
            {
                if (ConfirmVotePopup.isSave)
                {
                    Items = new InfiniteScrollCollection <PartyListModel>();
                    RaisePropertyChanged(nameof(Items)); // raise a property change in whatever way is right for your VM
                    Items.CollectionChanged += CollectionDidChange;

                    HitinProcess   = false;
                    pageindex      = 1;
                    getLeaderCount = 0;
                    totalcount     = 0;
                    IsFirstHit     = false;

                    Items = new InfiniteScrollCollection <PartyListModel>
                    {
                        OnLoadMore = async() =>
                        {
                            var items = new InfiniteScrollCollection <PartyListModel>();
                            if (totalcount > getLeaderCount && getLeaderCount != 0 || IsFirstHit == false)
                            {
                                if (!HitinProcess)
                                {
                                    HitinProcess  = true;
                                    IsLoadingMore = true;
                                    var response = await CommonLib.PartyList(CommonLib.ws_MainUrlMain + "CandidatureApi/Candidatures?" + "userId=" +
                                                                             LoginDetails.userId + "&pageIndex=" + pageindex + "&pageSize=" + pageSize);

                                    if (response.Status == 1)
                                    {
                                        if (LoginDetails.sessionId == response.SessionId)
                                        {
                                            pageindex++;
                                            IsFirstHit     = true;
                                            totalcount     = response.Count;
                                            getLeaderCount = response.Candidatures.Count;
                                            items          = GetItems(true, response.Candidatures, response.VoteButtonStatus, response.LabelStatus);
                                            IsLoadingMore  = false;
                                            HitinProcess   = false;
                                        }
                                        else
                                        {
                                            LoadPopup.CloseAllPopup();
                                            //await App.Current.MainPage.DisplayAlert("", "Your session is expired!", "ok");
                                            VoteAlertPopup.textmsg = "Your session is expired!";
                                            await App.Current.MainPage.Navigation.PushPopupAsync(new VoteAlertPopup());

                                            App.Current.MainPage = new Views.LogInPage();
                                        }
                                    }

                                    else
                                    {
                                        HitinProcess  = false;
                                        IsLoadingMore = false;
                                    }
                                }
                            }
                            //Call your Web API next items page.
                            //if (!ProductCategories.IsPull)
                            //    await Task.Delay(1200);

                            return(items);
                        }
                    };
                    Items.LoadMoreAsync();
                    //Items = new InfiniteScrollCollection<LeaderListModel>();
                    RaisePropertyChanged(nameof(Items)); // raise a property change in whatever way is right for your VM
                    Items.CollectionChanged += CollectionDidChange;
                }
            }
        }