コード例 #1
0
        public ModelInvokeResult <ServeManPK> Create(ServeMan serveMan)
        {
            ModelInvokeResult <ServeManPK> result = new ModelInvokeResult <ServeManPK> {
                Success = true
            };

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

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                Guid?_UserId = strUserId.ToGuid();
                if (_UserId == null)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }

                var count = BuilderFactory.DefaultBulder().ExecuteNativeSqlForCount(" select * from Pam_ServeMan where UserId='" + _UserId + "'");
                serveMan.UserId = _UserId;
                /***********************begin 自定义代码*******************/
                serveMan.OperatedBy = NormalSession.UserId.ToGuid();
                serveMan.OperatedOn = DateTime.Now;
                /***********************end 自定义代码*********************/
                if (count > 0)
                {
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = serveMan.GetUpdateMethodName(), ParameterObject = serveMan.ToStringObjectDictionary(false), Type = SqlExecuteType.UPDATE
                    });
                }
                else
                {
                    statements.Add(new IBatisNetBatchStatement {
                        StatementName = serveMan.GetCreateMethodName(), ParameterObject = serveMan.ToStringObjectDictionary(false), Type = SqlExecuteType.INSERT
                    });
                }
                /***********************begin 自定义代码*******************/
                /***********************此处添加自定义代码*****************/
                /***********************end 自定义代码*********************/
                BuilderFactory.DefaultBulder().ExecuteNativeSqlNoneQuery(statements);
                result.instance = new ServeManPK {
                    UserId = _UserId
                };
            }
            catch (Exception ex)
            {
                result.Success      = false;
                result.ErrorMessage = ex.Message;
            }
            return(result);
        }
コード例 #3
0
        public ModelInvokeResult <ServeManPK> Nullify(string strUserId)
        {
            ModelInvokeResult <ServeManPK> result = new ModelInvokeResult <ServeManPK> {
                Success = true
            };

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

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

            try
            {
                List <IBatisNetBatchStatement> statements = new List <IBatisNetBatchStatement>();
                string[] arrUserIds = strUserIds.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                if (arrUserIds.Length == 0)
                {
                    result.Success   = false;
                    result.ErrorCode = 59996;
                    return(result);
                }
                string statementName = new ServeMan().GetDeleteMethodName();
                foreach (string strUserId in arrUserIds)
                {
                    ServeManPK pk = new ServeManPK {
                        UserId = strUserId.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);
        }