Exemple #1
0
        /// <summary>
        /// 添加渠道类别
        /// </summary>
        /// <param name="en">渠道</param>
        /// <returns></returns>
        public int add(Channel en)
        {
            string strSql = "insert into Channel (name, memo) values (@name, @memo)";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@name", en.name),
                new SqlParameter("@memo", en.memo)
            };

            int result = SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param);
            return result;
        }
Exemple #2
0
        /// <summary>
        /// 修改渠道类别
        /// </summary>
        /// <param name="en">渠道</param>
        /// <returns></returns>
        public int update(Channel en)
        {
            string strSql = "update Channel set name=@name, memo=@memo where id=@id";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@id", en.id),
                new SqlParameter("@name", en.name),
                new SqlParameter("@memo", en.memo)
            };

            int result = SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param);
            return result;
        }
Exemple #3
0
        /// <summary>
        /// 删除渠道类别
        /// </summary>
        /// <param name="en">渠道</param>
        /// <returns></returns>
        public int delete(Channel en)
        {
            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@id", en.id)
            };

            string strSql = "select count(id) from ContractInfo where channelID=@id";
            DataTable dt = SqlHelper.ExecuteDataset(BaseHelper.DBConnStr, CommandType.Text, strSql, param).Tables[0];

            if (dt != null && Convert.ToInt32(dt.Rows[0][0]) > 0)
                return 0;

            strSql = "delete from Channel where id=@id";
            int result = SqlHelper.ExecuteNonQuery(BaseHelper.DBConnStr, CommandType.Text, strSql, param);
            return result;
        }
        /// <summary>
        /// 删除渠道类别
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns></returns>
        public JsonResult Channel_remove(string id)
        {
            Channel en = new Channel();
            en.id = Convert.ToInt32(id);

            DaChannel dal = new DaChannel();
            var result = new CustomJsonResult();
            result.Data = dal.delete(en);
            return result;
        }
        public JsonResult Channel_edit(string id, string name, string memo)
        {
            Channel en = new Channel();
            en.id = Convert.ToInt32(id);
            en.name = name;
            en.memo = memo;

            DaChannel dal = new DaChannel();
            var result = new CustomJsonResult();
            result.Data = dal.update(en);
            return result;
        }
        public JsonResult Channel_add(string name, string memo)
        {
            Channel en = new Channel();
            en.name = name;
            en.memo = memo;

            DaChannel dal = new DaChannel();
            var result = new CustomJsonResult();
            result.Data = dal.add(en);
            return result;
        }