Exemplo n.º 1
0
        public ActionResult IsActive(TSS_Question q)
        {
            Response       res  = new Response();
            TSS_QuestionBL qb   = new TSS_QuestionBL();
            dbDataTable    dbtd = new dbDataTable();

            try
            {
                DataTable dt = dbtd.List();
                foreach (var item in q.Responses)
                {
                    if (item.ResponseText != null)
                    {
                        myDataTable.AddRow(dt, "Value1", q.QuestionId, "Value2", item.ResponseText, "Value3", item.ResponseValue, "Value4", item.SortOrder, "Value5", item.IsPassed,
                                           "Value6", item.MinValue, "Value7", item.MaxValue, "Value8", item.IsGps, "Value9", true);
                    }
                }
                q.CreatedOn = DateTime.Now;
                q.CreatedBy = ViewBag.UserId;

                if (q.QuestionId > 0)
                {
                    res.Value = qb.Manage("UpdateStatus", q, dt);
                }
                res.Status  = "success";
                res.Message = "Save successfully";
            }
            catch (Exception ex)
            {
                res.Status  = "danger";
                res.Message = ex.Message;
            }

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public List <TSS_Question> SectionQuestions(Int64 Id)
        {
            try
            {
                TSS_QuestionBL      qb  = new TSS_QuestionBL();
                TSS_ResponseBL      rb  = new TSS_ResponseBL();
                TSS_QuestionLogicBL qlb = new TSS_QuestionLogicBL();
                var que =
                    new TSS_QuestionBL().GetQuestionsWithOptions("GET_Questions_BY_SECTIONID_API", 0, Id.ToString()).OrderBy(s => s.SortOrder).ToList();
                //var que = qb.ToList("GET_QUESTION_BY_SECTION", Id.ToString());
                //foreach (var q in que)
                //{
                //    //q.Responses = rb.ToList("GET_BY_QUESTIONID", q.QuestionId.ToString());
                //    q.Responses = rb.ToList("GET_RESPONSE_BY_SITEQUESTION", q.QuestionId.ToString());
                //}

                foreach (var q in que)
                {
                    q.QuestionLogics = qlb.ToList("GET_BY_QUESTIONID", q.QuestionId.ToString());
                }
                return(que);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 3
0
        public JsonResult ToList(string Filter, string Value)
        {
            TSS_QuestionBL qb  = new TSS_QuestionBL();
            var            rec = qb.ToList(Filter, Value);

            return(Json(rec, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public ActionResult Single(Int64 Id)
        {
            TSS_QuestionBL qb = new TSS_QuestionBL();
            TSS_Question   q  = qb.ToSingle("GET_BY_QUESTIONID", Id.ToString());

            if (q != null)
            {
                TSS_ResponseBL rb = new TSS_ResponseBL();
                q.Responses = rb.ToList("GET_BY_QUESTIONID", Id.ToString());
            }



            return(Json(q, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        public void GetSectionQuestions()
        {
            TSS_QuestionBL      qb  = new TSS_QuestionBL();
            TSS_ResponseBL      rb  = new TSS_ResponseBL();
            TSS_QuestionLogicBL qlb = new TSS_QuestionLogicBL();
            var que =
                new TSS_QuestionBL().GetQuestionsWithOptions("GET_Questions_BY_SECTIONID_API", 0, 70293.ToString());

            //var que = qb.ToList("GET_QUESTION_BY_SECTION", Id.ToString());
            //foreach (var q in que)
            //{
            //    //q.Responses = rb.ToList("GET_BY_QUESTIONID", q.QuestionId.ToString());
            //    q.Responses = rb.ToList("GET_RESPONSE_BY_SITEQUESTION", q.QuestionId.ToString());
            //}

            foreach (var q in que)
            {
                q.QuestionLogics = qlb.ToList("GET_BY_QUESTIONID", q.QuestionId.ToString());
            }
        }
Exemplo n.º 6
0
        public ActionResult Delete(Int64 Id)
        {
            Response res = new Response();

            try
            {
                TSS_QuestionBL qb = new TSS_QuestionBL();
                TSS_Question   q  = new TSS_Question();
                q.QuestionId = Id;
                qb.Manage("Delete", q, null);
                res.Status  = "success";
                res.Message = "Delete successfully";
            }
            catch (Exception ex)
            {
                res.Status  = "danger";
                res.Message = ex.Message;
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
        public ActionResult WithQuestions(string Value)
        {
            List <TSS_Section> Sections = new List <TSS_Section>();
            TSS_SectionBL      sb       = new TSS_SectionBL();

            string[] val = Value.Split(',');
            foreach (var item in val)
            {
                TSS_Section sec = (item != "0") ? sb.ToSingle("By_SectionId", item) : null;
                if (sec != null)
                {
                    TSS_QuestionBL qb = new TSS_QuestionBL();
                    sec.QuestionList = qb.ToList("GET_BY_SECTIONID", sec.SectionId.ToString());


                    Sections.Add(sec);
                }
            }

            return(Json(Sections, JsonRequestBehavior.AllowGet));
        }