public ModelInvokeResult <OldManConfigInfoPK> Delete(string strOldManId) { ModelInvokeResult <OldManConfigInfoPK> result = new ModelInvokeResult <OldManConfigInfoPK> { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); Guid?_OldManId = strOldManId.ToGuid(); if (_OldManId == null) { result.Success = false; result.ErrorCode = 59996; return(result); } OldManConfigInfoPK pk = new OldManConfigInfoPK { OldManId = _OldManId }; DeleteCascade(statements, pk); statements.Add(new IBatisNetBatchStatement { StatementName = new OldManConfigInfo().GetDeleteMethodName(), ParameterObject = pk, Type = SqlExecuteType.DELETE }); /***********************begin 自定义代码*******************/ /***********************此处添加自定义代码*****************/ /***********************end 自定义代码*********************/ BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements); result.instance = new OldManConfigInfoPK { OldManId = _OldManId }; } catch (Exception ex) { result.Success = false; result.ErrorMessage = ex.Message; } return(result); }
public InvokeResult DeleteSelected(string strOldManIds) { InvokeResult result = new InvokeResult { Success = true }; try { List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>(); string[] arrOldManIds = strOldManIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (arrOldManIds.Length == 0) { result.Success = false; result.ErrorCode = 59996; return(result); } string statementName = new OldManConfigInfo().GetDeleteMethodName(); foreach (string strOldManId in arrOldManIds) { OldManConfigInfoPK pk = new OldManConfigInfoPK { OldManId = strOldManId.ToGuid() }; 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, OldManConfigInfoPK pk) { //此处增加级联删除代码 }