public void UpdateQuestionaire(string qType, string myData, string myDataKey)  //single view update
        {
            Questionaire uQ      = JsonConvert.DeserializeObject <Questionaire>(myData);
            Questionaire dataKey = JsonConvert.DeserializeObject <Questionaire>(myDataKey);

            if (qType == "enumeration")
            {
                string[] keyID = dataKey.ansKeyID.Split('|');
                string[] key   = uQ.ansKey.Split('|');
                for (short c = 0; c < (key.Length - 1); c++)
                {
                    Main.fileManagement("UPDATE [key]" +
                                        "SET [ans_key] = '" + key[c].Replace("'", "''").Trim() + "'" +
                                        "WHERE [key_id] = " + Convert.ToInt32(keyID[c]));
                }
            }
            else
            {
                Main.fileManagement("EXEC [uspUpdateQuestionaire] @qID = " + dataKey.qID + ", @cID1 = " + dataKey.cID1 + ", @cID2 = " + dataKey.cID2 + ", @cID3 = " + dataKey.cID3 + ", @cID4 = " + dataKey.cID4 + ", @ansKeyID = " + dataKey.ansKeyID + ", " +
                                    "@qType = '" + qType + "', @question = '" + uQ.question + "', @c1 = '" + uQ.choiceA + "', @c2 = '" + uQ.choiceB + "', @c3 = '" + uQ.choiceC + "', @c4 = '" + uQ.choiceD + "', @ansKey = '" + uQ.ansKey + "'");
            }
        }
        public void addQuestion(string questionaire)
        {
            Questionaire cq = JsonConvert.DeserializeObject <Questionaire>(questionaire);

            if (cq.type == "multiple choice")
            {
                Main.fileManagement("EXEC [uspCreateQuestion] @examID = " + examID + ", @qType = '" + cq.type + "', @question = '" + cq.question + "', @c1 = '" + cq.choiceA + "', @c2 = '" + cq.choiceB + "', @c3 = '" + cq.choiceC + "', @c4 = '" + cq.choiceD + "', @ansKey = '" + cq.ansKey + "'");
            }
            else if (cq.type == "true or false")
            {
                Main.fileManagement("EXEC [uspCreateQuestion] @examID = " + examID + ", @qType = '" + cq.type + "', @question = '" + cq.question + "', @c1 = '" + cq.choiceA + "', @c2 = '" + cq.choiceB + "', @ansKey = '" + cq.ansKey + "'");
            }
            else if (cq.type == "enumeration")
            {
                if (examID == 0)
                {
                    examID = Main.dataCounter("SELECT MAX([exam_id]) FROM [exam]");
                }

                Main.fileManagement("INSERT INTO [exam_question]([question], [exam_id], [type])" +
                                    "VALUES('" + cq.question.Replace("'", "''").Trim() + "', " + examID + ", '" + cq.type + "')");

                qID = Main.dataCounter("SELECT MAX([question_id])" +
                                       "FROM [exam_question]" +
                                       "WHERE [exam_id] = " + examID);
                string[] ans = cq.ansKey.Split('|');
                for (short i = 0; i < (ans.Length - 1); i++)
                {
                    Main.fileManagement("INSERT INTO [key]([ans_key], [question_id])" +
                                        "VALUES('" + ans[i].Replace("'", "''").Trim() + "', " + qID + ")");
                }
            }
            else
            {
                Main.fileManagement("EXEC [uspCreateQuestion] @examID = " + examID + ", @qType = '" + cq.type + "', @question = '" + cq.question + "', @ansKey = '" + cq.ansKey + "'");
            }
        }