private static MdlApplication CalculateInsertScore(MdlApplication element) { ServerDatabase.DbUpdate dbUpdateObject = new ServerDatabase.DbUpdate(); //return bool, pass calculated score and ID int dateScore = CtrApplications.CalculateScoreDate(Convert.ToDateTime(element.DateOfCreation)); int profileScore = CtrStudent.GetScore(element.StudentId); element.Score = CtrApplications.SumScores(dateScore, profileScore); if (!dbUpdateObject.UpdateApplicationScore(element.Id, element.Score)) Console.WriteLine("Error while updating Application score. ID: " + element.Id + " Thread: " + Thread.CurrentThread.ManagedThreadId.ToString() + "\n Time: " + DateTime.Now); return element; }
private static void UpdateQueueOneFlat(List<MdlApplication> singleFlatList) { ServerDatabase.DbUpdate dbUpdateObj = new ServerDatabase.DbUpdate(); SortByScore sortObj = new SortByScore(); int queue = 1; //sort by score singleFlatList.Sort(sortObj); foreach(MdlApplication element in singleFlatList) { element.QueueNumber = queue; dbUpdateObj.UpdateQueue(element.Id, element.QueueNumber); queue++; } }
private static void UpdateScoreQueue() { try { ServerDatabase.DbUpdate dbUpdateObject = new ServerDatabase.DbUpdate(); List<MdlApplication> applicationList = dbUpdateObject.UpdateScore(); //score will be updated applicationList = UpdateScore(applicationList); UpdateQueue(applicationList); } catch(Exception e) { Console.WriteLine(e); } }