コード例 #1
0
        public ModelInvokeResult <SetMealPK> Create(SetMeal setMeal)
        {
            ModelInvokeResult <SetMealPK> result = new ModelInvokeResult <SetMealPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                if (setMeal.SetMealId == GlobalManager.GuidAsAutoGenerate)
                {
                    setMeal.SetMealId = Guid.NewGuid();
                }
                /***********************begin 自定义代码*******************/
                setMeal.OperatedBy = NormalSession.UserId.ToGuid();
                setMeal.OperatedOn = DateTime.Now;
                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = setMeal.GetCreateMethodName(), ParameterObject = setMeal.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new SetMealPK {
                    SetMealId = setMeal.SetMealId
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
コード例 #2
0
        public ModelInvokeResult <SetMealPK> Nullify(string strSetMealId)
        {
            ModelInvokeResult <SetMealPK> result = new ModelInvokeResult <SetMealPK> {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                Guid?_SetMealId = strSetMealId.ToGuid();
                if (_SetMealId == null)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                SetMeal setMeal = new SetMeal {
                    SetMealId = _SetMealId, Status = 0
                };
                /***********************begin 自定义代码*******************/
                setMeal.OperatedBy = NormalSession.UserId.ToGuid();
                setMeal.OperatedOn = DateTime.Now;
                /***********************end 自定义代码*********************/
                statements.Add(new IBatisNetBatchStatement {
                    StatementName = setMeal.GetUpdateMethodName(), ParameterObject = setMeal.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                });
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new SetMealPK {
                    SetMealId = _SetMealId
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
コード例 #3
0
        public InvokeResult NullifySelected(string strSetMealIds)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                string[] arrSetMealIds = strSetMealIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arrSetMealIds.Length == 0)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                string statementName = new SetMeal().GetUpdateMethodName();
                foreach (string strSetMealId in arrSetMealIds)
                {
                    SetMeal setMeal = new SetMeal {
                        SetMealId = strSetMealId.ToGuid(), Status = 0
                    };
                    /***********************begin 自定义代码*******************/
                    setMeal.OperatedBy = NormalSession.UserId.ToGuid();
                    setMeal.OperatedOn = DateTime.Now;
                    /***********************end 自定义代码*********************/
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = statementName, ParameterObject = setMeal.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                    });
                }
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
コード例 #4
0
        public InvokeResult DeleteSelected(string strSetMealIds)
        {
            InvokeResult result = new InvokeResult {
                Success = true
            };

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                string[] arrSetMealIds = strSetMealIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arrSetMealIds.Length == 0)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                string statementName = new SetMeal().GetDeleteMethodName();
                foreach (string strSetMealId in arrSetMealIds)
                {
                    SetMealPK pk = new SetMealPK {
                        SetMealId = strSetMealId.ToGuid()
                    };
                    DeleteCascade(statements, pk);
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = statementName, ParameterObject = pk, Type = SqlExecuteType.DELETE
                    });
                }
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }