Exemple #1
0
        public QA_CommentShow MapQA_CommentShow(DataRow input)
        {
            QA_CommentShow       ret   = new QA_CommentShow();
            USR_CustomerMaintain tmpuu = new USR_CustomerMaintain();

            USR_CustomerBll.GetInstance().GetModel(int.Parse(input["CustomerSysNo"].ToString())).MemberwiseCopy(tmpuu);
            ret.Customer = tmpuu;
            if (input["AnswerSysNo"].ToString() != "")
            {
                ret.AnswerSysNo = int.Parse(input["AnswerSysNo"].ToString());
            }
            ret.Context = input["Context"].ToString();
            if (input["CustomerSysNo"].ToString() != "")
            {
                ret.CustomerSysNo = int.Parse(input["CustomerSysNo"].ToString());
            }
            if (input["DR"].ToString() != "")
            {
                ret.DR = int.Parse(input["DR"].ToString());
            }
            if (input["QuestionSysNo"].ToString() != "")
            {
                ret.QuestionSysNo = int.Parse(input["QuestionSysNo"].ToString());
            }
            if (input["SysNo"].ToString() != "")
            {
                ret.SysNo = int.Parse(input["SysNo"].ToString());
            }
            if (input["TS"].ToString() != "")
            {
                ret.TS = DateTime.Parse(input["TS"].ToString());
            }
            return(ret);
        }
Exemple #2
0
        public ReturnValue <PageInfo <QA_AnswerShow> > GetAnswerByQuest(int pagesize, int pageindex, int sysno)
        {
            int                      total = 0;
            DataTable                m_dt  = QA_AnswerBll.GetInstance().GetListByQuest(pagesize, pageindex, sysno, ref total);
            List <QA_AnswerShow>     ret   = new List <QA_AnswerShow>();
            PageInfo <QA_AnswerShow> rett  = new PageInfo <QA_AnswerShow>();

            if (m_dt == null || m_dt.Rows.Count == 0)
            {
                rett.List        = ret;
                rett.Total       = total;
                rett.HasNextPage = false;
                return(ReturnValue <PageInfo <QA_AnswerShow> > .Get200OK(rett));
            }

            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                QA_AnswerShow    tmp_answer = MapQA_AnswerShow(m_dt.Rows[i]);
                USR_CustomerShow tmpu       = new USR_CustomerShow();
                USR_CustomerBll.GetInstance().GetModel(tmp_answer.CustomerSysNo).MemberwiseCopy(tmpu);
                tmp_answer.Customer = tmpu;
                DataTable tmp_dt = QA_CommentBll.GetInstance().GetListByAnswer(tmp_answer.SysNo);
                if (tmp_dt != null && tmp_dt.Rows.Count > 0)
                {
                    List <QA_CommentShow> commentlist = new List <QA_CommentShow>();
                    for (int j = 0; j < tmp_dt.Rows.Count && j <= 3; j++)
                    {
                        QA_CommentShow       tmp_comment = MapQA_CommentShow(tmp_dt.Rows[j]);
                        USR_CustomerMaintain tmpuu       = new USR_CustomerMaintain();
                        USR_CustomerBll.GetInstance().GetModel(tmp_comment.CustomerSysNo).MemberwiseCopy(tmpuu);
                        tmp_comment.Customer = tmpuu;
                        commentlist.Add(tmp_comment);
                    }
                    tmp_answer.TopComments = commentlist;
                    tmp_answer.ToalComment = tmp_dt.Rows.Count;
                    if (tmp_dt.Rows.Count > 3)
                    {
                        tmp_answer.HasMoreComment = true;
                    }
                    else
                    {
                        tmp_answer.HasMoreComment = false;
                    }
                }
                ret.Add(tmp_answer);
            }

            rett.List  = ret;
            rett.Total = total;
            if (pagesize * pageindex >= total)
            {
                rett.HasNextPage = false;
            }
            else
            {
                rett.HasNextPage = true;
            }
            return(ReturnValue <PageInfo <QA_AnswerShow> > .Get200OK(rett));
        }
Exemple #3
0
        public ReturnValue <List <QA_CommentShow> > GetCommentByAnswer(int sysno)
        {
            DataTable             m_dt = QA_CommentBll.GetInstance().GetListByAnswer(sysno);
            List <QA_CommentShow> ret  = new List <QA_CommentShow>();

            if (m_dt == null || m_dt.Rows.Count == 0)
            {
                return(ReturnValue <List <QA_CommentShow> > .Get200OK(ret));
            }

            for (int i = 0; i < m_dt.Rows.Count; i++)
            {
                QA_CommentShow tmp_comment = MapQA_CommentShow(m_dt.Rows[i]);
                ret.Add(tmp_comment);
            }

            return(ReturnValue <List <QA_CommentShow> > .Get200OK(ret));
        }