コード例 #1
0
        public IHttpActionResult PutSkillset(int id, Skillset skillset)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != skillset.SkillsetID)
            {
                return(BadRequest());
            }

            db.Entry(skillset).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SkillsetExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
    void instantiateVariables()
    {
        int science, engineering, farming;

        science     = Random.Range(1, 4);
        engineering = Random.Range(1, 4);
        farming     = Random.Range(1, 4);

        switch (scfield)
        {
        case Scfield.Scientist:
            science += 5;
            break;

        case Scfield.Engineer:
            engineering += 5;
            break;

        case Scfield.Farmer:
            farming += 5;
            break;

        case Scfield.Astronaut:
            science     += 2;
            engineering += 3;
            break;

        default:
            break;
        }
        this.skillset = new Skillset(science, engineering, farming);
    }
コード例 #3
0
    protected void BindDropDowns()
    {
        PRMS controller = new PRMS();

        PostingDropDown.DataSource     = controller.GetAllJobPostings();
        PostingDropDown.DataTextField  = "Description";
        PostingDropDown.DataValueField = "JobPostingID";
        PostingDropDown.Items.Insert(0, new ListItem("Select Job Posting...", "0"));
        PostingDropDown.DataBind();

        Profession.DataSource     = controller.GetProfessions();
        Profession.DataTextField  = "Description";
        Profession.DataValueField = "ProfessionID";
        Profession.Items.Insert(0, new ListItem("Select Profession...", "0"));
        Profession.DataBind();

        Skillset.DataSource     = controller.GetSkillsets();
        Skillset.DataTextField  = "Description";
        Skillset.DataValueField = "SkillsetID";
        Skillset.Items.Insert(0, new ListItem("Select Skillset...", "0"));
        Skillset.DataBind();

        Region.DataSource     = controller.GetRegions();
        Region.DataTextField  = "Description";
        Region.DataValueField = "RegionID";
        Region.Items.Insert(0, new ListItem("Select Region...", "0"));
        Region.DataBind();
    }
コード例 #4
0
        public async Task <Response <Skillset> > CreateOrUpdateAsync(string skillsetName, Skillset skillset, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
        {
            if (skillsetName == null)
            {
                throw new ArgumentNullException(nameof(skillsetName));
            }
            if (skillset == null)
            {
                throw new ArgumentNullException(nameof(skillset));
            }

            using var message = CreateCreateOrUpdateRequest(skillsetName, skillset, requestOptions, accessCondition);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            case 201:
            {
                Skillset value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                if (document.RootElement.ValueKind == JsonValueKind.Null)
                {
                    value = null;
                }
                else
                {
                    value = Skillset.DeserializeSkillset(document.RootElement);
                }
                return(Response.FromValue(value, message.Response));
            }
コード例 #5
0
        private static void AddUserInfoToIndex(ref Index index, ref Indexer indexer, ref Skillset skillset)
        {
            // Create a new index fields for userName and userLocation
            var userNameField = new Field
            {
                Name          = "userName",
                Type          = DataType.String,
                IsSearchable  = true,
                IsFilterable  = true,
                IsRetrievable = true,
                IsSortable    = true,
                IsKey         = false,
                Analyzer      = AnalyzerName.StandardLucene
            };

            index.Fields.Add(userNameField);

            var userLocationField = new Field
            {
                Name          = "userLocation",
                Type          = DataType.String,
                IsSearchable  = true,
                IsFilterable  = true,
                IsRetrievable = true,
                IsSortable    = true,
                IsKey         = false,
                Analyzer      = AnalyzerName.StandardLucene
            };

            index.Fields.Add(userLocationField);

            indexer.OutputFieldMappings.Add(CreateFieldMapping("/document/user/name", "userName"));
            indexer.OutputFieldMappings.Add(CreateFieldMapping("/document/user/location", "userLocation"));
        }
コード例 #6
0
        internal HttpMessage CreateCreateOrUpdateRequest(string skillsetName, Skillset skillset, Guid?xMsClientRequestId, string ifMatch, string ifNoneMatch)
        {
            var message = pipeline.CreateMessage();
            var request = message.Request;

            request.Method = RequestMethod.Put;
            var uri = new RawRequestUriBuilder();

            uri.AppendRaw(endpoint, false);
            uri.AppendPath("/skillsets('", false);
            uri.AppendPath(skillsetName, true);
            uri.AppendPath("')", false);
            uri.AppendQuery("api-version", apiVersion, true);
            request.Uri = uri;
            if (xMsClientRequestId != null)
            {
                request.Headers.Add("x-ms-client-request-id", xMsClientRequestId.Value);
            }
            if (ifMatch != null)
            {
                request.Headers.Add("If-Match", ifMatch);
            }
            if (ifNoneMatch != null)
            {
                request.Headers.Add("If-None-Match", ifNoneMatch);
            }
            request.Headers.Add("Prefer", "return=representation");
            request.Headers.Add("Content-Type", "application/json");
            using var content = new Utf8JsonRequestContent();
            content.JsonWriter.WriteObjectValue(skillset);
            request.Content = content;
            return(message);
        }
コード例 #7
0
        public async ValueTask <Response <Skillset> > CreateOrUpdateAsync(string skillsetName, Guid?xMsClientRequestId, string ifMatch, string ifNoneMatch, Skillset skillset, CancellationToken cancellationToken = default)
        {
            if (skillsetName == null)
            {
                throw new ArgumentNullException(nameof(skillsetName));
            }
            if (skillset == null)
            {
                throw new ArgumentNullException(nameof(skillset));
            }

            using var scope = clientDiagnostics.CreateScope("SkillsetsClient.CreateOrUpdate");
            scope.Start();
            try
            {
                using var message = CreateCreateOrUpdateRequest(skillsetName, xMsClientRequestId, ifMatch, ifNoneMatch, skillset);
                await pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

                switch (message.Response.Status)
                {
                case 200:
                {
                    using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                    var value = Skillset.DeserializeSkillset(document.RootElement);
                    return(Response.FromValue(value, message.Response));
                }
コード例 #8
0
        public ActionResult CreateChart(int id)
        {
            using (StudentRepository sr = new StudentRepository())
            {
                Skillset s = sr.GetSkillSetById(id);

                return(View(s));
            }
        }
コード例 #9
0
 public void CreateSkillsetThrowsExceptionWithNonShaperSkillWithNestedInputs()
 {
     Run(() =>
     {
         SearchServiceClient searchClient = Data.GetSearchServiceClient();
         Skillset skillset        = CreateTestSkillsetWithNestedInputs(isShaper: false);
         CloudException exception = Assert.Throws <CloudException>(() => searchClient.Skillsets.Create(skillset));
         Assert.Contains("Skill '#1' is not allowed to have recursively defined inputs", exception.Message);
     });
 }
コード例 #10
0
 public void CreateSkillsetThrowsExceptionWithInvalidLanguageSelection()
 {
     Run(() =>
     {
         SearchServiceClient searchClient = Data.GetSearchServiceClient();
         Skillset skillset        = CreateTestSkillsetOcrSentiment(OcrSkillLanguage.Fi, SentimentSkillLanguage.Fi, TextExtractionAlgorithm.Handwritten);
         CloudException exception = Assert.Throws <CloudException>(() => searchClient.Skillsets.Create(skillset));
         Assert.Contains("When 'textExtractionAlgorithm' parameter is set to 'handwritten' the only supported value for 'defaultLanguageCode' parameter is 'en'", exception.Message);
     });
 }
コード例 #11
0
        static async Task Main(string[] args)
        {
            // First, connect to a search service
            SearchServiceClient searchService = CreateSearchServiceClient(configuration);

            string indexName = "reviewsindex";

            if (!searchService.Indexes.Exists(indexName))
            {
                // Next, create the search index
                Console.WriteLine("Deleting index...\n");
                await DeleteIndexIfExists(indexName, searchService);

                // Create the skills
                Console.WriteLine("Creating the skills....");

                var      skills   = CreateSkills();
                Skillset skillSet = CreateOrUpdateDemoSkillSet(searchService, skills);

                Console.WriteLine("Creating index...\n");
                await CreateIndex(indexName, searchService);

                // Set up a Blob Storage data source and indexer, and run the indexer to merge hotel room data
                Console.WriteLine("Indexing and merging review data from blob storage...\n");
                await CreateAndRunBlobIndexer(indexName, searchService, skillSet);

                System.Threading.Thread.Sleep(4000);
                Console.WriteLine("Complete.\n");
            }
            else
            {
                Console.WriteLine("The index already exists.  Enter 1 to delete the index.  Enter 2 to query the existing index");
                int choice = Convert.ToInt32(Console.ReadLine());
                if (choice == 1)
                {
                    await DeleteIndexIfExists(indexName, searchService);

                    Console.WriteLine("Index deleted.  Exiting app");
                }
                else if (choice == 2)
                {
                    Console.WriteLine("{0}", "Searching index...\n");
                    ISearchIndexClient indexClient = searchService.Indexes.GetClient(indexName);
                    RunQueries(indexClient);
                }
                else
                {
                    Console.WriteLine("Invalid Choice.  Exiting app");
                    Console.ReadKey();
                }
            }

            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
コード例 #12
0
        public IHttpActionResult GetSkillset(int id)
        {
            Skillset skillset = db.Skillsets.Find(id);

            if (skillset == null)
            {
                return(NotFound());
            }

            return(Ok(skillset));
        }
        // GET /api/Skillsets/1
        public IHttpActionResult GetSkillset(long id)
        {
            Skillset Skillset = m_db.Skillset.SingleOrDefault(skill => skill.Id == id);

            if (Skillset == null)
            {
                return(NotFound());
            }

            return(Ok(Skillset));
        }
コード例 #14
0
    protected void BindDropDowns()
    {
        Skillset.Items.Clear();
        PRMS controller = new PRMS();

        Skillset.DataSource     = controller.GetSkillsets();
        Skillset.DataTextField  = "Description";
        Skillset.DataValueField = "SkillsetID";
        Skillset.Items.Insert(0, new ListItem("Select Skillset...", "0"));
        Skillset.DataBind();
    }
コード例 #15
0
 public int AddStudentSkill(Skillset ss, int id)
 {
     if (ss != null)
     {
         Student s = (Student)_users.GetUserById(id);
         s.Skillset = ss;
         _users.UpdateUser(s);
         _users.Save();
         return(1);
     }
     return(0);
 }
コード例 #16
0
        public IHttpActionResult PostSkillset(Skillset skillset)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Skillsets.Add(skillset);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = skillset.SkillsetID }, skillset));
        }
コード例 #17
0
    private void Awake()
    {
        _sprite               = GetComponent <Image>();
        _stats                = GetComponent <StatsManager>();
        focusSelector         = GetComponent <Button>();
        focusSelector.enabled = false;

        if (skillset == null)
        {
            skillset = ScriptableObject.CreateInstance <Skillset>();
        }
    }
コード例 #18
0
 private void CreateAndValidateSkillset(SearchServiceClient searchClient, Skillset expectedSkillset)
 {
     try
     {
         Skillset actualSkillset = searchClient.Skillsets.Create(expectedSkillset);
         AssertSkillsetEqual(expectedSkillset, actualSkillset);
     }
     finally
     {
         searchClient.Skillsets.Delete(expectedSkillset.Name);
     }
 }
コード例 #19
0
        public void CreateOrUpdateCreatesWhenSkillsetDoesNotExist()
        {
            Run(() =>
            {
                SearchServiceClient searchClient = Data.GetSearchServiceClient();

                Skillset skillset = CreateTestOcrSkillset(1, TextExtractionAlgorithm.Printed);

                AzureOperationResponse <Skillset> response =
                    searchClient.Skillsets.CreateOrUpdateWithHttpMessagesAsync(skillset.Name, skillset).Result;
                Assert.Equal(HttpStatusCode.Created, response.Response.StatusCode);
            });
        }
コード例 #20
0
        public static async Task <string> GetSkillsetJson(Skillset skillset)
        {
            var serializerSettings = new JsonSerializerSettings();

            serializerSettings.Converters.Add(new PolymorphicSerializeJsonConverter <Skill>("@odata.type"));
            serializerSettings.Converters.Add(new PolymorphicSerializeJsonConverter <CognitiveServices>("@odata.type"));
            var payload = await Task.Run(() => JsonConvert.SerializeObject(skillset, serializerSettings));

            // Remove problematic values
            var cleanPayload = payload.Replace(",\"@odata.etag\":null", "").Replace("\"httpHeaders\":null,", "");

            return(await Task.FromResult(cleanPayload));
        }
コード例 #21
0
 public virtual async Task <Response <Skillset> > CreateAsync(Skillset skillset, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.Create");
     scope.Start();
     try
     {
         return(await RestClient.CreateAsync(skillset, requestOptions, cancellationToken).ConfigureAwait(false));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
コード例 #22
0
        public IHttpActionResult DeleteSkillset(int id)
        {
            Skillset skillset = db.Skillsets.Find(id);

            if (skillset == null)
            {
                return(NotFound());
            }

            db.Skillsets.Remove(skillset);
            db.SaveChanges();

            return(Ok(skillset));
        }
コード例 #23
0
 public virtual Response <Skillset> CreateOrUpdate(string skillsetName, Skillset skillset, RequestOptions requestOptions = null, AccessCondition accessCondition = null, CancellationToken cancellationToken = default)
 {
     using var scope = _clientDiagnostics.CreateScope("SkillsetsClient.CreateOrUpdate");
     scope.Start();
     try
     {
         return(RestClient.CreateOrUpdate(skillsetName, skillset, requestOptions, accessCondition, cancellationToken));
     }
     catch (Exception e)
     {
         scope.Failed(e);
         throw;
     }
 }
        public IHttpActionResult DeleteSkillset(long id)
        {
            Skillset skill = m_db.Skillset.Find(id);

            if (skill == null)
            {
                return(NotFound());
            }

            m_db.Skillset.Remove(skill);
            m_db.SaveChanges();

            return(Ok(skill));
        }
コード例 #25
0
 public ActionResult CreateSkillset(Skillset s, string button)
 {
     if (ModelState.IsValid)
     {
         if (button == "Submit")
         {
             int code = uas.AddStudentSkill(s, Convert.ToInt32(Session["Id"]));
             if (code == 1)
             {
                 return(RedirectToAction("Index", "Students"));
             }
         }
     }
     ViewBag.SkillError = "An error has occured.";
     return(View());
 }
コード例 #26
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Skillset = await _context.Skillsets
                       .Include(s => s.Profile).FirstOrDefaultAsync(m => m.Id == id);

            if (Skillset == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #27
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Skillset = await _context.Skillsets.FindAsync(id);

            if (Skillset != null)
            {
                _context.Skillsets.Remove(Skillset);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
コード例 #28
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Skillset = await _context.Skillsets
                       .Include(s => s.Profile).FirstOrDefaultAsync(m => m.Id == id);

            if (Skillset == null)
            {
                return(NotFound());
            }
            ViewData["PersonId"] = new SelectList(_context.Persons, "Id", "Name");
            return(Page());
        }
コード例 #29
0
        public static void Main(string[] args)
        {
            // Create service client
            IConfigurationBuilder builder       = new ConfigurationBuilder().AddJsonFile("appsettings.json");
            IConfigurationRoot    configuration = builder.Build();
            SearchServiceClient   serviceClient = CreateSearchServiceClient(configuration);

            // Create or Update the data source
            Console.WriteLine("Creating or updating the data source...");
            DataSource dataSource = CreateOrUpdateDataSource(serviceClient, configuration);

            // Create the skills
            Console.WriteLine("Creating the skills...");
            OcrSkill                 ocrSkill                 = CreateOcrSkill();
            MergeSkill               mergeSkill               = CreateMergeSkill();
            EntityRecognitionSkill   entityRecognitionSkill   = CreateEntityRecognitionSkill();
            LanguageDetectionSkill   languageDetectionSkill   = CreateLanguageDetectionSkill();
            SplitSkill               splitSkill               = CreateSplitSkill();
            KeyPhraseExtractionSkill keyPhraseExtractionSkill = CreateKeyPhraseExtractionSkill();

            // Create the skillset
            Console.WriteLine("Creating or updating the skillset...");
            List <Skill> skills = new List <Skill>();

            skills.Add(ocrSkill);
            skills.Add(mergeSkill);
            skills.Add(languageDetectionSkill);
            skills.Add(splitSkill);
            skills.Add(entityRecognitionSkill);
            skills.Add(keyPhraseExtractionSkill);

            Skillset skillset = CreateOrUpdateDemoSkillSet(serviceClient, skills);

            // Create the index
            Console.WriteLine("Creating the index...");
            Index demoIndex = CreateDemoIndex(serviceClient);

            // Create the indexer, map fields, and execute transformations
            Console.WriteLine("Creating the indexer and executing the pipeline...");
            Indexer demoIndexer = CreateDemoIndexer(serviceClient, dataSource, skillset, demoIndex);

            // Check indexer overall status
            Console.WriteLine("Check the indexer overall status...");
            CheckIndexerOverallStatus(serviceClient, demoIndexer);
        }
コード例 #30
0
    private List <Skillset> GetJobSkills(int jobPostingID)
    {
        List <Skillset> skillsets = new List <Skillset>();

        SqlConnection con;

        con = new SqlConnection();
        con.ConnectionString = ConfigurationManager.ConnectionStrings["key"].ConnectionString;

        SqlCommand cmd;

        cmd             = new SqlCommand();
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Connection  = con;
        cmd.CommandText = "GetJobSkillsets";

        SqlParameter JobPostingID;

        JobPostingID = new SqlParameter();
        JobPostingID.ParameterName = "@JobPostingID";
        JobPostingID.SqlDbType     = SqlDbType.Int;
        JobPostingID.Direction     = ParameterDirection.Input;
        JobPostingID.Value         = jobPostingID;

        cmd.Parameters.Add(JobPostingID);

        con.Open();

        SqlDataReader reader;

        reader = cmd.ExecuteReader();



        while (reader.Read())
        {
            Skillset aSkillset = new Skillset();

            aSkillset.SkillsetID  = int.Parse(reader["SkillsetID"].ToString());
            aSkillset.Description = reader["Description"].ToString();

            skillsets.Add(aSkillset);
        }
        return(skillsets);
    }