示例#1
0
        //

        public ActionResult Assessment(string id, string name = "")
        {
            //AssessmentProfile entity = new AssessmentProfile();
            int           assmId        = 0;
            var           entity        = new AssessmentProfile();
            string        refresh       = Request.Params["refresh"];
            bool          skippingCache = FormHelper.GetRequestKeyValue("skipCache", false);
            List <string> messages      = new List <string>();

            if (int.TryParse(id, out assmId))
            {
                entity = AssessmentServices.GetDetail(assmId, skippingCache);
            }
            else if (ServiceHelper.IsValidCtid(id, ref messages))
            {
                entity = AssessmentServices.GetDetailByCtid(id, skippingCache);
            }
            else
            {
                SetPopupErrorMessage("ERROR - Enter the ctid which starts with 'ce' or Enter the id ");
                return(RedirectToAction("Index", "Home"));
            }
            //HttpContext.Server.ScriptTimeout = 300;

            if (entity.Id == 0)
            {
                SetPopupErrorMessage("ERROR - the requested Assessment record was not found ");
                return(RedirectToAction("Index", "Home"));
            }
            ActivityServices.SiteActivityAdd("AssessmentProfile", "View", "Detail", string.Format("User viewed Assessment: {0} ({1})", entity.Name, entity.Id), 0, 0, assmId);

            return(View("~/Views/Detail/Detail.cshtml", entity));
        }
    /**
     * Load the assessment and adaptation profiles from xml.
     *
     */
    //This method must be called after all chapter data is parse, because is a past functionality, and must be preserved in order
    // to bring the possibility to load game of past versions. Now the adaptation and assessment profiles are into chapter.xml, and not
    // in separate files.
    public void loadProfiles()
    {
        //check if in chapter.xml there was any assessment or adaptation data
        if (!adventureData.hasAdapOrAssesData())
        {
            // Load all the assessment files in each chapter
            foreach (string assessmentPath in assessmentPaths)
            {
                bool added = false;
                AssessmentProfile assessProfile = Loader.loadAssessmentProfile(isCreator, assessmentPath, incidences);
                if (assessProfile != null)
                {
                    foreach (Chapter chapter in adventureData.getChapters())
                    {
                        if (chapter.getAssessmentName().Equals(assessProfile.getName()))
                        {
                            chapter.addAssessmentProfile(assessProfile);
                            added = true;
                        }
                    }
                    if (!added)
                    {
                        foreach (Chapter chapter in adventureData.getChapters())
                        {
                            chapter.addAssessmentProfile(assessProfile);
                        }
                    }
                }
            }

            // Load all the adaptation files in each chapter
            foreach (string adaptationPath in adaptationPaths)
            {
                bool added = false;
                AdaptationProfile adaptProfile = Loader.loadAdaptationProfile(isCreator, adaptationPath, incidences);
                if (adaptProfile != null)
                {
                    foreach (Chapter chapter in adventureData.getChapters())
                    {
                        if (chapter.getAdaptationName().Equals(adaptProfile.getName()))
                        {
                            chapter.addAdaptationProfile(adaptProfile);
                            added = true;
                        }
                    }
                    if (!added)
                    {
                        foreach (Chapter chapter in adventureData.getChapters())
                        {
                            chapter.addAdaptationProfile(adaptProfile);
                        }
                    }
                }
            }
        }
    }
示例#3
0
    public static XmlElement writeAssessmentData( /* string zipFilename,*/
        AssessmentProfile profile, bool valid, XmlDocument doc)
    {
        /**
         * ******************* STORE ASSESSMENT DATA WHEN PRESENT
         * ******************
         */
        XmlElement assNode = null;

        if (profile.getName() != null && !profile.getName().Equals(""))
        {
            assNode = AssessmentDOMWriter.buildDOM(profile, doc);
        }
        return(assNode);
    }
示例#4
0
        /// <summary>
        /// Get all assessments for the provided entity
        /// The returned entities are just the base
        /// </summary>
        /// <param name="parentUid"></param>
        /// <returns></returnsThisEntity
        public static List <AssessmentProfile> GetAll(Guid parentUid, int relationshipTypeId = 1)
        {
            List <AssessmentProfile> list   = new List <AssessmentProfile>();
            AssessmentProfile        entity = new AssessmentProfile();

            Entity parent = EntityManager.GetEntity(parentUid);

            LoggingHelper.DoTrace(7, string.Format("EntityAssessments_GetAll: parentUid:{0} entityId:{1}, e.EntityTypeId:{2}", parentUid, parent.Id, parent.EntityTypeId));

            try
            {
                using (var context = new EntityContext())
                {
                    List <DBEntity> results = context.Entity_Assessment
                                              .Where(s => s.EntityId == parent.Id && s.RelationshipTypeId == relationshipTypeId)
                                              .OrderBy(s => s.Assessment.Name)
                                              .ToList();

                    if (results != null && results.Count > 0)
                    {
                        foreach (DBEntity item in results)
                        {
                            entity = new AssessmentProfile();

                            //need to distinguish between on a detail page for conditions and assessment detail
                            //would usually only want basics here??
                            //17-05-26 mp- change to MapFromDB_Basic
                            if (item.Assessment != null && item.Assessment.EntityStateId > 1)
                            {
                                AssessmentManager.MapFromDB_Basic(item.Assessment, entity,
                                                                  true); //includingCosts-not sure
                                                                         //add competencies
                                AssessmentManager.MapFromDB_Competencies(entity);
                                list.Add(entity);
                            }
                        }
                    }
                    return(list);
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, thisClassName + string.Format(".EntityAssessments_GetAll. Guid: {0}, parentType: {1} ({2}), ", parentUid, parent.EntityType, parent.EntityBaseId));
            }
            return(list);
        }
    /* Methods */

    /**
     * Default constructor
     */
    public AssessmentHandler(InputStreamCreator isCreator, AssessmentProfile profile)
    {
        this.profile = profile;
        if (profile.getRules() == null)
        {
            assessmentRules = new List <AssessmentRule>();
        }
        else
        {
            assessmentRules = profile.getRules();
        }
        currentAssessmentRule = null;
        currentstring         = string.Empty;
        vars  = new List <string>();
        flags = new List <string>();
        profile.setFlags(flags);
        profile.setVars(vars);
        this.isCreator = isCreator;
    }
示例#6
0
    public object Clone()
    {
        AssessmentProfile ap = (AssessmentProfile)this.MemberwiseClone();

        ap.email = (email != null ? email : null);
        if (flags != null)
        {
            ap.flags = new List <string>();
            foreach (string s in flags)
            {
                ap.flags.Add((s != null ? s : null));
            }
        }
        ap.name = (name != null ? name : null);
        if (rules != null)
        {
            ap.rules = new List <AssessmentRule>();
            foreach (AssessmentRule ar in rules)
            {
                ap.rules.Add((AssessmentRule)ar.Clone());
            }
        }
        ap.sendByEmail     = sendByEmail;
        ap.showReportAtEnd = showReportAtEnd;
        ap.smtpPort        = (smtpPort != null ? smtpPort : null);
        ap.smtpPwd         = (smtpPwd != null ? smtpPwd : null);
        ap.smtpServer      = (smtpServer != null ? smtpServer : null);
        ap.smtpSSL         = smtpSSL;
        ap.smtpUser        = (smtpUser != null ? smtpUser : null);
        if (vars != null)
        {
            ap.vars = new List <string>();
            foreach (string s in vars)
            {
                ap.vars.Add((s != null ? s : null));
            }
        }
        ap.scorm12   = scorm12;
        ap.scorm2004 = scorm2004;
        return(ap);
    }
        /**
         * Returns the DOM element for the chapter
         *
         * @param chapter
         *            Chapter data to be written
         * @return DOM element with the chapter data
         */

        public static XmlElement buildDOM(AssessmentProfile profile, XmlDocument doc)
        {
            List <AssessmentRule> rules = profile.getRules();

            XmlElement assessmentNode = null;

            // Create the root node
            assessmentNode = doc.CreateElement("assessment");
            if (profile.isShowReportAtEnd())
            {
                assessmentNode.SetAttribute("show-report-at-end", "yes");
            }
            else
            {
                assessmentNode.SetAttribute("show-report-at-end", "no");
            }
            if (!profile.isShowReportAtEnd() || !profile.isSendByEmail())
            {
                assessmentNode.SetAttribute("send-to-email", "");
            }
            else
            {
                if (profile.getEmail() == null || !profile.getEmail().Contains("@"))
                {
                    assessmentNode.SetAttribute("send-to-email", "");
                }
                else
                {
                    assessmentNode.SetAttribute("send-to-email", profile.getEmail());
                }
            }
            // add scorm attributes
            if (profile.isScorm12())
            {
                assessmentNode.SetAttribute("scorm12", "yes");
            }
            else
            {
                assessmentNode.SetAttribute("scorm12", "no");
            }
            if (profile.isScorm2004())
            {
                assessmentNode.SetAttribute("scorm2004", "yes");
            }
            else
            {
                assessmentNode.SetAttribute("scorm2004", "no");
            }
            //add the profile's name
            assessmentNode.SetAttribute("name", profile.getName());

            XmlElement smtpConfigNode = doc.CreateElement("smtp-config");

            smtpConfigNode.SetAttribute("smtp-ssl", (profile.isSmtpSSL() ? "yes" : "no"));
            smtpConfigNode.SetAttribute("smtp-server", profile.getSmtpServer());
            smtpConfigNode.SetAttribute("smtp-port", profile.getSmtpPort());
            smtpConfigNode.SetAttribute("smtp-user", profile.getSmtpUser());
            smtpConfigNode.SetAttribute("smtp-pwd", profile.getSmtpPwd());

            assessmentNode.AppendChild(smtpConfigNode);

            // Append the assessment rules
            foreach (AssessmentRule rule in rules)
            {
                if (rule is TimedAssessmentRule)
                {
                    TimedAssessmentRule tRule = (TimedAssessmentRule)rule;
                    //Create the rule node and set attributes
                    XmlElement ruleNode = doc.CreateElement("timed-assessment-rule");
                    ruleNode.SetAttribute("id", tRule.getId());
                    ruleNode.SetAttribute("importance", AssessmentRule.IMPORTANCE_VALUES[tRule.getImportance()]);
                    ruleNode.SetAttribute("usesEndConditions", (tRule.isUsesEndConditions() ? "yes" : "no"));
                    ruleNode.SetAttribute("repeatRule", (tRule.isRepeatRule() ? "yes" : "no"));

                    //Append concept
                    if (tRule.getConcept() != null && !tRule.getConcept().Equals(""))
                    {
                        XmlNode conceptNode = doc.CreateElement("concept");
                        conceptNode.AppendChild(doc.CreateTextNode(tRule.getConcept()));
                        ruleNode.AppendChild(conceptNode);
                    }

                    //Append conditions (always required at least one)
                    if (!tRule.getInitConditions().isEmpty())
                    {
                        DOMWriterUtility.DOMWrite(ruleNode, tRule.getInitConditions(), DOMWriterUtility.Name(ConditionsDOMWriter.INIT_CONDITIONS));
                    }

                    //Append conditions (always required at least one)
                    if (!tRule.getEndConditions().isEmpty())
                    {
                        DOMWriterUtility.DOMWrite(ruleNode, tRule.getEndConditions(), DOMWriterUtility.Name(ConditionsDOMWriter.END_CONDITIONS));
                    }

                    // Create effects
                    for (int i = 0; i < tRule.getEffectsCount(); i++)
                    {
                        //Create effect element and append it
                        XmlElement effectNode = doc.CreateElement("assessEffect");

                        // Append time attributes
                        effectNode.SetAttribute("time-min", tRule.getMinTime(i).ToString());
                        effectNode.SetAttribute("time-max", tRule.getMaxTime(i).ToString());

                        //Append set-text when appropriate
                        TimedAssessmentEffect currentEffect = tRule.getEffects()[i];
                        if (currentEffect.getText() != null && !currentEffect.getText().Equals(""))
                        {
                            XmlNode textNode = doc.CreateElement("set-text");
                            textNode.AppendChild(doc.CreateTextNode(currentEffect.getText()));
                            effectNode.AppendChild(textNode);
                        }
                        //Append properties
                        foreach (AssessmentProperty property in currentEffect.getAssessmentProperties())
                        {
                            XmlElement propertyElement = doc.CreateElement("set-property");
                            propertyElement.SetAttribute("id", property.getId());
                            propertyElement.SetAttribute("value", property.getValue().ToString());
                            effectNode.AppendChild(propertyElement);
                        }
                        //Append the effect
                        ruleNode.AppendChild(effectNode);
                    }

                    //Append the rule
                    assessmentNode.AppendChild(ruleNode);
                }
                else
                {
                    //Create the rule node and set attributes
                    XmlElement ruleNode = doc.CreateElement("assessment-rule");
                    ruleNode.SetAttribute("id", rule.getId());
                    ruleNode.SetAttribute("importance", AssessmentRule.IMPORTANCE_VALUES[rule.getImportance()]);
                    ruleNode.SetAttribute("repeatRule", (rule.isRepeatRule() ? "yes" : "no"));

                    //Append concept
                    if (rule.getConcept() != null && !rule.getConcept().Equals(""))
                    {
                        XmlNode conceptNode = doc.CreateElement("concept");
                        conceptNode.AppendChild(doc.CreateTextNode(rule.getConcept()));
                        ruleNode.AppendChild(conceptNode);
                    }

                    //Append conditions (always required at least one)
                    if (!rule.getConditions().isEmpty())
                    {
                        DOMWriterUtility.DOMWrite(ruleNode, rule.getConditions());
                    }

                    //Create effect element and append it
                    XmlNode effectNode = doc.CreateElement("assessEffect");
                    //Append set-text when appropriate
                    if (rule.getText() != null && !rule.getText().Equals(""))
                    {
                        XmlNode textNode = doc.CreateElement("set-text");
                        textNode.AppendChild(doc.CreateTextNode(rule.getText()));
                        effectNode.AppendChild(textNode);
                    }
                    //Append properties
                    foreach (AssessmentProperty property in rule.getAssessmentProperties())
                    {
                        XmlElement propertyElement = doc.CreateElement("set-property");
                        propertyElement.SetAttribute("id", property.getId());
                        propertyElement.SetAttribute("value", property.getValue());
                        if (property.getVarName() != null)
                        {
                            propertyElement.SetAttribute("varName", property.getVarName());
                        }
                        effectNode.AppendChild(propertyElement);
                    }
                    //Append the effect
                    ruleNode.AppendChild(effectNode);

                    //Append the rule
                    assessmentNode.AppendChild(ruleNode);
                }
            }

            return(assessmentNode);
        }
 /* Methods */
 /**
  * Default constructor
  */
 public AssessmentHandler(InputStreamCreator isCreator, AssessmentProfile profile)
 {
     this.profile = profile;
     if (profile.getRules() == null)
         assessmentRules = new List<AssessmentRule>();
     else
         assessmentRules = profile.getRules();
     currentAssessmentRule = null;
     currentstring = string.Empty;
     vars = new List<string>();
     flags = new List<string>();
     profile.setFlags(flags);
     profile.setVars(vars);
     this.isCreator = isCreator;
 }
 /**
  * Adds new assessment profile
  *
  * @param assessProfile
  *            the new assessment profile to add
  */
 public void addAssessmentProfile(AssessmentProfile assessProfile)
 {
     assessmentProfiles.Add(assessProfile);
 }
