コード例 #1
0
        public JsonResult Delete(int id)
        {
            try
            {
                if (id == 0)
                {
                    return(Json(new { responseCode = "-10" }));
                }


                LanguageLevel model = this._languageLevelBusiness.GetLanguageLevel(id);
                model.Enable = false;
                this._languageLevelBusiness.Save(model);

                var responseObject = new
                {
                    responseCode = 0
                };
                return(Json(responseObject));
            }
            catch (Exception)
            {
                return(Json(new { responseCode = "-10" }));
            }
        }
コード例 #2
0
 internal void AddLanguage(string LangName, string LangLevel)
 {
     AddNewButton.Click();                  //Click on AddNew button
     AddNewLanTextInput.SendKeys(LangName); //enter language name
     LanguageLevel.SendKeys(LangLevel);     //enter language level
     AddButton.Click();                     //click on Add button
 }
コード例 #3
0
        public void ShouldAddLanguageSkills()
        {
            var httpResult = controller.Get(1);
            var response   = httpResult as JsonResult <CandidateDTO>;
            var candidate  = response.Content;

            int           languageId    = context.Languages.First().Id;
            LanguageLevel languageLevel = LanguageLevel.Advanced;

            var newLanguageSkill = new LanguageSkillDTO
            {
                LanguageId    = languageId,
                LanguageLevel = languageLevel
            };

            var languageSkills = candidate.LanguageSkills.ToList();

            languageSkills.Add(newLanguageSkill);
            candidate.LanguageSkills = languageSkills;

            var newHttpResult = controller.Put(candidate.Id, candidate);
            var newResponse   = newHttpResult as JsonResult <CandidateDTO>;
            var newCandidate  = newResponse.Content;

            Assert.IsTrue(newCandidate.LanguageSkills.Any(x => x.LanguageId == languageId && x.LanguageLevel == languageLevel));
        }
コード例 #4
0
        /// <summary>
        /// Delete User Action Activity Log
        /// </summary>
        /// <param name=></param>
        /// <returns>bool</returns>
        public async Task <bool> DeleteLanguageLevel(int LanguageLevelId)
        {
            #region Declare a return type with initial value.
            bool isLanguageLevelDeleted = default(bool);
            #endregion
            try
            {
                if (LanguageLevelId > default(int))
                {
                    #region Vars
                    LanguageLevel LanguageLevel = null;
                    #endregion
                    #region Get LanguageLevel by id
                    LanguageLevel = await UnitOfWork.LanguageLevelRepository.GetById(LanguageLevelId);

                    #endregion
                    #region check if object is not null
                    if (LanguageLevel != null)
                    {
                        LanguageLevel.IsDeleted = (byte)DeleteStatusEnum.Deleted;
                        #region Apply the changes to the database
                        UnitOfWork.LanguageLevelRepository.Update(LanguageLevel);
                        isLanguageLevelDeleted = await UnitOfWork.Commit() > default(int);

                        #endregion
                    }
                    #endregion
                }
            }
            catch (Exception exception)
            {
            }
            return(isLanguageLevelDeleted);
        }
