Example #1
0
 public int addSurvey(eventsurvey newsurvey)
 {
     try
     {
         _db.eventsurveys.AddObject(newsurvey);
         _db.SaveChanges();
         return 1;
     }
     catch (Exception e)
     {
         return -1;
     }
 }
Example #2
0
        public ActionResult Create(FormCollection collection)
        {
            appinfo app = utility.getAppInfo(defaultappid);
            eventsurvey newsurvey = new eventsurvey();

            if (collection["QuestionInclude1"].Contains("true") && collection["QuestionText1"].Length > 0)
            {
                newsurvey.QuestionOne = collection["QuestionText1"];
                if (collection["QuestionMC1"].Contains("true"))
                {
                    if (collection["QuestionOptionInclude1_1"].Contains("true"))
                    {
                        newsurvey.QuestionOneMC1 = collection["QuestionOptionText1_1"];
                    }
                    if (collection["QuestionOptionInclude1_2"].Contains("true"))
                    {
                        newsurvey.QuestionOneMC2 = collection["QuestionOptionText1_2"];
                    }
                    if (collection["QuestionOptionInclude1_3"].Contains("true"))
                    {
                        newsurvey.QuestionOneMC3 = collection["QuestionOptionText1_3"];
                    }
                }
            }
            if (collection["QuestionInclude2"].Contains("true") && collection["QuestionText2"].Length > 0)
            {
                newsurvey.QuestionTwo = collection["QuestionText2"];
                if (collection["QuestionMC2"].Contains("true"))
                {
                    if (collection["QuestionOptionInclude2_1"].Contains("true"))
                    {
                        newsurvey.QuestionTwoMC1 = collection["QuestionOptionText2_1"];
                    }
                    if (collection["QuestionOptionInclude2_2"].Contains("true"))
                    {
                        newsurvey.QuestionTwoMC2 = collection["QuestionOptionText2_2"];
                    }
                    if (collection["QuestionOptionInclude2_3"].Contains("true"))
                    {
                        newsurvey.QuestionTwoMC3 = collection["QuestionOptionText2_3"];
                    }
                }
            }
            if (collection["QuestionInclude3"].Contains("true") && collection["QuestionText3"].Length > 0)
            {
                newsurvey.QuestionThree = collection["QuestionText3"];
                if (collection["QuestionMC3"].Contains("true"))
                {
                    if (collection["QuestionOptionInclude3_1"].Contains("true"))
                    {
                        newsurvey.QuestionThreeMC1 = collection["QuestionOptionText3_1"];
                    }
                    if (collection["QuestionOptionInclude3_2"].Contains("true"))
                    {
                        newsurvey.QuestionThreeMC2 = collection["QuestionOptionText3_2"];
                    }
                    if (collection["QuestionOptionInclude3_3"].Contains("true"))
                    {
                        newsurvey.QuestionThreeMC3 = collection["QuestionOptionText3_3"];
                    }
                }
            }

            newsurvey.SurveyID = surveymodel.getMaxSurveyID() + 1;
            newsurvey.AppID = app.AppID;
            if (collection["SurveyName"] != null)
            {
                newsurvey.SurveyName = collection["SurveyName"];
            }
            else
            {
                newsurvey.SurveyName = Convert.ToString(newsurvey.SurveyID);
            }
            surveymodel.addSurvey(newsurvey);

            return RedirectToAction("Home");
        }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the eventsurveys EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToeventsurveys(eventsurvey eventsurvey)
 {
     base.AddObject("eventsurveys", eventsurvey);
 }
Example #4
0
 /// <summary>
 /// Create a new eventsurvey object.
 /// </summary>
 /// <param name="surveyID">Initial value of the SurveyID property.</param>
 public static eventsurvey Createeventsurvey(global::System.Int32 surveyID)
 {
     eventsurvey eventsurvey = new eventsurvey();
     eventsurvey.SurveyID = surveyID;
     return eventsurvey;
 }