Exemplo n.º 1
0
        public BdQna GetCsQnaView(CsQnaModels getModel)
        {
            string errorStr = "";
            BdQna  model    = new BdQna();

            if (getModel.act_type != null && getModel.act_type == "updt")
            {
                //string ViewQuery = " SELECT SEQNO , " + string.Join(",", selectColumn_CsQna) + " FROM bd_qna WHERE SEQNO = " + getModel.act_key;
                string ViewQuery = " SELECT bQ.SEQNO , esmU.EMAIL , " + string.Join(",", selectColumn_CsQna) + " FROM bd_qna bn left outer join esm_user esmU on bn.WRITER_ID = esmU.SEQNO  WHERE bn.SEQNO = " + getModel.act_key;

                DataTable listDt = getQueryResult(ViewQuery, out errorStr);

                if (listDt != null && listDt.Rows.Count != 0)
                {
                    model.SEQNO        = int.Parse(listDt.Rows[0]["SEQNO"].ToString().Trim());
                    model.EST_CODE     = listDt.Rows[0]["EST_CODE"].ToString().Trim();
                    model.ESE_CODE     = listDt.Rows[0]["ESE_CODE"].ToString().Trim();
                    model.WRITER_ID    = int.Parse(listDt.Rows[0]["WRITER_ID"].ToString().Trim());
                    model.REGDATE      = listDt.Rows[0]["REGDATE"].ToString().Trim();
                    model.QNA_TYPE     = int.Parse(listDt.Rows[0]["QNA_TYPE"].ToString().Trim());
                    model.TITLE        = listDt.Rows[0]["TITLE"].ToString().Trim();
                    model.QUESTION     = listDt.Rows[0]["QUESTION"].ToString().Trim();
                    model.ANSWER       = listDt.Rows[0]["ANSWER"].ToString().Trim();
                    model.REGDATE      = listDt.Rows[0]["REGDATE"].ToString().Trim();
                    model.ANSWER_ID    = int.Parse(listDt.Rows[0]["ANSWER_ID"].ToString().Trim());
                    model.ANSWER_DATE  = listDt.Rows[0]["ANSWER_DATE"].ToString().Trim();
                    model.QNA_TYPE_txt = listDt.Rows[0]["ANSWER_DATE"].ToString().Trim();
                }
            }

            return(model);
        }
Exemplo n.º 2
0
        public string setCsQnaModels(CsQnaModels model)
        {
            string result   = "";
            string errorStr = "";
            //(msh)추가 2018-06-15 오전10:53
            string exeQueryStr = " UPDATE bd_qna SET  ";

            exeQueryStr += " ANSWER  = '" + model.Item.ANSWER + "' ";
            exeQueryStr += ", ANSWER_ID = '" + model.Item.ANSWER_ID + "' ";
            exeQueryStr += ", ANSWER_DATE =  CURRENT_TIMESTAMP ";
            exeQueryStr += " WHERE SEQNO =  " + model.Item.SEQNO;

            if (exeQuery(exeQueryStr, out errorStr))
            {
                result = "성공.";
            }
            else
            {
                result = "실패.";
            }

            return(result);
        }
Exemplo n.º 3
0
        public CsQnaModels GetCsQnaList(CsQnaModels model)
        {
            string errorStr = "";

            //string listQuery = " SELECT SEQNO , " + string.Join(",", selectColumn_CsQna);
            string listQuery = " SELECT bq.SEQNO , esmU.EMAIL , " + string.Join(",", selectColumn_CsQna);

            string cntQuery = " SELECT count(*) as cnt ";

            //string baseQuery = " FROM bd_qna WHERE 1=1 ";
            string baseQuery = " FROM bd_qna bq left outer join esm_user esmU on bq.WRITER_ID = esmU.SEQNO WHERE 1=1 ";

            if (!String.IsNullOrEmpty(model.schType))              //문의유형
            {
                baseQuery += " AND  QNA_TYPE = " + model.schType.Trim();
            }

            if (!String.IsNullOrEmpty(model.schSdt))                  //등록일자 (시작일)
            {
                baseQuery += " AND  REGDATE >= '" + model.schSdt.Trim() + "'";
            }

            if (!String.IsNullOrEmpty(model.schEdt))                  //등록일자 (종료일)
            {
                baseQuery += " AND  REGDATE <= '" + model.schEdt.Trim() + " 23:59:59'";
            }

            if (!String.IsNullOrEmpty(model.schTypeTxt) && !String.IsNullOrEmpty(model.schTxt))              //검색조건 검색어
            {
                baseQuery += " AND  " + model.schTypeTxt.Trim() + " like '%" + model.schTxt.Trim() + "%' ";
            }

            string endQuery = " ORDER BY " + model.sortKey.ToString().Trim() + " DESC limit " + ((model.Paging.page - 1) * model.Paging.pageNum) + " , " + model.Paging.pageNum; //정렬

            cntQuery  += baseQuery;                                                                                                                                              //토탈 카운트 쿼리
            listQuery += baseQuery + endQuery;                                                                                                                                   //리스트 쿼리

            int totCnt = getQueryCnt(cntQuery, out errorStr);                                                                                                                    //전체 리스트 갯수 구하기

            model.Paging.pageTotNum = (totCnt / model.Paging.pageNum) + 1;                                                                                                       //총 페이징 갯수 구하기

            DataTable listDt = getQueryResult(listQuery, out errorStr);

            //model.Items = new List<BdQna>();

            if (listDt != null && listDt.Rows.Count != 0)
            {
                for (int i = 0; i < listDt.Rows.Count; i++)
                {
                    BdQna temp = new BdQna();

                    temp.SEQNO       = int.Parse(listDt.Rows[i]["SEQNO"].ToString().Trim());
                    temp.EST_CODE    = listDt.Rows[i]["EST_CODE"].ToString().Trim();
                    temp.ESE_CODE    = listDt.Rows[i]["ESE_CODE"].ToString().Trim();
                    temp.WRITER_ID   = int.Parse(listDt.Rows[i]["WRITER_ID"].ToString().Trim());
                    temp.REGDATE     = listDt.Rows[i]["REGDATE"].ToString().Trim();
                    temp.QNA_TYPE    = int.Parse(listDt.Rows[i]["QNA_TYPE"].ToString().Trim());
                    temp.TITLE       = listDt.Rows[i]["TITLE"].ToString().Trim();
                    temp.QUESTION    = listDt.Rows[i]["QUESTION"].ToString().Trim();
                    temp.ANSWER      = listDt.Rows[i]["ANSWER"].ToString().Trim();
                    temp.ANSWER_ID   = int.Parse(listDt.Rows[i]["ANSWER_ID"].ToString().Trim());
                    temp.ANSWER_DATE = listDt.Rows[i]["ANSWER_DATE"].ToString().Trim();


                    foreach (schTypeArray tempS in model.schTypeArray)
                    {
                        if (tempS.opt_value == listDt.Rows[i]["QNA_TYPE"].ToString().Trim())
                        {
                            temp.QNA_TYPE     = int.Parse(listDt.Rows[i]["QNA_TYPE"].ToString().Trim());
                            temp.QNA_TYPE_txt = tempS.opt_key;
                        }
                    }
                    temp.WRITER_NAME = listDt.Rows[i]["EMAIL"].ToString().Trim();


                    model.Items.Add(temp);
                }
            }

            return(model);
        }