Exemplo n.º 1
0
        public ICallReportVO ProcessCallReport(ICallReportVO callReport, string action)
        {
            IUserVO loginUser = UserDAO.RetrieveUserByLoginId(callReport.LastUpdateBy);

            if (callReport.Id == 0)
            {
                callReport.Owner = loginUser;
            }
            CallReportDAO.SaveCallReport(callReport);

            ITaskVO task = TaskDAO.RetrieveTaskByRefIdAndFlowType(callReport.Id, WORKFLOW_TYPE);

            if (task == null)
            {
                task = new TaskVO()
                {
                    ReferenceId = callReport.Id, WorkflowType = WORKFLOW_TYPE
                };
                task.LastUpdateBy = callReport.LastUpdateBy;
                task.Initiator    = loginUser;
            }

            task.PreviousOwner = loginUser;
            task.TaskAction    = action;

            task = WorkflowManager.ExecuteWorkflow(task, callReport.Reviewer);
            TaskDAO.SaveTask(task);

            callReport.Status            = task.TaskStatus;
            callReport.WorkflowProcessId = task.WorkflowProcessId;
            callReport.TaskStatus        = task.TaskStatus;
            callReport.CurrentRecipient  = UserDAO.RetrieveUserById(task.CurrentOwner.Id);

            return(callReport);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructeur
 /// </summary>
 public TaskService() : base()
 {
     taskDAO      = new TaskDAO();
     groupDAO     = new GroupDAO();
     personDAO    = new PersonDAO();
     followingDAO = new FollowingDAO();
 }
Exemplo n.º 3
0
        public IActionResult PushUpdateTaskToDB(long taskid, string taskName, long employeeId, long priorityId, long statusId, string comment)
        {
            TaskModel task = TaskDAO.SelectFirst(new Dictionary <string, object>()
            {
                { TaskDAO.Columns.IdTask, taskid }
            });

            task.Title = taskName;
            if (statusId != 0)
            {
                task.StatusId = statusId;
            }
            task.EmployeeId = employeeId;
            task.PriorityId = priorityId;
            task.Comment    = comment;

            EmployeeModel model = EmployeeController.EmployeeDAO.SelectFirst(new Dictionary <string, object>()
            {
                { "IdEmployee", employeeId }
            });

            TaskDAO.Update(taskid, task);
            TaskModel        fullTask  = task;
            List <TaskModel> fullTasks = TaskDAO.Select(TaskDAO.Columns.Fill(task, true));

            if (fullTasks.Count > 0)
            {
                fullTask = fullTasks[0];
            }

            MailMessageSender.SendMessage(model.Email, model.Name + " " + model.SurName, "Edytowano Twoje zadanie", fullTask, MailTypes.editTask);

            return(RedirectToAction("MainPage", "Home"));
        }
Exemplo n.º 4
0
 private List <TaskModel> GetTasksForAuthor(long id, int mode)
 {
     return(TaskDAO.Select(new Dictionary <string, object>()
     {
         { "T." + TaskDAO.Columns.IdAuthor, id },
         { "Mode", mode }
     }));
 }
Exemplo n.º 5
0
 public static TaskDAO getInstance()
 {
     if (taskDAO == null)
     {
         taskDAO = new TaskDAOImplementation();
     }
     return(taskDAO);
 }
Exemplo n.º 6
0
 public MeetingService(IUserAuthorization userAuthorization, IUserProvider userProvider, MeetingDAO meetingDao, InvitationDAO invitationDao, TaskDAO taskDao, ResultDAO resultDao)
 {
     _userAuthorization = userAuthorization;
     _meetingDao        = meetingDao;
     _invitationDao     = invitationDao;
     _taskDao           = taskDao;
     _resultDao         = resultDao;
     _userId            = userProvider.GetUserId();
 }
Exemplo n.º 7
0
        public static TaskDTO GetAll()
        {
            TaskDTO taskdto = new TaskDTO();

            taskdto.Employees   = EmployeeDAO.GetEmployees();
            taskdto.Departments = DepartmentDAO.GetDepartments();
            taskdto.Positions   = PositionDAO.GetPositions();
            taskdto.TaskStates  = TaskDAO.GetTaskStates();
            taskdto.Tasks       = TaskDAO.GetTasks();
            return(taskdto);
        }
Exemplo n.º 8
0
 public List <Response> saveTasks()
 {
     try
     {
         User requester = UserDAO.instanceByAlias(HttpContext.Current.Request.LogonUserIdentity.Name);
         Log  log       = new Log("saveTasks", "POST", requester, DateTime.Now, "", "", "");
         LogDAO.insert(log);
         return(TaskDAO.insertOrUpdate(requester, Task.xmlToArrayOfTasks(requester, HttpContext.Current)));
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("Ops! An error has ocurred: {0}", ex.Message));
     }
 }
