Example #1
0
        // GET: User/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var user = await context.Users
                       .Include(u => u.Employee)
                       .ThenInclude(u => u.Position)
                       .Include(u => u.Role)
                       .FirstOrDefaultAsync(m => m.Id == id);

            if (user == null)
            {
                return(NotFound());
            }

            string        dateFormat  = config.GetValue <string>("Birthdate:Format");
            UserDetailsVM userDetails = new UserDetailsVM
            {
                Id         = user.Id,
                Login      = user.Login,
                Role       = user.Role.Name,
                Name       = user.Employee.Name,
                Patronymic = user.Employee.Patronymic,
                Surname    = user.Employee.Surname,
                Gender     = GenderHelper.GetValue(user.Employee.Gender),
                Position   = user.Employee.Position.Name,
                Birthdate  = user.Employee.Birthdate.ToString(dateFormat),
                Phone      = user.Employee.Phone
            };

            return(View(userDetails));
        }
Example #2
0
        public void GivenIHaveEnteredTheFollowingValuesToTheRegistrationFormWithoutReenteringEmailPhoneField(Table table)
        {
            dynamic account = table.CreateDynamicInstance();

            ScenarioContext.Current.Get <LoginSignupPage>().
            SetFirstName(account.Fname).
            SetLastName(account.Sname).
            SetMobileOrEmail(account.Email.ToString()).
            SetNewPassword(account.Password).
            SetGender(GenderHelper.GetGender(account.Gender));
        }
Example #3
0
    public IEnumerator Speak(string text, AudioSource audioPlayer, LanguageHelper.LanguageType language, GenderHelper.GenderType gender)
    {
        //create a speech synthesizer request object
        SpeechSynthesizerRequest req = new SpeechSynthesizerRequest();

        //specify the text to be verbalized
        GoogleCloudTTS.Input input = new GoogleCloudTTS.Input();
        input.text = text;
        //configure the voice to be used for verbalization
        Voice v = new Voice();

        v.languageCode = LanguageHelper.GetVoiceLanguageCode(language);
        v.name         = LanguageHelper.GetVoiceLanguageName(language, gender);
        v.ssmlGender   = GenderHelper.ConvertGenderTypeToString(gender);
        //specify the audio configuration
        AudioConfig config = new AudioConfig();

        config.audioEncoding = "LINEAR16"; //this is the only format that works
        //populate the speech synthesizer request object
        req.input       = input;
        req.voice       = v;
        req.audioConfig = config;
        //creat a SpeechSynthesizerClient to post the request
        SpeechSynthesizerClient client = new SpeechSynthesizerClient();

        //send the request
        yield return(client.SendWebRequest(req));

        //the SpeechSynthesizerClient will send the request and create response object
        //get a reference to the response object
        SpeechSynthesizerResponse res = client.response;

        //check if an error was encountered during the request
        if (res.isError)
        {
            //an error occurred during speech synthesis
            Debug.Log("Speech synthesis error: " + res.error);
        }
        else
        {
            //get a reference to the generated audio clip;
            AudioClip clip = res.audioClip;
            //play the clip using the specified audio source
            audioPlayer.PlayOneShot(clip);
        }
    }
Example #4
0
        private Product CreateNewProduct(
            List <Offer> offers,
            DateTime updateDate)
        {
            var offer   = offers.First();
            var soldOut = offers.All(o => o.SoldOut);

            _dbHelper.RememberVendorIfUnknown(offer.VendorNameClearly, offer.OriginalVendor);

            return(new Product {
                Id = offer.ProductId,
                Url = offer.Url,
                UpdateDate = updateDate,
                Name = offer.Name ?? string.Empty,
                Description = offer.Description ?? string.Empty,
                Model = offer.Model ?? string.Empty,
                Gender = GenderHelper.Convert(offer.Gender),
                Age = AgeHelper.Convert(offer.Age),
                ShopId = offer.ShopId.ToString(),
                Price = offers.Max(o => o.Price),
                OldPrice = offer.OldPrice ?? 0m,
                TypePrefix = offer.TypePrefix ?? string.Empty,
                CategoryName = offer.CategoryPath ?? string.Empty,
                Discount = offer.Discount,
                Currency = offer.Currency.ToString(),
                CountryId = offer.CountryId.ToString(),
                VendorNameClearly = offer.VendorNameClearly,
                Photos = new List <string>(),
                Params = new List <string>(),
                Enable = 1,
                Soldout = (byte)(soldOut ? 1 : 0),
                Delivery = 0,
                BrandId = _dbHelper.GetBrandId(offer.VendorNameClearly),
                SalesNotes = offer.SalesNotes,
                OriginalCategoryId = offer.CategoryId,
                OfferIds = offers.Select(o => o.OriginalId).ToArray(),
                Vendor = offer.OriginalVendor,
                Rating = _calculation.Calculate()
            });
        }
Example #5
0
        public async Task <IActionResult> Index()
        {
            var employees = await context.Employees
                            .Include(p => p.Position)
                            .AsNoTracking()
                            .ToListAsync();

            string dateFormat = config.GetValue <string>("Birthdate:Format");
            IEnumerable <EmployeePreviewVM> employeesPreview = employees.Select(e => new EmployeePreviewVM
            {
                Id         = e.Id,
                Name       = e.Name,
                Patronymic = e.Patronymic,
                Surname    = e.Surname,
                Gender     = GenderHelper.GetValue(e.Gender),
                Position   = e.Position.Name,
                Birthdate  = e.Birthdate.ToString(dateFormat),
                Phone      = e.Phone
            });

            return(View(employeesPreview));
        }
Example #6
0
        /// <summary>
        /// Select a variation based on the gender of a subject
        /// </summary>
        /// <param name="index"></param>
        /// <param name="neutral"></param>
        /// <param name="masculine"></param>
        /// <param name="feminine"></param>
        /// <returns></returns>
        public string GENDER(string index, string neutral, string masculine, string feminine)
        {
            try
            {
                int    i      = int.Parse(index);
                Gender gender = Gender.Neutral;
                if (i >= 0 && i < Subjects.Length)
                {
                    object subject = Subjects[i];
                    gender = GenderHelper.GenderOf(subject);
                }
                if (gender == Gender.Masculine)
                {
                    return(masculine);
                }
                else if (gender == Gender.Feminine)
                {
                    return(feminine);
                }
            }
            catch { }

            return(neutral);
        }
 public PatientEditViewModel()
 {
     genderItems  = GenderHelper.GetGenderListItems();
     countryItems = new List <SelectListItem>();
     cityItems    = new List <SelectListItem>();
 }
Example #8
0
 /// <summary>
 /// Create dropdown list for Genders
 /// </summary>
 private SelectList CreateGendersDropDownList() => new SelectList(GenderHelper.CreateList(), "Value", "Text");