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

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                int _Id             = Convert.ToInt32(strId);
                CourseSchedulePK pk = new CourseSchedulePK {
                    Id = _Id
                };
                DeleteCascade(statements, pk);
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = new CourseSchedule().GetDeleteMethodName(), ParameterObject = pk, Type = SqlExecuteType.DELETE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new CourseSchedulePK {
                    Id = _Id
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
Example #2
0
        public InvokeResult DeleteSelected(string strIds)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                string[] arrIds = strIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arrIds.Length == 0)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                string statementName = new CourseSchedule().GetDeleteMethodName();
                foreach (string strId in arrIds)
                {
                    CourseSchedulePK pk = new CourseSchedulePK {
                        Id = Convert.ToInt32(strId)
                    };
                    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, CourseSchedulePK pk)
 {
     //此处增加级联删除代码
 }