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)); }
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); }
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(); }
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)); }
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")); }
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); }
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)); }
public ActionResult CreateChart(int id) { using (StudentRepository sr = new StudentRepository()) { Skillset s = sr.GetSkillSetById(id); return(View(s)); } }
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); }); }
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); }); }
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(); }
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)); }
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(); }
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); }
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)); }
private void Awake() { _sprite = GetComponent <Image>(); _stats = GetComponent <StatsManager>(); focusSelector = GetComponent <Button>(); focusSelector.enabled = false; if (skillset == null) { skillset = ScriptableObject.CreateInstance <Skillset>(); } }
private void CreateAndValidateSkillset(SearchServiceClient searchClient, Skillset expectedSkillset) { try { Skillset actualSkillset = searchClient.Skillsets.Create(expectedSkillset); AssertSkillsetEqual(expectedSkillset, actualSkillset); } finally { searchClient.Skillsets.Delete(expectedSkillset.Name); } }
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); }); }
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)); }
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; } }
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)); }
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)); }
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()); }
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()); }
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")); }
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()); }
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); }
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); }