Ejemplo n.º 1
0
        public Question QuestionsByUser(int Q_By)
        {
            Question     model = new Question();
            MySqlCommand cmd   = new MySqlCommand("spGetQuestionsByAskerID");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("pQ_By", Q_By);
            dbUtil = new DBUtil(3);

            DataSet    dsQuestionsByUser = dbUtil.FillDataSet(cmd);
            QuestionWS Qws = new QuestionWS();

            model = Qws.GenModel4mDS(dsQuestionsByUser);
            return(model);
        }
Ejemplo n.º 2
0
        public Question GetQuestionsBySortFilter(string Sort)
        {
            string procName;

            switch (Sort)
            {
            case "Premium":
                procName = "spGetPremiumQuestions";
                break;

            case "Trending":
                procName = "spGetTrendingQuestions";
                break;

            case "Unanswered":
                procName = "spGetUnansweredQuestions";
                break;

            case "Live":
                procName = "spGetLiveQuestions";
                break;

            case "Popular":
                procName = "spGetPopularQuestions";
                break;

            case "Oldest":
                procName = "spGetOldestQuestions";
                break;

            case "Newest":
            default:
                procName = "spGetAllQuestions";
                break;
            }

            QuestionWS Qws   = new QuestionWS();
            Question   model = Qws.GenModel4mDS(
                Questions_ds: Qws.GetQuestions(procName));

            return(model);
        }