Ejemplo n.º 1
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            var concreteValue = (NIST_SAL_INFO_TYPES)value;
            var result        = new NistSpecialFactor
            {
                Confidentiality_Value = concreteValue.Confidentiality_Value == null ? SALLevelNIST.SAL_LOW:SALLevelNIST.StringValueToLevel[concreteValue.Confidentiality_Value.ToLower()],
                Availability_Value    = concreteValue.Availability_Value == null ? SALLevelNIST.SAL_LOW : SALLevelNIST.StringValueToLevel[concreteValue.Availability_Value.ToLower()],
                Integrity_Value       = concreteValue.Integrity_Value == null ? SALLevelNIST.SAL_LOW : SALLevelNIST.StringValueToLevel[concreteValue.Integrity_Value.ToLower()]
            };

            return(result);
        }
Ejemplo n.º 2
0
        private List <NistSpecialFactor> GetSpecialFactors(int assessmentId, CSET_Context db)
        {
            var topList = db.NIST_SAL_INFO_TYPES.Where(x => x.Assessment_Id == assessmentId && x.Selected == true).ToList();
            List <NistSpecialFactor> rvalue = new List <NistSpecialFactor>();

            foreach (NIST_SAL_INFO_TYPES t in topList)
            {
                NistSpecialFactor sp = new NistSpecialFactor()
                {
                    Availability_Special_Factor    = t.Availability_Special_Factor,
                    Confidentiality_Special_Factor = t.Confidentiality_Special_Factor,
                    Integrity_Special_Factor       = t.Integrity_Special_Factor,
                    Type_Value            = t.Type_Value,
                    Availability_Value    = SALLevelNIST.GetWeightPair(t.Availability_Value),
                    Integrity_Value       = SALLevelNIST.GetWeightPair(t.Integrity_Value),
                    Confidentiality_Value = SALLevelNIST.GetWeightPair(t.Confidentiality_Value),
                };
                rvalue.Add(sp);
            }

            return(rvalue);
        }