コード例 #5
0
        public async Task <IActionResult> PutLanguageLevel(int id, LanguageLevel languageLevel)
        {
            if (id != languageLevel.Id)
            {
                return(BadRequest());
            }

            _context.Entry(languageLevel).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LanguageLevelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #6
0
ファイル: Language.cs プロジェクト: sbxn14/ResumeStripper
 //for testing
 public Language(string name, LanguageLevel listen, LanguageLevel speaking, LanguageLevel writing)
 {
     Name             = name;
     LevelOfListening = listen;
     LevelOfSpeaking  = speaking;
     LevelOfWriting   = writing;
 }
コード例 #7
0
        public bool UpdateLanguageLevelDetails(LanguageLevel details)
        {
            List <SqlParameter> sp = new List <SqlParameter>()
            {
                new SqlParameter()
                {
                    ParameterName = "@name", Value = details.Name, SqlDbType = SqlDbType.NChar
                },
                new SqlParameter()
                {
                    ParameterName = "@lagLevel_Id", Value = details.LagLevel_Id, SqlDbType = SqlDbType.BigInt
                },
            };

            object[] parameters = sp.ToArray();
            var      users      = _languageLevelRepository.ExecuteStoredProcedureList <AuthUser>(PROC_UPDATE_LANGUAGE_LEVEL_DETAILS, parameters);

            if (users != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #8
0
        public async Task <ActionResult <LanguageLevel> > PostLanguageLevel(LanguageLevel languageLevel)
        {
            _context.LanguageLevel.Add(languageLevel);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLanguageLevel", new { id = languageLevel.Id }, languageLevel));
        }
コード例 #9
0
 public CodeGenerator(LanguageLevel level)
 {
     Context            = new Context( );
     Module             = new BitcodeModule(Context, "Kaleidoscope");
     InstructionBuilder = new InstructionBuilder(Context);
     NamedValues        = new Dictionary <string, Value>( );
     ParserStack        = new ReplParserStack(level);
 }
コード例 #10
0
        private void Update(LanguageLevel view)
        {
            LanguageLevel model = GetLanguageLevel(view.Id);

            model.Name = view.Name;

            this.repository.Update(view);
        }
コード例 #11
0
        public ActionResult DeleteConfirmed(int id)
        {
            LanguageLevel languageLevel = db.LanguageLevels.Find(id);

            db.LanguageLevels.Remove(languageLevel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #12
0
 public CodeGenerator(LanguageLevel level, TargetMachine machine)
 {
     Context            = new Context( );
     TargetMachine      = machine;
     InstructionBuilder = new InstructionBuilder(Context);
     NamedValues        = new Dictionary <string, Alloca>( );
     FunctionPrototypes = new PrototypeCollection( );
     ParserStack        = new ReplParserStack(level);
 }
コード例 #13
0
 public ActionResult Edit([Bind(Include = "LanguageLevelID,Name")] LanguageLevel languageLevel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(languageLevel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(languageLevel));
 }
コード例 #14
0
        /// <summary>Initializes a new instance of the <see cref="ReplParserStack"/> class configured for the specified language level</summary>
        /// <param name="level"><see cref="LanguageLevel"/> for the parser</param>
        public ReplParserStack(LanguageLevel level)
        {
            LanguageLevel = level;
            var listener = new FormattedConsoleErrorListener( );

            LexErrorListener   = listener;
            ParseErrorListener = listener;
            ErrorStrategy      = new ReplErrorStrategy( );
            InitializeParser(string.Empty);
        }
コード例 #15
0
        public ActionResult Edit(LanguageLevel language)
        {
            if (ModelState.IsValid)
            {
                _unitOfWork.LanguageLevelRepository.Edit(language);
                return(RedirectToAction("Index", "LevelLanguage"));
            }

            return(View(language));
        }
コード例 #16
0
ファイル: CodeGenerator.cs プロジェクト: nbsn2/Llvm.NET
 public CodeGenerator(LanguageLevel level)
 {
     Context = new Context( );
     InitializeModuleAndPassManager( );
     InstructionBuilder = new InstructionBuilder(Context);
     JIT                = new KaleidoscopeJIT( );
     NamedValues        = new Dictionary <string, Alloca>( );
     FunctionPrototypes = new PrototypeCollection( );
     ParserStack        = new ReplParserStack(level);
 }
コード例 #17
0
        public ActionResult Create([Bind(Include = "LanguageLevelID,Name")] LanguageLevel languageLevel)
        {
            if (ModelState.IsValid)
            {
                db.LanguageLevels.Add(languageLevel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(languageLevel));
        }
コード例 #18
0
 public void Save(LanguageLevel model)
 {
     if (model.Id > 0)
     {
         Update(model);
     }
     else
     {
         Create(model);
     }
 }
コード例 #19
0
 /// <summary>Initializes a new instance of the <see cref="ReplParserStack"/> class.</summary>
 /// <param name="level"><see cref="LanguageLevel"/> for the parser</param>
 /// <param name="lexErrorListener">Error listener for Lexer errors</param>
 /// <param name="parseErrorListener">Error listener for parer errors</param>
 public ReplParserStack(LanguageLevel level
                        , IAntlrErrorListener <int> lexErrorListener
                        , IAntlrErrorListener <IToken> parseErrorListener
                        )
 {
     LanguageLevel      = level;
     LexErrorListener   = lexErrorListener;
     ParseErrorListener = parseErrorListener;
     ErrorStrategy      = new ReplErrorStrategy( );
     InitializeParser(string.Empty);
 }
コード例 #20
0
        // GET: LanguageLevels/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LanguageLevel languageLevel = db.LanguageLevels.Find(id);

            if (languageLevel == null)
            {
                return(HttpNotFound());
            }
            return(View(languageLevel));
        }
コード例 #21
0
        public async Task <LanguageLevel> GetLanguageLevel(int Id)
        {
            _oLanguageLevel = new LanguageLevel();
            using (var httpClient = new HttpClient(_clientHandler))
            {
                using (var response = await httpClient.GetAsync("https://localhost:44304/api/LanguageLevels/" + Id))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();

                    _oLanguageLevel = JsonConvert.DeserializeObject <LanguageLevel>(apiResponse);
                }
            }
            return(_oLanguageLevel);
        }
コード例 #22
0
        public async Task <ActionResult <CandidateDTO> > GetCandidateDTO(int id)
        {
            Candidate Candidate = await _context.Candidate.FindAsync(id);

            CandidateDTO CandidateDTO = new CandidateDTO();
            List <CandidateExperience> candidateExperiences = await _context.CandidateExperience.ToListAsync();

            List <CandidateLanguage> candidateLanguages = await _context.CandidateLanguage.ToListAsync();

            List <CandidateLanguageDTO> languages = new List <CandidateLanguageDTO>();

            foreach (CandidateExperience ca in candidateExperiences)
            {
                if (ca.CandidateId == id)
                {
                    CandidateDTO.ExperienceId = ca.ExperienceId;
                }
            }
            CandidateDTO.DrivingLicenceId = Candidate.DrivingLicenceId;
            CandidateDTO.SalaryWishId     = Candidate.SalaryWishId;
            foreach (CandidateLanguage cl in candidateLanguages)
            {
                if (cl.CandidateId == id)
                {
                    CandidateLanguageDTO candidateLanguageDTO = new CandidateLanguageDTO();
                    candidateLanguageDTO.LanguageId      = cl.LanguageId;
                    candidateLanguageDTO.LanguageLevelId = cl.LanguageLevelId;
                    Language language = await _context.Language.FindAsync(candidateLanguageDTO.LanguageId);

                    candidateLanguageDTO.Language = language.Name;
                    LanguageLevel languageLevel = await _context.LanguageLevel.FindAsync(candidateLanguageDTO.LanguageLevelId);

                    candidateLanguageDTO.LanguageLevel = languageLevel.Name;
                    languages.Add(candidateLanguageDTO);
                }
            }
            SalaryWish salary = await _context.SalaryWish.FindAsync(CandidateDTO.SalaryWishId);

            DrivingLicence permis = await _context.DrivingLicence.FindAsync(CandidateDTO.DrivingLicenceId);

            Experience experience = await _context.Experience.FindAsync(CandidateDTO.ExperienceId);

            CandidateDTO.SalaryWish     = salary.Salary;
            CandidateDTO.DrivingLicence = permis.Type;
            CandidateDTO.Experience     = experience.Name;
            CandidateDTO.Languages      = languages;
            return(CandidateDTO);
        }
コード例 #23
0
 public CodeGenerator(LanguageLevel level, TargetMachine machine)
 {
     LexicalBlocks      = new Stack <DIScope>( );
     Context            = new Context( );
     TargetMachine      = machine;
     InstructionBuilder = new InstructionBuilder(Context);
     NamedValues        = new Dictionary <string, Alloca>( );
     FunctionPrototypes = new PrototypeCollection( );
     ParserStack        = new ReplParserStack(level);
     Module             = new BitcodeModule(Context, "Kaleidoscope", SourceLanguage.C, "fib.ks", "Kaleidoscope Compiler")
     {
         TargetTriple = machine.Triple,
         Layout       = machine.TargetData
     };
     DoubleType = new DebugBasicType(Context.DoubleType, Module, "double", DiTypeKind.Float);
 }
コード例 #24
0
        public JsonResult Get(int id)
        {
            LanguageLevel model = new LanguageLevel();

            try
            {
                model = this._languageLevelBusiness.GetLanguageLevel(id);


                return(Json(model, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(new { responseCode = "-10" }));
            }
        }
コード例 #25
0
 /// <summary>
 /// Mapping User Activity Log DTO to Action
 /// </summary>
 /// <param name=></param>
 /// <param name=></param>
 /// <returns></returns>
 public LanguageLevel MappingLanguageLevelupdateDTOToLanguageLevel(LanguageLevel languageLevel, LanguageLevelUpdateDTO LanguageLevelUpdateDTO)
 {
     #region Declare Return Var with Intial Value
     LanguageLevel LanguageLevel = languageLevel;
     #endregion
     try
     {
         if (LanguageLevelUpdateDTO.LanguageLevelId > default(int))
         {
             LanguageLevel.LanguageLevelId   = LanguageLevelUpdateDTO.LanguageLevelId;
             LanguageLevel.LanguageLevelName = LanguageLevelUpdateDTO.LanguageLevelName;
         }
     }
     catch (Exception exception) { }
     return(LanguageLevel);
 }
コード例 #26
0
        public async Task <LanguageLevel> PostLanguageLevel(LanguageLevel languageLevel)
        {
            _oLanguageLevel = new LanguageLevel();
            using (var httpClient = new HttpClient(_clientHandler))
            {
                StringContent content = new StringContent(JsonConvert.SerializeObject(languageLevel), Encoding.UTF8, "application/json");

                using (var response = await httpClient.PostAsync("https://localhost:44304/api/LanguageLevels", content))
                {
                    string apiResponse = await response.Content.ReadAsStringAsync();

                    _oLanguageLevel = JsonConvert.DeserializeObject <LanguageLevel>(apiResponse);
                }
            }
            return(_oLanguageLevel);
        }
コード例 #27
0
ファイル: IRentService.cs プロジェクト: davidketner/Rent
 public bool CreateLanguageLevel(LanguageLevel languageLevel, string userId)
 {
     try
     {
         if (!LanguageLevels.Items.Any(x => x.Name == languageLevel.Name.Trim() && x.Level == languageLevel.Level))
         {
             languageLevel.Name        = languageLevel.Name.Trim();
             languageLevel.UserCreated = userId;
             LanguageLevels.Add(languageLevel);
             return(true);
         }
     }
     catch (Exception e)
     {
     }
     return(false);
 }
コード例 #28
0
 /// <summary>
 /// Mapping user Action Actitvity Log
 /// </summary>
 /// <param name=></ param >
 /// <returns>Task<LanguageLevel></returns>
 public LanguageLevel MappingLanguageLevelAddDTOToLanguageLevel(LanguageLevelAddDTO LanguageLevelAddDTO)
 {
     #region Declare a return type with initial value.
     LanguageLevel LanguageLevel = null;
     #endregion
     try
     {
         LanguageLevel = new LanguageLevel
         {
             LanguageLevelName = LanguageLevelAddDTO.LanguageLevelName,
             CreationDate      = DateTime.Now,
             IsDeleted         = (byte)DeleteStatusEnum.NotDeleted
         };
     }
     catch (Exception exception) { }
     return(LanguageLevel);
 }
コード例 #29
0
        public async Task <int> AddAsync(string cvId, LanguageType languageType,
                                         LanguageLevel comprehension, LanguageLevel speaking, LanguageLevel writing)
        {
            var languageInfo = new LanguageInfo
            {
                CurriculumVitaeId = cvId,
                LanguageType      = languageType,
                Comprehension     = comprehension,
                Speaking          = speaking,
                Writing           = writing
            };

            await this.repository.AddAsync(languageInfo);

            await this.repository.SaveChangesAsync();

            return(languageInfo.Id);
        }
コード例 #30
0
        private void RunBasicReplLoop(LanguageLevel level
                                      , TextReader input
                                      , Func <DynamicRuntimeState, TextWriter, IKaleidoscopeCodeGenerator <Value> > generatorFactory
                                      )
        {
            var parser = new Parser(level);

            using var outputWriter = new TestContextTextWriter(TestContext);
            using var generator    = generatorFactory(parser.GlobalState, outputWriter);

            // Create sequence of parsed AST RootNodes to feed the 'REPL' loop
            var replSeq = from stmt in input.ToStatements(_ => { })
                          select parser.Parse(stmt);

            foreach (IAstNode node in replSeq)
            {
                var errors = node.CollectErrors();
                Assert.AreEqual(0, errors.Count( ));

                var result = generator.Generate(node);

                // Validate guarantees of OptionalValue<T>
                Assert.IsTrue((result.HasValue && !(result.Value is null)) || (!result.HasValue && result.Value is null));

                if (result.HasValue)
                {
                    switch (result.Value)
                    {
                    case ConstantFP value:
                        TestContext.WriteLine("Evaluated to {0}", value.Value);
                        break;

                    case IrFunction function:
                        TestContext.WriteLine("Generated:\n{0}", function.ToString( ));
                        break;

                    default:
                        TestContext.WriteLine(result.Value !.ToString( ));
                        break;
                    }
                }
            }
        }