示例#1
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 EvaluationInfo().GetUpdateMethodName();
                foreach (string strId in arrIds)
                {
                    EvaluationInfo evaluationInfo = new EvaluationInfo {
                        Id = Convert.ToInt32(strId), Status = 0
                    };
                    /***********************begin 自定义代码*******************/
                    evaluationInfo.OperatedBy = NormalSession.UserId.ToGuid();
                    evaluationInfo.OperatedOn = DateTime.Now;
                    /***********************end 自定义代码*********************/
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = statementName, ParameterObject = evaluationInfo.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                    });
                }
                BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
示例#2
0
        public ModelInvokeResult <EvaluationInfoPK> Nullify(string strId)
        {
            ModelInvokeResult <EvaluationInfoPK> result = new ModelInvokeResult <EvaluationInfoPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                int            _Id            = Convert.ToInt32(strId);
                EvaluationInfo evaluationInfo = new EvaluationInfo {
                    Id = _Id, Status = 0
                };
                /***********************begin 自定义代码*******************/
                evaluationInfo.OperatedBy = NormalSession.UserId.ToGuid();
                evaluationInfo.OperatedOn = DateTime.Now;
                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = evaluationInfo.GetUpdateMethodName(), ParameterObject = evaluationInfo.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder(GetHttpHeader("ConnectId")).ExecuteNativeSqlNoneQuery(statements);
                result.instance = new EvaluationInfoPK {
                    Id = _Id
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }