コード例 #1
0
        public InvokeResult SetUpColumnPermit2(string groupId, IList <string> permitIds)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };

            List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();

            try
            {
                ArticleColumnPermit articleColumnPermit = new ArticleColumnPermit();
                articleColumnPermit.OBJ_ID = groupId.ToGuid();
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = articleColumnPermit.GetDeleteMethodName(), ParameterObject = articleColumnPermit.ToStringObjectDictionary(false), Type = SqlExecuteType.DELETE
                });

                foreach (var item in permitIds)
                {
                    string[] stra = item.Split('_');
                    articleColumnPermit.ColumnId   = stra[0].ToGuid();
                    articleColumnPermit.PermitType = byte.Parse(stra[1]);
                    articleColumnPermit.Category   = 0;
                    articleColumnPermit.OperatedBy = NormalSession.UserId.ToGuid();
                    articleColumnPermit.OperatedOn = DateTime.Now;

                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = articleColumnPermit.GetCreateMethodName(), ParameterObject = articleColumnPermit.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                    });
                }
                BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }