Example #1
0
        public static QAResponse <IList <Question> > LoadTest(int sysId = 0, int language = 1, string connection = "")
        {
            IDictionary <string, string>   Extras   = new Dictionary <string, string>();
            QAResponse <IList <Question> > response = new QAResponse <IList <Question> >();

            using (SqlConnection con = new SqlConnection(connection))
            {
                SqlCommand cmd = new SqlCommand("sp_ManageQATemplate", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@Mode", Value = "ViewBySubjectMaterial"
                });
                cmd.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@SubjectMaterialId", Value = sysId
                });
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    Extras.Add("QATempId", Convert.ToInt32(rdr["ID"]).ToString());
                    Extras.Add("Description", rdr["Description"].ToString());
                    Extras.Add("TimeFrame", Convert.ToDouble(rdr["TimeFrame"]).ToString());
                    Extras.Add("TotalToPass", Convert.ToInt32(rdr["TotalToPass"]).ToString());
                }
            }
            //response=LoadTestQuestions(sysId,language,connection);
            response.Extras = Extras;
            return(response);
        }
        public IActionResult GetMiniNotifications(int page = 1, int pageSize = 5)
        {
            int        langId = 1;
            LoginModel model  = base.TutorModel != null ? base.TutorModel : base.StudentModel;

            if (model != null)
            {
                QAResponse <ICollection <Notif> > notifs = ScheduleDB.GetNotificationsPage
                                                           (
                    model.User.UserId,
                    Notification.NotificationType.Push,
                    0 - (short)DateTimeOffset.Now.Offset.TotalMinutes,
                    //DateTime.Now.AddHours(-100),
                    //DateTime.Now.AddHours(100),
                    null,
                    null,
                    langId,
                    page,
                    pageSize,
                    GetConfiguration().GetConnectionString(DEFAULT_CONNECTION),
                    false
                                                           );
                notifs.Extras.Remove("RemainingPages");
                notifs.Extras.Add("RemainingPages", "-1");
                return(Json(notifs));
            }
            return(null);
        }
        public static QAResponse <List <BoardItem> > GetBoardData(long UID = 0, string connection = "")
        {
            QAResponse <List <BoardItem> > response = new QAResponse <List <BoardItem> >();
            List <BoardItem> items = new List <BoardItem>();

            //using (SqlConnection con = new SqlConnection(connection))
            //{
            //    SqlCommand cmd = new SqlCommand("sp_ManageTutorDashboard", con);
            //    cmd.CommandType = CommandType.StoredProcedure;
            //    cmd.Parameters.Add(new SqlParameter() { ParameterName = "@Mode", Value = "GetDashboardTabs" });
            //    cmd.Parameters.Add(new SqlParameter() { ParameterName = "@UID", Value = UID });
            //    con.Open();
            //    SqlDataReader rdr = cmd.ExecuteReader();
            //    BoardItem boardItem = null;
            //    while (rdr.Read())
            //    {
            //        boardItem = new BoardItem();
            //        boardItem.Id = Convert.ToInt64(rdr["AnswerID"]);
            //        boardItem.Type = rdr[""].ToString();
            //        boardItem.Data = rdr[""].ToString();
            //        boardItem.DataTitle = rdr[""].ToString();

            //        items.Add(boardItem);
            //    }
            //}
            BoardItem boardItem = new BoardItem();

            boardItem.Id        = 100;
            boardItem.Type      = "student";
            boardItem.Data      = "23";
            boardItem.DataTitle = "Total Students";
            items.Add(boardItem);

            BoardItem boardItem2 = new BoardItem();

            boardItem2.Id        = 101;
            boardItem2.Type      = "course";
            boardItem2.Data      = "15";
            boardItem2.DataTitle = "Total Courses";
            items.Add(boardItem2);

            BoardItem boardItem3 = new BoardItem();

            boardItem3.Id        = 102;
            boardItem3.Type      = "request";
            boardItem3.Data      = "20";
            boardItem3.DataTitle = "Total Requests";
            items.Add(boardItem3);

            BoardItem boardItem4 = new BoardItem();

            boardItem4.Id        = 103;
            boardItem4.Type      = "message";
            boardItem4.Data      = "0";
            boardItem4.DataTitle = "Total Messages";
            items.Add(boardItem4);

            response.Content = items;
            return(response);
        }
Example #4
0
        public IActionResult GetDisLikersByQuestionAnswerId(long TutorQuestionAnswerId = 0)
        {
            QAResponse <List <TQuestionAnswerDisliker> > response = new QAResponse <List <TQuestionAnswerDisliker> >();

            response = TutorQuestionDB.GetDisLikersByQuestionAnswerId(TutorQuestionAnswerId, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION));
            return(Json(response));
        }
Example #5
0
        public IActionResult GetTutorQuestionAnswers(long UID = 0, long TQuestionId = 0)
        {
            QAResponse <List <TQuestionAnswer> > response = new QAResponse <List <TQuestionAnswer> >();

            response = TutorQuestionDB.GetAllTutorQuestionAnswers(UID, TQuestionId, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION));
            return(Json(response));
        }
Example #6
0
        public IActionResult GetCommentsByQuestionId(long TQuestionId = 0)
        {
            QAResponse <List <TQuestionComment> > response = new QAResponse <List <TQuestionComment> >();

            response = TutorQuestionDB.GetCommentsByQuestionId(TQuestionId, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION));
            return(Json(response));
        }
Example #7
0
        public IActionResult GetAllTags()
        {
            QAResponse <IList <string> > response = new QAResponse <IList <string> >();

            response.Content = TutorQuestionDB.GetAllTagsUnique(GetConfiguration().GetConnectionString(DEFAULT_CONNECTION));
            return(Json(response));
        }
Example #8
0
        public IActionResult Getlookups(int lang = 1, int LookupId = 0)
        {
            QAResponse <IList <LookUpDetails> > response = new QAResponse <IList <LookUpDetails> >();

            response.Content = LookUpDB.GetLookUpDetails(LookupId, lang, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION));
            return(Json(response));
        }
Example #9
0
        public IActionResult GetTutorQuestionsDDL(int lang = 1)
        {
            // 36 is the lookupId for tutorQuestionDDL
            QAResponse <IList <LookUpDetails> > response = new QAResponse <IList <LookUpDetails> >();

            response.Content = LookUpDB.FillTutorQuestionDropDown(36, lang, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION));
            return(Json(response));
        }
Example #10
0
        public static QAResponse <IList <Question> > LoadTestQuestions(int sysId = 0, int language = 1, string connection = "")
        {
            QAResponse <IList <Question> > response = new QAResponse <IList <Question> >();

            response.Content = new List <Question>();
            using (SqlConnection con = new SqlConnection(connection))
            {
                SqlCommand cmd = new SqlCommand("sp_ManageQuestions", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@Mode", Value = "getQuestionsAnswers"
                });
                cmd.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@SubjectMaterialId", Value = sysId
                });
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@LanguageId", Value = language
                });
                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                Question      q   = null;
                while (rdr.Read())
                {
                    int id = Convert.ToInt32(rdr["QuestionID"]);
                    if (q != null && id != q.Id)
                    {
                        response.Content.Add(q);
                        q = null;
                    }

                    if (q == null)
                    {
                        q               = new Question();
                        q.Id            = id;
                        q.Description   = rdr["Description"].ToString();
                        q.CatId         = Convert.ToInt32(rdr["CatId"]);
                        q.FieldTypeId   = Convert.ToInt32(rdr["FieldTypeId"]);
                        q.FieldTypeName = rdr["FieldTypeName"].ToString();
                        q.DisplayId     = Convert.ToInt32(rdr["DisplayId"]);
                        q.DisplayName   = rdr["DisplayName"].ToString();
                        //q.Points = Convert.ToInt32(rdr["Points"]);
                        q.answer = new List <Answer>();
                    }
                    Answer a = new Answer();
                    a.Id                = Convert.ToInt32(rdr["AnswerID"]);
                    a.QuestionId        = Convert.ToInt32(rdr["QuestionID"]);
                    a.AnswerDescription = rdr["AnswerName"].ToString();
                    a.Correct           = Convert.ToBoolean(rdr["Correct"]);
                    q.answer.Add(a);
                }
                response.Content.Add(q);
            }
            return(response);
        }
        public IActionResult GetBoardData()
        {
            TutorModel tutorModel = base.TutorModel;

            if (tutorModel != null)
            {
                QAResponse <List <BoardItem> > response = new QAResponse <List <BoardItem> >();
                response = TutorDashboardDB.GetBoardData(tutorModel.User.UserId, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION));
                return(Json(response));
            }
            return(null);
        }
        public QAResponse <IList <Question> > LoadQuestions(int material = 0, int lang = 1)
        {
            QAResponse <IList <Question> > testQuestions = TestDB.LoadTestQuestions(material, lang, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION));

            return(testQuestions);
        }
