Esempio n. 1
0
        //QUESTIONS CRUD FUNCTIONS
        public static void CreateFAQQuestion(FAQQuestions m_FAQQuestion)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            int sortOrder = getSortOrder(m_FAQQuestion.FaqID);

            string queryString = "INSERT INTO CMS_FAQQuestions(faqID, faqQuestion, faqAnswer, sortOrder) VALUES(@faqID, @faqQuestion, @faqAnswer, @sortOrder)";
            SqlCommand insertFAQQuestion = new SqlCommand(queryString, conn);
            insertFAQQuestion.Parameters.AddWithValue("faqID", m_FAQQuestion.FaqID);
            insertFAQQuestion.Parameters.AddWithValue("faqQuestion", m_FAQQuestion.FaqQuestion);
            insertFAQQuestion.Parameters.AddWithValue("faqAnswer", m_FAQQuestion.FaqAnswer);
            insertFAQQuestion.Parameters.AddWithValue("sortOrder", sortOrder);
            insertFAQQuestion.ExecuteNonQuery();

            conn.Close();
        }
Esempio n. 2
0
 public bool UpdateFAQQuestion(FAQQuestions m_FAQQuestion)
 {
     DBFAQ.UpdateFAQQuestion(m_FAQQuestion);
     return true;
 }
Esempio n. 3
0
        public bool CreateFAQQuestion(FAQQuestions m_FAQQuestion)
        {
            DBFAQ.CreateFAQQuestion(m_FAQQuestion);

            return true;
        }
Esempio n. 4
0
        public static void UpdateFAQQuestion(FAQQuestions m_FAQQuestion)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "UPDATE CMS_FAQQuestions SET faqID = @faqID, faqQuestion = @faqQuestion, faqAnswer = @faqAnswer WHERE id = @id";
            SqlCommand updateFAQQuestion = new SqlCommand(queryString, conn);
            updateFAQQuestion.Parameters.AddWithValue("faqID", m_FAQQuestion.FaqID);
            updateFAQQuestion.Parameters.AddWithValue("faqQuestion", m_FAQQuestion.FaqQuestion);
            updateFAQQuestion.Parameters.AddWithValue("faqAnswer", m_FAQQuestion.FaqAnswer);
            updateFAQQuestion.Parameters.AddWithValue("id", m_FAQQuestion.QID);
            updateFAQQuestion.ExecuteNonQuery();

            conn.Close();
        }
Esempio n. 5
0
        public static FAQQuestions RetrieveOneFAQQuestion(int m_FaqQuestionID)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "SELECT * FROM CMS_FAQQuestions WHERE id = @id AND pageWorkFlowState != 4";
            SqlCommand getFAQQuestion = new SqlCommand(queryString, conn);
            getFAQQuestion.Parameters.AddWithValue("id", m_FaqQuestionID);
            SqlDataReader myFAQQuestion = getFAQQuestion.ExecuteReader();

            FAQQuestions tempQuestion = new FAQQuestions();

            if (myFAQQuestion.Read())
            {
                tempQuestion.QID = myFAQQuestion.GetInt32(0);
                tempQuestion.FaqID = myFAQQuestion.GetInt32(1);
                tempQuestion.FaqQuestion = myFAQQuestion.GetString(2);
                tempQuestion.FaqAnswer = myFAQQuestion.GetString(3);
                tempQuestion.PageWorkFlowState = myFAQQuestion.GetInt32(4);
                tempQuestion.SortOrder = myFAQQuestion.GetInt32(5);
            }

            conn.Close();
            return tempQuestion;
        }
Esempio n. 6
0
        public static List<FAQQuestions> RetrieveAllFAQQuestions(int m_FaqID)
        {
            SqlConnection conn = DB.DbConnect();
            conn.Open();

            string queryString = "SELECT * FROM CMS_FAQQuestions WHERE faqID = @faqID AND pageWorkFlowState != 4 ORDER BY sortOrder";
            SqlCommand getFAQQuestions = new SqlCommand(queryString, conn);
            getFAQQuestions.Parameters.AddWithValue("faqID", m_FaqID);

            SqlDataReader myFAQQuestions = getFAQQuestions.ExecuteReader();

            List<FAQQuestions> m_FAQs = new List<FAQQuestions>();

            while (myFAQQuestions.Read())
            {
                FAQQuestions tempFAQQuestion = new FAQQuestions();
                tempFAQQuestion.QID = myFAQQuestions.GetInt32(0);
                tempFAQQuestion.FaqID = myFAQQuestions.GetInt32(1);
                tempFAQQuestion.FaqQuestion = myFAQQuestions.GetString(2);
                tempFAQQuestion.FaqAnswer = myFAQQuestions.GetString(3);

                m_FAQs.Add(tempFAQQuestion);
            }

            conn.Close();
            return m_FAQs;
        }
Esempio n. 7
0
 public ActionResult FAQQuestionEdit(FAQQuestions m_FAQQuestion)
 {
     if (ModelState.IsValid)
     {
         FAQRepository.UpdateFAQQuestion(m_FAQQuestion);
         return RedirectToAction("FAQQuestions", "FAQ", new { id = m_FAQQuestion.FaqID });
     }
     else
     {
         return View("FAQQuestionEdit", m_FAQQuestion);
     }
 }
Esempio n. 8
0
 public ActionResult FAQQuestionAdd(FAQQuestions myQuestion)
 {
     if (ModelState.IsValid)
     {
         FAQRepository.CreateFAQQuestion(myQuestion);
         return RedirectToAction("FAQQuestions", "FAQ", new { id = myQuestion.FaqID });
     }
     else
     {
         ViewBag.FAQID = myQuestion.FaqID;
         return View("FAQQuestionAdd", myQuestion);
     }
 }
Esempio n. 9
0
        public ActionResult FAQQuestionAdd(string id)
        {
            int FaqID = int.Parse(id);
            ViewBag.FAQID = FaqID;
            FAQQuestions myQuestion = new FAQQuestions();

            return View("FAQQuestionAdd", myQuestion);
        }