コード例 #1
0
        public ModelInvokeResult <SubSetColumnPK> Create2(string strParam)
        {
            ModelInvokeResult <SubSetColumnPK> result = new ModelInvokeResult <SubSetColumnPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                /***********************begin 自定义代码*******************/
                SubSetColumn subSetColumn = new SubSetColumn();
                if (strParam != "")
                {
                    string[] param = strParam.Trim().Split(new char[] { ',' });
                    for (int i = 0; i < param.Length; i++)
                    {
                        subSetColumn                   = new SubSetColumn();
                        subSetColumn.OperatedBy        = NormalSession.UserId.ToGuid();
                        subSetColumn.OperatedOn        = DateTime.Now;
                        subSetColumn.OrderNo           = 0;
                        subSetColumn.ComputeColumnFlag = 0;

                        string[] param1 = param[i].Split(new char[] { '.' });

                        subSetColumn.TableName      = param1[0];
                        subSetColumn.ColumnName     = param1[1];
                        subSetColumn.ColumnNameNew  = param1[2];
                        subSetColumn.WidgetId       = param1[3];
                        subSetColumn.SubSetId       = param1[4];
                        subSetColumn.ColumnCNameNew = param1[5];
                        statements.Add(new IBatisNetBatchStatement {
                            StatementName = subSetColumn.GetCreateMethodName(), ParameterObject = subSetColumn.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                        });
                    }
                    BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                    result.instance = new SubSetColumnPK {
                        SubSetId = subSetColumn.SubSetId, ColumnNameNew = subSetColumn.ColumnNameNew
                    };
                }
                else
                {
                    result.Success      = false;
                    result.ErrorMessage = "无参数传递";
                }
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
コード例 #2
0
        public ModelInvokeResult <SubSetColumnPK> CreateEmployee(SubSetColumn subSetColumn)
        {
            ModelInvokeResult <SubSetColumnPK> result = new ModelInvokeResult <SubSetColumnPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                if (subSetColumn.ColumnNameNew == "自动生成")
                {
                    subSetColumn.ColumnNameNew = GlobalManager.getPK(subSetColumn.GetMappingTableName(), "ColumnNameNew");
                }
                /***********************begin 自定义代码*******************/
                subSetColumn.OperatedBy = NormalSession.UserId.ToGuid();
                subSetColumn.OperatedOn = DateTime.Now;

                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = subSetColumn.GetCreateMethodName(), ParameterObject = subSetColumn.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new SubSetColumnPK {
                    SubSetId = subSetColumn.SubSetId, ColumnNameNew = subSetColumn.ColumnNameNew
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }