Ejemplo n.º 1
0
        /// <summary>
        /// 获得指定任务人员的姓名和编号
        /// </summary>
        /// <param name="tasktypeid">任务类型id</param>
        /// <returns>返回指定任务人员的姓名和编号</returns>
        public string GetFeedTaskEmployeeNameAndNumber(long tasktypeid)
        {
            int i;
            var stremployeenumber = new StringBuilder();
            var taskService = new TaskService();
            var taskEmployeeService = new TaskEmployeeService();
            List<task> tasks = taskService.FindByTaskTypeId(tasktypeid);
            List<task_employee> taskEmployees =
                tasks.SelectMany(task => taskEmployeeService.FindByTaskId(task.Id)).ToList();

            for (i = 0; i < taskEmployees.Count - 1; i++)
            {
                stremployeenumber.Append(taskEmployees[i].employee.Number + ":" + taskEmployees[i].employee.Name + ",");
            }
            stremployeenumber.Append(taskEmployees[i].employee.Number + ":" + taskEmployees[i].employee.Name);
            return stremployeenumber.ToString();
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     治疗任务的姓名的下拉列表框
 /// </summary>
 /// <returns></returns>
 public IEnumerable<SelectListItem> GetCureTaskEmployee()
 {
     var taskService = new TaskService();
     var tasktypeService = new TaskTypeService();
     var taskEmployeeService = new TaskEmployeeService();
     long curetaskid = tasktypeService.FindByName("治疗").Id;
     List<task> tasks = taskService.FindByTaskTypeId(curetaskid);
     List<task_employee> taskEmployees =
         tasks.SelectMany(task => taskEmployeeService.FindByTaskId(task.Id)).ToList();
     if (taskEmployees.Count >= 2)
     {
         for (int i = 0; i < taskEmployees.Count; i++)
         {
             task_employee employee = taskEmployees[i];
             for (int j = i + 1; j < taskEmployees.Count; j++)
             {
                 if (taskEmployees[j].employee.Name.Equals(employee.employee.Name))
                 {
                     taskEmployees.Remove(taskEmployees[j]);
                 }
             }
         }
     }
     IEnumerable<SelectListItem> feedTaskEmployeelist = taskEmployees.Select(taskEmployee => new SelectListItem
                                                                                                 {
                                                                                                     Text =
                                                                                                         taskEmployee
                                                                                                         .
                                                                                                         employee
                                                                                                         .Name,
                                                                                                     Value =
                                                                                                         taskEmployee
                                                                                                             .
                                                                                                             employee
                                                                                                             .Id +
                                                                                                         string.
                                                                                                             Empty,
                                                                                                 })
                                                                     .OrderBy(m => m.Text);
     return feedTaskEmployeelist;
 }
Ejemplo n.º 3
0
        /// <summary>
        ///     获得指定任务类型的所有任务
        /// </summary>
        /// <param name="taskTypeId">任务类型Id</param>
        /// <returns>返回任务集合</returns>
        public IEnumerable<Task> GetTaskList(long taskTypeId)
        {
            var taskService = new TaskService();
            var taskStatusTypeService = new TaskStatusTypeService();
            var taskEmployeeService = new TaskEmployeeService();

            IEnumerable<Task> tasklist = taskService.FindByTaskTypeId(taskTypeId).Select(item => new Task
                                                                                                     {
                                                                                                         TaskNumber =
                                                                                                             item.
                                                                                                             TaskNumber,
                                                                                                         EmployeeName =
                                                                                                             taskEmployeeService
                                                                                                             .
                                                                                                             GetEmployeeNames
                                                                                                             (
                                                                                                                 item.Id),
                                                                                                         StartTime =
                                                                                                             item.
                                                                                                             StartTime,
                                                                                                         EndTime =
                                                                                                             item.
                                                                                                             EndTime,
                                                                                                         Status =
                                                                                                             taskStatusTypeService
                                                                                                             .
                                                                                                             Find(
                                                                                                                 item.
                                                                                                                     TaskStatusId)
                                                                                                             .Name,
                                                                                                         Memo =
                                                                                                             item.Memo
                                                                                                     });
            return tasklist;
        }
Ejemplo n.º 4
0
 /// <summary>
 ///     喂饲任务的任务编号的下拉列表框
 /// </summary>
 /// <returns></returns>
 public IEnumerable<SelectListItem> GetFeedTaskNumber()
 {
     var taskService = new TaskService();
     var tasktypeService = new TaskTypeService();
     long feedtaskid = tasktypeService.FindByName("喂饲").Id;
     List<task> feedtasks = taskService.FindByTaskTypeId(feedtaskid);
     IEnumerable<SelectListItem> feedTaskSelect = feedtasks.Select(feedtask => new SelectListItem
                                                                                   {
                                                                                       Text = feedtask.TaskNumber,
                                                                                       Value =
                                                                                           feedtask.Id +
                                                                                           string.Empty,
                                                                                   }).OrderBy(m => m.Text);
     return feedTaskSelect;
 }
Ejemplo n.º 5
0
        /// <summary>
        ///     任务编号下拉列表
        /// </summary>
        /// <param name="taskTypeId">任务类型id</param>
        /// <returns></returns>
        public IEnumerable<SelectListItem> GetTaskNumberSelect(long taskTypeId)
        {
            var taskService = new TaskService();

            var taskNumberSelect = new List<SelectListItem>();
            if (taskTypeId == 1)
            {
                foreach (task taskNumberItem in taskService.FindByTaskTypeId(taskTypeId))
                {
                    //if (taskNumberItem.feed.Count > 0) continue;
                    taskNumberSelect.Add(new SelectListItem
                                             {
                                                 Text = taskNumberItem.TaskNumber,
                                                 Value = taskNumberItem.Id + ""
                                             });
                }
            }
            else if (taskTypeId == 2)
            {
                foreach (task taskNumberItem in taskService.FindByTaskTypeId(taskTypeId))
                {
                    if (taskNumberItem.prevention.Count > 0) continue;
                    taskNumberSelect.Add(new SelectListItem
                                             {
                                                 Text = taskNumberItem.TaskNumber,
                                                 Value = taskNumberItem.Id + ""
                                             });
                }
            }
            else if (taskTypeId == 3)
            {
                foreach (task taskNumberItem in taskService.FindByTaskTypeId(taskTypeId))
                {
                    //if (taskNumberItem.inspection.Count > 0) continue;
                    taskNumberSelect.Add(new SelectListItem
                                             {
                                                 Text = taskNumberItem.TaskNumber,
                                                 Value = taskNumberItem.Id + ""
                                             });
                }
            }
            else if (taskTypeId == 4)
            {
                foreach (task taskNumberItem in taskService.FindByTaskTypeId(taskTypeId))
                {

                    taskNumberSelect.Add(new SelectListItem
                                             {
                                                 Text = taskNumberItem.TaskNumber,
                                                 Value = taskNumberItem.Id + ""
                                             });
                }
            }
            else if (taskTypeId == 5 || taskTypeId == 8 || taskTypeId == 9)
            {
                foreach (task taskNumberItem in taskService.FindByTaskTypeId(taskTypeId))
                {

                    if (taskNumberItem.sale.Count >0) continue;
                    taskNumberSelect.Add(new SelectListItem
                                             {
                                                 Text = taskNumberItem.TaskNumber,
                                                 Value = taskNumberItem.Id + ""
                                             });
                }
            }
            else if (taskTypeId == 6)
            {
                foreach (task taskNumberItem in taskService.FindByTaskTypeId(taskTypeId))
                {
                    if (taskNumberItem.transfer.Count > 0) continue;
                    taskNumberSelect.Add(new SelectListItem
                                             {
                                                 Text = taskNumberItem.TaskNumber,
                                                 Value = taskNumberItem.Id + ""
                                             });
                }
            }
            else if (taskTypeId == 7)
            {
                foreach (task taskNumberItem in taskService.FindByTaskTypeId(taskTypeId))
                {
                    taskNumberSelect.Add(new SelectListItem
                                             {
                                                 Text = taskNumberItem.TaskNumber,
                                                 Value = taskNumberItem.Id + ""
                                             });
                }
            }

            return taskNumberSelect;
        }