Beispiel #1
0
        public Error InsertOrUpdateTask(TaskModel task, string lockGuid)
        {
            var error = validateTaskModel(task);

            if (!error.IsError)
            {
                // Check that the lock is still current
                if (!db.IsLockStillValid(typeof(DAL.Task).ToString(), task.Id, lockGuid))
                {
                    error.SetError(EvolutionResources.errRecordChangedByAnotherUser, "Name");
                }
                else
                {
                    DAL.Task temp = null;
                    if (task.Id != 0)
                    {
                        temp = db.FindTask(task.Id);
                    }
                    if (temp == null)
                    {
                        temp = new DAL.Task();
                    }

                    Mapper.Map <TaskModel, DAL.Task>(task, temp);

                    db.InsertOrUpdateTask(temp);
                    task.Id = temp.Id;
                }
            }
            return(error);
        }
Beispiel #2
0
        public Error SendTask(string title,
                              string description,
                              TaskType taskType,
                              LOVItemModel businessArea,
                              UserModel recipient,
                              int?customerId,
                              Dictionary <string, string> dict)
        {
            var error = new Error();

            AddOrganisationDetails(dict);
            dict.AddProperty("MESSAGEHEADER", "");      // Hide these from
            dict.AddProperty("MESSAGEFOOTER", "");      // notifications

            var newTask = new DAL.Task {
                CompanyId        = _company.Id,
                CreatedDate      = DateTimeOffset.Now,
                LOVItem_TaskType = db.FindLOVItemByValue1(null, LOVName.TaskType, ((int)taskType).ToString()),
                BusinessUnitId   = businessArea.Id,
                UserId           = recipient.Id,
                Title            = title.DoSubstitutions(dict),
                Description      = description.DoSubstitutions(dict),
                LOVItem_Status   = db.FindLOVItems(null, db.FindLOV(LOVName.TaskStatus).Id).FirstOrDefault(),
                CustomerId       = customerId,
                Enabled          = true
            };

            db.InsertOrUpdateTask(newTask);
            error.Id = newTask.Id;

            return(error);
        }
Beispiel #3
0
 protected override Task CreateRecord(IActiveRecord activeRecord)
 {
     DAL.Task dalTask = (DAL.Task)activeRecord;
     return(new Task(dalTask.Id, dalTask.ModuleID, dalTask.Name, dalTask.Description,
                     (TaskComplexity)dalTask.Complexity, dalTask.StartDate, dalTask.ExpEndDate,
                     dalTask.ActEndDate));
 }
        public void AddNewTask_ValidParentTask_ReturnsAllTasks()
        {
            bool isValidTask = false;

            while (!isValidTask)
            {
                var TaskId = new Random().Next();

                var TaskInDb = _TaskController.GetTask(TaskId);
                if (TaskInDb.GetType() == typeof(NotFoundResult))
                {
                    isValidTask = true;

                    var Task = new DAL.Task()
                    {
                        Task_ID  = TaskId,
                        Priority = 0,
                        TaskName = "Test_Nunit"
                    };
                    IHttpActionResult actionResult = _TaskController.PostTask(Task);
                    var contentResult = ((System.Web.Http.Results.CreatedAtRouteNegotiatedContentResult <ProjectManagement.DAL.Task>)actionResult);

                    Assert.IsNotNull(contentResult);
                    Assert.IsNotNull(contentResult.Content);
                }
            }
        }
Beispiel #5
0
        public TaskModel GetTaskById(int taskId)
        {
            DAL.Task  tsk      = _dbService.GetTaskById(taskId);
            TaskModel tskModel = new TaskModel()
            {
                TaskID         = tsk.Task_ID,
                TaskName       = tsk.Task_Name,
                ParentTaskID   = tsk.ParentTask?.Parent_ID,
                ParentTaskName = tsk.ParentTask?.Parent_Task,
                StartDate      = tsk.StartDate,
                EndDate        = tsk.EndDate,
                Priority       = tsk.Priority,
                Status         = tsk.Status,
                Project        = new ProjectModel()
                {
                    ProjectID   = tsk.Project.Project_ID,
                    ProjectName = tsk.Project.Project_Name,
                    Priority    = tsk.Project.Priority
                }
            };

            foreach (var user in tsk.Usrs)
            {
                tskModel.User = new UserModel()
                {
                    EmployeeId = user.Employee_ID,
                    FirstName  = user.FirstName,
                    LastName   = user.LastName,
                    UserId     = user.Usr_ID
                };
            }
            return(tskModel);
        }
Beispiel #6
0
        public static DAL.Task TaskBalToTaskDal(Models.TaskDetails taskdetails)
        {
            DAL.Task task = new DAL.Task();

            task.Title = taskdetails.Title;
            task.Description = taskdetails.Description;
            task.DueDate = taskdetails.DueDate;

            return task;
        }
Beispiel #7
0
        public static DAL.Task TaskBalToTaskDal(Models.TaskDetails taskdetails)
        {
            DAL.Task task = new DAL.Task();

            task.Title       = taskdetails.Title;
            task.Description = taskdetails.Description;
            task.DueDate     = taskdetails.DueDate;

            return(task);
        }
