Ejemplo n.º 1
0
        public void BindData_old()
        {
            Entities.QueryKLFAQ query = new QueryKLFAQ();
            if (RequestKeywords != "")
            {
                query.Keywords = RequestKeywords;
                #region 添加搜索关键字
                Entities.SearchLog searchLog = new Entities.SearchLog();
                searchLog.SearchKey    = RequestKeywords;
                searchLog.Type         = 2;
                searchLog.CreateTime   = DateTime.Now;
                searchLog.CreateUserID = BLL.Util.GetLoginUserID();
                BLL.SearchLog.Instance.Insert(searchLog);
                #endregion
            }
            if (RequestKCID != "")
            {
                query.KCIDs = RequestKCID;
            }
            query.State = "2";
            int       RecordCount = 0;
            DataTable dt          = BLL.KLFAQ.Instance.GetKLFAQ(query, "KLFAQ.CreateTime DESC", BLL.PageCommon.Instance.PageIndex, 10, out RecordCount);
            Rt_FAQ.DataSource = dt;
            Rt_FAQ.DataBind();

            litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), 10, RecordCount, 10, BLL.PageCommon.Instance.PageIndex, 1);
        }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (KnowledgeID != "")
     {//FAQ数据绑定
         DataTable  dt           = new DataTable();
         QueryKLFAQ query        = new QueryKLFAQ();
         long       nKnowledgeID = -1;
         if (long.TryParse(KnowledgeID, out nKnowledgeID))
         {
             ;
         }
         {
             query.KLID = nKnowledgeID;
             int totalCount = 0;
             dt = BLL.KLFAQ.Instance.GetKLFAQ(query, "", 1, 100, out totalCount);
             dt.Columns.Add("Num");
             int num = 1;
             foreach (DataRow dr in dt.Rows)
             {
                 dr["Num"] = num.ToString();
                 num++;
             }
             Rt_FAQList.DataSource = dt;
             Rt_FAQList.DataBind();
         }
     }
 }
        //获取分类下拉列表
        private void bindKnowledgeCategory()
        {
            try
            {
                int       qCount;
                int       parentParentId = -1;
                DataTable dtkc           = new DataTable();
                if (KLType == "0")
                {
                    Entities.QueryKnowledgeLib queryM = new QueryKnowledgeLib();
                    queryM.KLID = int.Parse(KLID);
                    dtkc        = BLL.KnowledgeLib.Instance.GetKnowledgeLib(queryM, "", 1, 1, out qCount);
                }
                else if (KLType == "1")
                {
                    Entities.QueryKLFAQ queryF = new QueryKLFAQ();
                    queryF.KLID = int.Parse(KLID);
                    dtkc        = BLL.KLFAQ.Instance.GetKLFAQ(queryF, "", 1, 1, out qCount);
                }
                if (dtkc != null && dtkc.Rows.Count > 0)
                {
                    KnowledgeCategory categoryEntity = BLL.KnowledgeCategory.Instance.GetKnowledgeCategory(int.Parse(dtkc.Rows[0]["KCID"].ToString()));
                    KCid     = categoryEntity.KCID;
                    KCPid    = categoryEntity.Pid.Value;
                    KLPLevel = categoryEntity.Level.Value;
                    if (KCid != 0)
                    {
                        KnowledgeCategory categoryEntityPP = BLL.KnowledgeCategory.Instance.GetKnowledgeCategory(KCPid);
                        parentParentId = categoryEntityPP.Pid.Value;
                    }
                }

                Entities.QueryKnowledgeCategory query = new Entities.QueryKnowledgeCategory();
                //query.Level = 1;
                if (parentParentId != -1)
                {
                    query.Pid = parentParentId;
                }
                else
                {
                    query.Pid = 0;
                }
                query.Regionid = RegionID;
                int       count;
                DataTable dt = BLL.KnowledgeCategory.Instance.GetKnowledgeCategory(query, "", 1, 10000, out count);

                selKCID1.DataSource     = dt;
                selKCID1.DataTextField  = "Name";
                selKCID1.DataValueField = "KCID";
                selKCID1.DataBind();
                selKCID1.Items.Insert(0, new ListItem()
                {
                    Text = "请选择", Value = "-1"
                });
            }
            catch (Exception ex)
            {
                BLL.Loger.Log4Net.Error("异常:" + ex.Message);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 判断一个知识点下是否有FAQ
        /// </summary>
        ///
        /// <returns>BooL</returns>
        public bool IsHaveFAQ(string knoledgeID)
        {
            QueryKLFAQ query      = new QueryKLFAQ();
            int        totalCount = 0;

            string where = " and KLFAQ.KLID=" + StringHelper.SqlFilter(knoledgeID);

            DataSet ds;

            SqlParameter[] parameters =
            {
                new SqlParameter("@where",         SqlDbType.NVarChar, 40000),
                new SqlParameter("@order",         SqlDbType.NVarChar,   200),
                new SqlParameter("@pagesize",      SqlDbType.Int,          4),
                new SqlParameter("@indexpage",     SqlDbType.Int,          4),
                new SqlParameter("@totalRecorder", SqlDbType.Int, 4)
            };

            parameters[0].Value     = where;
            parameters[1].Value     = "";
            parameters[2].Value     = 10;
            parameters[3].Value     = 1;
            parameters[4].Direction = ParameterDirection.Output;

            ds         = SqlHelper.ExecuteDataset(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_KLFAQ_SELECT, parameters);
            totalCount = (int)(parameters[4].Value);
            if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (KnowledgeID != string.Empty)
     {//FAQ数据绑定
         DataTable  dt    = new DataTable();
         QueryKLFAQ query = new QueryKLFAQ();
         query.KLID = long.Parse(KnowledgeID);
         int totalCount = 0;
         dt = BLL.KLFAQ.Instance.GetKLFAQ(query, "", 1, 100, out totalCount);
         Rt_FAQList.DataSource = dt;
         Rt_FAQList.DataBind();
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 按照查询条件查询
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <param name="order">排序</param>
        /// <param name="currentPage">页号,-1不分页</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="totalCount">总行数</param>
        /// <returns>集合</returns>
        public DataTable GetKLFAQ(QueryKLFAQ query, string order, int currentPage, int pageSize, out int totalCount)
        {
            string where = string.Empty;

            if (query.KLFAQID != Constant.INT_INVALID_VALUE)
            {
                where += " and KLFAQ.KLFAQID=" + query.KLFAQID.ToString();
            }
            if (query.KLID != Constant.INT_INVALID_VALUE)
            {
                where += " and KLFAQ.KLID=" + query.KLID.ToString();
            }
            if (query.KCIDs != Constant.STRING_INVALID_VALUE)
            {
                where += " and KnowLedgeLib.KCID in (select ID from f_Cid(" + Dal.Util.SqlFilterByInCondition(query.KCIDs) + "))";
            }
            if (query.Keywords != Constant.STRING_INVALID_VALUE)
            {
                where += " and (KLFAQ.Ask like '%" + StringHelper.SqlFilter(query.Keywords) + "%' or KLFAQ.Question like '%" + StringHelper.SqlFilter(query.Keywords) + "%')";
            }
            if (query.State != Constant.STRING_INVALID_VALUE)
            {
                where += " and KnowLedgeLib.Status=" + StringHelper.SqlFilter(query.State);
            }


            DataSet ds;

            SqlParameter[] parameters =
            {
                new SqlParameter("@where",         SqlDbType.NVarChar, 40000),
                new SqlParameter("@order",         SqlDbType.NVarChar,   200),
                new SqlParameter("@pagesize",      SqlDbType.Int,          4),
                new SqlParameter("@indexpage",     SqlDbType.Int,          4),
                new SqlParameter("@totalRecorder", SqlDbType.Int, 4)
            };

            parameters[0].Value     = where;
            parameters[1].Value     = order;
            parameters[2].Value     = pageSize;
            parameters[3].Value     = currentPage;
            parameters[4].Direction = ParameterDirection.Output;

            ds         = SqlHelper.ExecuteDataset(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_KLFAQ_SELECT, parameters);
            totalCount = (int)(parameters[4].Value);
            return(ds.Tables[0]);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool IsExistsByKLFAQID(long KLFAQID)
        {
            QueryKLFAQ query = new QueryKLFAQ();

            query.KLFAQID = KLFAQID;
            DataTable dt    = new DataTable();
            int       count = 0;

            dt = GetKLFAQ(query, string.Empty, 1, 1, out count);
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Entities.KLFAQ GetKLFAQ(long KLFAQID)
        {
            QueryKLFAQ query = new QueryKLFAQ();

            query.KLFAQID = KLFAQID;
            DataTable dt    = new DataTable();
            int       count = 0;

            dt = GetKLFAQ(query, string.Empty, 1, 1, out count);
            if (count > 0)
            {
                return(LoadSingleKLFAQ(dt.Rows[0]));
            }
            else
            {
                return(null);
            }
        }
        private void GetFLFAQ()
        {
            long nid = -1;

            if (string.IsNullOrEmpty(KFAQID) || !long.TryParse(KFAQID, out nid))
            {
                return;
            }
            QueryKLFAQ faq = new QueryKLFAQ()
            {
                KLFAQID = nid
            };
            int       nCount;
            DataTable dt = BLL.KLFAQ.Instance.GetKLFAQ(faq, "", 1, 100, out nCount);

            if (dt != null && dt.Rows.Count < 1)
            {
                return;
            }
            this.FAQ_A.InnerText = dt.Rows[0]["Ask"].ToString();
            this.FAQ_Q.InnerText = dt.Rows[0]["Question"].ToString();
            KCPID = dt.Rows[0]["KCPID"].ToString();
            KCID  = dt.Rows[0]["KCID"].ToString();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 按照查询条件查询
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <param name="order">排序</param>
        /// <param name="currentPage">页号,-1不分页</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="totalCount">总行数</param>
        /// <returns>集合</returns>
        public DataTable GetKLFAQ(QueryKLFAQ query, string order, int currentPage, int pageSize, out int totalCount)
        {
            //知识点分类处理

            return(Dal.KLFAQ.Instance.GetKLFAQ(query, order, currentPage, pageSize, out totalCount));
        }