Ejemplo n.º 1
0
        public ModelInvokeResult <TreeItemPK> Create(TreeItem treeItem)
        {
            ModelInvokeResult <TreeItemPK> result = new ModelInvokeResult <TreeItemPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                if (treeItem.ItemId == "自动生成")
                {
                    treeItem.ItemId = GlobalManager.getPK(treeItem.GetMappingTableName(), "ItemId");
                }
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = treeItem.GetCreateMethodName(), ParameterObject = treeItem.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new TreeItemPK {
                    TreeId = treeItem.TreeId, ItemId = treeItem.ItemId
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }