public static List <Qustions> GetQustion() { try { return(DataBaseConnections.GetQuestionFromDataBase()); } catch (Exception ex) { StaticObjects.Erros.Log(ex); return(null); } }
/// <summary> /// This function to get all question from database and put the questions in my list by refrence /// and return 0 if getquestion is succeeded /// </summary> public static int GetQustion(ref List <Qustion> ListOfAllQuestion) { try { ListOfAllQuestion.Clear(); return(DataBaseConnections.GetQuestionFromDataBase(ref ListOfAllQuestion)); } catch (Exception ex) { GenralVariables.Errors.Log(ex.Message); return(GenralVariables.ErrorInMangerGetQuestion); } }
/// <summary> /// this for check if my tow object are equals or not /// return true if objects are not equal and false if objects are equal for refresh data /// </summary> public static void CheckForRefresh() { try { List <Qustion> TempListOfQuestion = new List <Qustion>(); while (EnableAutoRefrsh) { TempListOfQuestion.Clear(); DataBaseConnections.GetQuestionFromDataBase(ref TempListOfQuestion); IsDifferntList = false; if (TempListOfQuestion.Count == ListOfAllQuestion.Count) { for (int i = 0; i < TempListOfQuestion.Count; ++i) { if (TempListOfQuestion[i].Equals(ListOfAllQuestion[i])) { IsDifferntList = true; break; } } } else { IsDifferntList = true; } if (IsDifferntList) { ListOfAllQuestion = TempListOfQuestion.ToList(); foreach (var key in SessionFlags.Keys.ToList()) { SessionFlags[key] = true; } if (PutListToShow != null) { PutListToShow(); } } Thread.Sleep(TimeForChangeData); } }catch (Exception ex) { GenralVariables.Errors.Log(ex.Message); } }