Example #1
0
        public ModelInvokeResult <ServiceStationPK> Delete(string strStationId)
        {
            ModelInvokeResult <ServiceStationPK> result = new ModelInvokeResult <ServiceStationPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                Guid?_StationId = strStationId.ToGuid();
                if (_StationId == null)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                ServiceStationPK pk = new ServiceStationPK {
                    StationId = _StationId
                };
                DeleteCascade(statements, pk);
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = new ServiceStation().GetDeleteMethodName(), ParameterObject = pk, Type = SqlExecuteType.DELETE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new ServiceStationPK {
                    StationId = _StationId
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
Example #2
0
        public InvokeResult DeleteSelected(string strStationIds)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                string[] arrStationIds = strStationIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arrStationIds.Length == 0)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                string statementName = new ServiceStation().GetDeleteMethodName();
                foreach (string strStationId in arrStationIds)
                {
                    ServiceStationPK pk = new ServiceStationPK {
                        StationId = strStationId.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);
        }
Example #3
0
 private void DeleteCascade(List <IBatisNetBatchStatement> statements, ServiceStationPK pk)
 {
     //此处增加级联删除代码
 }