Beispiel #1
0
        /*
         * public void BindTaskComment(IManagerEntity parent)
         * {
         *      IStorageCommand commentCommand = fDealer.CommandFactory.CreateSelectCommand(fDealer);
         *
         *      commentCommand.SetParam("EntityName","Comment");
         *
         *      Hashtable rules = new Hashtable();
         *      rules.Add("TaskID","ID = " + parent.ID);
         *
         *      commentCommand.SetParam("Rules",rules);
         *
         *      DataTable commentTable = fDealer.ExecuteDataSet(commentCommand).Tables[0];
         *      if (commentTable.Rows.Count > 1)
         *      {
         *              throw new ValidationException("more when one comment for task id " + parent.ID);
         *      }
         *
         *      if (commentTable.Rows.Count == 0)
         *      {
         *              //todo create comment on the fly
         *      }
         *      else
         *      {
         *              //todo: fill comment
         *              DataRow commentRow = commentTable.Rows[0];
         *              Comment comment = new Comment
         *              {
         *                      Description = (string)commentRow["Description"],
         *                      Date = (DateTime)commentRow["Description"],
         *                      ID = commentRow["ID"],
         *
         *              };
         *      }
         *
         * }
         */

        public void UpdateTaskState(IManagerEntity stateEntity)
        {
            State state = (State)stateEntity;

            IStorageCommand updateStateCommand = fRepository.CommandFactory.GetUpdateCommand("TaskState");

            Hashtable values = new Hashtable();

            values.Add("Name", state.Name);

            values.Add("ColorRed", state.ColorRed);
            values.Add("ColorGreen", state.ColorGreen);
            values.Add("ColorBlue", state.ColorBlue);

            try
            {
                values.Add("MappingID", state.MappingID);
            }
            catch (ManagementException)
            {
                values.Add("MappingID", DBNull.Value);
            }

            updateStateCommand.SetParam("Values", values);

            Hashtable rules = new Hashtable();

            rules.Add("UniqueID", "ID = " + state.Id);

            updateStateCommand.SetParam("Rules", rules);

            fRepository.ExecuteNonQuery(updateStateCommand);

            //store fConnections
        }
Beispiel #2
0
        public void BindTaskStateConnection(IManagerEntity stateConnectionEntity)
        {
            Connection connection = (Connection)stateConnectionEntity;

            IStorageCommand connectionCommand = fRepository.CommandFactory.GetSelectCommand("TaskStateConnection");

            Hashtable rules = new Hashtable();

            rules.Add("UniqueID", "ID = " + connection.Id);

            connectionCommand.SetParam("Rules", rules);

            DataTable connectionTable = fRepository.ExecuteDataSet(connectionCommand).Tables[0];

            if (connectionTable.Rows.Count > 1)
            {
                throw new ManagementException(ExceptionType.ValidationFailed, "more when one task state connection for id " + connection.Id);
            }

            if (connectionTable.Rows.Count == 0)
            {
                throw new ManagementException(ExceptionType.ValidationFailed, "Task state Connection not found for id " + connection.Id);
            }

            DataRow connectionRow = connectionTable.Rows[0];

            connection.Name      = (string)connectionRow["Name"];
            connection.MappingID = (int)connectionRow["MappingID"];
            connection.StateID   = (int)connectionRow["StateID"];
        }
Beispiel #3
0
        public DataSet GetTaskStateSource(IManagerEntity state)
        {
            DataSet stateSource = new DataSet("TaskStateSource");

            stateSource.Tables.Add(fRepository.Storage.Tables["TaskState"].Copy());
            return(stateSource);
        }
Beispiel #4
0
        public void UpdateTask(IManagerEntity taskEntity)
        {
            Task task = (Task)taskEntity;

            IStorageCommand updateTaskCommand = fRepository.CommandFactory.GetUpdateCommand("Task");

            Hashtable values = new Hashtable();

            if (task.ActorPresent)
            {
                values.Add("ActorID", task.ActorID);
            }
            values.Add("Description", task.Description);
            values.Add("StartTime", task.StartTime);
            values.Add("EndTime", task.EndTime);
            values.Add("Priority", task.Priority);
            if (task.StatePresent)
            {
                values.Add("StateID", task.StateID);
            }

            updateTaskCommand.SetParam("Values", values);

            Hashtable rules = new Hashtable();

            rules.Add("UniqueID", "ID = " + task.Id);

            updateTaskCommand.SetParam("Rules", rules);

            fRepository.ExecuteNonQuery(updateTaskCommand);
        }
Beispiel #5
0
        public void BindActor(IManagerEntity actorEntity)
        {
            Actor actor = (Actor)actorEntity;

            IStorageCommand actorCommand = fRepository.CommandFactory.GetSelectCommand("Actor");

            Hashtable rules = new Hashtable();

            rules.Add("UniqueID", "ID = " + actor.Id);

            actorCommand.SetParam("Rules", rules);

            DataTable actorTable = fRepository.ExecuteDataSet(actorCommand).Tables[0];

            if (actorTable.Rows.Count > 1)
            {
                throw new ManagementException(ExceptionType.ValidationFailed, "more when one actor for id " + actor.Id);
            }

            if (actorTable.Rows.Count == 0)
            {
                throw new ManagementException(ExceptionType.ValidationFailed, "Actor not found for id " + actor.Id);
            }

            DataRow actorRow = actorTable.Rows[0];

            actor.Name  = actorRow["Name"].ToString();
            actor.Email = actorRow["Email"].ToString();
        }
Beispiel #6
0
        public bool IsUpdatedTaskState(IManagerEntity stateEntity)
        {
            State newState = (State)stateEntity;
            State oldState = new State(this, newState.Id);

            BindTaskState(oldState);

            bool result = newState.Id == oldState.Id;

            result = result && newState.Name == oldState.Name;
            try
            {
                result = result && newState.MappingID == oldState.MappingID;
            }
            catch (ManagementException)
            {
                result = result && newState.IsMapped == oldState.IsMapped;
            }

            foreach (int stateID in newState.Connections.Keys)
            {
                result = result && oldState.Connections.ContainsKey(stateID) && oldState.Connections[stateID] == newState.Connections[stateID];
            }

            return(result);
        }
Beispiel #7
0
        /*
         * public IManagerEntity GetComment(int id)
         * {
         *      Comment comment = new Comment(this, id);
         *      BindComment(comment);
         *      return comment;
         * }*/

        public IManagerEntity CreateComment(IManagerEntity commentedEntity)
        {
            IStorageCommand createCommentCommand = fRepository.CommandFactory.GetInsertCommand("Comment");

            Hashtable values = new Hashtable();

            values.Add("Description", "");
            values.Add("Date", DateTime.Now);
            if (commentedEntity != null)
            {
                if (commentedEntity is Task)
                {
                    values.Add("EntryID", commentedEntity.Id);
                }
            }
            else
            {
                values.Add("EntryID", DBNull.Value);
            }

            createCommentCommand.SetParam("Values", values);

            //int id = (int)fDealer.ExecuteScalar(createCommentCommand);
            //Comment comment = new Comment(this, id);
            //BindComment(comment);
            return(null);
        }
Beispiel #8
0
 private void Initialize(ITaskManager parent, IManagerEntity commentedEntity)
 {
     fParent = parent;
     if (commentedEntity != null)
     {
         fCommentedEntity = commentedEntity;
         CommentedEntryID = fCommentedEntity.ID;
     }
 }
Beispiel #9
0
 public void Disconnect(IManagerEntity stateEntry)
 {
     if (Connections.ContainsKey(stateEntry.Id))
     {
         Connections.Remove(stateEntry.Id);
     }
     else
     {
         throw new KeyNotFoundException <int>(stateEntry.Id);
     }
 }
Beispiel #10
0
        public void Connect(IManagerEntity stateEntry, string connectionName)
        {
            State state = (State)stateEntry;

            if (!Connections.ContainsKey(state.Id))
            {
                Connections.Add(state.Id, connectionName);
            }
            else
            {
                throw new ManagementException(ExceptionType.NotRequired, "Connection to state with ID " + stateEntry.Id + " already added");
            }
        }
Beispiel #11
0
        public void BindConnections(IManagerEntity stateEntry)
        {
            State state = (State)stateEntry;

            TaskStateConnectionStore = new TreeStore(typeof(int), typeof(string));
            TaskStateConnectionStore.Clear();
            foreach (int connectionID in state.Connections.Keys)
            {
                State connectedState = (State)stateCore.TaskManager.GetTaskStateConnection(connectionID);
                TaskStateStore.AppendValues(connectionID, connectedState.Name);
            }

            tvStateConnection.Model = TaskStateConnectionStore;
        }
Beispiel #12
0
        public bool IsUpdatedActor(IManagerEntity actorEntity)
        {
            Actor newActor = (Actor)actorEntity;
            Actor oldActor = new Actor(this, newActor.Id);

            BindActor(oldActor);

            bool result = newActor.Id == oldActor.Id;

            result = result && newActor.Name == oldActor.Name;
            result = result && newActor.Email == oldActor.Email;

            return(result);
        }
Beispiel #13
0
        public bool isUpdatedTaskStateConnection(IManagerEntity stateConnectionEntity)
        {
            Connection newConnection = (Connection)stateConnectionEntity;
            Connection oldConnection = new Connection(this, newConnection.Id);

            BindTaskStateConnection(oldConnection);

            bool result = newConnection.Id == oldConnection.Id;

            result = result && newConnection.Name == oldConnection.Name;
            result = result && newConnection.MappingID == oldConnection.MappingID;
            result = result && newConnection.StateID == oldConnection.StateID;

            return(result);
        }
Beispiel #14
0
        public bool IsUpdatedTask(IManagerEntity taskEntity)
        {
            Task newTask = (Task)taskEntity;
            Task oldTask = new Task(this, newTask.Id);

            BindTask(oldTask);

            bool result = newTask.ActorID == oldTask.ActorID;

            result = result && newTask.Description == oldTask.Description;
            result = result && newTask.EndTime == oldTask.EndTime;
            result = result && newTask.StartTime == oldTask.StartTime;
            result = result && newTask.StateID == oldTask.StateID;
            result = result && newTask.Priority == oldTask.Priority;

            return(result);
        }
Beispiel #15
0
        public void UpdateActor(IManagerEntity actorEntity)
        {
            Actor actor = (Actor)actorEntity;

            IStorageCommand updateActorCommand = fRepository.CommandFactory.GetUpdateCommand("Actor");

            Hashtable values = new Hashtable();

            values.Add("Name", actor.Name);
            values.Add("Email", actor.Email);

            updateActorCommand.SetParam("Values", values);

            Hashtable rules = new Hashtable();

            rules.Add("UniqueID", "ID = " + actor.Id);

            updateActorCommand.SetParam("Rules", rules);

            fRepository.ExecuteNonQuery(updateActorCommand);
        }
Beispiel #16
0
        public IManagerEntity CreateTaskStateConnection(IManagerEntity stateEntity, IManagerEntity connectedStateEntity)
        {
            IStorageCommand createTaskStateConnectionCommand = fRepository.CommandFactory.GetInsertCommand("TaskStateConnection");

            Hashtable values = new Hashtable();

            State state          = (State)stateEntity;
            State connectedState = (State)connectedStateEntity;

            values.Add("Name", "");
            if (!state.IsMapped)
            {
                // create mappintID
                int mappintID = -1;
                foreach (DataRow row in TaskStateSource.Tables["TaskState"].Rows)
                {
                    if (!(row["MappingID"] is DBNull) && (int)row["MappingID"] > mappintID)
                    {
                        mappintID = (int)row["MappingID"];
                    }
                }

                mappintID++;
                state.MappingID = mappintID;
                state.Save();
            }

            values.Add("MappingID", state.MappingID);
            values.Add("StateID", connectedState.Id);

            createTaskStateConnectionCommand.SetParam("Values", values);
            int        id         = (int)fRepository.ExecuteScalar(createTaskStateConnectionCommand);
            Connection connection = new Connection(this, id);

            BindTaskStateConnection(connection);
            return(connection);
        }
Beispiel #17
0
        public void UpdateTaskStateConnection(IManagerEntity stateConnectionEntity)
        {
            Connection connection = (Connection)stateConnectionEntity;

            IStorageCommand updateStateConnectionCommand = fRepository.CommandFactory.GetUpdateCommand("TaskStateConnection");

            Hashtable values = new Hashtable();

            values.Add("Name", connection.Name);
            values.Add("MappingID", connection.MappingID);
            values.Add("StateID", connection.StateID);

            updateStateConnectionCommand.SetParam("Values", values);

            Hashtable rules = new Hashtable();

            rules.Add("UniqueID", "ID = " + connection.Id);

            updateStateConnectionCommand.SetParam("Rules", rules);

            fRepository.ExecuteNonQuery(updateStateConnectionCommand);

            //store fConnections
        }
Beispiel #18
0
 public void UpdateTaskStateConnection(IManagerEntity stateConnectionEntity)
 {
     throw new ManagementException(ExceptionType.NotAllowed);
 }
Beispiel #19
0
 public IManagerEntity CreateTaskStateConnection(IManagerEntity stateEntity, IManagerEntity connectedStateEntity)
 {
     throw new ManagementException(ExceptionType.NotAllowed);
 }
Beispiel #20
0
 public bool IsUpdatedTaskState(IManagerEntity stateEntity)
 {
     return(false);
 }
Beispiel #21
0
 public void BindTaskComment(IManagerEntity stateEntity)
 {
     throw new ManagementException(ExceptionType.NotAllowed);
 }
Beispiel #22
0
 public DataSet GetTaskStateSource(IManagerEntity state)
 {
     throw new ManagementException(ExceptionType.NotAllowed);
 }
Beispiel #23
0
 public bool IsUpdatedActor(IManagerEntity actorEntity)
 {
     return(false);
 }
Beispiel #24
0
 public void UpdateActor(IManagerEntity actorEntity)
 {
     throw new ManagementException(ExceptionType.NotAllowed);
 }
Beispiel #25
0
 public bool isUpdatedTaskStateConnection(IManagerEntity stateConnectionEntity)
 {
     return(false);
 }
Beispiel #26
0
 public void UpdateTask(IManagerEntity taskEntity)
 {
     throw new ManagementException(ExceptionType.NotAllowed);
 }
Beispiel #27
0
 public void BindProject(IManagerEntity taskEntity)
 {
     throw new NotImplementedException();
 }
Beispiel #28
0
 public Comment(ITaskManager parent, IManagerEntity commentedEntity)
 {
     fNew = true;
     Initialize(parent, commentedEntity);
 }
Beispiel #29
0
 public bool IsUpdatedTask(IManagerEntity taskEntity)
 {
     return(false);
 }
Beispiel #30
0
 public bool IsConnected(IManagerEntity stateEntry)
 {
     return(Connections.ContainsKey(stateEntry.Id));
 }