/// <summary>
        /// Saves the province.
        /// </summary>
        /// <param name="province">The province.</param>
        /// <returns></returns>
        public async Task <int> SaveProvince(EntityProvince province)
        {
            province.Id = UtilsService.GenerateId(province.Id);

            return(await Util.TryAsync(() => GetConnection().InsertOrReplaceAsync(province),
                                       failureMessage : "DataContext failed to SAVE EntityProvince"));
        }
Пример #2
0
 public SendCodeHandler(AppDbContext identityDbContext, IOptions <ApplicationOptions> options, UtilsService utils, IMessageProducerService messageProducer)
 {
     _identityDbContext = identityDbContext;
     _utils             = utils;
     _messageProducer   = messageProducer;
     _options           = options?.Value ?? throw new NullReferenceException(nameof(ApplicationOptions));
 }
        /// <summary>
        /// Saves the town.
        /// </summary>
        /// <param name="town">The town.</param>
        /// <returns></returns>
        public async Task <int> SaveTown(EntityTown town)
        {
            town.Id = UtilsService.GenerateId(town.Id);

            return(await Util.TryAsync(() => GetConnection().InsertOrReplaceAsync(town),
                                       failureMessage : "DataContext {SaveTown} failed to load EntityTown"));
        }
Пример #4
0
 public static void UpdateGroupMembers(string json)
 {
     if (group != null)
     {
         group.members = UtilsService.GetJsonArray <GroupMember>(json);
     }
 }
Пример #5
0
 public void UpdateTextFields()
 {
     name.text        = evt.name;
     description.text = evt.description;
     dates.text       = UtilsService.GetDate(evt.start_date) + " - " + UtilsService.GetDate(evt.end_date);
     place.text       = evt.place;
 }
        /// <summary>
        /// Saves the installer.
        /// </summary>
        /// <param name="installer">The installer.</param>
        /// <returns></returns>
        public async Task <int> SaveInstaller(EntityInstaller installer)
        {
            installer.Id = UtilsService.GenerateId(installer.Id);

            return(await Util.TryAsync(() => GetConnection().InsertOrReplaceAsync(installer),
                                       failureMessage : "DataContext failed to SAVE EntityInstaller"));
        }
    private IEnumerator _GetUserPhoto()
    {
        string    photoUrl = UserService.user.picture;
        Texture2D texture;

        if (photoUrl == null || photoUrl.Length < 1)
        {
            texture = UtilsService.GetDefaultProfilePhoto();
        }
        else
        {
            var www = new WWW(photoUrl);
            yield return(www);

            texture = www.texture;
        }

        if (texture != null)
        {
            UserService.user.profilePicture = texture;
        }

        UserService.user.profilePicture = texture;
        PlayerPrefs.SetString("MeuVivoMuseu:Email", emailField.text);
        LoadView("Home");
    }
Пример #8
0
        /// <summary>
        /// Gets the system user.
        /// </summary>
        /// <param name="emailAddress">The email address.</param>
        /// <param name="password">The password.</param>
        /// <returns></returns>
        internal static async Task <EntitySystemUser> GetSystemUser(string emailAddress, string password)
        {
            if (_users == null)
            {
                _users = new List <EntitySystemUser>();
            }

            EntitySystemUser user = _users.FirstOrDefault();

            if (user == null)
            {
                var streets = await GetStreets();

                user           = new EntitySystemUser();
                user.Id        = UtilsService.GenerateId(user.Id);
                user.FirstName = "System";
                user.LastName  = "Administrator";
                user.Username  = emailAddress;
                user.Password  = password;

                user.EmailAddress = "*****@*****.**";
                user.PhoneNumber  = "021 531 7856";
                user.MobileNumber = "082 421 1330";

                SetAddress(streets, UtilsService.RandomNumber(11, 99).ToString(), ref user);

                using (var db = new MancobaLocalDataApi(ConnectionFactory, PlatformCapabilities))
                {
                    var response = await db.SaveSystemUser(user);
                }
            }

            return(user);
        }
        /// <summary>
        /// Saves the suburb.
        /// </summary>
        /// <param name="suburb">The suburb.</param>
        /// <returns></returns>
        public async Task <int> SaveSuburb(EntitySuburb suburb)
        {
            suburb.Id = UtilsService.GenerateId(suburb.Id);

            return(await Util.TryAsync(() => GetConnection().InsertOrReplaceAsync(suburb),
                                       failureMessage : "DataContext failed to SAVE EntitySuburb"));
        }
        /// <summary>
        /// Saves the street.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task <int> SaveStreet(EntityStreet entity)
        {
            entity.Id = UtilsService.GenerateId(entity.Id);

            return(await Util.TryAsync(() => GetConnection().InsertOrReplaceAsync(entity),
                                       failureMessage : "DataContext failed to load Towns"));
        }
        /// <summary>
        /// Saves the application.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <returns></returns>
        public async Task <int> SaveApplication(EntityApplication application)
        {
            application.Id = UtilsService.GenerateId(application.Id);

            return(await Util.TryAsync(() => GetConnection().InsertOrReplaceAsync(application),
                                       failureMessage : "DataContext failed to SAVE EntityApplication"));
        }
Пример #12
0
    private IEnumerator _UpdateMission()
    {
        WWW missionRequest = MissionsService.GetMission(submission._mission);

        while (!missionRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        AlertsService.removeLoadingAlert();
        Debug.Log("Header: " + missionRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + missionRequest.text);

        if (missionRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            missions = UtilsService.GetJsonArray <Mission>(missionRequest.text);

            if (missions.Length >= 1)
            {
                title.text = missions[0].name;
            }
        }

        yield return(null);
    }
Пример #13
0
    private IEnumerator _GetAuthorPhoto()
    {
        string    photoUrl = post.author_photo;
        Texture2D texture;

        if (photoUrl == null || photoUrl.Length < 1)
        {
            texture = UtilsService.GetDefaultProfilePhoto();
        }
        else
        {
            Debug.Log("Current author photo url is " + photoUrl);
            var www = new WWW(photoUrl);
            yield return(www);

            texture = www.texture;
        }

        if (texture == null)
        {
            texture = UtilsService.GetDefaultProfilePhoto();
        }

        profilePic.texture = texture;
        UtilsService.SizeToParent(profilePic, 0f);
    }
        /// <summary>
        /// Saves the payment.
        /// </summary>
        /// <param name="providerPayment">The provider payment.</param>
        /// <returns></returns>
        public async Task <int> SavePayment(EntityProviderPayment providerPayment)
        {
            providerPayment.Id = UtilsService.GenerateId(providerPayment.Id);

            return(await Util.TryAsync(() => GetConnection().InsertOrReplaceAsync(providerPayment),
                                       failureMessage : "DataContext failed to load Towns"));
        }
Пример #15
0
    public void CancelPhoto()
    {
        camService.resetFields("default_avatar");
        camService.pickPreiveimage.texture = originalPhoto;

        UtilsService.SizeToParent(camService.pickPreiveimage, 0f);
    }
Пример #16
0
    public static WWW Update(User user, string photoBase64)
    {
        WWWForm updateForm = new WWWForm();

        updateForm.AddField("name", user.name);
        updateForm.AddField("email", user.email);
        updateForm.AddField("sex", user.sex);
        updateForm.AddField("phone", user.phone);
        updateForm.AddField("birth", UtilsService.GetInverseDate(user.birth));
        updateForm.AddField("password", user.password);
        updateForm.AddField("street", user.street);
        updateForm.AddField("complement", user.complement);
        updateForm.AddField("number", user.number);
        updateForm.AddField("neighborhood", user.neighborhood);
        updateForm.AddField("city", user.city);
        updateForm.AddField("state", user.state);
        updateForm.AddField("zipcode", user.zipcode);

        if (photoBase64 != null)
        {
            Debug.Log("sending picture to update");
            updateForm.AddField("picture", photoBase64);
        }

        WebService.route  = ENV.USERS_ROUTE;
        WebService.action = ENV.UPDATE_ACTION;
        WebService.id     = user._id.ToString();

        return(WebService.Post(updateForm));
    }
    private bool CheckFields()
    {
        bool validInstitution;

        if (institutionFieldObj.activeSelf)
        {
            if (institutionField.text.Length > 3)
            {
                validInstitution = true;
            }
            else
            {
                validInstitution = false;
            }
        }
        else
        {
            validInstitution = true;
        }

        return(UtilsService.CheckName(nameField.text) &&
               UtilsService.CheckEmail(emailField.text) &&
               UtilsService.CheckPassword(passwordField.text) &&
               userTypeDropdown.captionText.text != "Você é..." &&
               validInstitution);
    }
Пример #18
0
    public void CancelPhoto()
    {
        camService.resetFields("seeding_icon");
        camService.pickPreiveimage.texture = originalPhoto;

        UtilsService.SizeToParent(camService.pickPreiveimage, 0f);
    }
Пример #19
0
    private IEnumerator _GetPostImage()
    {
        string    photoUrl = post.picture;
        Texture2D texture;

        if (photoUrl == null || photoUrl.Length < 1)
        {
            yield break;
        }

        Debug.Log("current post photo url is " + photoUrl);
        var www = new WWW(photoUrl);

        yield return(www);

        if (www.responseHeaders["STATUS"] != HTML.HTTP_200)
        {
            yield break;
        }

        texture = www.texture;

        if (texture == null)
        {
            Debug.LogError("Failed to load texture url: " + photoUrl);
            yield break;
        }

        Destroy(loadingHolder);
        imagePost.texture = texture;
        UtilsService.SizeToParent(imagePost, 0f);
    }
Пример #20
0
 public void UpdateTextFields()
 {
     authorName.text = post.author_name;
     date.text       = UtilsService.GetDate(post.created_at);
     message.text    = post.text_msg;
     likes.text      = post.points.ToString();
 }
Пример #21
0
    private static string GetHash(string stepName)
    {
        int    userId = UserService.user._id;
        string param  = UtilsService.GetParam("Tutorial"),
               hash   = string.Format("{0}:{1}:{2}", param, userId, stepName);

        return(hash);
    }
Пример #22
0
 public DatesViewModel(INavigation navi, Page page)
 {
     uService = new UtilsService();
     GetDatesAsync();
     _page      = page;
     Navigation = navi;
     Refresh    = new Command(() => GetDatesAsync(true));
 }
Пример #23
0
    public void Logout()
    {
        string param = UtilsService.GetParam("Email");

        PlayerPrefs.DeleteKey(param);

        LoadView("Login");
    }
Пример #24
0
    public static void UpdateQuizzes(string json)
    {
        _quizzes = UtilsService.GetJsonArray <Quiz>(json);

        foreach (Quiz quiz in _quizzes)
        {
            quiz.BuildAnswers();
        }
    }
Пример #25
0
    public void rotateImage()
    {
        Texture2D texture = pickPreiveimage.texture as Texture2D;

        texture = UtilsService.rotateImage(texture);

        pickPreiveimage.texture = texture;
        photoBase64             = System.Convert.ToBase64String(texture.EncodeToJPG());
    }
Пример #26
0
    private void CheckAuthenticatedUser()
    {
        string param = UtilsService.GetParam("Email");

        if (PlayerPrefs.HasKey(param))
        {
            emailField.text = PlayerPrefs.GetString(param);
        }
    }
Пример #27
0
 public EmployeeListViewModel(INavigation navi, Page page)
 {
     uService   = new UtilsService();
     _page      = page;
     Navigation = navi;
     GetEmployeeListAsync();
     ShowEmployee = new Command(async() => await Navigation.PushAsync(new EmployeeDetailsPage(Navigation, SelectedEmployee)));
     Refresh      = new Command(() => GetEmployeeListAsync(true));
 }
Пример #28
0
 public UserProfileViewModel(INavigation navi, Page page)
 {
     uService   = new UtilsService();
     _page      = page;
     Navigation = navi;
     GetUserProfileAsync();
     ShowProfile = new Command(async() => await Navigation.PushAsync(new EctsPage(Navigation)));
     Refresh     = new Command(() => GetUserProfileAsync(true));
 }
Пример #29
0
    private void FillInputFields()
    {
        User aux = UserService.user;

        camService.pickPreiveimage.texture = UserService.user.profilePicture;
        originalPhoto = camService.pickPreiveimage.texture;

        if (aux.name.Length > 0)
        {
            nameField.text = aux.name;
        }
        if (aux.email.Length > 0)
        {
            emailField.text = aux.email;
        }
        if (aux.birth.Length > 0)
        {
            birthField.text = UtilsService.GetDate(aux.birth);
        }
        if (aux.sex.Length > 0)
        {
            genreDropdown.value = FindIndexFromGenre(aux);
        }
        if (aux.phone.Length > 0)
        {
            phoneField.text = aux.phone;
        }
        if (aux.street.Length > 0)
        {
            streetField.text = aux.street;
        }
        if (aux.neighborhood.Length > 0)
        {
            neighborhoodField.text = aux.neighborhood;
        }
        if (aux.complement.Length > 0)
        {
            complementField.text = aux.complement;
        }
        if (aux.zipcode.Length > 0)
        {
            zipField.text = aux.zipcode;
        }
        if (aux.city.Length > 0)
        {
            cityField.text = aux.city;
        }
        if (aux.state.Length > 0)
        {
            stateDropdown.value = FindIndexFromState(aux);
        }
        if (aux.number != null)
        {
            numberField.text = aux.number.ToString();
        }
    }
Пример #30
0
        public FindUserByPhoneAndPasswordQueryValidator(AppDbContext identityDBContext, UtilsService utils, IOptions <ApplicationOptions> options)
        {
            this.options           = options;
            this.utils             = utils;
            this.identityDBContext = identityDBContext;

            RuleFor(x => x.Phone).NotEmpty();
            RuleFor(x => x.Password).NotEmpty();
            RuleFor(x => x.Phone).MustAsync((x, y, z) => IsExist(x, z));
        }