public ModelInvokeResult <ArticlePK> Delete(string strArticleId) { ModelInvokeResult <ArticlePK> result = new ModelInvokeResult <ArticlePK> { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); Guid?_ArticleId = strArticleId.ToGuid(); if (_ArticleId == null) { result.Success = false; result.ErrorCode = 59996; return(result); } ArticlePK pk = new ArticlePK { ArticleId = _ArticleId }; DeleteCascade(statements, pk); statements.Add(new IBatisNetBatchStatement { StatementName = new Article().GetDeleteMethodName(), ParameterObject = pk, Type = SqlExecuteType.DELETE }); /***********************begin 自定义代码*******************/ /***********************此处添加自定义代码*****************/ /***********************end 自定义代码*********************/ BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements); result.instance = new ArticlePK { ArticleId = _ArticleId }; } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public InvokeResult DeleteSelected(string strArticleIds) { InvokeResult result = new InvokeResult { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); string[] arrArticleIds = strArticleIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (arrArticleIds.Length == 0) { result.Success = false; result.ErrorCode = 59996; return(result); } string statementName = new Article().GetDeleteMethodName(); foreach (string strArticleId in arrArticleIds) { ArticlePK pk = new ArticlePK { ArticleId = strArticleId.ToGuid() }; DeleteCascade(statements, pk); statements.Add(new IBatisNetBatchStatement { StatementName = statementName, ParameterObject = pk, Type = SqlExecuteType.DELETE }); } BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements); } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
private void DeleteCascade(List <IBatisNetBatchStatement> statements, ArticlePK pk) { //此处增加级联删除代码 }