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