예제 #1
0
        public virtual IActionResult GetCompetencyDefinition([FromRoute] string sourceId)
        {
            CompetencyDefinitionData data = new CompetencyDefinitionData(_connectionString);

            if (!sourceId.Contains('.'))
            {
                return(new BadRequestResult());
            }

            string[] sourceValues           = sourceId.Split('.');
            CompetencyDefinitionType result = null;

            switch (sourceValues[0])
            {
            case "SLO":
                SLO value = data.GetLearningOutcome(sourceId);

                if (value != null)
                {
                    result = CompetencyDefinitionSetMapper.Map(value);
                }
                break;
            }

            if (result == null)
            {
                return(new NotFoundObjectResult(sourceId));
            }

            return(new ObjectResult(result.ToJson()));
        }
예제 #2
0
        public SLO GetLearningOutcome(string sourcedId)
        {
            SLO nextOutcome = null;

            MySql.Data.MySqlClient.MySqlConnection connection = (MySqlConnection)MySql.Data.MySqlClient.MySqlClientFactory.Instance.CreateConnection();
            connection.ConnectionString = _connectionString;
            connection.Open();

            string SQL = @"SELECT slo.slo_id, asmt.asmt_id, slo.current_flag, slo.is_latest, slo.name, slo.performance, slo.lst_mod_dt, org_entity.name AS org_name, slo.slo_outcome_level_id, slo.slo_category_id, slo.new_course_id, slo.seq, slo.status_id, slo_category.name AS slo_category
FROM  slo LEFT OUTER JOIN
         org_entity ON slo.owner_org_entity_id = org_entity.org_entity_id LEFT OUTER JOIN
         slo_category ON slo.slo_category_id = slo_category.slo_category_id AND org_entity.org_entity_id = slo_category.owner_org_entity_id LEFT OUTER JOIN
         asmt_slo_rel ON slo.slo_id = asmt_slo_rel.slo_id LEFT OUTER JOIN
         asmt ON asmt_slo_rel.asmt_id = asmt.asmt_id
WHERE slo.slo_id = '{0}'";

            using (MySqlCommand cmd = new MySqlCommand(string.Format(SQL, sourcedId), connection))
            {
                using (MySqlDataReader dr = (MySqlDataReader)cmd.ExecuteReader())
                {
                    if (dr.Read())
                    {
                        nextOutcome = SLO.CreateFromCredential(dr);
                    }
                }
            }

            return(nextOutcome);
        }
예제 #3
0
        public List <SLO> GetLearningOutcomes(int offset, int limit)
        {
            List <SLO> credentials = new List <SLO>();

            MySql.Data.MySqlClient.MySqlConnection connection = (MySqlConnection)MySql.Data.MySqlClient.MySqlClientFactory.Instance.CreateConnection();
            connection.ConnectionString = _connectionString;
            connection.Open();

            string SQL = @"SELECT slo.slo_id, asmt.asmt_id, slo.current_flag, slo.is_latest, slo.name, slo.performance, slo.lst_mod_dt, org_entity.name AS org_name, slo.slo_outcome_level_id, slo.slo_category_id, slo.new_course_id, slo.seq, slo.status_id, slo_category.name AS slo_category
FROM  slo LEFT OUTER JOIN
         org_entity ON slo.owner_org_entity_id = org_entity.org_entity_id LEFT OUTER JOIN
         slo_category ON slo.slo_category_id = slo_category.slo_category_id AND org_entity.org_entity_id = slo_category.owner_org_entity_id LEFT OUTER JOIN
         asmt_slo_rel ON slo.slo_id = asmt_slo_rel.slo_id LEFT OUTER JOIN
         asmt ON asmt_slo_rel.asmt_id = asmt.asmt_id
LIMIT {0}, {1}";

            using (MySqlCommand cmd = new MySqlCommand(string.Format(SQL, offset, limit), connection))
            {
                using (MySqlDataReader dr = (MySqlDataReader)cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        SLO nextCred = SLO.CreateFromCredential(dr);
                        credentials.Add(nextCred);
                    }
                }
            }

            return(credentials);
        }
        public List <SLO> GetCourseOutcomes(string courseId)
        {
            List <SLO> outcomes = new List <SLO>();

            MySql.Data.MySqlClient.MySqlConnection connection = (MySqlConnection)MySql.Data.MySqlClient.MySqlClientFactory.Instance.CreateConnection();
            connection.ConnectionString = _connectionString;
            connection.Open();

            string SQL = @"SELECT slo.slo_id, slo.name AS slo_name, slo.slo_outcome_level_id, slo.seq AS slo_sequence, slo.current_flag, org_entity.name AS org_name, org_entity.ds AS org_description, slo.lst_mod_dt, slo_category.name AS category_name, slo_category.description AS category_desc, slo.new_course_id, slo.slo_category_id
FROM  slo LEFT OUTER JOIN
         org_entity ON slo.owner_org_entity_id = org_entity.org_entity_id LEFT OUTER JOIN
         slo_category ON slo.slo_category_id = slo_category.slo_category_id
WHERE (new_course_id = {0})";

            using (MySqlCommand cmd = new MySqlCommand(string.Format(SQL, courseId), connection))
            {
                using (MySqlDataReader dr = (MySqlDataReader)cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        SLO nextCred = SLO.CreateFromCredential(dr);
                        outcomes.Add(nextCred);
                    }
                }
            }

            return(outcomes);
        }
예제 #5
0
 private static CFItemType MapBase(SLO input)
 {
     return(new CFItemType(new GUIDType(string.Format("SLO.{0}", input.slo_id)),
                           string.Format("SLO.{0}.{1}", input.org_name, input.slo_id),
                           string.Format("SLO.{0}.{1}", input.org_name, input.slo_id),
                           input.lst_mod_dt,
                           string.Format("SLO.{0}.{1}", input.org_name, input.slo_id),
                           string.Format("SLO.{0}.{1}", input.org_name, input.slo_id))
     {
         CompetencyEffectiveDate = input.lst_mod_dt,
         CompetencyLabel = "Outcome",
         AbbreviatedStatement = input.name,
         CFItemTypeType = "OUTCOME",
         CFItemTypeURI = null,
         //CompetencyEffectiveDate = CompetencyEffectiveDate,
         //CompetencyTerminationDate = CompetencyTerminationDate,
         //FullStatement = FullStatement,
         //CompetencyLabel = CompetencyLabel,
         //CFItemType = CFItemType,
         //CompetencyAssociationSet = CompetencyAssociationSet,
         //CompetencyReferenceHierarchy = CompetencyReferenceHierarchy,
         //HumanCodingScheme = HumanCodingScheme,
         //ListEnumeration = ListEnumeration,
         //AbbreviatedStatement = AbbreviatedStatement,
         //ConceptKeywords = ConceptKeywords,
         //ConceptKeywordsURI = ConceptKeywordsURI,
         //Notes = Notes,
         //Language = Language,
         //EducationLevel = EducationLevel,
         //CFItemTypeURI = CFItemTypeURI,
         //License = License,
         //LicenseURI = LicenseURI
     });
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompetencyContextSetType" /> class.
        /// </summary>
        /// <param name="input">Courses serving as competency contexts</param>
        /// <returns></returns>
        public static CFItemType Map(SLO input)
        {
            var contexts = new List <CFItemType>();

            CFItemType def = MapBase(input);

            return(def);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CompetencyContextSetType" /> class.
        /// </summary>
        /// <param name="input">Courses serving as competency contexts</param>
        /// <returns></returns>
        public static CompetencyDefinitionType Map(SLO input)
        {
            var contexts = new List <CompetencyDefinitionType>();

            CompetencyDefinitionType def = MapBase(input);

            return(def);
        }
 private static CFItemType MapBase(SLO input)
 {
     return(new CFItemType(Guid.NewGuid(), string.Format("SLO.{0}", input.slo_id), string.Format("SLO.{0}.{1}", input.org_name, input.slo_id))
     {
         CompetencyEffectiveDate = input.lst_mod_dt,
         CompetencyLabel = input.name,
         CompetencyStatement = input.name,
         CompetencyType = "OUTCOME",
         CompetencyTerminationDate = null,
         CompetencyReferenceHierarchy = new List <Guid>()
                                        //, CompetencyRelationshipSet = new CompetencyRelationshipSetType()
     });
 }