Exemplo n.º 1
0
        /// <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);
            }
        }
Exemplo n.º 2
0
 public static Qustions AddQustion(Qustions Question)
 {
     try
     {
         if (Question is Slider)
         {
             return(DataBaseConnections.AddNewSlider(Question));
         }
         else if (Question is Smiles)
         {
             return(DataBaseConnections.AddNewSmile(Question));
         }
         else
         {
             return(DataBaseConnections.AddNewStar(Question));
         }
     }
     catch (Exception ex)
     {
         StaticObjects.Erros.Log(ex);
         StaticObjects.SuccOfFail = 0;
         return(null);
     }
 }