/// <summary> /// delete question will receive question from UI and send it to database to delete /// and return 0 if delete operation is succeeded. /// </summary> public static int DeleteQustion(Qustion Question) { try { switch (Question.TypeOfQuestion) { case TypeOfQuestion.Slider: int ResultOfDeleteSlider = DataBaseConnections.DeleteSlider(Question); return(ResultOfDeleteSlider); case TypeOfQuestion.Smily: int ResultOfDeleteSmile = DataBaseConnections.DeleteSmile(Question); return(ResultOfDeleteSmile); case TypeOfQuestion.Stars: int ResultOfDeleteStar = DataBaseConnections.DeleteStar(Question); return(ResultOfDeleteStar); default: return(GenralVariables.ErrorInManger); } } catch (Exception ex) { GenralVariables.Errors.Log(ex.Message); return(GenralVariables.ErrorInMangerDelete); } }
/// <summary> /// Add question will receive the data from UI and send it to database and return 0 /// if add operation is succeeded /// </summary> public static int AddQustion(Qustion NewQuestion) { try { switch (NewQuestion.TypeOfQuestion) { case TypeOfQuestion.Slider: int ResultOfAddSlider = DataBaseConnections.AddNewSlider(NewQuestion); return(ResultOfAddSlider); case TypeOfQuestion.Smily: int ResultOfAddSmile = DataBaseConnections.AddNewSmile(NewQuestion); return(ResultOfAddSmile); case TypeOfQuestion.Stars: int ResultOfAddStar = DataBaseConnections.AddNewStar(NewQuestion); return(ResultOfAddStar); default: return(GenralVariables.ErrorInManger); } } catch (Exception ex) { GenralVariables.Errors.Log(ex.Message); return(GenralVariables.ErrorInMangerAdd); } }
private void button4_Click(object sender, EventArgs e) { DataBaseConnections _DataBaseConnections = new DataBaseConnections(); CnnString X1 = new CnnString(); X1.DataSource = "dddd"; X1.InitialCatalog = "dddd"; X1.User = "******"; _DataBaseConnections.Connections.Add(X1); _DataBaseConnections.Save(); }
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); } }
public static int DeleteQustion(Qustions Question) { try { if (Question is Slider) { return(DataBaseConnections.DeleteSlider(Question)); } else if (Question is Smiles) { return(DataBaseConnections.DeleteSmile(Question)); } else { return(DataBaseConnections.DeleteStar(Question)); } } catch (Exception ex) { StaticObjects.Erros.Log(ex); StaticObjects.SuccOfFail = 0; return(0); } }
public static Qustions EditQustion(Qustions Question) { try { if (Question is Slider) { return(DataBaseConnections.EditSlider(Question)); } else if (Question is Smiles) { return(DataBaseConnections.EditSmile(Question)); } else { return(DataBaseConnections.EditStar(Question)); } } catch (Exception ex) { StaticObjects.Erros.Log(ex); StaticObjects.SuccOfFail = 0; return(null); } }
private void button5_Click(object sender, EventArgs e) { DataBaseConnections _DataBaseConnections = new DataBaseConnections(); _DataBaseConnections.Clear(); }