Exemplo n.º 1
0
        public string GetDbOption(string optionCode, out bool existOption)
        {
            string value = string.Empty;

            existOption = false;

            if (!string.IsNullOrWhiteSpace(optionCode))
            {
                try
                {
                    OptionItemEntity option = dataService.Select <OptionItemEntity>().FirstOrDefault(x => x.Code == optionCode);

                    if (option != null)
                    {
                        value       = option.Value;
                        existOption = true;
                    }
                }
                catch (Exception e)
                {
                    ;//throw;
                }
            }

            return(value);
        }
Exemplo n.º 2
0
        private bool ExistDbOption(string optionCode)
        {
            bool value = false;

            if (!string.IsNullOrWhiteSpace(optionCode))
            {
                OptionItemEntity option = dataService.Select <OptionItemEntity>().FirstOrDefault(x => x.Code == optionCode);

                if (option != null)
                {
                    value = true;
                }
            }

            return(value);
        }
Exemplo n.º 3
0
        public void SetDbOption(string optionCode, string value)
        {
            if (!string.IsNullOrWhiteSpace(optionCode))
            {
                OptionItemEntity option = dataService.Select <OptionItemEntity>().FirstOrDefault(x => x.Code == optionCode);

                if (option == null)
                {
                    option      = dataService.DataBaseContext.OptionItemEntities.Create();
                    option.Code = optionCode;
                    dataService.DataBaseContext.OptionItemEntities.Add(option);
                }

                option.Value = value;
                dataService.DataBaseContext.SaveChanges();
            }
        }