예제 #1
0
        public List <PriorityDTO> GetPriority()
        {
            List <PriorityDTO> item = new List <PriorityDTO>();

            try
            {
                DataTable dtUser = SqlClientRMXProd.ExecuteDataTable("udsp_GetPriority");
                if (dtUser != null && dtUser.Rows.Count > 0)
                {
                    int i = 0;
                    foreach (DataRow row in dtUser.Rows)
                    {
                        // if (dtUser != null && dtUser.Rows.Count > 0)
                        // {
                        PriorityDTO list = new PriorityDTO();
                        list.CreatedDate           = Convert.ToDateTime(dtUser.Rows[0]["CreatedDate"].ToString());
                        list.Creator               = dtUser.Rows[0]["Creator"].ToString();
                        list.Description           = dtUser.Rows[0]["Description"].ToString();
                        list.Level                 = dtUser.Rows[0]["Level"].ToString();
                        list.ModifiedDate          = Convert.ToDateTime(dtUser.Rows[0]["ModifiedDate"].ToString());
                        list.Name                  = dtUser.Rows[0]["Name"].ToString();
                        list.NumberOfHoursDeadline = Convert.ToDecimal(dtUser.Rows[0]["NumberOfHoursDeadline"].ToString());
                        list.PriorityID            = Convert.ToInt32(dtUser.Rows[0]["PriorityID"].ToString());
                        item.Add(list);
                    }
                }
            }
            catch (Exception ex)
            { }
            return(item);
        }
예제 #2
0
파일: TaskService.cs 프로젝트: rayray96/TMS
        private TaskInfo EditTask(EditTaskDTO task, string authorName, int assigneeId, string priority)
        {
            if (task.Deadline < DateTime.Now)
            {
                throw new DateIsWrongException($"Deadline date \"{task.Deadline}\" cannot be less than current date \"{DateTime.Now}\"");
            }

            PersonDTO authorDTO = mapper.Map <Person, PersonDTO>(db.People.Find(p => p.UserName == authorName).SingleOrDefault());

            if (authorDTO == null)
            {
                throw new PersonNotFoundException($"Author \"{authorName}\" has not found");
            }

            PersonDTO assigneeDTO = mapper.Map <Person, PersonDTO>(db.People.Find(p => p.Id == assigneeId).SingleOrDefault());

            if (assigneeDTO == null)
            {
                throw new PersonNotFoundException($"Assignee \"{assigneeId}\" has not found");
            }

            PriorityDTO priorityDTO = mapper.Map <Priority, PriorityDTO>(db.Priorities.Find(p => p.Name == priority).SingleOrDefault());

            if (priorityDTO == null)
            {
                throw new PriorityNotFoundException($"Priority \"{priority}\" has not known");
            }

            StatusDTO status = mapper.Map <Status, StatusDTO>(db.Statuses.Find(s => (s.Name == "Not Started")).SingleOrDefault());

            if (status == null)
            {
                throw new StatusNotFoundException("Status \"Not Started\" has not found in database");
            }

            var newTask = new TaskInfo
            {
                Name        = task.Name,
                Description = task.Description,
                PriorityId  = priorityDTO.Id,
                AuthorId    = authorDTO.Id,
                AssigneeId  = assigneeDTO.Id,
                StatusId    = status.Id,
                Progress    = 0,
                StartDate   = null,
                FinishDate  = null,
                Deadline    = task.Deadline,
            };

            // For sending email to assignee when task created or updated.
            EmailBody = string.Format(EmailService.BODY_NEW_TASK,
                                      assigneeDTO.FName + " " + assigneeDTO.LName, task.Name, authorDTO.FName + " " + authorDTO.LName);
            EmailSender    = authorDTO.Email;
            EmailRecipient = assigneeDTO.Email;

            return(newTask);
        }
예제 #3
0
        public IActionResult Create(string title, string description, PriorityDTO priority, EmployeeDTO empl)
        {
            var task = new TaskDTO {
                Title = title, Descriprion = description, Priority = priority, Employee = empl
            };

            _taskService.CreateTask(task);

            return(RedirectToAction("Index"));
        }
        public void HandleDelete(int id, string entityTypeName)
        {
            var priority = new PriorityDTO {
                ID = id, PriorityID = id, EntityTypeName = entityTypeName
            };

            TransportMock.HandleMessageFromTp(Profile, new PriorityDeletedMessage {
                Dto = priority
            });
        }
        public ActionResult <Priority> PostPriority(PriorityDTO priority)
        {
            Priority newPriority = new Priority()
            {
                Title = priority.Title, Color = priority.Color
            };

            _priorityRepository.Add(newPriority);
            _priorityRepository.SaveChanges();

            return(CreatedAtAction(nameof(GetAllPriorities), new { id = newPriority.Id }, newPriority));
        }
예제 #6
0
        public async Task <IActionResult> SetPriority([FromBody] PriorityDTO body)
        {
            foreach (Street item in data.Streets)
            {
                if (item.Name == body.Street)
                {
                    item.Priority          = body.Priority;
                    data.Entry(item).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                    break;
                }
            }

            await data.SaveChangesAsync();

            return(Ok());
        }
 public PriorityResponse(PriorityDTO priority) : this(true, string.Empty, priority)
 {
 }
 public PriorityResponse(bool success, string message, PriorityDTO priority) : base(success, message)
 {
     Priority = priority;
 }