예제 #1
0
        public async Task LeaderWinnerPikerSelect()
        {
            try
            {
                await Navigation.PushPopupAsync(new LoadPopup());


                string postData = "type=" + LeaderwinnerType;
                var    result   = await CommonLib.LeaderWinnerChart(CommonLib.ws_MainUrlMain + "LeaderApi/LeaderWinner?" + postData);

                if (result != null && result.Status != 0)
                {
                    _rateWinnerModel.Clear();
                    foreach (var item in result.chartData)
                    {
                        string name = item.Name.Replace("'", "");
                        // _rateWinnerModel.Add(new LeaderWinner { LeaderColor = item.LeaderColor, Name = name, PCode = item.PCode, per = item.per, PSName = item.PSName });
                    }

                    var LeaderWinnerchartConfigScript1 = GetLeaderWinnerChartScript();
                    var htmlLeaderWinner = GetHtmlWithLeaderWinnerChartConfig(LeaderWinnerchartConfigScript1);
                    LeaderWinner.Html = htmlLeaderWinner;


                    LoadPopup.CloseAllPopup1();
                }

                else
                {
                    VoteAlertPopup.textmsg = result.msg;
                    await App.Current.MainPage.Navigation.PushPopupAsync(new VoteAlertPopup());

                    LoadPopup.CloseAllPopup1();
                }
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("", ex.Message, "OK");

                LoadPopup.CloseAllPopup1();
            }
        }
예제 #2
0
        //Get all category
        public async void LoadCategory()
        {
            try
            {
                await Navigation.PushPopupAsync(new LoadPopup());



                var result = await CommonLib.GetCategory(CommonLib.ws_MainUrlMain + "CategoryApi/GetAllCategory");

                if (result != null && result.Status != 0)
                {
                    InitializeComponent();
                    Title = Resx.AppResources.category;
                    myList.ItemsSource = result.CategoryData;

                    LoadPopup.CloseAllPopup1();
                }

                else
                {
                    VoteAlertPopup.textmsg = result.msg;
                    await App.Current.MainPage.Navigation.PushPopupAsync(new VoteAlertPopup());

                    LoadPopup.CloseAllPopup1();
                }
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("", ex.Message, "OK");

                LoadPopup.CloseAllPopup1();
            }


            iosCheck();
        }
예제 #3
0
        public async void PackageDetails()
        {
            try
            {
                await Navigation.PushPopupAsync(new LoadPopup());



                var result = await CommonLib.GetPackage(CommonLib.ws_MainUrlMain + "PackageApi/GetPackage");

                if (result != null && result.Status != 0)
                {
                    price = result.details.PackagePrice;

                    try
                    {
                        string msg = string.Empty;
                        if (string.IsNullOrEmpty(txtcardNumber.Text))
                        {
                            msg += Resx.AppResources.entercard + Environment.NewLine;
                        }
                        else
                        {
                            if (txtcardNumber.Text.Length != 16)
                            {
                                msg += Resx.AppResources.entervalidcard + Environment.NewLine;
                            }
                        }
                        if (string.IsNullOrEmpty(txtCVVNumber.Text))
                        {
                            msg += Resx.AppResources.entercvv + Environment.NewLine;
                        }
                        else
                        {
                            if (txtCVVNumber.Text.Length != 3)
                            {
                                msg += Resx.AppResources.entervalidcvv + Environment.NewLine;
                            }
                        }
                        if (string.IsNullOrEmpty(txtMonth.Text))
                        {
                            msg += Resx.AppResources.entermonth + Environment.NewLine;
                        }
                        else
                        {
                            if (Convert.ToInt32(txtMonth.Text) > 12)
                            {
                                msg += Resx.AppResources.entervalidmonth + Environment.NewLine;
                            }
                        }
                        if (string.IsNullOrEmpty(txtYear.Text))
                        {
                            msg += Resx.AppResources.enteryear + Environment.NewLine;
                        }
                        else
                        {
                            int curYear = Convert.ToInt32(DateTime.Now.Year.ToString().Substring(1));
                            if (Convert.ToInt32(txtYear.Text) < curYear)
                            {
                                msg += Resx.AppResources.entervalidyear + Environment.NewLine;
                            }
                        }
                        if (!string.IsNullOrEmpty(msg))
                        {
                            LoadPopup.CloseAllPopup3();
                            await App.Current.MainPage.DisplayAlert("", msg, "OK");

                            return;
                        }


                        StripeCardInfo cardInfo = new StripeCardInfo();
                        cardInfo.CardNumber = txtcardNumber.Text;
                        cardInfo.CCV        = txtCVVNumber.Text;
                        cardInfo.Month      = Convert.ToInt32(txtMonth.Text);
                        cardInfo.Year       = Convert.ToInt32(txtYear.Text);


                        double Amount = Convert.ToDouble(price);


                        var paymentresult = await DependencyService.Get <ICustomStripeService>().MakePayment(cardInfo, Amount);


                        if (!paymentresult.IsPaid)
                        {
                            LoadPopup.CloseAllPopup3();
                            MyProfilePage.checkPremimun = false;

                            await App.Current.MainPage.DisplayAlert("", paymentresult.FailureMessage, "OK");



                            return;
                        }
                        else
                        {
                            await App.Current.MainPage.DisplayAlert("", Resx.AppResources.PaymentSuccessful, "OK");


                            MyProfilePage.checkPremimun = true;
                            PremimumUser();
                        }
                    }
                    catch (Exception)
                    {
                    }


                    LoadPopup.CloseAllPopup1();
                }

                else
                {
                    LoadPopup.CloseAllPopup1();
                }
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("", ex.Message, "OK");

                LoadPopup.CloseAllPopup1();
            }
        }