Exemple #1
0
        /// <summary>
        /// 删除一行或多行记录
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="filter"></param>
        public void DeleteModel(ModelFilter filter)
        {
            string sql = SqlSplice.GetDelete(filter);

            try
            {
                SqlRequest.Update(sql, filter.Params.ToArray());
            }
            catch (Exception ex)
            {
                throw new Exception("删除记录出错了", ex);
            }
        }
Exemple #2
0
        /// <summary>
        /// 删除一行记录
        /// </summary>
        /// <param name="model"></param>
        public void DeleteModel(CModel model)
        {
            if (model == null)
            {
                return;
            }

            string sql = SqlSplice.GetDelete(model);


            try
            {
                SqlRequest.Update(sql, SqlSplice.GetSqlParams());
            }
            catch (Exception ex)
            {
                throw new Exception("删除一行记录出错了", ex);
            }
        }
Exemple #3
0
        /// <summary>
        /// 删除多行记录
        /// </summary>
        /// <param name="models"></param>
        public void DeleteModels(List <CModel> models)
        {
            if (models.Count <= 0)
            {
                return;
            }

            foreach (var model in models)
            {
                string sql = SqlSplice.GetDelete(model);

                try
                {
                    SqlRequest.Update(sql, SqlSplice.GetSqlParams());
                }
                catch (Exception ex)
                {
                    throw new Exception("删除多行记录出错了", ex);
                }
            }
        }