示例#1
0
        public virtual AssetWorkflowUser Update(AssetWorkflowUser assetWorkflowUser)
        {
            if (!assetWorkflowUser.IsDirty || assetWorkflowUser.IsNull)
            {
                // Nothing to do - no point hammering the database unnecessarily
                return(assetWorkflowUser);
            }

            IDbCommand command = CreateCommand();

            if (assetWorkflowUser.IsNew)
            {
                // Adding
                command.CommandText = "INSERT INTO [AssetWorkflowUser] ([AssetWorkflowId], [UserId], [Position], [Comments], [AssetWorkflowUserStatusId], [CreateDate], [LastUpdate], [IsDeleted]) VALUES (@assetWorkflowId, @userId, @position, @comments, @assetWorkflowUserStatusId, @createDate, @lastUpdate, @isDeleted) ; SELECT @@identity AS NewId;";
            }
            else
            {
                // Updating
                command.CommandText = "UPDATE [AssetWorkflowUser] SET [AssetWorkflowId] = @assetWorkflowId, [UserId] = @userId, [Position] = @position, [Comments] = @comments, [AssetWorkflowUserStatusId] = @assetWorkflowUserStatusId, [CreateDate] = @createDate, [LastUpdate] = @lastUpdate, [IsDeleted] = @isDeleted WHERE AssetWorkflowUserId = @assetWorkflowUserId";
            }

            command.Parameters.Add(CreateParameter("@assetWorkflowId", assetWorkflowUser.AssetWorkflowId));
            command.Parameters.Add(CreateParameter("@userId", assetWorkflowUser.UserId));
            command.Parameters.Add(CreateParameter("@position", assetWorkflowUser.Position));
            command.Parameters.Add(CreateParameter("@comments", assetWorkflowUser.Comments));
            command.Parameters.Add(CreateParameter("@assetWorkflowUserStatusId", assetWorkflowUser.AssetWorkflowUserStatusId));
            command.Parameters.Add(CreateParameter("@createDate", assetWorkflowUser.CreateDate));
            command.Parameters.Add(CreateParameter("@lastUpdate", assetWorkflowUser.LastUpdate));
            command.Parameters.Add(CreateParameter("@isDeleted", assetWorkflowUser.IsDeleted));

            if (assetWorkflowUser.IsNew)
            {
                assetWorkflowUser.AssetWorkflowUserId = Convert.ToInt32(ExecScalar(command));
            }
            else
            {
                command.Parameters.Add(CreateParameter("@assetWorkflowUserId", assetWorkflowUser.AssetWorkflowUserId));
                ExecuteCommand(command);
            }

            assetWorkflowUser.IsDirty = false;
            assetWorkflowUser.ChangedProperties.Clear();

            return(assetWorkflowUser);
        }
示例#2
0
        protected override object ReadRow(IRowReader reader)
        {
            AssetWorkflowUser assetWorkflowUser = AssetWorkflowUser.New();

            // Table Fields
            assetWorkflowUser.AssetWorkflowUserId = reader.GetInt32("AssetWorkflowUserId");
            assetWorkflowUser.AssetWorkflowId     = reader.GetInt32("AssetWorkflowId");
            assetWorkflowUser.UserId   = reader.GetInt32("UserId");
            assetWorkflowUser.Position = reader.GetInt32("Position");
            assetWorkflowUser.Comments = reader.GetString("Comments");
            assetWorkflowUser.AssetWorkflowUserStatusId = reader.GetInt32("AssetWorkflowUserStatusId");
            assetWorkflowUser.CreateDate = reader.GetDateTime("CreateDate");
            assetWorkflowUser.LastUpdate = reader.GetDateTime("LastUpdate");
            assetWorkflowUser.IsDeleted  = reader.GetBoolean("IsDeleted");


            assetWorkflowUser.IsDirty = false;
            assetWorkflowUser.ChangedProperties.Clear();

            return(assetWorkflowUser);
        }
 public static AssetWorkflowUser Update(AssetWorkflowUser assetWorkflowUser)
 {
     return(AssetWorkflowUserMapper.Instance.Update(assetWorkflowUser));
 }
        public static AssetWorkflowUser FindOne(AssetWorkflowUserFinder finder)
        {
            AssetWorkflowUser AssetWorkflowUser = AssetWorkflowUserMapper.Instance.FindOne(finder);

            return(AssetWorkflowUser ?? Empty);
        }
        public static AssetWorkflowUser Get(Nullable <Int32> AssetWorkflowUserId)
        {
            AssetWorkflowUser AssetWorkflowUser = AssetWorkflowUserMapper.Instance.Get(AssetWorkflowUserId);

            return(AssetWorkflowUser ?? Empty);
        }