Exemplo n.º 9
0
 public List <Task> getTasks(int projectId)
 {
     try
     {
         User requester = UserDAO.instanceByAlias(HttpContext.Current.Request.LogonUserIdentity.Name);
         Log  log       = new Log("getTasks", "POST", requester, DateTime.Now, projectId.ToString(), "", "");
         LogDAO.insert(log);
         return(TaskDAO.select(requester, projectId));
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("Ops! An error has ocurred: {0}", ex.Message));
     }
 }
Exemplo n.º 10
0
 public Response finishTask(int taskId)
 {
     try
     {
         User requester = UserDAO.instanceByAlias(HttpContext.Current.Request.LogonUserIdentity.Name);
         Log  log       = new Log("finishTask", "POST", requester, DateTime.Now, taskId.ToString(), "", "");
         LogDAO.insert(log);
         return(TaskDAO.finishTask(requester, TaskDAO.instanceById(taskId)));
     }
     catch (Exception ex)
     {
         throw new Exception(string.Format("Ops! An error has ocurred: {0}", ex.Message));
     }
 }
Exemplo n.º 11
0
        public IActionResult PushAddTaskToDB(string name, long typeId, long employeeId, long priorityId, string comment)
        {
            TaskModel taskModel = new TaskModel(0, typeId, HomeController.ActualUser.Id, employeeId, name, null, null, comment, 1, priorityId);

            TaskController.TaskDAO.Insert(taskModel);
            EmployeeModel model = EmployeeController.EmployeeDAO.SelectFirst(new Dictionary <string, object>()
            {
                { "IdEmployee", employeeId }
            });
            //ściągnąć model po id razem z słownikiem
            TaskModel fullTask = TaskDAO.Select(TaskDAO.Columns.Fill(taskModel, true))[0];

            MailMessageSender.SendMessage(model.Email, model.Name + " " + model.SurName, "Przydzielono Ci zadanie", fullTask, MailTypes.addTask);
            return(RedirectToAction("MainPage", "Home"));
        }
Exemplo n.º 12
0
        public void AddNewTask(string taskName)
        {
            Random random = new Random();
            Task   task   = new Task();

            task.Id        = TimeUtils.DataTime2Stamp(DateTime.Now);
            task.StartTime = TimeUtils.DataTime2Stamp(DateTime.Now);
            task.EndTime   = task.StartTime + 60 * 60 * 24;
            task.TagId     = 1;
            task.Progress  = 0;
            task.Describe  = taskName;
            task.Detail    = " ";
            task.Finish    = false;

            TaskDAO taskDAO = new TaskDAO();

            taskDAO.insert(task);
        }
Exemplo n.º 13
0
        public IActionResult ChangeStatus(long id, int status, DateTime date)
        {
            TaskModel taskToChange = TaskDAO.SelectFirst(new Dictionary <string, object>()
            {
                { TaskDAO.Columns.IdTask, id }
            });

            taskToChange.StatusId = status;
            if (status == 2)
            {
                taskToChange.DateStart = date;
            }
            else
            {
                taskToChange.DateEnd = date;
            }
            TaskDAO.Update(id, taskToChange);
            return(PartialView());
        }
