Ejemplo n.º 1
0
        public static Workflow Update(Workflow workflow)
        {
            Workflow wf = WorkflowMapper.Instance.Update(workflow);

            if (wf.IsWorkflowUserListLoaded)
            {
                WorkflowUserMapper.Instance.DeleteWorkflowUsers(wf.WorkflowId.GetValueOrDefault());

                foreach (WorkflowUser wfu in wf.WorkflowUserList)
                {
                    wfu.WorkflowId = wf.WorkflowId.GetValueOrDefault();
                    WorkflowUser.Update(wfu);
                }
            }

            return(wf);
        }
Ejemplo n.º 2
0
        protected override object ReadRow(IRowReader reader)
        {
            WorkflowUser workflowUser = WorkflowUser.New();

            // Table Fields
            workflowUser.WorkflowUserId = reader.GetInt32("WorkflowUserId");
            workflowUser.WorkflowId     = reader.GetInt32("WorkflowId");
            workflowUser.UserId         = reader.GetInt32("UserId");
            workflowUser.Position       = reader.GetInt32("Position");
            workflowUser.DateAdded      = reader.GetDateTime("DateAdded");

            // View Fields
            workflowUser.UserFullName = reader.GetString("UserFullName");

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

            return(workflowUser);
        }
Ejemplo n.º 3
0
        public virtual WorkflowUser Update(WorkflowUser workflowUser)
        {
            if (!workflowUser.IsDirty || workflowUser.IsNull)
            {
                // Nothing to do - no point hammering the database unnecessarily
                return(workflowUser);
            }

            IDbCommand command = CreateCommand();

            if (workflowUser.IsNew)
            {
                // Adding
                command.CommandText = "INSERT INTO [WorkflowUser] ([WorkflowId], [UserId], [Position], [DateAdded]) VALUES (@workflowId, @userId, @position, @dateAdded) ; SELECT @@identity AS NewId;";
            }
            else
            {
                // Updating
                command.CommandText = "UPDATE [WorkflowUser] SET [WorkflowId] = @workflowId, [UserId] = @userId, [Position] = @position, [DateAdded] = @dateAdded WHERE WorkflowUserId = @workflowUserId";
            }

            command.Parameters.Add(CreateParameter("@workflowId", workflowUser.WorkflowId));
            command.Parameters.Add(CreateParameter("@userId", workflowUser.UserId));
            command.Parameters.Add(CreateParameter("@position", workflowUser.Position));
            command.Parameters.Add(CreateParameter("@dateAdded", workflowUser.DateAdded));

            if (workflowUser.IsNew)
            {
                workflowUser.WorkflowUserId = Convert.ToInt32(ExecScalar(command));
            }
            else
            {
                command.Parameters.Add(CreateParameter("@workflowUserId", workflowUser.WorkflowUserId));
                ExecuteCommand(command);
            }

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

            return(workflowUser);
        }
Ejemplo n.º 4
0
        public static WorkflowUser FindOne(WorkflowUserFinder finder)
        {
            WorkflowUser WorkflowUser = WorkflowUserMapper.Instance.FindOne(finder);

            return(WorkflowUser ?? Empty);
        }
Ejemplo n.º 5
0
 public static WorkflowUser Update(WorkflowUser workflowUser)
 {
     return(WorkflowUserMapper.Instance.Update(workflowUser));
 }
Ejemplo n.º 6
0
        public static WorkflowUser Get(Nullable <Int32> WorkflowUserId)
        {
            WorkflowUser WorkflowUser = WorkflowUserMapper.Instance.Get(WorkflowUserId);

            return(WorkflowUser ?? Empty);
        }