/// <summary>
        /// 添加
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        public MsgEntity Add(T_EC_KWCategory category)
        {
            MsgEntity me = new MsgEntity();

            if (category == null || string.IsNullOrEmpty(category.CATEGORY_CODE) || string.IsNullOrEmpty(category.CATEGORY_NAME))
            {
                me.MsgCode = MsgEntity.MsgCodeEnum.Failure;
                me.MsgDes  = "编码或名称不能为空";
                return(me);
            }
            //查找关键字是否有相同值
            int count = dao.Count <T_EC_KWCategory>(Predicates.Field <T_EC_KWCategory>(f => f.CATEGORY_CODE, Operator.Eq, category.CATEGORY_CODE));

            if (count > 0)
            {
                me.MsgCode = MsgEntity.MsgCodeEnum.Failure;
                me.MsgDes  = "编码重复";
                return(me);
            }
            dynamic result = null;

            try
            {
                result = dao.Insert <T_EC_KWCategory>(category);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            if (result != null)
            {
                me.MsgCode = MsgEntity.MsgCodeEnum.Success;
                me.MsgDes  = MsgEntity.MsgCodeEnum.Success.GetDescription();
            }
            return(me);
        }
Example #2
0
        public int GetDictCount()
        {
            int iCount = dao.Count <T_Sys_Dict>(null);

            return(iCount);
        }