public static int Main(string[] arg) { Console.WriteLine("Before allocation: {0}", TestMark.GetCommitted()); CC cc = new CC(500000); cc.array[1024].t1 = new A(); cc.array[1024].t1.a = 3; cc.array[1024].t2 = new B(); cc.array[1024].t2.b = 4; long a = TestMark.GetCommitted(); Console.WriteLine("After allocation: {0}", a); Console.WriteLine(); Console.WriteLine("Collecting..."); for (int i = 0; i < 100; i++) { GC.Collect(); } long b = TestMark.GetCommitted(); Console.WriteLine("After 100 Collections: {0}", b); GC.KeepAlive(cc); if (Math.Abs(b - a) > (a / 2)) { Console.WriteLine("failed"); return(0); } Console.WriteLine("passed"); return(100); }
public IHttpActionResult AjouterTestMark(int score, int testid, int userid) { TestMark Mark = new TestMark(); Mark.mark = score; Mark.testId = testid; Mark.CandidatId = userid; itm.Add(Mark); itm.Commit(); return(Ok()); }
public bool Save(TestMark test, string modifiedby, ref bool dbFlag) { using (var connection = GetConnection()) { var update = @" UPDATE TestMark SET Mark = @Mark , Percentage = @Percentage , Lastmodifiedby = @modifiedby WHERE studentTermRegisterID = @studentTermRegisterID AND TestID = @TestID AND ISDELETED IS NULL "; var id = connection.Execute(update, new { studentTermRegisterID = test.StudentTermRegisterID, TestID = test.TestID, Mark = test.Mark, Percentage = test.Percentage, modifiedby = modifiedby }); if (id == 0) { // insert var insert = @" INSERT INTO TestMark (studentTermRegisterID ,TestID ,Mark ,Percentage , lastmodifiedby ) VALUES ( @studentTermRegisterID ,@TestID ,@Mark ,@Percentage , @modifiedby ) "; id = connection.Execute(insert, new { studentTermRegisterID = test.StudentTermRegisterID, TestID = test.TestID, Mark = test.Mark, Percentage = test.Percentage, modifiedby = modifiedby }); } return(true); } }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns> public override int GetHashCode() { var hashCode = -1226589120; hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(TestName); hashCode = hashCode * -1521134295 + TestMark.GetHashCode(); hashCode = hashCode * -1521134295 + TestTime.GetHashCode(); return(hashCode); }
public ActionResult <object> Save([FromBody] TestMark test) { try { Init(); StringBuilder sbError = new StringBuilder(""); if (!ModelState.IsValid && test != null) { Response.StatusCode = 400; return("Failed getting test id"); } else { var listTestMarks = new List <TestMark>(); listTestMarks.Add(test); List <string> error = new List <string>(); List <string> success = new List <string>(); _testMarkService.Save(listTestMarks, test.TestID, ref error, ref success); if (success.Count >= 1 && error.Count == 0) { return("Record saved"); } else { Response.StatusCode = 400; return(string.Join(" , ", error)); } } } catch (Exception er) { return(Error(er)); } }
public void CreateTestMark(TestMark mark, List <SubjectOfFillBlank> list1, List <SubjectOfJudge> list2, List <SubjectOfSingleSelection> list3, List <SubjectOfMultiSelection> list4, List <SubjectOfSimpleAnswer> list5) { this.CreateTestMark(mark); new BLLTestRecorder().SaveTestRecorderAnswer_Scores(mark.TestRecorder.RecorderID, list1, list2, list3, list4, list5); }
public void CreateTestMark(TestMark testMark) { dbTestMark.Insert(testMark); }
/// <summary> /// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. /// </summary> /// <param name="obj">An object to compare with this instance.</param> /// <returns>A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes <paramref name="obj" /> in the sort order. Zero This instance occurs in the same position in the sort order as <paramref name="obj" />. Greater than zero This instance follows <paramref name="obj" /> in the sort order.</returns> public int CompareTo(object obj) { return(TestMark.CompareTo((obj as TestData).TestMark)); }
public int CompareTo(StudentData st) { return(TestMark.CompareTo(st.TestMark)); }