protected void btnOk_Click(object sender, EventArgs e) { int credId = MyConvert.GetInt32(this.hidCredId.Value); TenderInfo tenderInfo = new TenderInfoManager().GetTenderByCredId(credId); if (tenderInfo == null) { GotoMsgBoxPageForDynamicPage("请选择要评价的债权信息!", 1, "Index.aspx"); } XYECOM.Model.AMS.Evaluation info = new Evaluation(); info.CreditInfoId = credId; info.Description = this.txtDescription.Text.Trim(); info.EvaluationResult = MyConvert.GetInt32(this.radEvaluationType.SelectedValue); info.User2Id = tenderInfo.LayerId; info.UserId = (int)userinfo.userid; info.UserName = userinfo.LoginName; info.User2Name = userInfoManage.GetUserNameByID(tenderInfo.LayerId); int result = manage.InsertEvaluation(info); if (result > 0) { new CreditInfoManager().UpdateEvaluationByCredId(credId, false); GotoMsgBoxPageForDynamicPage("评价成功!", 1, "Index.aspx"); } else { GotoMsgBoxPageForDynamicPage("评价失败!", 1, "Index.aspx"); } }
public List<Evaluation> GetEvaluationList(string evaluationId) { var EvaluationList = new List<Evaluation>(); var cmd = new SqlCommand("SELECT EvaluationId, Name, NumberOfQuestions" + " FROM Evaluations" + " WHERE EvaluationId = @EvaluationId", Cxn); cmd.Parameters.Add(new SqlParameter("EvaluationId", evaluationId)); // Open the connection Cxn.Open(); // Perform the query var reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (reader.Read()) { // Set the basic properties var Evaluation = new Evaluation { Id = reader.GetGuid(0).ToString(), Name = reader.GetString(1), NumberOfQuestions = reader.GetInt32(2) }; EvaluationList.Add(Evaluation); } return EvaluationList; }
public Evaluation GetEvaluation(string evaluationId) { Evaluation evaluation = new Evaluation(); var cmd = new SqlCommand("SELECT EvaluationId, Name, NumberOfQuestions" + " FROM Evaluations" + " WHERE EvaluationId = @EvaluationId", Cxn); cmd.Parameters.Add(new SqlParameter("EvaluationId", evaluationId)); if (Cxn.State == ConnectionState.Open) Cxn.Close(); // Open the connection Cxn.Open(); // Perform the query var reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (reader.Read()) { evaluation.Id = reader.GetGuid(0).ToString(); evaluation.Name = reader.GetString(1); evaluation.NumberOfQuestions = reader.GetInt32(2); } return evaluation; }
/// <summary> /// Récupère une Evaluation à partir d'un identifiant de client /// </summary> /// <param name="Identifiant">Identifant de Evaluation</param> /// <returns>Un Evaluation </returns> public static Evaluation Get(Int32 identifiant) { //Connection ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"]; SqlConnection connection = new SqlConnection(connectionStringSettings.ToString()); //Commande String requete = @"SELECT Identifiant, Relation, Qualite, Realisation, Polyvalence, Assiduite, Motivation, Autonomie, RespectConsigne FROM Evaluation WHERE Identifiant = @Identifiant"; SqlCommand commande = new SqlCommand(requete, connection); //Paramètres commande.Parameters.AddWithValue("Identifiant", identifiant); //Execution connection.Open(); SqlDataReader dataReader = commande.ExecuteReader(); dataReader.Read(); //1 - Création du Evaluation Evaluation evaluation = new Evaluation(); evaluation.Identifiant = dataReader.GetInt32(0); evaluation.Relation = dataReader.GetInt16(1); evaluation.Qualite = dataReader.GetInt16(2); evaluation.Realisation = dataReader.GetInt16(3); evaluation.Polyvalence = dataReader.GetInt16(4); evaluation.Assiduite = dataReader.GetInt16(5); evaluation.Motivation = dataReader.GetInt16(6); evaluation.Autonomie = dataReader.GetInt16(7); evaluation.RespectConsigne = dataReader.GetInt16(8); dataReader.Close(); connection.Close(); return evaluation; }
/// <summary> /// 新增评价信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public int InsertEvaluation(Evaluation info) { if (info == null) { return 0; } return DAL.InsertEvaluation(info); }
public void Test_candidate_7_DevelopmentIOS_and_5_DevelopmentAndroid() { Evaluation evaluation = new Evaluation (); evaluation.DevelopmentiOS = 7; evaluation.DevelopmentAndroid = 5; VerifyAssess (evaluation, "message_mobile"); }
public void Test_candidate_7_HTML_CSS_and_Javascript() { Evaluation evaluation = new Evaluation (); evaluation.HTML = 7; evaluation.CSS = 7; evaluation.JavaScript = 7; VerifyAssess (evaluation, "message_frontend"); }
protected override Evaluation EvaluateConstructorInfo(ConstructorInfo constructorInfo) { var result = new Evaluation(constructorInfo.DeclaringType); if (constructorInfo.ContainsGenericParameters) { result.Failed = true; result.Message = "Sorry, ConstructorTester can't test generic Constructors."; } return result; }
protected override Evaluation EvaluateConstructorInfo(ConstructorInfo constructorInfo) { var result = new Evaluation(constructorInfo.DeclaringType); if (constructorInfo.GetParameters().Any(x => x.ParameterType.IsByRef)) { result.Failed = true; result.Message = "Sorry, ConstructorTester can't test Constructors containing ByRef-arguments."; } return result; }
protected override Evaluation EvaluateConstructorInfo(ConstructorInfo constructorInfo) { var result = new Evaluation(constructorInfo.DeclaringType); if (HasPointerArguments(constructorInfo)) { result.Failed = true; result.Message = "Sorry, ConstructorTester can't test Constructors containing pointer-arguments."; } return result; }
public override Expression Evaluate(Evaluation.Bindings scope) { // A List evaluates either as a special form, a macro, or a function call if (SpecialForms.IsSpecialForm(Elements[0].Token.Text)) return SpecialForms.CallSpecialForm(this); else if (IsMacro(Elements[0], scope)) return CallMacro(scope); else return CallFunction(scope); }
public ActionResult Create(Evaluation NouvEvaluation) { try { DB.Evaluations.Add(NouvEvaluation); DB.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }
/// <summary> /// 新增评价信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public int InsertEvaluation(Evaluation info) { string sql = @"Insert Into Evaluation (userid,UserName,User2Id,User2Name,Evaluation,Description,CreditInfoID) values (@UserId,@UserName,@User2Id,@User2Name,@EvaluationResult,@Description,@CreditInfoID)"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@UserId",info.UserId), new SqlParameter("@UserName",info.UserName), new SqlParameter("@User2Id",info.User2Id), new SqlParameter("@User2Name",info.User2Name), new SqlParameter("@EvaluationResult",info.EvaluationResult), new SqlParameter("@Description",info.Description), new SqlParameter("@CreditInfoID",info.CreditInfoId) }; int rowAffected = SqlHelper.ExecuteNonQuery(CommandType.Text, sql, param); return rowAffected; }
public Evaluation Evaluate(object @object) { var type = @object as Type; if (type == null) throw new ArgumentException("Cannot evaluate objects that are not Type."); var result = new Evaluation(type); if (!type.IsPublic && !_testConfig.TestInternals) { result.Failed = true; result.Message = "Cannot test non-public classes because TestInternals is set to false."; } return result; }
public Evaluation Evaluate(object @object) { var type = @object as Type; if (type == null) throw new ArgumentException("Cannot evaluate objects that are not Type."); var result = new Evaluation(type); if (type.IsAbstract) { result.Failed = true; result.Message = "Sorry, ConstructorTester can't test abstract classes."; } return result; }
public String BuildString(String format, Evaluation.Number[] args) { if (format == null) throw new ArgumentNullException("format"); if (args == null) throw new ArgumentNullException("args"); lock(m_lock) { m_args.Clear(); for (Int32 i = 0; i != args.Length; ++i) { if (args[i].NumberType == NumberType.Int) m_args.Add(args[i].IntValue); else if (args[i].NumberType == NumberType.Float) m_args.Add(args[i].FloatValue); else m_args.Add(null); } return Build(format); } }
private Evaluation Minimax(MinimaxNode node, bool maximizing, int firstMove, string mySymbol) { var eval = EvaluateNode(node, mySymbol); if (eval != null) { return new Evaluation() { Value = eval.Value, Move = firstMove }; } if (maximizing) { var best = new Evaluation() { Value = int.MinValue, Move = -1 }; for (int i = 0; i < 9; i++) { if (IsEmpty(node.Board.Tiles[i])) { var child = new MinimaxNode(node.Board, i); var val = Minimax(child, false, firstMove == -1 ? i : firstMove, mySymbol); if (val.Value > best.Value) { best = val; } } } return best; } else { var best = new Evaluation() { Value = int.MaxValue, Move = -1 }; for (int i = 0; i < 9; i++) { if (IsEmpty(node.Board.Tiles[i])) { var child = new MinimaxNode(node.Board, i); var val = Minimax(child, true, firstMove == -1 ? i : firstMove, mySymbol); if (val.Value < best.Value) { best = val; } } } return best; } }
///<summary>Converts a DataTable to a list of objects.</summary> public static List<Evaluation> TableToList(DataTable table){ List<Evaluation> retVal=new List<Evaluation>(); Evaluation evaluation; for(int i=0;i<table.Rows.Count;i++) { evaluation=new Evaluation(); evaluation.EvaluationNum = PIn.Long (table.Rows[i]["EvaluationNum"].ToString()); evaluation.InstructNum = PIn.Long (table.Rows[i]["InstructNum"].ToString()); evaluation.StudentNum = PIn.Long (table.Rows[i]["StudentNum"].ToString()); evaluation.SchoolCourseNum = PIn.Long (table.Rows[i]["SchoolCourseNum"].ToString()); evaluation.EvalTitle = PIn.String(table.Rows[i]["EvalTitle"].ToString()); evaluation.DateEval = PIn.Date (table.Rows[i]["DateEval"].ToString()); evaluation.GradingScaleNum = PIn.Long (table.Rows[i]["GradingScaleNum"].ToString()); evaluation.OverallGradeShowing= PIn.String(table.Rows[i]["OverallGradeShowing"].ToString()); evaluation.OverallGradeNumber = PIn.Float (table.Rows[i]["OverallGradeNumber"].ToString()); evaluation.Notes = PIn.String(table.Rows[i]["Notes"].ToString()); retVal.Add(evaluation); } return retVal; }
private void Graphique_Load(object sender, EventArgs e) { chartEvaluationMOD.Dock = DockStyle.Fill; chartEvaluationMOD.Palette = ChartColorPalette.Fire; chartEvaluationMOD.Titles.Add("Title1"); chartEvaluationMOD.Titles["Title1"].Text = "Graphique"; ChartArea chartarea = new ChartArea(); chartarea.Name = "NewChartArea"; chartEvaluationMOD.ChartAreas.Add("NewChartArea"); Legend legend = new Legend(); legend.Name = "legend1"; legend.Title = "Donnée du graphique"; chartEvaluationMOD.Legends.Add("legend1"); Series series1 = new Series(); series1.LegendText = "Zone de notification"; series1.Name = "series1"; chartEvaluationMOD.Series.Add("series1"); chartEvaluationMOD.Series["series1"].Legend = "legend1"; chartEvaluationMOD.Series["series1"].IsVisibleInLegend = true; Evaluation evaluationMOD = new Evaluation(); evaluationMOD.Relation =4 ; evaluationMOD.Qualite = 2; evaluationMOD.Realisation =3 ; evaluationMOD.Polyvalence = 4; evaluationMOD.Assiduite = 3; evaluationMOD. Motivation =4 ; evaluationMOD.Autonomie = 1; evaluationMOD.RespectConsigne =2 ; Double[] doubltte = new Double[] { evaluationMOD.Relation, evaluationMOD.Qualite, evaluationMOD.Realisation, evaluationMOD.Polyvalence, evaluationMOD.Assiduite, evaluationMOD.Motivation, evaluationMOD.Autonomie, evaluationMOD.RespectConsigne }; String[] strinnng = new String[] { "Relation", "Qualité", "Réalisation", "Polyvalence", "Assiduite", "Motivation", "Autonomie", "Respect des Consigne" }; chartEvaluationMOD.Series["series1"].Points.DataBindXY(strinnng, doubltte); chartEvaluationMOD.Series["series1"].ChartType = SeriesChartType.Radar; }
public async Task <Response> AddEvaluation(Student student, Evaluation evaluation) { Response response = new Response(); try { (await _context.Students.Include(c => c.Evaluations).Where(c => c.ID == student.ID).FirstOrDefaultAsync()).Evaluations.Add(evaluation); await _context.SaveChangesAsync(); return(response); } catch (Exception e) { StringBuilder sb = new StringBuilder(); log.Error(sb.AppendLine(e.Message).AppendLine(e.StackTrace).ToString()); response.Success = false; response.ErrorList.Add("Error while addind evaluation to student."); return(response); } }
/// <summary> /// Update repository /// </summary> /// <param name="coll1"></param> /// <param name="groupName"></param> /// <param name="indivName"></param> public void UpdateRepository(ObservableCollection <Evaluation> coll1, string groupName, string indivName) { var targetDirectory = DataTracker.Properties.Settings.Default.SaveLocation + "\\" + groupName + "\\" + indivName; try { string[] subdirectoryEntries = Directory.GetDirectories(targetDirectory); coll1.Clear(); foreach (string subdirectory in subdirectoryEntries) { string[] group = subdirectory.Split('\\'); coll1.Add(Evaluation.CreateEvaluation(group[group.Length - 1])); } } catch { } }
/// <summary> /// Reparse directory /// </summary> /// <param name="groupName"></param> /// <param name="indivName"></param> public void RefreshRepository(string groupName, string indivName) { var targetDirectory = Properties.Settings.Default.SaveLocation + "\\" + groupName + "\\" + indivName; try { string[] subdirectoryEntries = Directory.GetDirectories(targetDirectory); AllEvaluations.Clear(); foreach (string subdirectory in subdirectoryEntries) { string[] group = subdirectory.Split('\\'); AllEvaluations.Add(Evaluation.CreateEvaluation(group[group.Length - 1])); } } catch { } }
public void ProgressAllParticipants() { ProjectService projectService = new ProjectService(_context); ParticipantService participantService = new ParticipantService(_context); EvaluationService evaluationService = new EvaluationService(_context); Project project = projectService.Create("ProgressAllParticipants"); Evaluation evaluation = evaluationService.Create("ProgressAllParticipants", project); Participant participant1 = participantService.Create("ProgressAllParticipants1", evaluation, Organization.All, Role.Facilitator); Participant participant2 = participantService.Create("ProgressAllParticipants2", evaluation, Organization.Commissioning, Role.OrganizationLead); Progression progression1Before = participant1.Progression; participantService.ProgressAllParticipants(evaluation, Progression.Individual); Progression progression1After = participant1.Progression; Progression progression2After = participant2.Progression; Assert.Equal(Progression.Nomination, progression1Before); Assert.Equal(Progression.Individual, progression1After); Assert.Equal(Progression.Individual, progression2After); }
public void Test_EvaluationService_Get_ShouldBeOk() { _student = ObjectMother.GetExistentValidStudent(); _result = ObjectMother.GetExistentValidResult(_student); results = new List <Result> { _result }; Evaluation evaluation = ObjectMother.GetExistentValidEvaluation(results); _result.Evaluation = evaluation; _mockEvaluationRepository.Setup(r => r.Get(evaluation.Id)).Returns(evaluation); _mockResultRepository.Setup(r => r.GetByEvaluation(evaluation.Id)).Returns(results); Evaluation evaluationFound = _service.Get(evaluation.Id); evaluationFound.Should().Be(evaluation); evaluationFound.Results.Should().BeEquivalentTo(results); _mockEvaluationRepository.Verify(r => r.Get(evaluation.Id)); _mockResultRepository.Verify(r => r.GetByEvaluation(evaluation.Id)); }
public void Test_EvaluationService_Get_InvalidId_ShouldThrowException() { int invalidId = 0; _student = ObjectMother.GetExistentValidStudent(); _result = ObjectMother.GetNewValidResult(_student); results = new List <Result> { _result }; Evaluation evaluation = ObjectMother.GetExistentValidEvaluation(results); _result.Evaluation = evaluation; evaluation.Id = invalidId; Action action = () => _service.Get(evaluation.Id); action.Should().Throw <IdentifierUndefinedException>(); _mockEvaluationRepository.VerifyNoOtherCalls(); _mockResultRepository.VerifyNoOtherCalls(); }
private bool IsChoiceShouldBeDisabled() { var disabled = false; foreach (var condition in _choice.Conditions) { var eval = new Evaluation(condition); if (eval.CanBePlayedInContext()) { continue; } disabled = true; break; } return(disabled); }
public void Test_EvaluationService_Add_ShouldBeOk() { _student = ObjectMother.GetExistentValidStudent(); _result = ObjectMother.GetExistentValidResult(_student, null); results = new List <Result> { _result }; int ExistentId = 1; Evaluation evaluationToSave = ObjectMother.GetNewValidEvaluation(results); _result.Evaluation = evaluationToSave; _mockEvaluationRepository.Setup(r => r.Save(evaluationToSave)).Returns(ObjectMother.GetExistentValidEvaluation(results)); _mockResultRepository.Setup(r => r.Save(evaluationToSave.Results.First())); Evaluation evaluationReturned = _service.Add(evaluationToSave); evaluationReturned.Id.Should().Be(ExistentId); _mockEvaluationRepository.Verify(r => r.Save(evaluationToSave)); _mockResultRepository.VerifyNoOtherCalls(); }
private IEnumerator DisplayScoreRoutine() { Debug.Log("DisplayScore"); score.state = ScoreData.State.Score; isMoving = true; Evaluation evaluation = new Evaluation(endMovementDuration); Vector3 startPos = transform.position; follow = false; while (evaluation.isBelowOne) { transform.position = Vector3.Lerp(startPos, scorePos, getToScoreCurve.Evaluate(evaluation.fraction)); yield return(evaluation.YieldIncrement()); } transform.position = scorePos; isMoving = false; }
public Answer SetAnswer(string questionId, Severity severity, string text, Progression progression) { IQueryable <Question> queryableQuestion = _questionService.GetQuestion(questionId); Question question = queryableQuestion.First(); Evaluation evaluation = queryableQuestion.Select(q => q.Evaluation).First(); Participant currentUser = CurrentUser(evaluation); Answer answer; try { answer = _answerService.GetAnswer(question, currentUser, progression); _answerService.UpdateAnswer(answer, severity, text); } catch (NotFoundInDBException) { answer = _answerService.Create(currentUser, question, severity, text, progression); } return(answer); }
public Object Deserialize(String text) { if ((Object)text == null) { return(null); } Evaluation evaluation = null; ; try { evaluation = Evaluation.ParseEvaluation(text); } catch (FormatException e) { throw new ArgumentException("can't deserialize " + text + " to an Evaluation. " + e.Message); } return(evaluation); }
public ActionResult <string> createEvaluation([FromBody] Evaluation model) { try { Evaluation newEvaluation = new Evaluation(); newEvaluation.CourseCrn = model.CourseCrn; newEvaluation.CourseTerm = model.CourseTerm; newEvaluation.CourseYear = model.CourseYear; newEvaluation.EvaluationId = model.EvaluationId; newEvaluation.StudentGroupId = model.StudentGroupId; _context.Evaluations.Add(newEvaluation); _context.SaveChanges(); return(JsonConvert.SerializeObject("Created New Evaluation")); } catch (Exception e) { } return(JsonConvert.SerializeObject("Error")); }
public ActionResult NotifyRatersNow(Evaluation model) { if (model == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var eval = UnitOfWork.EvaluationRepository.GetByID(model.EvaluationID); foreach (var rater in eval.Raters) { if (!rater.Disabled && string.IsNullOrEmpty(rater.Answers)) { SendRaterEmail(rater.RaterID, model.EvaluationID); } } TempData["TakeEvalSuccess"] = "Evaluation complete. Email notifications sent to raters."; return(RedirectToAction("EmployeeEvalsIndex", "Evaluations", new { id = model.EmployeeID })); }
public static AbstractType Resolve(TypeOfDeclaration typeOf, ResolverContextStack ctxt) { // typeof(return) if (typeOf.InstanceId is TokenExpression && (typeOf.InstanceId as TokenExpression).Token == DTokens.Return) { var m = HandleNodeMatch(ctxt.ScopedBlock, ctxt, null, typeOf); if (m != null) { return(m); } } // typeOf(myInt) => int else if (typeOf.InstanceId != null) { var wantedTypes = Evaluation.EvaluateType(typeOf.InstanceId, ctxt); return(DResolver.StripMemberSymbols(wantedTypes)); } return(null); }
protected Participant CreateParticipant( Evaluation evaluation, string azureUniqueId = null, Organization?organization = null, Role?role = null) { if (azureUniqueId == null) { azureUniqueId = Randomize.Integer().ToString(); } Participant participant = _mutation.CreateParticipant( azureUniqueId: azureUniqueId, evaluationId: evaluation.Id, organization: organization.GetValueOrDefault(Randomize.Organization()), role: role.GetValueOrDefault(Randomize.Role()) ); return(participant); }
public void AddEvaluationType(string text, int id) { var sarahDb = new SarahIncContext(); if (!string.IsNullOrEmpty(text)) { var existEvalType = (from e in sarahDb.Evaluation where e.Type == text && (e.FormId == null || e.FormId == id) select e).FirstOrDefault(); if (existEvalType == null) { var newEvalType = new Evaluation(); sarahDb.Evaluation.Add(newEvalType); newEvalType.Type = text; newEvalType.FormId = id; sarahDb.SaveChanges(); } } }
public void ShouldReturnMissingGoalWhenSetSkillScoreToSkillGoalIfGoalIsNotFound() { // arrange var skillEvaluator = new Employee(100, "Jane Doe").SkillEvaluator; var skill = new Skill("C#"); var evaluatee = new Employee(101, "John Doe").Evaluatee; var evaluationPeriod = new EvaluationPeriod(TimeZoneInfo.Local, new DateTime(DateTime.Today.Year, 1, 1), new DateTime(DateTime.Today.Year, 12, 31)); var evaluation = new Evaluation(evaluatee, evaluationPeriod); var targetLevel = SkillLevel.Advanced; var currentLevel = SkillLevel.Average; var skillGoal = new SkillGoal(skill, skillEvaluator, targetLevel, currentLevel, evaluation); // act var skillLevelAchieved = SkillLevel.Advanced; var result = skillEvaluator.SetSkillScoreToSkillGoal(skillGoal, skillLevelAchieved, 10, "Excelsior!!!"); // assert Assert.Equal(OperationStatusCode.MissingSkillGoal, result.OperationStatusCode); Assert.Empty(skillEvaluator.SkillGoals); }
public void Test_candidate_7_in_HTML_CSS_and_Javascript_Python_Django() { var address = "*****@*****.**"; Candidate candidate = new Candidate (); candidate.Email = new Email(address); candidate.Nome = "Bernardo Bruning"; Evaluation evaluation = new Evaluation (); evaluation.HTML = 7; evaluation.CSS = 7; evaluation.JavaScript = 7; evaluation.Python = 7; evaluation.Django = 7; _service.Assess (candidate, evaluation); VerifySendEmailService ("message_frontend", address); VerifySendEmailService ("message_backend", address); }
private static int GetSelectorId(Evaluation evaluation, Test test, DemographicsInTest demographicInTest) { switch (demographicInTest.Demographic.Name) { case "Gender": return(evaluation.Sex == "Female" ? 0 : 1); case "AgeRange": return(evaluation.Age_Id.Value); case "InstructionLevel": return(evaluation.InstructionLevel_Id.Value); case "Location": return(evaluation.Location_Id.Value); case "Performance": return(evaluation.Performance_Id.Value); case "PositionLevel": return(evaluation.PositionLevel_Id.Value); case "Seniority": return(evaluation.Seniority_Id.Value); case "Country": return(evaluation.Location.State.Country_Id); case "State": return(evaluation.Location.State_Id); case "Region": return(evaluation.Location.Region_Id.Value); case "FunctionalOrganizationType": return(evaluation.EvaluationFOs.Where(f => f.FunctionalOrganization.Type_Id == demographicInTest.FOT_Id.Value).FirstOrDefault().FunctionalOrganization_Id); default: return(0); } }
/// <param name="args"> Command line parameters used to initialize parameters of convolutional network /// [0] - maximal number of epochs during learning /// [1] - learning error stop condition /// [2] - learning rate used during learning process /// [3] - number of feature maps in 1st convolutional layer /// [4] - number of feature maps in 2nd convolutional layer /// [5] - number of feature maps in 3rd convolutional layer </param> public static void Main(string[] args) { try { int maxIter = 10000; // Integer.parseInt(args[0]); double maxError = 0.01; //Double.parseDouble(args[1]); double learningRate = 0.2; // Double.parseDouble(args[2]); int layer1 = Convert.ToInt32(args[3]); int layer2 = Convert.ToInt32(args[4]); int layer3 = Convert.ToInt32(args[5]); LOG.info("{}-{}-{}", layer1, layer2, layer3); DataSet trainSet = MNISTDataSet.createFromFile(MNISTDataSet.TRAIN_LABEL_NAME, MNISTDataSet.TRAIN_IMAGE_NAME, 100); DataSet testSet = MNISTDataSet.createFromFile(MNISTDataSet.TEST_LABEL_NAME, MNISTDataSet.TEST_IMAGE_NAME, 10000); Dimension2D inputDimension = new Dimension2D(32, 32); Dimension2D convolutionKernel = new Dimension2D(5, 5); Dimension2D poolingKernel = new Dimension2D(2, 2); ConvolutionalNetwork convolutionNetwork = (new ConvolutionalNetwork.Builder()).withInputLayer(32, 32, 1).withConvolutionLayer(5, 5, layer1).withPoolingLayer(2, 2).withConvolutionLayer(5, 5, layer2).withPoolingLayer(2, 2).withConvolutionLayer(5, 5, layer3).withFullConnectedLayer(10).build(); ConvolutionalBackpropagation backPropagation = new ConvolutionalBackpropagation(); backPropagation.LearningRate = learningRate; backPropagation.MaxError = maxError; backPropagation.MaxIterations = maxIter; backPropagation.addListener(new LearningListener(convolutionNetwork, testSet)); backPropagation.ErrorFunction = new MeanSquaredError(); convolutionNetwork.LearningRule = backPropagation; convolutionNetwork.learn(trainSet); Evaluation.runFullEvaluation(convolutionNetwork, testSet); } catch (IOException e) { Console.WriteLine(e.ToString()); Console.Write(e.StackTrace); } }
public void TestPostEvaluation() { Memory.Templates.List.Add(new Template() { Id = Guid.Parse("00000001-0000-0000-0000-000000000000"), EvalNameMaxChars = 150, AllowedCharsRule = @"^[\w\s]+$", ValueRequired = true, Name = "Evaluation Header Test Template", ScoreFormula = "sum(i, 0, questionsLength, questionResult(i))", QualificationRules = new Dictionary <string, object>() { { "Min", 0 }, { "MinRanges", 1 } }, Headers = new List <DataField> { new TextField() { Id = Guid.Parse("00000001-0001-0000-0000-000000000000"), AllowedCharsRule = @"^[\w\s]+$", ValueRequired = true, Input = false, Label = "Title", Type = DataFieldType.Text, MinChar = 4, MaxChar = 150 } } }); var expected = new Evaluation() { Name = "New Evaluation", IdTemplate = Guid.Parse("00000001-0000-0000-0000-000000000000") }; var service = new EvaluationsService(new EvaluationsStubDao()); var actual = service.CreateEvaluation(expected); Assert.True(expected.Name == actual.Name); }
public void TestCreatingOne() { Catalogue c = new Catalogue(CatalogueRepository, "FrankyMicky"); try { var dqeRepo = new DQERepository(CatalogueRepository); Evaluation evaluation = new Evaluation(dqeRepo, c); var annotation = new DQEGraphAnnotation(dqeRepo, 1, 2, 3, 4, "Fishesfly", evaluation, DQEGraphType.TimePeriodicityGraph, "ALL"); Assert.AreEqual(annotation.StartX, 1); Assert.AreEqual(annotation.StartY, 2); Assert.AreEqual(annotation.EndX, 3); Assert.AreEqual(annotation.EndY, 4); Assert.AreEqual(annotation.AnnotationIsForGraph, DQEGraphType.TimePeriodicityGraph); //should be about 2 milliseconds ago Assert.IsTrue(annotation.CreationDate <= DateTime.Now.AddSeconds(3)); //certainly shouldnt be before yesterday! Assert.IsTrue(annotation.CreationDate > DateTime.Now.AddDays(-1)); //text should match Assert.AreEqual(annotation.Text, "Fishesfly"); annotation.Text = "flibble"; annotation.SaveToDatabase(); annotation.Text = ""; //new copy is flibble Assert.AreEqual("flibble", dqeRepo.GetObjectByID <DQEGraphAnnotation>(annotation.ID).Text); annotation.DeleteInDatabase(); } finally { c.DeleteInDatabase(); } }
public ActionResult Delete(Evaluation evaluationToBeDeleted) { int etudiantId = evaluationToBeDeleted.EtudiantId, matiereId = evaluationToBeDeleted.MatiereId, enseignantId = evaluationToBeDeleted.EnseignantId; try { var evaluation = (from e in DB.Evaluations where e.EtudiantId == etudiantId && e.MatiereId == matiereId && e.EnseignantId == enseignantId select e).First(); DB.Evaluations.Remove(evaluation); DB.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }
public EvaluationReplyDto SaveEvaluation([FromBody] EvaluationSaveDto data) { Console.WriteLine(data); Evaluation evaluation = new Evaluation { SchoolOrTeacherId = data.SchoolOrTeacherId, EvaluationType = data.EvaluationType, PhoneNr = data.PhoneNr, EvaluationItems = data.EvaluationItems }; Evaluation evaluationReply = lernsiegService.SaveEvaluation(evaluation); return(new EvaluationReplyDto { Id = evaluationReply.Id, SchoolOrTeacherId = evaluation.SchoolOrTeacherId, EvaluationType = evaluation.EvaluationType, PhoneNr = evaluation.PhoneNr }); }
public void TestUpdateEvaluationWithEditDate_Throws_InternalErrorDaoException() { var mockEvaluation = new Evaluation() { Id = Guid.Parse("11111111-1111-1111-1111-111111111114"), Name = "New Evaluation", EditDate = DateTime.Now }; var expected = "Bad arguments, cannot update existing evaluation Edit Date"; try { var service = new EvaluationsService(new EvaluationsStubDao()); service.UpdateEvaluation(mockEvaluation); } catch (Exception e) { Assert.Equal(expected, e.Message); } }
public async Task <DataResponse <Evaluation> > Update(Evaluation item) { DataResponse <Evaluation> response = new DataResponse <Evaluation>(); try { item.UpdatedAt = DateTime.Now; _context.Evaluations.Update(item); await _context.SaveChangesAsync(); return(response); } catch (Exception e) { StringBuilder sb = new StringBuilder(); log.Error(sb.AppendLine(e.Message).AppendLine(e.StackTrace).ToString()); response.Success = false; response.ErrorList.Add("Error while updating Evaluation."); return(response); } }
public void SaveEvaluation_EvaluationDoesNotExists_Created() { Stubs.GameRepository.Add(new Game() { Key = 1 }); Stubs.UnitOfWork.Commit(); var evaluation = new Evaluation() { GameKey = 1 }; evaluation.Cons.Add("Con"); evaluation.Pros.Add("Pro"); m_target.SaveEvaluation(evaluation); Assert.AreEqual(5, m_target.CountAllEvaluations()); Assert.AreEqual(5, m_target.GetEvaluationByKey(evaluation.Key).Key); }
static AbstractType DeduceEponymousTemplate(EponymousTemplateType ept, ResolutionContext ctxt) { if (ept.Definition.Initializer == null) { ctxt.LogError(ept.Definition, "Can't deduce type from empty initializer!"); return(null); } // Introduce the deduced params to the current resolution context ctxt.CurrentContext.IntroduceTemplateParameterTypes(ept); // Get actual overloads AbstractType deducedType = null; deducedType = new MemberSymbol(ept.Definition, Evaluation.EvaluateType(ept.Definition.Initializer, ctxt), null, ept.DeducedTypes); //ept; //Evaluation.EvaluateType (ept.Definition.Initializer, ctxt); // Undo context-related changes ctxt.CurrentContext.RemoveParamTypesFromPreferredLocals(ept); return(deducedType); }
public ActionResult Delete(Evaluation evaluationToBeDeleted) { int etudiantId = evaluationToBeDeleted.EtudiantId, matiereId = evaluationToBeDeleted.MatiereId, enseignantId = evaluationToBeDeleted.EnseignantId; try { var evaluation = (from e in DB.Evaluations where e.EtudiantId == etudiantId && e.MatiereId == matiereId && e.EnseignantId == enseignantId select e).First(); DB.Evaluations.Remove(evaluation); DB.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public void TestEvaluationToStringMethod() { //empty var eval = new Evaluation(); Assert.AreEqual(eval.ToString(), "<?>: ?b"); eval.Definition = new EvaluationDefinition() { Name = "Category", }; Assert.AreEqual(eval.ToString(), "Category: ?b"); eval.Value = new EvaluationValue() { Points = 5, }; Assert.AreEqual(eval.ToString(), "Category: 5b"); }
public ActionResult Edit(Evaluation EditEvaluation) { int etudiantId = EditEvaluation.EtudiantId, matiereId = EditEvaluation.MatiereId, enseignantId = EditEvaluation.EnseignantId; try { var evaluation = (from e in DB.Evaluations where e.EtudiantId == etudiantId && e.MatiereId == matiereId && e.EnseignantId == enseignantId select e).First(); evaluation.Note = EditEvaluation.Note; DB.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
private void lstTests_SelectedIndexChanged(object sender, System.EventArgs e) { ArrayList evals = GetTests(); Evaluations aevals = new Evaluations(Globals.CurrentIdentity); lstOrder.Items.Clear(); foreach (int evalID in evals) { Evaluation eval = aevals.GetInfo(evalID); Evaluations.DependencyGraph dg = new Evaluations.DependencyGraph(eval, Globals.CurrentIdentity); Evaluation.EvaluationList order = dg.GetBuildOrder(); foreach (Evaluation oeval in order) { lstOrder.Items.Add(oeval.Name); } lstOrder.Items.Add(eval.Name); } }
/// <summary> /// Récupère une liste de Evaluation à partir de la base de données /// </summary> /// <returns>Une liste de client</returns> public static List<Evaluation> List() { //Récupération de la chaine de connexion //Connection ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["EntretienSPPPConnectionString"]; SqlConnection connection = new SqlConnection(connectionStringSettings.ToString()); //Commande String requete = "SELECT Identifiant, Relation, Qualite, Realisation, Polyvalence, Assiduite, Motivation, Autonomie, RespectConsigne FROM Evaluation"; connection.Open(); SqlCommand commande = new SqlCommand(requete, connection); //execution SqlDataReader dataReader = commande.ExecuteReader(); List<Evaluation> list = new List<Evaluation>(); while (dataReader.Read()) { //1 - Créer un Evaluation à partir des donner de la ligne du dataReader Evaluation evaluation = new Evaluation(); evaluation.Identifiant = dataReader.GetInt32(0); evaluation.Relation = dataReader.GetInt16(1); evaluation.Qualite = dataReader.GetInt16(2); evaluation.Realisation = dataReader.GetInt16(3); evaluation.Polyvalence = dataReader.GetInt16(4); evaluation.Assiduite = dataReader.GetInt16(5); evaluation.Motivation = dataReader.GetInt16(6); evaluation.Autonomie = dataReader.GetInt16(7); evaluation.RespectConsigne = dataReader.GetInt16(8); //2 - Ajouter ce Evaluation à la list de client list.Add(evaluation); } dataReader.Close(); connection.Close(); return list; }
///<summary>Inserts one Evaluation into the database. Returns the new priKey.</summary> public static long Insert(Evaluation evaluation){ if(DataConnection.DBtype==DatabaseType.Oracle) { evaluation.EvaluationNum=DbHelper.GetNextOracleKey("evaluation","EvaluationNum"); int loopcount=0; while(loopcount<100){ try { return Insert(evaluation,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ evaluation.EvaluationNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(evaluation,false); } }
static void ReconstructAndSave(string fileName, MyImageReader image, Evaluation evaluation) { var tileOrders = new byte[1, 9]; TileOrderFromPermutation(Permutations, evaluation.Permutation, 9, tileOrders, 0); var tileOrder = new byte[9]; for (var i = 0; i < 9; i++) { tileOrder[i] = tileOrders[0, i]; } var pixels = new uint[image.Width, image.Height]; var cxTile = image.Width / 3; var cyTile = image.Height / 3; for (var destinationTile = 0; destinationTile < 9; destinationTile++) { var destTileX = destinationTile % 3; var destTileY = destinationTile / 3; var sourceTile = tileOrder[destinationTile]; var sourceTileX = sourceTile % 3; var sourceTileY = sourceTile / 3; for (var x = 0; x < cxTile; x++) { for (var y = 0; y < cyTile; y++) { pixels[destTileX * cxTile + x, destTileY * cyTile + y] = image.Pixels[sourceTileX * cxTile + x + (sourceTileY * cyTile + y) * image.Width]; } } } MyImageWriter.Write(fileName, pixels); }
public static void Solve(string sourceFileName, string destinationFileName) { // load image from disk var cpuImage = new MyImageReader(sourceFileName); // allocate image memory on the GPU var gpuImage = Gpu.Allocate<uint>(cpuImage.Pixels.Length); // copy the image pixels to the GPU Gpu.StartTimer(); Gpu.CopyToDevice(cpuImage.Pixels, gpuImage); CopyImageTimeMs = Gpu.StopTimer(); // allocate scaled image memory on the GPU var gpuScaledImage = Gpu.Allocate<byte>(64 * 3, 64 * 3); // rescale the image using the GPU Gpu.StartTimer(); Gpu.Launch(new dim3(12, 12), new dim3(16, 16), EnhancedScaleImageKernel, gpuImage, cpuImage.Width, cpuImage.Height, gpuScaledImage); Gpu.Synchronize(); ScaleImageTimeMs = Gpu.StopTimer(); // save a copy of the scaled image SaveScaledImage("Scaled.bmp", gpuScaledImage); // compare with CPU scale image time TimeCpuEnhancedScaleImage(cpuImage); // allocate edges memory on the GPU var gpuEdges = Gpu.Allocate<byte>(9, 4, 64); // extract edge information using the GPU Gpu.StartTimer(); Gpu.Launch(new dim3(9, 4), 64, ExtractEdgeKernel, gpuScaledImage, gpuEdges); Gpu.Synchronize(); ExtractEdgeTimeMs = Gpu.StopTimer(); // copy edges to GPU constant memory Gpu.StartTimer(); Gpu.CopyFromDevice(gpuEdges, Edges); Gpu.CopyToConstantMemory(Edges, Edges); CopyEdgesToConstantMemoryTimeMs = Gpu.StopTimer(); // allocate fit memory on the GPU var gpuFit = Gpu.Allocate<float>(9, 9); // compare edge fitting using the GPU Gpu.StartTimer(); Gpu.Launch(new dim3(9, 9), 64, ComputeFitsKernel, 2, 0, gpuFit); Gpu.Synchronize(); ComputeFitsTimeMs = Gpu.StopTimer(); // copy edges to GPU constant memory Gpu.StartTimer(); Gpu.CopyFromDevice(gpuFit, LeftRightFit); Gpu.CopyToConstantMemory(LeftRightFit, LeftRightFit); CopyFitsToConstantMemoryTimeMs = Gpu.StopTimer(); // compare edge fitting using the GPU Gpu.StartTimer(); Gpu.Launch(new dim3(9, 9), 64, ComputeFitsKernel, 3, 1, gpuFit); Gpu.Synchronize(); ComputeFitsTimeMs += Gpu.StopTimer(); // copy edges to GPU constant memory Gpu.StartTimer(); Gpu.CopyFromDevice(gpuFit, TopBottomFit); Gpu.CopyToConstantMemory(TopBottomFit, TopBottomFit); CopyFitsToConstantMemoryTimeMs += Gpu.StopTimer(); // evaluate all permutations const int threads = 256; const int blocks = Permutations / threads + 1; var cpuEvaluations = new Evaluation[blocks]; var gpuEvaluations = Gpu.Allocate(cpuEvaluations); Gpu.StartTimer(); Gpu.Launch(blocks, threads, ExplorePermutationsKernel, gpuEvaluations); Gpu.Synchronize(); ExplorePermutationsTimeMs += Gpu.StopTimer(); Gpu.StartTimer(); Gpu.CopyFromDevice(gpuEvaluations, cpuEvaluations); CopyPermutationsTimeMs += Gpu.StopTimer(); // get the best permutation var bestEvaluation = cpuEvaluations[0]; foreach (var evaluation in cpuEvaluations) { if (evaluation.Metric < bestEvaluation.Metric) { bestEvaluation = evaluation; } } // reconstruct and save the new image ReconstructAndSave(destinationFileName, cpuImage, bestEvaluation); // free memory on the GPU Gpu.Free(gpuImage); Gpu.Free(gpuScaledImage); Gpu.Free(gpuFit); Gpu.Free(gpuEdges); Gpu.Free(gpuEvaluations); }
public static void ExplorePermutationsKernel(GThread gThread, Evaluation[] evaluations) { var blockEvaluations = gThread.AllocateShared<Evaluation>("be", 256); var v = gThread.AllocateShared<byte>("v", 256, 9); var t = gThread.threadIdx.x; var permutation = gThread.blockIdx.x * gThread.blockDim.x + gThread.threadIdx.x; // 0 1 2 // 3 4 5 // 6 7 8 TileOrderFromPermutation(Permutations, permutation, 9, v, t); var metric = 0f; metric += LeftRightFit[v[t, 0], v[t, 1]] + LeftRightFit[v[t, 1], v[t, 2]]; metric += LeftRightFit[v[t, 3], v[t, 4]] + LeftRightFit[v[t, 4], v[t, 5]]; metric += LeftRightFit[v[t, 6], v[t, 7]] + LeftRightFit[v[t, 7], v[t, 8]]; metric += TopBottomFit[v[t, 0], v[t, 3]] + TopBottomFit[v[t, 3], v[t, 6]]; metric += TopBottomFit[v[t, 1], v[t, 4]] + TopBottomFit[v[t, 4], v[t, 7]]; metric += TopBottomFit[v[t, 2], v[t, 5]] + TopBottomFit[v[t, 5], v[t, 8]]; blockEvaluations[t].Permutation = permutation; blockEvaluations[t].Metric = metric; gThread.SyncThreads(); for (var i = 256 / 2; i > 0; i /= 2) { if (t < i) { if (blockEvaluations[t].Metric > blockEvaluations[t + i].Metric) { blockEvaluations[t] = blockEvaluations[t + i]; } } gThread.SyncThreads(); } if (gThread.threadIdx.x == 0) { evaluations[gThread.blockIdx.x] = blockEvaluations[0]; } }
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/> internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info) { access = info.Access; ExInfoFromParent operand_info = ExInfoFromParent.DefaultExInfo; Evaluation left_eval = leftExpr.Analyze(analyzer, operand_info); Evaluation right_eval; // Boolean expression evaluation semantics: if (operation == Operations.Or) { analyzer.EnterConditionalCode(); right_eval = rightExpr.Analyze(analyzer, operand_info); analyzer.LeaveConditionalCode(); } else { right_eval = rightExpr.Analyze(analyzer, operand_info); } Evaluation result = Evaluation.Evaluate(this, left_eval, out leftExpr, right_eval, out rightExpr); // division by zero check: if ((operation == Operations.Div || operation == Operations.Mod) && result.HasValue && result.Value is bool && (bool)result.Value == false) { analyzer.ErrorSink.Add(Warnings.DivisionByZero, analyzer.SourceUnit, rightExpr.Position); } else if ((operation == Operations.Div || operation == Operations.Mod) && right_eval.HasValue && right_eval.Value is int && (int)right_eval.Value == 0) { result = new Evaluation(this, false); analyzer.ErrorSink.Add(Warnings.DivisionByZero, analyzer.SourceUnit, rightExpr.Position); } return result; }
private Expression CallFunction(Evaluation.Bindings scope) { var f = GetFirstExpressionAsFunction(scope); return f.Call(EvaluatedArguments(scope)); }
private IEnumerable<Expression> EvaluatedArguments(Evaluation.Bindings scope) { return Elements.Skip(1).Select(e => e.Evaluate(scope)); }
public void Test_candidate_7_Python_Django() { Evaluation evaluation = new Evaluation (); evaluation.Python = 7; evaluation.Django = 7; VerifyAssess (evaluation, "message_backend"); }