Пример #1
0
    public void CreateNewUser()
    {
        PlayerPrefs.SetString("username", usernameText.text);
        PlayerPrefs.SetString("email", emailText.text);
        UpdateScores();

        Debug.Log(PlayerPrefs.GetInt("userid"));
        if (PlayerPrefs.GetInt("userid") > 1)
        {
            UsersCount usercount = new UsersCount();
            usercount.UserIdCount = PlayerPrefs.GetInt("userid");

            string json = JsonUtility.ToJson(usercount);
            Debug.Log(json);
            reference.Child("UsersCount").SetRawJsonValueAsync(json);
        }
        SceneManager.LoadScene(1);
    }
Пример #2
0
        public static string GetUsersWithProducts(ProductShopContext context)
        {
            var users = new UsersCount()
            {
                Count      = context.Users.Count(u => u.ProductsSold.Any(a => a.BuyerId != null)),
                UserOutput = context.Users
                             //.AsEnumerable() // or else inmemory error from judge
                             .Where(u => u.ProductsSold.Any(p => p.Buyer != null))
                             .OrderByDescending(u => u.ProductsSold.Count)
                             .Take(10)
                             .Select(u => new UserModel()
                {
                    FirstName = u.FirstName,
                    LastName  = u.LastName,
                    Age       = u.Age,

                    SoldProducts = new SoldProducts()
                    {
                        Count    = u.ProductsSold.Count(ps => ps.Buyer != null),
                        Products = u.ProductsSold
                                   .Where(ps => ps.Buyer != null)
                                   .Select(ps => new Products()
                        {
                            Name  = ps.Name,
                            Price = ps.Price
                        })
                                   .OrderByDescending(p => p.Price)
                                   .ToList()
                    }
                })
                             .ToList()
            };

            var result = XmlConverter.Serialize(users, "Users");

            return(result);
        }
Пример #3
0
 public override string GetLabel()
 {
     return(("Cyberization.Alert." + MessageType + "." + MessageKey + ".Label").Translate()
            .Replace("{0}", UsersCount.ToString()));
 }