示例#10
0
        public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequestMessage req, ILogger log)
        {
            log.LogTrace("C# HTTP trigger function processed a request.");

            dynamic body = await req.Content.ReadAsStringAsync();

            Guid?  CompanyId;
            string CompanyName = null;

            try
            {
                var data = JsonConvert.DeserializeObject <AssessmentProfile>(body as string);
                CompanyId   = data?.CompanyId;
                CompanyName = data?.CompanyName;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            // parse query parameter

            string connectionstring2 = "DefaultEndpointsProtocol=https;AccountName=spassessservices20190227;AccountKey=KLx/VDJ279oOZ2Z2wELr90GauiVlEN4pr8r2ss2xAiokZJGAi4PF6eGz0nI0Vz0IieEwtKxqkgoM+ukeVoWxMw==;EndpointSuffix=core.windows.net";
            string json = null;


            if (CompanyName == null)
            {
                return(req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a company name"));
            }

            try
            {
                //this code will do a insert and do a check for the id
                CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionstring2);
                CloudTableClient    tableClient    = storageAccount.CreateCloudTableClient();

                CloudTable cloudTable = tableClient.GetTableReference("AssessmentProfile");

                TableOperation tableOperation = TableOperation.Retrieve <AssessmentProfile>(CompanyId.ToString(), CompanyName);

                TableResult tableResult = await cloudTable.ExecuteAsync(tableOperation);

                AssessmentProfile person = tableResult.Result as AssessmentProfile;


                if (person != null)
                {
                    // add the code here to pass the id back to the client
                    json = JsonConvert.SerializeObject(person, Newtonsoft.Json.Formatting.None,
                                                       new JsonSerializerSettings
                    {
                        NullValueHandling = NullValueHandling.Ignore
                    });;
                }
            }
            catch (StorageException se)
            {
                log.LogTrace(se.Message);
            }
            catch (Exception ex)
            {
                log.LogTrace(ex.Message);
            }


            //change this to return the companyid
            return(new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(json, Encoding.UTF8, "application/json")
            });
        }
    /* Methods */

    /**
     * Constructor.
     *
     * @param chapter
     *            Chapter data to store the read data
     */
    public AssessmentSubParser(Chapter chapter) : base(chapter)
    {
        profile = new AssessmentProfile();
    }
示例#12
0
    /**
     * Loads the assessment profile (set of assessment rules) stored in file
     * with path xmlFile in zipFile
     *
     * @param zipFile
     * @param xmlFile
     * @param incidences
     * @return
     */
    public static AssessmentProfile loadAssessmentProfile(InputStreamCreator isCreator, string xmlFile, List<Incidence> incidences)
    {
        AssessmentProfile newProfile = null;
        if (Loader.adventureData != null)
        {
            foreach (Chapter chapter in Loader.adventureData.getChapters())
            {
                if (chapter.getAssessmentProfiles().Count != 0)
                {
                    foreach (AssessmentProfile profile in chapter.getAssessmentProfiles())
                    {
                        if (profile.getName().Equals(xmlFile))
                        {
                            //try
                            //{
                                newProfile = (AssessmentProfile)profile;
                            //}
                            //catch (CloneNotSupportedException e)
                            //{
                            //    e.printStackTrace();
                            //}
                            break;
                        }
                    }
                }
            }
        }
        else {

            // Open the file and load the data
            try
            {
                // Set the chapter handler
                AssessmentProfile profile = new AssessmentProfile();

                string name = xmlFile;
                name = name.Substring(name.IndexOf("/") + 1);
                if (name.IndexOf(".") != -1)
                    name = name.Substring(0, name.IndexOf("."));
                profile.setName(name);
                AssessmentHandler assParser = new AssessmentHandler(isCreator, profile);

                //factory.setValidating(true);
                //SAXParser saxParser = factory.newSAXParser();

                //// Parse the data and close the data
                string assessmentIS = isCreator.buildInputStream(xmlFile);

                //saxParser.parse(assessmentIS, assParser);
                //assessmentIS.close();
                assParser.Parse(assessmentIS);
                // Finally add the new controller to the list
                // Create the new profile

                // Fill flags & vars
                newProfile = profile;

            }
            catch (Exception e) { Debug.LogError(e); }

            //catch (ParserConfigurationException e)
            //{
            //    incidences.add(Incidence.createAssessmentIncidence(false, Language.GetText("Error.LoadAssessmentData.SAX"), xmlFile, e));
            //}
            //catch (SAXException e)
            //{
            //    incidences.add(Incidence.createAssessmentIncidence(false, Language.GetText("Error.LoadAssessmentData.SAX"), xmlFile, e));
            //}
            //catch (IOException e)
            //{
            //    incidences.add(Incidence.createAssessmentIncidence(false, Language.GetText("Error.LoadAssessmentData.IO"), xmlFile, e));
            //}
        }
        return newProfile;
    }
 /* Methods */
 /**
  * Constructor.
  *
  * @param chapter
  *            Chapter data to store the read data
  */
 public AssessmentSubParser(Chapter chapter)
     : base(chapter)
 {
     profile = new AssessmentProfile();
 }
