Esempio n. 1
0
        /// <summary>
        ///  根据用户查询任务
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="pagination"></param>
        /// <param name="paras"></param>
        /// <returns></returns>
        public IEnumerable <T> QryTask <T>(Pagination pagination, Dictionary <string, object> paras)
        {
            if (pagination.sidx == null || pagination.sidx == "")
            {
                pagination.sidx = "ProjectId";
            }
            bool boo = pagination.sidx.IndexOf("ProjectId", StringComparison.OrdinalIgnoreCase) >= 0;

            if (!boo)
            {
                pagination.sidx = "ProjectId," + pagination.sidx;
            }
            WhereBuilder builder = new WhereBuilder();

            builder.FromSql = "fun_userTask(@userName)";
            builder.AddParameter("userName", paras["userName"]);
            builder.AddWhereAndParameter(paras, "ProjectId");
            int tag = int.Parse(paras["qryTag"].ToString());

            if (tag == 1)
            {
                builder.AddWhere(" CreateBy = @userName");
            }
            if (tag == 2)
            {
                builder.AddWhere(" FinishBy = @userName");
            }
            return(SortAndPage <T>(builder, pagination));
        }
Esempio n. 2
0
        /// <summary>
        /// 查询用户列表
        /// </summary>
        /// <typeparam name="T">数据集</typeparam>
        /// <param name="pagination">分页信息</param>
        /// <param name="paras">查询条件参数</param>
        /// <returns></returns>
        public IEnumerable <T> QryUsers <T>(Pagination pagination, Dictionary <string, object> paras)
        {
            WhereBuilder builder = new WhereBuilder();

            builder.FromSql = "v_user_list";
            if (paras.ContainsKey("keyword"))
            {
                builder.AddWhere(" (AccountName Like '%'+@keyword+'%' OR RealName Like '%'+@keyword+'%')");
                builder.AddParameter("keyword", paras["keyword"]);
            }

            var rows = SortAndPage <T>(builder, pagination);

            return(rows);
        }