Example #13
0
        public static QAResponse <ICollection <Notif> > GetNotificationsPage(long UID, NotificationType type, int tzOffset, DateTime?from = null, DateTime?to = null, int lang = 1, int pageNumber = 1, int pageSize = 1, string conStr = "", bool content = true)
        {
            QAResponse <ICollection <Notif> > response = new QAResponse <ICollection <Notif> >();
            IDictionary <string, Notif>       notifs   = new Dictionary <string, Notif>();
            int outp = 0;

            using (SqlConnection connection = new SqlConnection(conStr))
            {
                SqlCommand cmd = new SqlCommand("sp_ManageNotification", connection);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@Mode", Value = "readyToSendPagination"
                });
                cmd.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@Type", Value = (byte)type
                });
                cmd.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@TimeZoneOffset", Value = tzOffset
                });
                cmd.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@UserId", Value = UID
                });
                cmd.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@FromDate", Value = from
                });
                cmd.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@ToDate", Value = to
                });
                cmd.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@LanguageId", Value = lang
                });
                cmd.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@PageSize", Value = pageSize
                });
                cmd.Parameters.Add(new SqlParameter()
                {
                    ParameterName = "@PageNumber", Value = pageNumber
                });
                SqlParameter outPara = new SqlParameter();
                outPara.ParameterName = "@RemainingPages";
                outPara.DbType        = DbType.Int32;
                outPara.SqlDbType     = SqlDbType.Int;
                outPara.Direction     = ParameterDirection.Output;
                cmd.Parameters.Add(outPara);
                connection.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        long   id       = Convert.ToInt64(reader["Id"]);
                        int    userLang = Convert.ToInt32(reader["LanguageId"]);
                        string key      = string.Concat(id, '_', userLang);

                        Notif notif = new Notif
                        {
                            Id      = id,
                            Title   = reader["Title"].ToString(),
                            Content = content ? reader["Content"].ToString() : "",
                            Date    = reader["StartDate"] != DBNull.Value ? Convert.ToDateTime(reader["StartDate"]) : default(DateTime?)
                        };
                        if (!notifs.Keys.Contains(key))
                        {
                            notifs.Add(key, notif);
                        }
                        else
                        {
                            notif = notifs[key];
                        }
                    }
                    reader.NextResult();
                }
                outp = Convert.ToInt32(cmd.Parameters["@RemainingPages"].Value);
                connection.Close();
            }
            response.Content = notifs.Values;
            response.Extras.Add("RemainingPages", outp.ToString());
            return(response);
        }
Example #14
0
        public IActionResult GetTutorQuestions(int pageNumber = 1, int pageSize = 5, long UID = 0, long tutorId = 0, int selectType = 1)
        {
            QAResponse <List <TutorQuestion> > response = TutorQuestionDB.GetTutorQuestions(pageNumber, pageSize, UID, tutorId, selectType, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION));

            return(Json(response));
        }
Example #15
0
        public IActionResult GetAllQuestions(int pageNumber = 1, int pageSize = 5, long UID = 0, string tag = "")
        {
            QAResponse <List <TutorQuestion> > response = TutorQuestionDB.GetAllTutorQuestions(pageNumber, pageSize, UID, tag, GetConfiguration().GetConnectionString(DEFAULT_CONNECTION));

            return(Json(response));
        }