Exemplo n.º 14
0
        public IActionResult PushUpdateTaskToDB(long taskid, string name, long employeeId, long priorityId, long statusId, string comment)
        {
            TaskModel task = TaskDAO.SelectFirst(new Dictionary <string, object>()
            {
                { TaskDAO.Columns.IdTask, taskid }
            });

            task.Title = name;
            if (statusId != 0)
            {
                task.StatusId = statusId;
            }
            task.EmployeeId = employeeId;
            task.PriorityId = priorityId;
            task.Comment    = comment;

            TaskDAO.Update(taskid, task);

            return(RedirectToAction("MainPage", "Home"));
        }
 public static void AddTask(TASK task)
 {
     TaskDAO.AddTask(task);
 }
Exemplo n.º 16
0
 public void Init()
 {
     taskDao        = new TaskDAO();
     taskController = new PrTaskController(taskDao);
     DeleteAllTasks();
 }
Exemplo n.º 17
0
 public TaskService()
 {
     dao = new TaskDAO();
 }
Exemplo n.º 18
0
 public static void ApproveTask(int taskID, bool isAdmin)
 {
     TaskDAO.ApproveTask(taskID, isAdmin);
 }
Exemplo n.º 19
0
        public ApiResult GetAll(DateTime?BeginDate = null, DateTime?EndDate = null, int pageindex = 1, int pagesize = 10, ClassTypeEnums?ClassType = null)
        {
            ApiResult result  = new ApiResult();
            string    message = string.Empty;

            try
            {
                BeginDate = BeginDate ?? Convert.ToDateTime("1900-01-01");
                EndDate   = EndDate ?? Convert.ToDateTime("2099-12-31");
                using (FLDbContext db = new FLDbContext())
                {
                    var tasklist = from task in db.FLTask
                                   join taskflow in db.TaskFlow on task.ID equals taskflow.TaskID
                                   where taskflow.BeginDate >= BeginDate &&
                                   taskflow.BeginDate <= EndDate &&
                                   (ClassType == null || task.ClassType == ClassType) &&
                                   taskflow.MaintainUserID == LoginHelper.CurrentUser.ID
                                   select new
                    {
                        TaskName   = task.TaskName,
                        TaskID     = task.ID,
                        BeginDate  = taskflow.BeginDate,
                        EndDate    = taskflow.EndDate,
                        RemindDate = taskflow.RemindDate,
                        IsAudit    = taskflow.IsAudit,
                        ApplyType  = taskflow.ApplyType
                    };
                    int           total      = tasklist.Count();
                    List <object> returnlist = new List <object>();
                    TaskDAO       taskdao    = new TaskDAO();
                    foreach (var data in tasklist.OrderByDescending(t => t.EndDate).Skip((pageindex - 1) * pagesize).Take(pagesize).ToList())
                    {
                        returnlist.Add(new
                        {
                            TaskName   = data.TaskName,
                            TaskID     = data.TaskID,
                            BeginDate  = data.BeginDate.ToString("yyyy-MM-dd HH:mm"),
                            EndDate    = data.EndDate.ToString("yyyy-MM-dd HH:mm"),
                            RemindDate = data.RemindDate.ToString("yyyy-MM-dd HH:mm"),
                            Status     = taskdao.GetApplyTypeName(data.IsAudit, data.ApplyType)
                        });
                    }

                    result = ApiResult.NewSuccessJson(new
                    {
                        Total = total,
                        List  = returnlist
                    });
                }
            }
            catch
            {
                result = ApiResult.NewErrorJson("请检查网络状态或联系系统管理员");
            }
            if (!string.IsNullOrEmpty(message))
            {
                //回滚

                result = ApiResult.NewErrorJson(message);
            }
            return(result);
        }