Beispiel #8
0
        public ActionResult Patch(DAL.Task userTask)
        {
            var task = _context.Tasks.Find(userTask.Id);

            task.IsComplete = userTask.IsComplete;

            _context.Update(task);
            _context.SaveChanges();
            return(Ok(task));
        }
        public ActionResult AddTask(AddTaskViewModel model)
        {
            var task = new DAL.Task()
            {
                bundle_id = model.BundleId,
                task_type_id = model.TypeId,
                task_name = model.Name,
                TaskType = bundleService.GetTaskTypeWithId(model.TypeId),
                Bundle = bundleService.GetBundleWithId(model.BundleId)
            };

            var new_task = bundleService.AddTask(task);
            return RedirectToAction("TaskDetail", new { id = new_task.id });
        }
Beispiel #10
0
        private async void Add_Task_Click(object sender, RoutedEventArgs e)
        {
            DataClassesLinqDataContext db = new DataClassesLinqDataContext(DataAccessClassLinq.connectionStringLinq);

            //getting max id from datebase
            var max = db.Tasks.OrderByDescending(i => i.Task_ID).FirstOrDefault();

            string taskID = "";

            foreach (char a in max.Task_ID)
            {
                int val = (int)Char.GetNumericValue(a);
                taskID = (val + 1).ToString();
            }

            //storing values to task object
            DAL.Task task = new DAL.Task();

            task.Task_ID          = taskID;
            task.TaskType         = task_type.Text;
            task.Task_Description = Task_Description.Text;
            task.Assigned_Date    = DateTime.Now;
            task.Deadline         = DateTime.Parse(deadline.Text);

            //storing valurs to teacker_task object
            DAL.Teacher_Task teacher_task = new DAL.Teacher_Task();

            teacher_task.Task_ID    = taskID;
            teacher_task.Teacher_ID = Login.getID();

            try
            {
                db.Teacher_Tasks.InsertOnSubmit(teacher_task);
                db.Tasks.InsertOnSubmit(task);
                db.SubmitChanges();

                await this.ShowMessageAsync("Information", "Task assignment successful.");

                HR hr = new HR();
                hr.Show();
                this.Close();
            }
            catch
            {
                await this.ShowMessageAsync("Error", "Task assignment error.");
            }
        }
Beispiel #11
0
        public ActionResult Create(TaskDetails newTask)
        {
            if (ModelState.IsValid)
            {
                DAL.Task task = Translator.TaskBalToTaskDal(newTask);
                db.Tasks.Add(task);
                db.SaveChanges();

                //HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, task);
                //response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = friend.FriendId }));
                return(View());
            }
            else
            {
                return(View());// Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
        }
Beispiel #12
0
        public ActionResult Post(CreateTask model)
        {
            if (model == null)
            {
                return(BadRequest());
            }

            var newTask = new DAL.Task
            {
                Name       = model.Name,
                IsComplete = model.IsComplete,
                UserId     = model.UserId
            };

            _context.Add(newTask);
            _context.SaveChanges();

            return(Ok(newTask));
        }
Beispiel #13
0
        public void TestMethod8_GetTaskById()
        {
            DAL.Task taskObj = new DAL.Task()
            {
                Task_ID    = 100,
                Task_Name  = "Task1",
                Project_ID = 201,
                StartDate  = DateTime.Now,
                EndDate    = DateTime.Now,
                ParentTask = new DAL.ParentTask()
                {
                    Parent_ID = 100, Parent_Task = "Parent1"
                },
                Parent_ID = 100,
                Priority  = 10,
                Usrs      = new List <Usr> {
                    new Usr()
                    {
                        Usr_ID      = 100,
                        FirstName   = "Animesh",
                        LastName    = "Singh",
                        Project_ID  = 201,
                        Task_ID     = 100,
                        Employee_ID = 576113
                    }
                },
                Project = new Project()
                {
                    Project_ID = 201, Project_Name = "GICR", Priority = 10
                }
            };
            Mock <IProjectDbService> mock   = new Mock <IProjectDbService>();
            ProjectManagerBL         projBL = new ProjectManagerBL(mock.Object);

            mock.Setup(c => c.GetTaskById(It.IsAny <int>())).Returns(taskObj);

            // int expectedcount = 1;
            var actual = projBL.GetTaskById(100);

            Assert.AreEqual(100, actual.TaskID);
        }
Beispiel #14
0
        /// <summary>
        /// Inserts the task.
        /// </summary>
        /// <param name="task">The task.</param>
        /// <returns></returns>
        public override void Insert(Task task)
        {
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }

            DAL.Task dalTask = new DAL.Task
            {
                ModuleID    = task.ModuleID,
                Name        = task.Name,
                Description = task.Description,
                StartDate   = task.StartDate,
                ExpEndDate  = task.ExpEndDate,
                ActEndDate  = task.ActEndDate,
                Status      = (short)task.Status,
                Complexity  = (short)task.Complexity
            };

            dalTask.Save();

            task.ID = dalTask.Id;
        }
Beispiel #15
0
        public void BenchMarkMethod_GetTaskById(BenchmarkContext context)
        {
            ProjectDbService _dbSvc = new ProjectDbService();

            DAL.Task tskObj = _dbSvc.GetTaskById(2315);
        }
Beispiel #16
0
 public static void AddTask(DAL.Task task)
 {
     TaskDAO.AddTask(task);
 }
Beispiel #17
0
 public static void UpdateTask(DAL.Task task)
 {
     TaskDAO.UpdateTask(task);
 }
Beispiel #18
0
 public List <DAL.Task> UpdateTask(DAL.Task objTask)
 {
     throw new NotImplementedException();
 }