Beispiel #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);
        }
Beispiel #2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public int Update(SqlTransaction sqltran, Entities.SearchLog model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RecID",        SqlDbType.BigInt,      8),
                new SqlParameter("@SearchKey",    SqlDbType.NVarChar,  900),
                new SqlParameter("@Type",         SqlDbType.Int,         4),
                new SqlParameter("@CreateTime",   SqlDbType.DateTime),
                new SqlParameter("@CreateUserID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.RecID;
            parameters[1].Value = model.SearchKey;
            parameters[2].Value = model.Type;
            parameters[3].Value = model.CreateTime;
            parameters[4].Value = model.CreateUserID;

            return(SqlHelper.ExecuteNonQuery(sqltran, CONNECTIONSTRINGS, CommandType.StoredProcedure, P_SEARCHLOG_UPDATE, parameters));
        }
Beispiel #3
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Insert(Entities.SearchLog model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RecID",        SqlDbType.BigInt,      8),
                new SqlParameter("@SearchKey",    SqlDbType.NVarChar,  900),
                new SqlParameter("@Type",         SqlDbType.Int,         4),
                new SqlParameter("@CreateTime",   SqlDbType.DateTime),
                new SqlParameter("@CreateUserID", SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.SearchKey;
            parameters[2].Value     = model.Type;
            parameters[3].Value     = model.CreateTime;
            parameters[4].Value     = model.CreateUserID;

            SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_SEARCHLOG_INSERT, parameters);
            return(Convert.ToInt32(parameters[0].Value));
        }
Beispiel #4
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Insert(SqlTransaction sqltran, Entities.SearchLog model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RecID",        SqlDbType.BigInt,      8),
                new SqlParameter("@SearchKey",    SqlDbType.NVarChar,  900),
                new SqlParameter("@Type",         SqlDbType.Int,         4),
                new SqlParameter("@CreateTime",   SqlDbType.DateTime),
                new SqlParameter("@CreateUserID", SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.SearchKey;
            parameters[2].Value     = model.Type;
            parameters[3].Value     = model.CreateTime;
            parameters[4].Value     = model.CreateUserID;

            SqlHelper.ExecuteNonQuery(sqltran, CommandType.StoredProcedure, P_SEARCHLOG_INSERT, parameters);
            int id = CommonFunction.ObjectToInteger(parameters[0].Value);

            return(id);
        }
Beispiel #5
0
        private Entities.SearchLog LoadSingleSearchLog(DataRow row)
        {
            Entities.SearchLog model = new Entities.SearchLog();

            if (row["RecID"].ToString() != "")
            {
                model.RecID = long.Parse(row["RecID"].ToString());
            }
            model.SearchKey = row["SearchKey"].ToString();
            if (row["Type"].ToString() != "")
            {
                model.Type = int.Parse(row["Type"].ToString());
            }
            if (row["CreateTime"].ToString() != "")
            {
                model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
            }
            if (row["CreateUserID"].ToString() != "")
            {
                model.CreateUserID = int.Parse(row["CreateUserID"].ToString());
            }
            return(model);
        }
Beispiel #6
0
        public void BindData()
        {
            #region 添加搜索关键字
            if (RequestKeywords != "")
            {
                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

            #region 整理Where

            StringBuilder sb = new StringBuilder();

            //sb.Append(BLL.UserGroupDataRigth.Instance.GetSqlRightstr("a", "BGID", "CreateUserID", BLL.Util.GetLoginUserID()));

            if (RequestKCPID != "-1")
            {
                sb.Append(" and c.ppid=");
                sb.Append(RequestKCPID.ToString());
            }
            if (RequestKCID != "-1")
            {
                sb.Append(" and c.kcid=");
                sb.Append(RequestKCID.ToString());
            }

            if (!string.IsNullOrEmpty(RequestKeywords))
            {
                var keyWorsArray = RequestKeywords.Split(' ').Where(s => !string.IsNullOrEmpty(s)).ToArray();
                if (keyWorsArray.Length > 0)
                {
                    sb.Append(" and (");
                    foreach (string s in keyWorsArray)
                    {
                        sb.Append(string.Format(" a.Ask like '%{0}%' OR a.Question like '%{0}%' or", BitAuto.Utils.StringHelper.SqlFilter(s)));
                    }

                    sb.Remove(sb.Length - 3, 3);

                    sb.Append(") ");
                }
            }
            var orderQuery = Oreder;
            if (string.IsNullOrEmpty(orderQuery))
            {
                orderQuery = "a.CreateTime desc";
            }
            #endregion

            DataSet ds = BLL.KLFAQ.Instance.GetKLFAQReport(BLL.Util.GetLoginUserID(), orderQuery, sb.ToString(), BLL.PageCommon.Instance.PageIndex, 10);


            sb = new StringBuilder();
            DataTable dt = ds.Tables[0];
            if (dt == null || dt.Rows.Count < 1)
            {
                return;
            }
            DataRow[] arrayDR = dt.Select("flag=1");
            DataRow[] drT;
            string    idT = "";
            try
            {
                RecordCount = Convert.ToInt32(dt.Select("flag=2")[0]["num"]);
            }
            catch
            {
                RecordCount = 0;
            }

            int i = 0;
            foreach (DataRow dr in arrayDR) //flag=1
            {
                if (i == 0)
                {
                    sb.Append("<ul>");

                    sb.Append(" <li>全部(" + RecordCount.ToString() + ")</li>");
                }
                else if (i % 7 == 0)
                {
                    sb.Append("</ul>");
                    if (i == 7)
                    {
                        sb.Append("<span class='more dnowup' id='btnMore'><a href='#'>更多</a></span>");
                    }
                    sb.Append("<ul style='display: none;'><li></li>");
                }


                idT = dr["ppid"].ToString();
                sb.Append(string.Format("<li><a  class='aC' href='javascript:void(0)' lev='1' did='{0}'>{1}({2})</a>", idT, dr["ppname"].ToString(), dr["num"]));
                drT = dt.Select("ppid=" + idT + " and flag=0");
                if (drT.Length > 0)
                {
                    sb.Append("<div class='arrow' style='display: none;'></div><ul style='display: none;'>");

                    foreach (DataRow dr2 in drT)
                    {
                        sb.Append(string.Format("<li><a  class='aC' href='javascript:void(0)' lev='2' did='{0}'>{1}({2})</a></li>", dr2["KCID"], dr2["kcname"], dr2["num"]));
                    }
                    sb.Append("</ul>");
                }
                sb.Append("</li>");
                i++;
            }

            sb.Append("</ul>");
            lbKLC.Text = sb.ToString();

            Rt_FAQ.DataSource = ds.Tables[1];
            Rt_FAQ.DataBind();
            litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), 8, RecordCount, 10, BLL.PageCommon.Instance.PageIndex, 1);
        }
Beispiel #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(SqlTransaction sqltran, Entities.SearchLog model)
 {
     return(Dal.SearchLog.Instance.Update(sqltran, model));
 }
Beispiel #8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Entities.SearchLog model)
 {
     return(Dal.SearchLog.Instance.Update(model));
 }
Beispiel #9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Insert(Entities.SearchLog model)
 {
     return(Dal.SearchLog.Instance.Insert(model));
 }