public bool EditCategory(List <ArticleCategory> categoryModelList)
        {
            StringBuilder strSql = new StringBuilder();
            Dictionary <string, object> dicParams = new Dictionary <string, object>();

            for (int i = 0; i < categoryModelList.Count; i++)
            {
                var data = categoryModelList[i];
                //判断ID是否为空(为空则Add 反之则Update)
                if (!string.IsNullOrEmpty(data.id.ToString()) && data.id > 0)
                {
                    string sqlSet   = string.Format(" CategoryName = @CategoryName_{0},Sort = @Sort_{0},Color = @Color_{0} ", i);
                    string sqlWhere = string.Format(" id = @id_{0} ", i);
                    strSql.AppendFormat(" UPDATE [Marketing].[dbo].[tbl_NewCategoryList] WITH(rowlock) SET {0} WHERE {1} ", sqlSet, sqlWhere);

                    dicParams.Add("@CategoryName_" + i, data.CategoryName);
                    dicParams.Add("@Sort_" + i, data.Sort);
                    dicParams.Add("@id_" + i, data.id);
                    dicParams.Add("@Color_" + i, data.Color);
                }
                else
                {
                    string sqlSet   = string.Format("CategoryName,Sort,Color");
                    string sqlWhere = string.Format("@CategoryName_{0},@Sort_{0},@Color_{0} ", i);
                    strSql.AppendFormat(" INSERT into [Marketing].[dbo].[tbl_NewCategoryList]({0}) VALUES({1}) ", sqlSet, sqlWhere);

                    dicParams.Add("@CategoryName_" + i, data.CategoryName);
                    dicParams.Add("@Sort_" + i, data.Sort);
                    dicParams.Add("@Color_" + i, data.Color);
                }
            }

            SqlParameter[] sqlParams = new SqlParameter[dicParams.Count];//参数值
            //修改
            for (int i = 0; i < dicParams.Count; i++)
            {
                var dicKey   = dicParams.ElementAt(i).Key;
                var dicValue = dicParams.ElementAt(i).Value;
                sqlParams[i] = new SqlParameter(dicKey, dicValue);
            }
            Func <SqlConnection, bool> action = (connection) => DalArticle.EditCategory(connection, strSql.ToString(), sqlParams);

            return(dbManager.Execute(action));
        }