Exemplo n.º 1
0
        public void DeleteData()
        {
            //Database tables deletion---------------------------------------------------------------------------------
            dataUserController   DUC = new dataUserController();
            dataBoardController  DBC = new dataBoardController();
            dataColumnController DCC = new dataColumnController();
            dataTaskController   DTC = new dataTaskController();

            DUC.DeleteAll(); //Deleting all Users from database
            log.Info("deleted all users");
            DBC.DeleteAll(); //Deleting all Boards from database
            log.Info("deleted all boards");
            DCC.DeleteAll(); //Deleting all Columns from database
            log.Info("deleted all columns");
            DTC.DeleteAll(); //Deleting all Tasks from database
            log.Info("deleted all tasks");
            //Variables data deletion----------------------------------------------------------------------------------
            foreach (var item in users) //Calling each board to deleteData (which deletes all columns and tasks)
            {
                item.Value.getBoard().DeleteData();
            }

            this.users = new Dictionary <string, User>(); //Deleting all existing users by creating new empty dictionary
            bc.DeleteData();
        }
Exemplo n.º 2
0
        public virtual void setColumnId(int colomnId)
        {
            //Updating database
            dataTaskController DTC = new dataTaskController();

            DTC.Update(boardId, this.key, "column", colomnId);
            //Updating field
            this.columnId = colomnId;
        }
Exemplo n.º 3
0
 public void setEmailAssignee(string emailAssignee, string email)
 {
     if (isAssignedUser(email))
     {
         this.emailAssignee = emailAssignee;
         //Updating database
         dataTaskController DTC = new dataTaskController();
         DTC.Update(boardId, key, "emailAssignee", emailAssignee);
     }
 }
Exemplo n.º 4
0
 public void setDescription(string description, string email)
 {
     if (isValidDescription(description))
     {
         if (isAssignedUser(email))
         {
             this.description = description;
             //Updating database
             dataTaskController DTC = new dataTaskController();
             DTC.Update(boardId, key, "description", description);
         }
     }
 }
Exemplo n.º 5
0
 public void setDueDate(DateTime dueDate, string email)
 {
     if (isValidDueDate(dueDate, DateTime.Now))
     {
         if (isAssignedUser(email))
         {
             this.dueDate = dueDate;
             //Updating database
             dataTaskController DTC = new dataTaskController();
             DTC.Update(boardId, key, "dueDate", dueDate);
         }
     }
 }
Exemplo n.º 6
0
 public void setTitle(string title, string email)
 {
     if (isValidTitle(title))
     {
         if (isAssignedUser(email))
         {
             this.title = title;
             //Updating database
             dataTaskController DTC = new dataTaskController();
             DTC.Update(boardId, key, "title", title);
         }
     }
 }
Exemplo n.º 7
0
        public void DeleteTask(int taskId, string email)
        {
            Task toDelete = findTask(taskId);

            if (!toDelete.getEmailAssignee().Equals(email))
            {
                log.Warn("only assignee user can delete his tasks");
                throw new Exception("only assignee user can delete his tasks");
            }
            if (toDelete == null)
            {
                log.Warn("task does not exist");
                throw new Exception("task does not exist");
            }
            tasks.Remove(toDelete);
            // update in DB
            dataTaskController DTC = new dataTaskController();

            DTC.Delete(boardId, taskId);
        }