Пример #1
0
        public ModelInvokeResult <ArticleColumn_RelationPK> Nullify(string strId)
        {
            ModelInvokeResult <ArticleColumn_RelationPK> result = new ModelInvokeResult <ArticleColumn_RelationPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                int _Id = int.Parse(strId);
                ArticleColumn_Relation articleColumn = new ArticleColumn_Relation {
                    Id = _Id, Status = 0
                };
                /***********************begin 自定义代码*******************/
                articleColumn.OperatedBy = NormalSession.UserId.ToGuid();
                articleColumn.OperatedOn = DateTime.Now;
                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = articleColumn.GetUpdateMethodName(), ParameterObject = articleColumn.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements);
                result.instance = new ArticleColumn_RelationPK {
                    Id = _Id
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
Пример #2
0
        public InvokeResult Create2(string articleId, IList <string> columnIds)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements             = new List <IBatisNetBatchStatement>();
                ArticleColumn_Relation         articleColumn_relation = new ArticleColumn_Relation();

                /***********************begin 自定义代码*******************/
                articleColumn_relation.ArticleId = articleId.ToGuid();
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = articleColumn_relation.GetDeleteMethodName(), ParameterObject = articleColumn_relation.ToStringObjectDictionary(false), Type = SqlExecuteType.DELETE
                });

                articleColumn_relation.OperatedBy = NormalSession.UserId.ToGuid();
                articleColumn_relation.OperatedOn = DateTime.Now;
                foreach (var item in columnIds)
                {
                    articleColumn_relation.ColumnId   = item.ToGuid();;
                    articleColumn_relation.Status     = 1;
                    articleColumn_relation.OperatedBy = NormalSession.UserId.ToGuid();
                    articleColumn_relation.OperatedOn = DateTime.Now;

                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = articleColumn_relation.GetCreateMethodName(), ParameterObject = articleColumn_relation.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                    });
                }
                /***********************end 自定义代码*********************/
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements);
                //result.instance = new ArticleColumn_RelationPK { Id = articleColumn.Id };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
Пример #3
0
        public InvokeResult NullifySelected(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 ArticleColumn_Relation().GetUpdateMethodName();
                foreach (string strId in arrIds)
                {
                    ArticleColumn_Relation articleColumn = new ArticleColumn_Relation {
                        Id = int.Parse(strId), Status = 0
                    };
                    /***********************begin 自定义代码*******************/
                    articleColumn.OperatedBy = NormalSession.UserId.ToGuid();
                    articleColumn.OperatedOn = DateTime.Now;

                    /***********************end 自定义代码*********************/
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = statementName, ParameterObject = articleColumn.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                    });
                }
                BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
Пример #4
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 ArticleColumn_Relation().GetDeleteMethodName();
                foreach (string strId in arrIds)
                {
                    ArticleColumn_RelationPK pk = new ArticleColumn_RelationPK {
                        Id = int.Parse(strId)
                    };
                    DeleteCascade(statements, pk);
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = statementName, ParameterObject = pk, Type = SqlExecuteType.DELETE
                    });
                }
                BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }