예제 #1
0
        public NaoConformidadesController(ISetorService setorService
                                         , IUsuarioService usuarioService
                                         , IEnumHelper enumHelper
                                         , INaoConformidadeService naoConformidadeService
                                         , IReclamativaService reclamativaService
                                         , ICausaRaizService causaRaizService
                                         , IPlanoDeAcaoService planoDeAcaoService
            ,IEficaciaService eficaciaService)
        {
            this._setorService = setorService;
            this._usuarioService = usuarioService;
            this._enumHelper = enumHelper;
            this._naoConformidadeService = naoConformidadeService;
            this._reclamativaService = reclamativaService;
            this._causaRaizService = causaRaizService;
            this._planoDeAcaoService = planoDeAcaoService;
            this._eficaciaService = eficaciaService;

            ViewBag.Setores = _setorService.ObterSetores().ConvertAll(s => new ValorTextoDto() { Text = s.Id.ToString(), Value = s.Nome }).OrderBy(r => r.Text);
            ViewBag.Usuarios = _usuarioService.ObterUsuarios().ToList().ConvertAll(s => new ValorTextoDto() { Text = s.Id.ToString(), Value = s.Nome }).OrderBy(r => r.Text);
            ViewBag.StatusRnc = Enum.GetValues(typeof(DKO.EQualy.Domain.Enum.NaoConformidade.Status)).Cast<DKO.EQualy.Domain.Enum.NaoConformidade.Status>().Select(v => new SelectListItem
            {
                Text = _enumHelper.ObterDescricaoDoEnum(v),
                Value = ((int)v).ToString()

            }).ToList();
        }
예제 #2
0
        public NaoConformidadesController(ISetorService setorService
                                          , IUsuarioService usuarioService
                                          , IEnumHelper enumHelper
                                          , INaoConformidadeService naoConformidadeService
                                          , IReclamativaService reclamativaService
                                          , ICausaRaizService causaRaizService
                                          , IPlanoDeAcaoService planoDeAcaoService
                                          , IEficaciaService eficaciaService)
        {
            this._setorService           = setorService;
            this._usuarioService         = usuarioService;
            this._enumHelper             = enumHelper;
            this._naoConformidadeService = naoConformidadeService;
            this._reclamativaService     = reclamativaService;
            this._causaRaizService       = causaRaizService;
            this._planoDeAcaoService     = planoDeAcaoService;
            this._eficaciaService        = eficaciaService;

            ViewBag.Setores = _setorService.ObterSetores().ConvertAll(s => new ValorTextoDto()
            {
                Text = s.Id.ToString(), Value = s.Nome
            }).OrderBy(r => r.Text);
            ViewBag.Usuarios = _usuarioService.ObterUsuarios().ToList().ConvertAll(s => new ValorTextoDto()
            {
                Text = s.Id.ToString(), Value = s.Nome
            }).OrderBy(r => r.Text);
            ViewBag.StatusRnc = Enum.GetValues(typeof(DKO.EQualy.Domain.Enum.NaoConformidade.Status)).Cast <DKO.EQualy.Domain.Enum.NaoConformidade.Status>().Select(v => new SelectListItem
            {
                Text  = _enumHelper.ObterDescricaoDoEnum(v),
                Value = ((int)v).ToString()
            }).ToList();
        }
예제 #3
0
        public void CanComputeSameDiffgram()
        {
            List <string> left;
            List <string> right;

            CreateStringLists(out left, out right);

            DiffGram <string> diff = IEnumHelper.ComputeDiff(left, right);

            TestDiffGram(diff, true, left.Count, 0, 0);
        }
예제 #4
0
        public void CanFindLeftDiffs()
        {
            List <int> left;
            List <int> right;

            CreateIntLists(out left, out right);

            left.AddRange(new[] { 5, 6, 7 });
            DiffGram <int> diff = IEnumHelper.ComputeDiff(left, right);

            TestDiffGram(diff, false, 3, 3, 0);
        }
예제 #5
0
        public void CanUseContains()
        {
            List <int> TestList = new List <int>();

            for (int i = 0; i < 10; i++)
            {
                TestList.Add(i);
            }

            Assert.IsTrue(IEnumHelper.Contains(TestList, x => x == 5));
            Assert.IsFalse(IEnumHelper.Contains(TestList, x => x == 11));
        }
예제 #6
0
        public static void Initialize(TestContext testContext)
        {
            Mock <IEnumDescriptor> enumDescriptorMock = new Mock <IEnumDescriptor>();

            enumDescriptorMock.Setup(instance => instance.DataType).Returns(typeof(int));
            enumDescriptorMock.Setup(instance => instance.Enumerations).Returns(new List <string>()
            {
                "e1,1"
            });
            enumDescriptor = enumDescriptorMock.Object;

            enumHelper = new EnumHelper(typeof(TesztEnum), enumDescriptor);
        }
예제 #7
0
        public void CanFindMixedDiffs()
        {
            List <string> left;
            List <string> right;

            CreateStringLists(out left, out right);

            left.AddRange(new[] { "l1", "l2", "l3" });
            right.AddRange(new[] { "r1", "r2", "r3" });

            DiffGram <string> diff = IEnumHelper.ComputeDiff(left, right);

            TestDiffGram(diff, false, 3, 3, 3);
        }
예제 #8
0
        public void CanFindAllDiffs()
        {
            List <string> left = new List <string>()
            {
                "a", "b", "c"
            };
            List <string> right = new List <string>()
            {
                "d", "e", "f"
            };

            DiffGram <string> diff = IEnumHelper.ComputeDiff(left, right);

            TestDiffGram(diff, false, 0, 3, 3);
        }
예제 #9
0
        public PerfilController(UsuarioService usuarioService, MensagemService mensagemService, AtividadeService atividadeService, IEnumHelper enumHelper)
        {
            this._usuarioService = usuarioService;
            this._mensagemService = mensagemService;
            this._atividadeService = atividadeService;
            ViewBag.Usuarios = usuarioService.ObterUsuarios();

            ViewBag.ListaStatusTarefa = Enum.GetValues(typeof(DKO.EQualy.Domain.Enum.Atividade.StatusAtividade)).Cast<DKO.EQualy.Domain.Enum.Atividade.StatusAtividade>().Select(v => new SelectListItem
            {
                Text = enumHelper.ObterDescricaoDoEnum(v),
                Value = ((int)v).ToString()

            }).ToList();

            ViewBag.LstaTipoTarefa = Enum.GetValues(typeof(DKO.EQualy.Domain.Enum.Atividade.TipoAtividade)).Cast<DKO.EQualy.Domain.Enum.Atividade.TipoAtividade>().Select(v => new SelectListItem
            {
                Text = enumHelper.ObterDescricaoDoEnum(v),
                Value = ((int)v).ToString()
            });
    
        }
예제 #10
0
        public PerfilController(UsuarioService usuarioService, MensagemService mensagemService, AtividadeService atividadeService, IEnumHelper enumHelper)
        {
            this._usuarioService   = usuarioService;
            this._mensagemService  = mensagemService;
            this._atividadeService = atividadeService;
            ViewBag.Usuarios       = usuarioService.ObterUsuarios();

            ViewBag.ListaStatusTarefa = Enum.GetValues(typeof(DKO.EQualy.Domain.Enum.Atividade.StatusAtividade)).Cast <DKO.EQualy.Domain.Enum.Atividade.StatusAtividade>().Select(v => new SelectListItem
            {
                Text  = enumHelper.ObterDescricaoDoEnum(v),
                Value = ((int)v).ToString()
            }).ToList();

            ViewBag.LstaTipoTarefa = Enum.GetValues(typeof(DKO.EQualy.Domain.Enum.Atividade.TipoAtividade)).Cast <DKO.EQualy.Domain.Enum.Atividade.TipoAtividade>().Select(v => new SelectListItem
            {
                Text  = enumHelper.ObterDescricaoDoEnum(v),
                Value = ((int)v).ToString()
            });
        }
예제 #11
0
 protected TypeConverterEnumHelper(IEnumHelper <EnumType> enumHelper)
 {
     this.enumHelper = enumHelper;
 }
예제 #12
0
 // --------------------------------------------------------------------------------------------------------------------------
 public static Stack <T> ToStack <T>(this IEnumerable <T> src)
 {
     return(IEnumHelper.ToStack(src));
 }
예제 #13
0
        public static KeyValuePair <ValueType, string> ParseEnum(this IEnumHelper enumHelper, string rawEnumValue)
        {
            var enumValue = new EnumValueResolver(',').ResolveEnumValue(enumHelper.EnumDescriptor.DataType, rawEnumValue);

            return(new KeyValuePair <ValueType, string>(enumValue.Item2, enumValue.Item1));
        }
예제 #14
0
 public static string GetDisplayValue(this IEnumHelper enumHelper, ValueType value) => $"{value} ({enumHelper.GetName(value)})";
예제 #15
0
 public static string GetRawEnumData(this IEnumHelper enumHelper, ValueType value)
 => enumHelper.EnumDescriptor.Enumerations.First(rawEnum => rawEnum.StartsWith(enumHelper.GetName(value)));