Exemplo n.º 20
0
 public static void UpdateTask(TASK task)
 {
     TaskDAO.UpdateTask(task);
 }
Exemplo n.º 21
0
 public static void DeleteTask(int taskID)
 {
     TaskDAO.DeleteTask(taskID);
 }
Exemplo n.º 22
0
 private TaskBLO()
 {
     baseDao = TaskDAO.Current;
     dao     = TaskDAO.Current;
 }
Exemplo n.º 23
0
 public static void addTask(TASK task)
 {
     TaskDAO.addTask(task);
 }
Exemplo n.º 24
0
 private TaskDTOImplementation()
 {
     Logging.singlton(nameof(TaskDTO));
     taskDAO = TaskDAOImplementation.getInstance();
 }
Exemplo n.º 25
0
        public CalendarTab()
        {
            InitializeComponent();

            project = MainController.Instance.Project;

            MySqlDataReader dataReader = new TaskDAO().GetGanttTasks(project.Id);

            if (dataReader != null)
            {
                _values  = new ChartValues <GanttPoint>();
                taskData = new List <DTO.Task>();
                while (dataReader.Read())
                {
                    //_values.Add(new GanttPoint(dataReader.IsDBNull(1) ? 0 : ((DateTime)dataReader.GetMySqlDateTime("start_date")).Ticks, dataReader.IsDBNull(2) ? 0 : ((DateTime)dataReader.GetMySqlDateTime("due_date")).Ticks));
                    taskData.Add(new DTO.Task(0, null, null, null, 0, dataReader.GetString(3), dataReader.GetString(4), 0, 0, dataReader.GetBoolean(5), (DateTime)dataReader.GetMySqlDateTime(1), (DateTime)dataReader.GetMySqlDateTime(2), DateTime.MinValue));
                }
            }


            var labels = new List <string>();

            for (int i = 0; i < taskData.Count; i++)
            {
                labels.Add(taskData.ElementAt(i).Name);
                _values.Add(new GanttPoint(taskData.ElementAt(i).StartDate.Ticks, taskData.ElementAt(i).DueDate.Ticks));
            }


            Series = new SeriesCollection
            {
                new RowSeries
                {
                    Values     = _values,
                    DataLabels = true,
                }
            };
            Formatter = value => new DateTime((long)value).ToString("dd MMM");

            DataContext = this;

            Gantt.Series = Series;
            Gantt.AxisY.Clear();
            Gantt.AxisY.Add(
                new Axis
            {
                Labels    = labels.ToArray(),
                Separator = new Separator {
                    Step = 1
                },
                FontSize = 14,
            });

            Gantt.AxisX.Clear();
            Gantt.AxisX.Add(
                new Axis
            {
                MinValue       = project.CreatedAt.AddDays(-1).Ticks,
                MaxValue       = project.DueDate.AddDays(1).Ticks,
                LabelFormatter = Formatter,
                FontSize       = 14,
            });


            Gantt.Height = _values.Count * 50;
        }
Exemplo n.º 26
0
 private TaskServiceImpl()
 {
     taskDAO = new TaskDAO();
 }
Exemplo n.º 27
0
 public ProjectController(IConfiguration configuration)
 {
     _configuration = configuration;
     projectDao     = new(_configuration);
     taskDao        = new(_configuration);
 }
Exemplo n.º 28
0
 public PrTaskController()
 {
     taskDao = new TaskDAO();
 }
Exemplo n.º 29
0
 public PrTaskController(TaskDAO t)
 {
     taskDao = t;
 }
Exemplo n.º 30
0
 private async static Task DoDBStuff(string dbConnString)
 {
     ITaskDAO taskDAO = new TaskDAO(dbConnString);
     await taskDAO.SaveExecutionInformation(new TaskExecutionInformation { Id = Guid.NewGuid(), Duration = 457, Status = "Success" });
 }