コード例 #1
0
 /// <summary>
 /// 通过对象删除记录
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public bool Del( TbDimIndicator item)
 {
     bool res = false;
     using (var connection = DataBase.GetOpenConnection())
     {
         res = connection.Delete< TbDimIndicator>(item);
     }
     return res;
 }
コード例 #2
0
 /// <summary>
 /// 通过ID删除记录
 /// </summary>
 /// <param name="id">需要删除的对象的ID</param>
 /// <returns></returns>
 public bool Del(int id)
 {
     bool res = false;
     TbDimIndicator item = new TbDimIndicator();
     using (var connection = DataBase.GetOpenConnection())
     {
         item = GetByID(id);
         res = connection.Delete<TbDimIndicator>(item);
     }
     return res;
 }
コード例 #3
0
        /// <summary>
        /// PUT api/DimIndicator/Put/5,更新数据
        /// </summary>
        public int Put(int id, TbDimIndicator item)
        {
            if (id != item.Id)
            {
                //数据无效
                return -1;
            }

            try
            {
                DimIndicatorDAO.Update(item);
            }
            catch (Exception ex)
            {
                //更新数据失败
                return -2;
            }

            //更新成功
            return 1;
        }
コード例 #4
0
        /// <summary>
        /// POST api/DimIndicator/Post
        ///新增item数据,
        /// </summary>
        /// <param name="item">item,新增数据</param>
        public int Post(TbDimIndicator item)
        {
            DimIndicatorDAO.Insert(item);

            return item.Id;//新增数据成功
        }
コード例 #5
0
        /// <summary>
        /// 
        ///新增数据
        /// </summary>
        /// <param name="item">item,新增数据</param>
        public int NewPost(TbDimIndicator item)
        {
            //获取指标类型名称
            string cateName = _DimIndCateDao.GetByID(item.ICateID).SCateName;

            //获取库名
            string libName = _DimLibDao.GetByID(item.ILibID).SLibName;

            item.SCateName = cateName;
            item.SLibName = libName;

            DimIndicatorDAO.Insert(item);

            return item.Id;//新增数据成功
        }
コード例 #6
0
 /// <summary>
 /// 插入一个对象
 /// </summary>
 /// <param name="item">需要插入的对象</param>
 /// <returns></returns>
 public int Insert(TbDimIndicator item)
 {
     int id = 0;
     using (var connection = DataBase.GetOpenConnection())
     {
         id = (int)connection.Insert<TbDimIndicator>(item);
     }
     return id;
 }