Ejemplo n.º 1
0
        /// <summary>
        /// 根据用户获取Category集合
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public TaskCategoryCollection GetCategoriesByUserID(string userID, ref int totalCount)
        {
            TaskCategoryCollection tc = GetCategoriesByWhereCondition("", "INNER_SORT_ID", new List <string>());

            totalCount = tc.Count;

            return(tc);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 若该集合类刚从库中取出,各UserTask的Category子对象中只有CategoryID被赋值,通过该方法取出Category的其他属性
        /// </summary>
        public void FillUserTasksCategory()
        {
            string[] CategoryIDs = GetCategoryIDsFromUserTaskCollection(this);

            TaskCategoryCollection taskCategories = TaskCategoryAdapter.Instance.GetCategoriesByCategoryIDs(CategoryIDs);

            foreach (UserTask task in this)
            {
                foreach (TaskCategory category in taskCategories)
                {
                    if (task.Category.CategoryID == category.CategoryID)
                    {
                        task.Category = category;
                        break;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 根据CategoryID获取Category集合
        /// </summary>
        /// <param name="categoryID"></param>
        /// <returns></returns>
        public TaskCategoryCollection GetCategoriesByCategoryIDs(params string[] categoryID)
        {
            string strSQL = string.Empty;
            TaskCategoryCollection taskCategories = new TaskCategoryCollection();

            if (categoryID.Length > 0)
            {
                InSqlClauseBuilder inSQL = new InSqlClauseBuilder("CATEGORY_GUID");
                inSQL.AppendItem(categoryID);

                strSQL = string.Format("SELECT * FROM WF.USER_TASK_CATEGORY WHERE {0} ORDER BY INNER_SORT_ID",
                                       inSQL.AppendTenantCodeSqlClause(typeof(TaskCategory)).ToSqlString(TSqlBuilder.Instance));

                DataView dv = DbHelper.RunSqlReturnDS(strSQL, ConnectionDefine.DBConnectionName).Tables[0].DefaultView;
                taskCategories.LoadFromDataView(dv);
            }

            return(taskCategories);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 根据SQL获取category
        /// </summary>
        /// <param name="where"></param>
        /// <param name="orderby"></param>
        /// <param name="selector"></param>
        /// <returns></returns>
        public TaskCategoryCollection GetCategoriesByWhereCondition(string where, string orderby, List <string> selector)
        {
            string sql = string.Format("SELECT");

            if (selector != null && selector.Count > 0)
            {
                foreach (string sel in selector)
                {
                    sql += TSqlBuilder.Instance.CheckQuotationMark(sel, true);
                }
            }
            else
            {
                sql += " * ";
            }

            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem("USER_ID", DeluxeIdentity.CurrentUser.ID);
            builder.AppendTenantCode(typeof(TaskCategory));

            sql += string.Format("FROM WF.USER_TASK_CATEGORY WHERE {0}",
                                 builder.ToSqlString(TSqlBuilder.Instance));

            if (where != string.Empty && where != null)
            {
                sql += string.Format("AND ({0})", where);
            }

            if (orderby != string.Empty && orderby != null)
            {
                sql += string.Format("ORDER BY {0}", orderby);
            }

            DataView dv = DbHelper.RunSqlReturnDS(sql, ConnectionDefine.DBConnectionName).Tables[0].DefaultView;
            TaskCategoryCollection tcc = new TaskCategoryCollection();

            tcc.LoadFromDataView(dv);

            return(tcc);
        }