示例#1
0
        /// <summary>
        /// 通过条件查询收藏的KLRaiseQuestion数据
        /// </summary>
        /// <param name="query"></param>
        /// <param name="order"></param>
        /// <param name="currentPage"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        public DataTable GetKLRaiseQuestionData(KLRaiseQuestions query, string order, int currentPage, int pageSize, out int totalCount)
        {
            string where = string.Empty;

            where += GetKLRaiseQuestionWhere(query);

            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_KLRaiseQuestions_Select_ForCollection, parameters);
            totalCount = (int)(parameters[4].Value);
            return(ds.Tables[0]);
        }
示例#2
0
        public string GetKLRaiseQuestionWhere(KLRaiseQuestions query)
        {
            string where = string.Empty;

            if (query.Id != Constant.INT_INVALID_VALUE)
            {
                where += " and klr.Id=" + query.Id;
            }
            if (query.CreateUserId != Constant.INT_INVALID_VALUE)
            {
                where += " and klr.CreateUserId=" + query.CreateUserId;
            }
            if (query.CreateDate != Constant.DATE_INVALID_VALUE)
            {
                where += " and klr.CreateDate='" + query.CreateDate + "'";
            }
            if (query.Title != Constant.STRING_INVALID_VALUE)
            {
                where += " and klr.Title='" + StringHelper.SqlFilter(query.Title) + "'";
            }
            if (query.CONTENT != Constant.STRING_INVALID_VALUE)
            {
                where += " and klr.CONTENT like '%" + StringHelper.SqlFilter(query.CONTENT) + "%'";
            }
            if (query.KLCId != Constant.INT_INVALID_VALUE)
            {
                where += " and klr.KLCId=" + query.KLCId;
            }
            if (query.KLRefId != Constant.INT_INVALID_VALUE)
            {
                where += " and klr.KLRefId=" + query.KLRefId;
            }
            if (query.Type != Constant.INT_INVALID_VALUE)
            {
                where += " and klr.Type=" + query.Type;
            }
            if (query.Status != Constant.INT_INVALID_VALUE)
            {
                where += " and klr.Status=" + query.Status;
            }
            if (query.AnswerUser != Constant.INT_INVALID_VALUE)
            {
                where += " and klr.AnswerUser="******" and klr.BGID=" + query.BGID;
            }
            if (query.LastModifyDate != Constant.DATE_INVALID_VALUE)
            {
                where += " and CONVERT(VARCHAR(10),klr.LastModifyDate,120) ='" + query.LastModifyDate.ToString("yyyy-MM-dd") + "'";
            }
            if (query.LastModifyBy != Constant.INT_INVALID_VALUE)
            {
                where += " and klr.LastModifyBy=" + query.LastModifyBy;
            }
            return(where);
        }
        public void BindData()
        {
            KLRaiseQuestions query = new KLRaiseQuestions();

            query.CreateUserId = BLL.Util.GetLoginUserID();
            if (SelType == "2")  //未解答
            {
                query.Status = 0;
            }

            DataTable dt = BLL.Personalization.Instance.GetKLRaiseQuestionData(query, "CreateDate DESC", BLL.PageCommon.Instance.PageIndex, PageSize, out RecordCount);

            if (dt != null && dt.Rows.Count > 0)
            {
                NotAnswerCount = dt.Rows[0]["notAnswer"].ToString();
            }
            Rt_Question.DataSource = dt;
            Rt_Question.DataBind();


            litPagerDown.Text = BLL.PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), GroupLength, RecordCount, PageSize, BLL.PageCommon.Instance.PageIndex, 1);
        }
示例#4
0
 /// <summary>
 /// 通过条件查询收藏的KLRaiseQuestion数据
 /// </summary>
 /// <param name="query"></param>
 /// <param name="order"></param>
 /// <param name="currentPage"></param>
 /// <param name="pageSize"></param>
 /// <param name="totalCount"></param>
 /// <returns></returns>
 public DataTable GetKLRaiseQuestionData(KLRaiseQuestions query, string order, int currentPage, int pageSize, out int totalCount)
 {
     return(Dal.Personalization.Instance.GetKLRaiseQuestionData(query, order, currentPage, pageSize, out totalCount));
 }
示例#5
0
        private void AnswerQuestion(out string msg)
        {
            int intQuestionId;

            if (int.TryParse(QuestionId, out intQuestionId))
            {
                DataTable dt = BLL.Personalization.Instance.GetKLRaiseQuestionModelDataById(intQuestionId);
                if (dt != null && dt.Rows.Count > 0)
                {
                    KLRaiseQuestions entity = new KLRaiseQuestions();
                    if (Action.ToLower() == "updatequestion")
                    {
                        entity.Id             = intQuestionId;
                        entity.CreateUserId   = int.Parse(dt.Rows[0]["CreateUserId"].ToString());
                        entity.CreateDate     = Convert.ToDateTime(dt.Rows[0]["CreateDate"].ToString());
                        entity.Title          = dt.Rows[0]["Title"].ToString();
                        entity.CONTENT        = QuestionDetails;
                        entity.KLCId          = int.Parse(dt.Rows[0]["KLCId"].ToString());
                        entity.KLRefId        = int.Parse(dt.Rows[0]["KLRefId"].ToString());
                        entity.Type           = int.Parse(dt.Rows[0]["Type"].ToString());
                        entity.Status         = int.Parse(dt.Rows[0]["Status"].ToString());
                        entity.AnswerUser     = dt.Rows[0]["AnswerUser"] == null ? -2 : int.Parse(dt.Rows[0]["AnswerUser"].ToString());
                        entity.BGID           = dt.Rows[0]["BGID"] == null ? -2 : int.Parse(dt.Rows[0]["BGID"].ToString());
                        entity.LastModifyDate = DateTime.Now;
                        entity.LastModifyBy   = BLL.Util.GetLoginUserID();
                    }
                    else
                    {
                        int userId = BLL.Util.GetLoginUserID();
                        entity.Id             = intQuestionId;
                        entity.CreateUserId   = int.Parse(dt.Rows[0]["CreateUserId"].ToString());
                        entity.CreateDate     = Convert.ToDateTime(dt.Rows[0]["CreateDate"].ToString());
                        entity.Title          = dt.Rows[0]["Title"].ToString();
                        entity.CONTENT        = QuestionDetails;
                        entity.KLCId          = int.Parse(dt.Rows[0]["KLCId"].ToString());
                        entity.KLRefId        = int.Parse(dt.Rows[0]["KLRefId"].ToString());
                        entity.Type           = int.Parse(dt.Rows[0]["Type"].ToString());
                        entity.Status         = 1;
                        entity.AnswerUser     = userId;
                        entity.BGID           = int.Parse(BLL.EmployeeSuper.Instance.GetEmployeeAgent(userId).Rows[0]["BGID"].ToString());
                        entity.LastModifyDate = DateTime.Now;
                        entity.LastModifyBy   = userId;
                    }

                    int backData = BLL.Personalization.Instance.UpdateKLRaiseQuestion(entity);
                    if (backData == 0)
                    {
                        msg = "提交失败";
                    }
                    else
                    {
                        msg = "提交成功";
                    }
                }
                else
                {
                    msg = "该条问题已不存在";
                }
            }
            else
            {
                msg = "传入数据格式不正确";
            }
        }