Example #1
0
        public ActionResult Index()
        {
            user user = (user)Session[ECGlobalConstants.CurrentUserMarcker];

            if (user == null || user.id == 0)
            {
                return(RedirectToAction("Index", "Account"));
            }

            #region EC-CC Viewbag
            ViewBag.is_cc = is_cc;
            string cc_ext = "";
            if (is_cc)
            {
                cc_ext = "_cc";
            }
            ViewBag.cc_extension = cc_ext;
            #endregion


            int user_id = user.id;
            // user
            UserModel   um = new UserModel(user_id);
            ReportModel rm = new ReportModel();

            //  List<task> tasks = um.UserTasks(0, null);
            List <task>         tasks    = um.UserTasks(1, null, true);
            List <TaskExtended> list_tsk = new List <TaskExtended>();
            int task_id      = 0;
            int unread_tasks = 0;
            foreach (task _task in tasks)
            {
                task_id = _task.id;
                TaskExtended tsk = new TaskExtended(_task.id, user_id);

                if (!tsk.IsRead())
                {
                    unread_tasks++;
                }

                list_tsk.Add(tsk);
            }
            ViewBag.tasks        = (list_tsk.OrderBy(m => m.TaskDueDate)).ToList();
            ViewBag.user_id      = user_id;
            ViewBag.um           = um;
            ViewBag.unread_tasks = unread_tasks;
            List <report> reports = um.ReportsSearch(0, 0);
            ViewBag.reports = reports;

            return(View());
        }
Example #2
0
        public ActionResult Tasks(int report_id)
        {
            user user = (user)Session[ECGlobalConstants.CurrentUserMarcker];

            //DEBUG
            //user = user != null ? user : db.user.FirstOrDefault(x => x.id == 2);
            //DEBUG
            if (user == null || user.id == 0)
            {
                return(RedirectToAction("Index", "Account"));
            }

            ReportModel rm = new ReportModel(report_id);

            if (!rm.HasAccessToReport(user.id))
            {
                return(RedirectToAction("Index", "Account"));
            }

            if ((rm._investigation_status == 1) || (rm._investigation_status == 2) || (rm._investigation_status == 7))
            {
                // case is not approved to work on it yet, need to approve first. if == 7 - its spam, so they will share the view.
                return(RedirectToAction("Index", "NewReport", new { id = report_id }));
            }

            int         user_id = user.id;
            UserModel   um      = new UserModel(user_id);
            List <task> tasks   = rm.ReportTasks(0);

            glb.UpdateReportRead(user_id, report_id);

            List <TaskExtended> list_tsk = new List <TaskExtended>();
            int task_id           = 0;
            ActiveCasesModel temp = new ActiveCasesModel();

            foreach (task _task in tasks)
            {
                task_id = _task.id;
                TaskExtended tsk = new TaskExtended(_task.id, user_id);
                temp.HasTaskFile(tsk);
                list_tsk.Add(tsk);
            }
            ViewBag.tasks           = list_tsk;
            ViewBag.um              = um;
            ViewBag.attachmentFiles = getAttachmentFiles(report_id);
            ViewBag.report_id       = report_id; // 167-171
            ViewBag.user_id         = user_id;

            return(View());
        }
Example #3
0
        public static IList <TaskExtended> GetRepairTaskTemplateData(string pathToPropServicesData)
        {
            var taskRows = Utils.ReadCsv(pathToPropServicesData);

            IList <TaskExtended> tasks = new List <TaskExtended>();

            var firstRow = true;

            foreach (var taskRow in taskRows)
            {
                if (!firstRow)
                {
                    var template = new TaskExtended
                    {
                        Code                 = taskRow[0].Trim(),
                        StanhopePFI          = taskRow[1].Trim(),
                        Category             = taskRow[2].Trim(),
                        RepairArea           = taskRow[3].Trim(),
                        Problem              = taskRow[4].Trim(),
                        Item                 = taskRow[5].Trim(),
                        Priority             = taskRow[6].Trim(),
                        Communal             = FormatBool(taskRow[7].Trim()),
                        Unit                 = FormatBool(taskRow[8].Trim()),
                        TenureSharedOwner    = FormatBool(taskRow[9].Trim()),
                        TenureRented         = FormatBool(taskRow[10].Trim()),
                        TenureSupported      = FormatBool(taskRow[11].Trim()),
                        BookOnline           = FormatBool(taskRow[12].Trim()),
                        CategoryTip          = taskRow[13].Trim(),
                        RepairAreaTip        = taskRow[14].Trim(),
                        ItemTip              = taskRow[15].Trim(),
                        SpecialistContractor = FormatBool(taskRow[16].Trim())
                    };

                    tasks.Add(template);
                }

                firstRow = false;
            }

            return(tasks);
        }
Example #4
0
        public ActionResult Task(int?id)
        {
            if (!id.HasValue)
            {
                return(RedirectToAction("Index", "Cases"));
            }

            //int user_id = 2;
            user user = (user)Session[ECGlobalConstants.CurrentUserMarcker];

            if (user == null || user.id == 0)
            {
                return(RedirectToAction("Index", "Account"));
            }


            int user_id = user.id;

            TaskExtended tsk = new TaskExtended(id.Value, user_id);

            ReportModel rm = new ReportModel(tsk.TaskReportID);

            if (!rm.HasAccessToReport(user_id))
            {
                return(RedirectToAction("Index", "Account"));
            }

            UserModel um = new UserModel(user_id);

            glb.UpdateReportRead(user_id, tsk.TaskReportID);

            if ((rm._investigation_status == 1) || (rm._investigation_status == 2) || (rm._investigation_status == 7))
            {
                // case is not approved to work on it yet, need to approve first. if == 7 - its spam, so they will share the view.
                return(RedirectToAction("Index", "NewReport", new { id = tsk.TaskReportID }));
            }
            #region EC-CC Viewbag
            ViewBag.is_cc = is_cc;
            string cc_ext = "";
            if (is_cc)
            {
                cc_ext = "_cc";
            }
            ViewBag.cc_extension = cc_ext;
            #endregion


            // user
            //  UserModel um = new UserModel(user_id);
            ViewBag.report_id           = tsk.TaskReportID; // 167-171
            ViewBag.user_id             = user_id;
            ViewBag.task_id             = id;
            ViewBag.taskStatus          = tsk.TaskStatus;
            ViewBag.um                  = um;
            ViewBag.attachmentFiles     = getAttachmentFiles(tsk.TaskReportID);
            ViewBag.AttachmentFilesTask = getAttachmentFilesTask(id.Value);

            glb.UpdateTaskRead(user_id, id.Value);

            List <Int32> _task_comments_ids = new List <Int32>();

            _task_comments_ids = db.task_comment.Where(a => a.id == id.Value).Select(t => t.id).ToList();
            foreach (int _id in _task_comments_ids)
            {
                /////           glb.UpdateTaskCommentRead(user_id, _id);
            }
            // if (!db.task_comment_user_read.Any(item => ((item.user_id == user_id) && (item.task_comment_id == task_comment_id))))
            // get all tasks comments
            // glb.UpdateTaskRead(user_id, id.Value);



            return(View());
        }