예제 #1
0
        /// <summary>
        /// Gets the branches details.
        /// </summary>
        /// <param name="countryId">The country identifier.</param>
        /// <param name="cultureInfo">The culture information.</param>
        /// <returns></returns>
        public async Task GetBranchesDetails(int countryId, string cultureInfo)
        {
            try
            {
                SetActivityIndicatorBlurred(true);
                ActOpacity      = 1;
                MainStackLayout = false;
                PackingCygestPageLayoutOpacity = 0.4;
                Status = "Loading data...";
                var connected = CrossConnectivity.Current.IsConnected;

                if (connected)
                {
                    Branch = await _branchService.GetBranchDetailsAsync(countryId, cultureInfo, BrandId);

                    if (Branch.Count == 0 && _appViewModel.DefaultedCultureInfo != "fr-FR")
                    {
                        BranchModel tempBranch = new BranchModel
                        {
                            Id   = 0,
                            Code = "Unknown",
                            Name = "Unknown"
                        };
                        Branch.Add(tempBranch);
                    }
                    else
                    {
                        BranchModel tempBranch = new BranchModel
                        {
                            Id   = 0,
                            Code = "Inconnu",
                            Name = "Inconnu"
                        };
                        Branch.Add(tempBranch);
                    }

                    SetActivityIndicatorBlurred(false);
                    MainStackLayout = true;
                    PackingCygestPageLayoutOpacity = 1;
                    Status = "";
                }
            }
            catch (Exception e)
            {
                await _pageService.DisplayAlert(LblError, LblNoConnection, LblOk);

                DatabaseAccessAsync da = new DatabaseAccessAsync();
                da.InsertException(new PackingCygestExceptionModel
                {
                    Message = e.Message, StackTrace = e.StackTrace, TimeSpan = DateTime.Today.ToString(System.Globalization.CultureInfo.CurrentCulture), MethodName = e.Source
                });
            }
        }