示例#14
0
    /**
     * Loads the assessment profile (set of assessment rules) stored in file
     * with path xmlFile in zipFile
     *
     * @param zipFile
     * @param xmlFile
     * @param incidences
     * @return
     */
    public static AssessmentProfile loadAssessmentProfile(InputStreamCreator isCreator, string xmlFile, List <Incidence> incidences)
    {
        AssessmentProfile newProfile = null;

        if (Loader.adventureData != null)
        {
            foreach (Chapter chapter in Loader.adventureData.getChapters())
            {
                if (chapter.getAssessmentProfiles().Count != 0)
                {
                    foreach (AssessmentProfile profile in chapter.getAssessmentProfiles())
                    {
                        if (profile.getName().Equals(xmlFile))
                        {
                            //try
                            //{
                            newProfile = (AssessmentProfile)profile;
                            //}
                            //catch (CloneNotSupportedException e)
                            //{
                            //    e.printStackTrace();
                            //}
                            break;
                        }
                    }
                }
            }
        }
        else
        {
            // Open the file and load the data
            try
            {
                // Set the chapter handler
                AssessmentProfile profile = new AssessmentProfile();

                string name = xmlFile;
                name = name.Substring(name.IndexOf("/") + 1);
                if (name.IndexOf(".") != -1)
                {
                    name = name.Substring(0, name.IndexOf("."));
                }
                profile.setName(name);
                AssessmentHandler assParser = new AssessmentHandler(isCreator, profile);

                //factory.setValidating(true);
                //SAXParser saxParser = factory.newSAXParser();

                //// Parse the data and close the data
                string assessmentIS = isCreator.buildInputStream(xmlFile);

                //saxParser.parse(assessmentIS, assParser);
                //assessmentIS.close();
                assParser.Parse(assessmentIS);
                // Finally add the new controller to the list
                // Create the new profile

                // Fill flags & vars
                newProfile = profile;
            }
            catch (Exception e) { Debug.LogError(e); }

            //catch (ParserConfigurationException e)
            //{
            //    incidences.add(Incidence.createAssessmentIncidence(false, Language.GetText("Error.LoadAssessmentData.SAX"), xmlFile, e));
            //}
            //catch (SAXException e)
            //{
            //    incidences.add(Incidence.createAssessmentIncidence(false, Language.GetText("Error.LoadAssessmentData.SAX"), xmlFile, e));
            //}
            //catch (IOException e)
            //{
            //    incidences.add(Incidence.createAssessmentIncidence(false, Language.GetText("Error.LoadAssessmentData.IO"), xmlFile, e));
            //}
        }
        return(newProfile);
    }
示例#15
0
        public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequestMessage req, ILogger log)
        {
            log.LogTrace("C# HTTP trigger function processed a request.");

            dynamic body = await req.Content.ReadAsStringAsync();

            var data = JsonConvert.DeserializeObject <AssessmentProfile>(body as string);

            // parse query parameter
            Guid?  CompanyId       = data?.CompanyId;
            string CompanyName     = data?.CompanyName;
            Guid?  AssessmentId    = data?.AssessmentId;
            string GroupAdminToken = data?.GroupAdminToken;
            string AssessmentToken = data?.AssessmentToken;
            // Contact Contact = data?.Contact;

            string connectionstring2 = "DefaultEndpointsProtocol=https;AccountName=spassessservices20190227;AccountKey=KLx/VDJ279oOZ2Z2wELr90GauiVlEN4pr8r2ss2xAiokZJGAi4PF6eGz0nI0Vz0IieEwtKxqkgoM+ukeVoWxMw==;EndpointSuffix=core.windows.net";

            if (CompanyName == null && CompanyId == null)
            {
                return(req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a CompanyId in the request body"));
            }


            //this code will do a insert and do a check for the id
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionstring2);
            CloudTableClient    tableClient    = storageAccount.CreateCloudTableClient();

            CloudTable cloudTable = tableClient.GetTableReference("AssessmentProfile");

            TableOperation tableOperation = TableOperation.Retrieve <AssessmentProfile>(CompanyId.Value.ToString(), CompanyName);

            TableResult tableResult = await cloudTable.ExecuteAsync(tableOperation);

            AssessmentProfile person = tableResult.Result as AssessmentProfile;

            if (person == null)
            {
                try
                {
                    if (AssessmentId == null)
                    {
                        AssessmentId = GenerateAssessmentId();
                    }


                    var assessment = new AssessmentProfile()
                    {
                        PartitionKey    = CompanyId.Value.ToString(),
                        RowKey          = CompanyName,
                        CompanyId       = CompanyId,
                        AssessmentId    = AssessmentId,
                        CompanyName     = CompanyName,
                        GroupAdminToken = GroupAdminToken,
                        //Contact = Contact
                    };

                    TableOperation insertOperation = TableOperation.Insert(assessment);
                    TableResult    insertResult    = await cloudTable.ExecuteAsync(insertOperation);
                }
                catch (StorageException se)
                {
                    log.LogTrace(se.Message);
                }
                catch (Exception ex)
                {
                    log.LogTrace(ex.Message);
                }
            }



            return(req.CreateResponse(HttpStatusCode.Created, "successful"));
        }
 /**
  * Adds new assessment profile
  *
  * @param assessProfile
  *            the new assessment profile to add
  */
 public void addAssessmentProfile(AssessmentProfile assessProfile)
 {
     assessmentProfiles.Add(assessProfile);
 }