Exemplo n.º 1
0
        public void rptTaskStrip_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                try
                {
                    TaskItem item = (TaskItem)e.Item.DataItem;

                    Label lbl = (Label)e.Item.FindControl("lblDueDate");
                    lbl.Text = SQMBasePage.FormatDate((DateTime)item.Task.DUE_DT, "d", false);

                    if (item.Taskstatus == TaskStatus.EscalationLevel1 || item.Taskstatus == TaskStatus.EscalationLevel2)
                    {
                        ImageButton img = (ImageButton)e.Item.FindControl("imgTaskStatus");
                        img.ImageUrl = TaskMgr.TaskStatusImage(item.Taskstatus);
                        img.ToolTip  = item.Taskstatus.ToString();
                        img.Visible  = true;
                    }

                    if (SessionManager.IsUserAgentType("ipad,iphone"))
                    {
                        ImageButton btn = (ImageButton)e.Item.FindControl("btnTaskDetails");
                        btn.Visible = true;
                    }
                }
                catch
                {
                }
            }
        }
Exemplo n.º 2
0
    //-------------------------------------------------------------------------
    public override void onInit()
    {
        TbDataTaskKillMonster = EbDataMgr.Instance.getData <TbDataTaskKillMonster>(TaskData.task_id);
        ListMonsterData       = new List <OneMonsterData>();

        if (TaskData.task_state == TaskState.Init)
        {
            if (TbDataTask.AcceptNpcId == 0)
            {
                TaskData.task_state = TaskState.Doing;
            }
            else
            {
                TaskData.task_state = TaskState.CanDo;
            }
        }

        _loadTaskData();

        if (TaskData.task_state == TaskState.Doing && _isDone())
        {
            TaskData.task_state = TaskState.Done;
        }

        if (TaskData.task_state == TaskState.Done && TbDataTask.FinishNpcId == 0)
        {
            TaskData.task_state = TaskState.Release;
            TaskMgr._serverAddDirtyTask(this);
        }
    }
Exemplo n.º 3
0
 internal void CompileAndRun(IEnumerable <ScriptPath> srcs)
 {
     TapWasUpdated = CopyMe(TAPApp.Subject);
     using (TaskMgr tm = new TaskMgr(this)) {
         tm.Run(srcs.ToArray());
     }
 }
Exemplo n.º 4
0
        //static void SendEmail(PERSON responsiblePerson, string body)
        //{
        //	try
        //	{
        //		MailMessage msg = new MailMessage();
        //		msg.To.Add(responsiblePerson.EMAIL.Trim());
        //		msg.From = new MailAddress(MailFrom);
        //		msg.Subject = WebSiteCommon.GetXlatValue("emailSettings", "companyName") + " Reminder Notification";
        //		msg.Body = body;
        //		msg.Priority = MailPriority.Normal;
        //		msg.IsBodyHtml = true;

        //		SmtpClient client = new SmtpClient();
        //		client.Credentials = new System.Net.NetworkCredential(MailFrom, MailPassword);
        //		client.Port = MailSmtpPort; // Gmail works on this port
        //		client.Host = MailServer;
        //		client.EnableSsl = MailEnableSsl;

        //		client.Send(msg);
        //	}
        //	catch (Exception ex)
        //	{
        //		WriteLine("Error: " + ex.ToString());
        //	}
        //}

        static void TaskNotification()
        {
            try
            {
                DateTime        fromDate    = DateTime.Now.AddMonths(-6);
                List <TaskItem> taskList    = new List <TaskItem>();
                List <decimal>  respForList = new List <decimal>();

                List <UserContext> assignedUserList = TaskMgr.AssignedUserList();

                foreach (UserContext assignedUser in assignedUserList)
                {
                    WriteLine(assignedUser.Person.SSO_ID);

                    respForList.Clear();
                    respForList.Add(assignedUser.Person.PERSON_ID);
                    respForList.AddRange(assignedUser.DelegateList);

                    taskList.Clear();
                    taskList.AddRange(TaskMgr.ProfileApprovalStatus(new DateTime(fromDate.Year, fromDate.Month, 1), new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), respForList, assignedUser.EscalationAssignments));
                    taskList.AddRange(TaskMgr.IncidentTaskStatus(1, respForList, assignedUser.EscalationAssignments, true));
                    WriteLine(taskList.Count.ToString());

                    TaskMgr.MailTaskList(taskList, assignedUser.Person.EMAIL, "exe");
                }
            }
            catch (Exception ex)
            {
                WriteLine("TaskNotification Error: " + ex.ToString());
                WriteLine("TaskNotification Detailed Error: " + ex.InnerException.ToString());
            }
        }
        /// <summary>
        /// DeSerialize (load)
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="taskManager"></param>
        /// <param name="projectManager"></param>
        public void BinaryDeSerialize(string fileName, out TaskMgr taskManager, out ProjectMgr projectManager)
        {
            taskManager    = null;
            projectManager = null;
            Serialization serialization;
            Object        obj = null;

            BinaryFormatter b          = new BinaryFormatter();
            FileStream      fileStream = new FileStream(fileName, FileMode.Open);

            try {
                obj           = b.Deserialize(fileStream);
                serialization = (Serialization)obj;
                if (serialization != null)
                {
                    projectManager = serialization.projectManager;
                    taskManager    = serialization.taskManager;
                }
            } finally {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
Exemplo n.º 6
0
        public static void CreateOrUpdateTask(decimal auditId, decimal responsiblePersonId, int recordTypeId, DateTime dueDate, string status)
        {
            var entities = new PSsqmEntities();

            AUDIT      audit   = SelectAuditById(entities, auditId);
            AUDIT_TYPE type    = SelectAuditTypeById(entities, audit.AUDIT_TYPE_ID);
            var        taskMgr = new TaskStatusMgr();

            taskMgr.Initialize(recordTypeId, auditId);
            taskMgr.LoadTaskList(recordTypeId, auditId);
            TASK_STATUS task = taskMgr.FindTask("0", "T", responsiblePersonId);

            if (task == null)
            {
                task        = taskMgr.CreateTask("0", "T", 0, type.TITLE.ToString(), dueDate, responsiblePersonId);
                task.STATUS = ((int)TaskMgr.CalculateTaskStatus(task)).ToString();
            }
            else
            {
                switch (status)
                {
                case "C":
                    task.STATUS = ((int)TaskStatus.Complete).ToString();
                    taskMgr.SetTaskComplete(task, responsiblePersonId);
                    break;
                }
                //task = taskMgr.UpdateTask(task, dueDate, responsiblePersonId, audit.AUDIT_TYPE_ID.ToString());
            }

            taskMgr.UpdateTaskList(auditId);
        }
Exemplo n.º 7
0
        public void Run()
        {
            //new Thread(() =>
            //{
            //    Random rnd = new Random();
            //    do
            //    {
            //        LoggerMgr.GetInstance().Notify(new Logger(EnumLoggerType.Normal, rnd.Next(10, 99).ToString()));
            //        Thread.Sleep(500);
            //    }
            //    while (true);
            //}).Start();
            //ITaskMgr taskMgr = TaskMgr.GetInstance();
            //taskMgr.Start();
            ////taskMgr.AddWork(Work, OnWorkCompltedCallBack);
            int i = 0;
            int j = 500;

            new Thread(() =>
            {
                ITaskMgr taskMgr = TaskMgr.GetInstance();
                taskMgr.Start();
                while (i < j)
                {
                    taskMgr.AddWork(Work, OnWorkCompltedCallBack);
                    Thread.Sleep(10);
                    i++;
                }
                taskMgr.Stop();
            }).Start();
        }
Exemplo n.º 8
0
        private void SetupPage()
        {
            ddlScheduleScope.Items.Clear();

            SysPriv maxPriv = UserContext.GetMaxScopePrivilege(SysScope.busloc);

            if (maxPriv <= SysPriv.config)              // is a plant admin or greater ?
            {
                List <BusinessLocation> locationList = SessionManager.PlantList;
                locationList = UserContext.FilterPlantAccessList(locationList);

                if (locationList.Select(l => l.Plant.BUS_ORG_ID).Distinct().Count() > 1 && SessionManager.IsUserAgentType("ipad,iphone") == false)
                {
                    ddlScheduleScope.Visible = false;
                    mnuScheduleScope.Visible = true;
                    SQMBasePage.SetLocationList(mnuScheduleScope, locationList, 0, SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME, "TOP", true);
                    RadMenuItem mi = new RadMenuItem();
                    mi.Text     = (SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME);
                    mi.Value    = "0";
                    mi.ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png";
                    mnuScheduleScope.Items[0].Items.Insert(0, mi);
                }
                else
                {
                    ddlScheduleScope.Visible = true;
                    mnuScheduleScope.Visible = false;
                    SQMBasePage.SetLocationList(ddlScheduleScope, locationList, 0, true);
                    ddlScheduleScope.Items.Insert(0, new RadComboBoxItem((SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME), "0"));
                    ddlScheduleScope.Items[0].ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png";
                }
            }
            else
            {
                ddlScheduleScope.Visible = true;
                mnuScheduleScope.Visible = false;
                ddlScheduleScope.Items.Insert(0, new RadComboBoxItem((SessionManager.UserContext.Person.FIRST_NAME + " " + SessionManager.UserContext.Person.LAST_NAME), "0"));
                ddlScheduleScope.Items[0].ImageUrl = "~/images/defaulticon/16x16/user-alt-2.png";
            }

            // get tasks - due or escalated
            respForList = new List <decimal>();
            respForList.Add(SessionManager.UserContext.Person.PERSON_ID);
            respForList.AddRange(SQMModelMgr.SelectPersonListBySupvID(SessionManager.UserContext.Person.EMP_ID).Select(l => l.PERSON_ID).ToList());
            respPlantList = new List <decimal>();


            SessionManager.UserContext.TaskList.Clear();
            SessionManager.UserContext.TaskList = new List <TaskItem>();
            DateTime fromDate = DateTime.Now.AddMonths(-3);

            if (UserContext.CheckUserPrivilege(SysPriv.view, SysScope.inbox))
            {
                SessionManager.UserContext.TaskList.AddRange(TaskMgr.ProfileInputStatus(new DateTime(fromDate.Year, fromDate.Month, 1), new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), respForList, respPlantList));
                SessionManager.UserContext.TaskList.AddRange(TaskMgr.IncidentTaskStatus(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, respForList, respPlantList, false));
            }

            ++SessionManager.UserContext.InboxReviews;
        }
Exemplo n.º 9
0
        public void Save()
        {
            Categories.Save();
            Projects.Save();
            TaskMgr.Save();
            TimeEntries.Save();

            XmlDataSource.Document.Save(XmlDataSource.FullFilename);
        }
Exemplo n.º 10
0
    //-------------------------------------------------------------------------
    public override void c2sTaskFinish()
    {
        if (TaskData.task_state == TaskState.Doing)
        {
            TaskData.task_state = TaskState.Done;
            TaskMgr._serverAddDirtyTask(this);

            if (TbDataTask.FinishNpcId == 0)
            {
                TaskData.task_state = TaskState.Release;
                TaskMgr._serverAddDirtyTask(this);
            }
        }
    }
Exemplo n.º 11
0
        private void SetupPage()
        {
            if (langList == null || langList.Count == 0)
            {
                langList = SQMModelMgr.SelectLanguageList(new PSsqmEntities(), true);
                uclPrefsEdit.SetLanguageList(langList);
            }

            BusinessLocation businessLocation = new BusinessLocation(); businessLocation = SessionManager.UserContext.HRLocation;

            List <decimal> respForList = new List <decimal>();

            respForList.Add(SessionManager.UserContext.Person.PERSON_ID);
            respForList.AddRange(SessionManager.UserContext.DelegateList);

            SessionManager.UserContext.TaskList.Clear();
            SessionManager.UserContext.TaskList = new List <TaskItem>();
            AccessMode accessmode;

            DateTime fromDate = DateTime.Now.AddMonths(-6);

            if ((accessmode = UserContext.RoleAccess()) > AccessMode.Limited)
            {
                SessionManager.UserContext.TaskList.AddRange(TaskMgr.ProfileInputStatus(new DateTime(fromDate.Year, fromDate.Month, 1), new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), respForList, SessionManager.UserContext.EscalationAssignments));
                SessionManager.UserContext.TaskList.AddRange(TaskMgr.IncidentTaskStatus(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, respForList, SessionManager.UserContext.EscalationAssignments, true));
                if (accessmode == AccessMode.Admin && SessionManager.UserContext.EscalationAssignments.Count > 0)
                {
                    SessionManager.UserContext.TaskList.AddRange(TaskMgr.ProfileFinalizeStatus(new DateTime(fromDate.Year, fromDate.Month, 1), new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day), respForList, SessionManager.UserContext.EscalationAssignments, SessionManager.UserContext.Person));
                }
            }

            lblTaskCount0.Text = SessionManager.UserContext.TaskList.Where(l => l.NotifyType == TaskNotification.Owner).Count().ToString();
            uclTaskList0.BindTaskList(SessionManager.UserContext.TaskList.Where(l => l.NotifyType == TaskNotification.Owner).OrderBy(l => l.RecordType).ThenByDescending(l => l.Task.DUE_DT).ToList());

            lblTaskCount1.Text = SessionManager.UserContext.TaskList.Where(l => l.NotifyType == TaskNotification.Delegate).Count().ToString();
            if (lblTaskCount1.Text != "0")
            {
                divTaskList1.Visible = pnlTaskList1.Visible = true;
                uclTaskList1.BindTaskList(SessionManager.UserContext.TaskList.Where(l => l.NotifyType == TaskNotification.Delegate).OrderBy(l => l.RecordType).ThenByDescending(l => l.Task.DUE_DT).ToList());
            }

            lblTaskCount2.Text = SessionManager.UserContext.TaskList.Where(l => l.NotifyType == TaskNotification.Escalation).Count().ToString();
            if (lblTaskCount2.Text != "0")
            {
                divTaskList2.Visible = pnlTaskList2.Visible = true;
                uclTaskList2.BindTaskList(SessionManager.UserContext.TaskList.Where(l => l.NotifyType == TaskNotification.Escalation).OrderBy(l => l.RecordType).ThenByDescending(l => l.Task.DUE_DT).ToList());
            }

            ++SessionManager.UserContext.InboxReviews;
        }
Exemplo n.º 12
0
        public static void SetTaskComplete(decimal incidentId, int recordTypeId)
        {
            var taskMgr = new TaskStatusMgr();

            taskMgr.Initialize(recordTypeId, incidentId);
            taskMgr.LoadTaskList(recordTypeId, incidentId);
            TASK_STATUS task = taskMgr.FindTask("0", "T", 0);

            if (task != null)
            {
                taskMgr.UpdateTaskStatus(task, TaskMgr.CalculateTaskStatus(task));
                taskMgr.SetTaskComplete("0", "T", 0, true);
                taskMgr.UpdateTaskList(incidentId);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Serialize (save)
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="taskManager"></param>
        /// <param name="projectManager"></param>
        public void BinarySerialize(string fileName, TaskMgr taskManager, ProjectMgr projectManager)
        {
            this.taskManager    = taskManager;
            this.projectManager = projectManager;
            BinaryFormatter b          = new BinaryFormatter();
            FileStream      fileStream = new FileStream(fileName, FileMode.Create);

            try {
                b.Serialize(fileStream, this);
            } finally {
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }
        }
Exemplo n.º 14
0
    //-------------------------------------------------------------------------
    public override void onInit()
    {
        CoPlayer = Entity.getComponent <CellPlayer <DefPlayer> >();
        TbDataTaskCollectItem = EbDataMgr.Instance.getData <TbDataTaskCollectItem>(TaskData.task_id);
        ListItemData          = new List <OneItemData>();

        if (TaskData.task_state == TaskState.Init)
        {
            if (TbDataTask.AcceptNpcId == 0)
            {
                TaskData.task_state = TaskState.Doing;
            }
            else
            {
                TaskData.task_state = TaskState.CanDo;
            }
        }

        // 主动查询一次背包中是否有所需任务物品
        foreach (var i in TbDataTaskCollectItem.ListCollectItem)
        {
            OneItemData one_item_data = new OneItemData();
            one_item_data.item_id   = i.item_id;
            one_item_data.num_total = i.count;
            int num_cur = CoPlayer.CoBag.getItemNumByItemId(i.item_id);
            if (num_cur > i.count)
            {
                num_cur = i.count;
            }
            one_item_data.num_cur = num_cur;

            ListItemData.Add(one_item_data);
        }

        if (TaskData.task_state == TaskState.Doing && _isDone())
        {
            TaskData.task_state = TaskState.Done;
        }

        _saveTaskData();

        if (TaskData.task_state == TaskState.Done && TbDataTask.FinishNpcId == 0)
        {
            TaskData.task_state = TaskState.Release;
            TaskMgr._serverAddDirtyTask(this);
        }
    }
Exemplo n.º 15
0
    //-------------------------------------------------------------------------
    public override void handleEvent(object sender, EntityEvent e)
    {
        if (e is EvCellBagAddItem)
        {
            // CellBag,添加道具消息
            var ev = (EvCellBagAddItem)e;

            // 主动查询一次背包中是否有所需任务物品
            foreach (var i in TbDataTaskCollectItem.ListCollectItem)
            {
                int num_cur = CoPlayer.CoBag.getItemNumByItemId(i.item_id);
                if (num_cur > i.count)
                {
                    num_cur = i.count;
                }

                foreach (var j in ListItemData)
                {
                    if (j.item_id == i.item_id)
                    {
                        if (j.num_cur != num_cur)
                        {
                            j.num_cur = num_cur;
                            _saveTaskData();
                            TaskMgr._serverAddDirtyTask(this);
                        }
                        break;
                    }
                }
            }

            if (TaskData.task_state == TaskState.Doing && _isDone())
            {
                TaskData.task_state = TaskState.Done;
                TaskMgr._serverAddDirtyTask(this);
            }

            if (TaskData.task_state == TaskState.Done && TbDataTask.FinishNpcId == 0)
            {
                TaskData.task_state = TaskState.Release;
                TaskMgr._serverAddDirtyTask(this);
            }
        }
    }
Exemplo n.º 16
0
        static void Main(string[] args)
        {
            //var builderClient = new TCPClientTaskBuilder(ClientName.ModbusTCPClient);

            //var taskClient = builderClient.GetResult();

            //var builderServer = new TCPServerTaskBuilder(ServerName.ModbusTCPServer);
            //var taskServer = builderServer.GetResult();
            //if (taskClient.OnInit())
            //{
            //    taskClient.OnStart();
            //    if (taskServer.OnInit())
            //    {
            //        taskServer.OnStart();
            //    }
            //}
            TaskMgr.Main(args);
            Console.ReadKey();
        }
        protected void rgTasks_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            try
            {
                GridDataItem parentItem = ((sender as RadGrid).NamingContainer as GridNestedViewItem).ParentItem as GridDataItem;
                if (parentItem != null)
                {
                    decimal     questionID = Convert.ToDecimal(parentItem.GetDataKeyValue("QuestionId").ToString());
                    HiddenField hdn        = (HiddenField)parentItem.FindControl("hdnAuditID");
                    decimal     auditID    = Convert.ToDecimal(hdn.Value.ToString());

                    TaskStatusMgr myTasks = new TaskStatusMgr().CreateNew(0, 0);

                    //myTasks.LoadTaskList((int)TaskRecordType.Audit, auditID, questionID);
                    List <TaskItem> tasks = TaskMgr.ExceptionTaskListByRecord((int)TaskRecordType.Audit, auditID, questionID);

                    (sender as RadGrid).DataSource = tasks;
                }
            }
            catch (Exception ex) { }
        }
Exemplo n.º 18
0
        public int CheckCaseStatus()
        {
            int isComplete = 0;

            if (this.TeamTask != null)
            {
                foreach (TASK_STATUS task in this.TeamTask.TaskList)
                {
                    switch (TaskMgr.CalculateTaskStatus(task))
                    {
                    case TaskStatus.Complete:
                        ++isComplete;
                        break;

                    default:
                        break;
                    }
                }
            }

            return(isComplete);
        }
Exemplo n.º 19
0
    //-------------------------------------------------------------------------
    public override void init()
    {
        CoActor  = Entity.getComponent <CellActor <DefActor> >();
        CoPlayer = Entity.getComponent <CellPlayer <DefPlayer> >();
        if (CoActor.Def.mPropIsBot.get())
        {
            return;
        }

        TaskMgr = new TaskMgr(Entity, false);
        TaskMgr.regTaskFactory(new TaskFactoryCollectItem());
        TaskMgr.regTaskFactory(new TaskFactoryDialogue());
        TaskMgr.regTaskFactory(new TaskFactoryKillMonster());
        TaskMgr.OnServerTaskAward = _onTaskAward;

        if (Def.mPropFirstRun.get())
        {
            // 读取任务配置文件
            List <int> list_taskstory_starttasyid = CellApp.Instance.Cfg.ListTaskStoryStartTaskId;

            List <TaskData> list_taskdata = Def.mPropListTaskData.get();
            if (list_taskdata.Count == 0)
            {
                foreach (var i in list_taskstory_starttasyid)
                {
                    TaskData td = new TaskData();
                    td.task_id    = i;
                    td.task_data  = new Dictionary <byte, string>();
                    td.task_state = TaskState.Init;
                    list_taskdata.Add(td);
                }
            }

            Def.mPropFirstRun.set(true);
        }

        TaskMgr.loadAllTask(Def.mPropListTaskData.get());
    }
Exemplo n.º 20
0
        private void SetupPage()
        {
            int nextStep = CaseCtl().problemCase.CheckCaseNextStep();
            int progress = CaseCtl().problemCase.CheckCaseStatus();

            if (CaseCtl().isDirected)
            {
                uclSearchBar.SetButtonsEnabled(false, false, false, false, false, false);
            }
            uclPageTabs.TabsPanel.Visible = true;
            uclPageTabs.SetTabLabelsFromList(WebSiteCommon.GetXlatList("caseStep", "", "short"));
            uclPageTabs.SetAllTabsEnabled(true);

            if (CaseCtl().problemCase.TeamTask != null)
            {
                TaskStatus status;
                foreach (TASK_STATUS task in CaseCtl().problemCase.TeamTask.TaskList.Where(l => l.TASK_TYPE == "C" && l.TASK_SEQ == 0))
                {
                    if ((status = TaskMgr.CalculateTaskStatus(task)) < TaskStatus.New)
                    {
                        string imageURL = TaskMgr.TaskStatusImage(status);
                        uclPageTabs.SetTabImage(Convert.ToInt32(task.TASK_STEP), imageURL, status.ToString());
                    }
                }
            }

            SessionManager.EffLocation = SessionManager.UserContext.WorkingLocation;  /// is this true ??

            if (CaseCtl().isNew)
            {
                uclCaseHdr.ProblemCaseHdr.Visible = true;
            }
            else
            {
                uclCaseHdr.ProblemCaseHdr.Visible = true;
                uclCaseHdr.BindProblemCaseHeader(CaseCtl().problemCase, true);
            }
        }
        public void gvIssueList_OnRowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            if ((!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Header.ToString())) & (!e.Row.RowType.ToString().Trim().Equals(System.Web.UI.WebControls.ListItemType.Footer.ToString())))
            {
                try
                {
                    Label       lbl;
                    HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("hfIssueID");

                    LinkButton lnk = (LinkButton)e.Row.Cells[0].FindControl("lnkViewIssue_out");
                    lnk.Text = WebSiteCommon.FormatID(Convert.ToInt32(hf.Value), 6);

                    lbl = (Label)e.Row.Cells[0].FindControl("lblDisposition_Out");
                    string tempDisposition = lbl.Text;
                    lbl.Text = WebSiteCommon.GetXlatValue("NCDisposition", lbl.Text);

                    lnk      = (LinkButton)e.Row.Cells[0].FindControl("lnkIssueDate_Out");
                    lnk.Text = WebSiteCommon.LocalTime(Convert.ToDateTime(lnk.Text), SessionManager.UserContext.TimeZoneID).ToShortDateString();

                    lnk      = (LinkButton)e.Row.Cells[0].FindControl("lnkIssueTask_out");
                    lnk.Text = WebSiteCommon.GetXlatValueLong("taskType", lnk.Text);

                    TASK_STATUS task = new TASK_STATUS();
                    hf           = (HiddenField)e.Row.Cells[0].FindControl("hfTaskStatus");
                    task.TASK_ID = Convert.ToDecimal(hf.Value);
                    hf           = (HiddenField)e.Row.Cells[0].FindControl("hfTaskDueDate");
                    task.DUE_DT  = WebSiteCommon.LocalTime(Convert.ToDateTime(hf.Value), SessionManager.UserContext.TimeZoneID);
                    Image      img    = (Image)e.Row.Cells[0].FindControl("imgTaskStatus");
                    TaskStatus status = TaskMgr.CalculateTaskStatus(task);
                    img.ImageUrl = TaskMgr.TaskStatusImage(status);
                    img.ToolTip  = status.ToString();
                }
                catch
                {
                }
            }
        }
Exemplo n.º 22
0
        public static void CreateOrUpdateTask(decimal incidentId, decimal responsiblePersonId, int recordTypeId, DateTime dueDate)
        {
            var entities = new PSsqmEntities();

            INCIDENT incident = SelectIncidentById(entities, incidentId);

            var taskMgr = new TaskStatusMgr();

            taskMgr.Initialize(recordTypeId, incidentId);
            taskMgr.LoadTaskList(recordTypeId, incidentId);
            TASK_STATUS task = taskMgr.FindTask("0", "T", 0);

            if (task == null)
            {
                task        = taskMgr.CreateTask("0", "T", 0, incident.ISSUE_TYPE, dueDate, responsiblePersonId);
                task.STATUS = ((int)TaskMgr.CalculateTaskStatus(task)).ToString();
            }
            else
            {
                task = taskMgr.UpdateTask(task, dueDate, responsiblePersonId, incident.ISSUE_TYPE);
            }

            taskMgr.UpdateTaskList(incidentId);
        }
Exemplo n.º 23
0
        private void DisplayCalendar(DateTime selectedDate)
        {
            // don't display task strip if tasklist is empty


            bool enableItemLinks = false;

            // get scheduled tasks
            respForList = new List <decimal>();
            respForList.Add(SessionManager.UserContext.Person.PERSON_ID);
            DateTime toDate   = SessionManager.UserContext.LocalTime.AddMonths(3);
            DateTime fromDate = SessionManager.UserContext.LocalTime.AddMonths(-3);

            string selectedValue = "0";

            if (ddlScheduleScope.SelectedIndex > -1)
            {
                selectedValue = ddlScheduleScope.SelectedValue;
            }
            else if (mnuScheduleScope.SelectedItem != null)
            {
                selectedValue = mnuScheduleScope.SelectedItem.Value;
            }

            respForList   = new List <decimal>();
            respPlantList = new List <decimal>();
            List <TaskItem> taskList         = new List <TaskItem>();
            List <TaskItem> taskScheduleList = new List <TaskItem>();

            if (selectedValue == "0" || selectedValue == "TOP")
            {
                respForList.Add(SessionManager.UserContext.Person.PERSON_ID);
            }
            else
            {
                if (selectedValue.All(c => c >= '0' && c <= '9') == false)
                {                   // all accessible plants for a selected BU
                    decimal   busOrgID       = Convert.ToDecimal(selectedValue.Substring(2, selectedValue.Length - 2));
                    decimal[] busOrgPlantIDS = SQMModelMgr.SelectPlantList(entities, SessionManager.PrimaryCompany().COMPANY_ID, busOrgID).Select(l => l.PLANT_ID).ToArray();
                    foreach (decimal plantID in busOrgPlantIDS)
                    {
                        if (ddlScheduleScope.Visible && ddlScheduleScope.Items.FindItemByValue(plantID.ToString()) != null)
                        {
                            respPlantList.Add(plantID);
                        }
                        else if (mnuScheduleScope.Visible)
                        {
                            RadMenuItem miTop = mnuScheduleScope.Items[0];
                            foreach (RadMenuItem miBU in miTop.Items)
                            {
                                foreach (RadMenuItem miLoc in miBU.Items)
                                {
                                    if (miLoc.Value == plantID.ToString())
                                    {
                                        respPlantList.Add(plantID);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {                   // specific plant
                    respPlantList.Add(Convert.ToDecimal(selectedValue));
                }

                if (SessionManager.CheckUserPrivilege(SysPriv.config, SysScope.busorg))
                {
                    enableItemLinks = true;
                }
            }

            if (UserContext.CheckUserPrivilege(SysPriv.view, SysScope.inbox))
            {
                //taskList.AddRange(TaskMgr.ProfileInputStatus(new DateTime(fromDate.Year, fromDate.Month, 1), new DateTime(SessionManager.UserContext.LocalTime.Year, SessionManager.UserContext.LocalTime.Month, SessionManager.UserContext.LocalTime.Day), respForList, respPlantList));
                DateTime inputFromDate = new DateTime(DateTime.UtcNow.AddMonths(-1).Year, DateTime.Now.AddMonths(-1).Month, 1);
                taskScheduleList.AddRange(TaskMgr.ProfileInputSchedule(inputFromDate, toDate, respForList, respPlantList.ToArray(), SessionManager.CheckUserPrivilege(SysPriv.admin, SysScope.busorg)));
                taskList.AddRange(TaskMgr.IncidentTaskStatus(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, respForList, respPlantList, false));
            }
            taskScheduleList.AddRange(taskList);
            // MT - removed below logic because I don't know WTF
            //List<TaskItem> schedTasks = TaskMgr.IncidentTaskSchedule(SessionManager.PrimaryCompany().COMPANY_ID, DateTime.Now, toDate, respForList, respPlantList.ToArray(), false);
            //taskScheduleList.AddRange(TaskMgr.IncidentTaskSchedule(SessionManager.PrimaryCompany().COMPANY_ID, DateTime.Now, toDate, respForList, respPlantList.ToArray(), false));


            enableItemLinks = true;

            uclTaskSchedule.BindTaskSchedule(taskScheduleList, selectedDate, enableItemLinks);

            // get task escalations
            if (btnEscalateView.Visible)
            {
                respForList = new List <decimal>();
                respForList.AddRange(SQMModelMgr.SelectPersonListBySupvID(SessionManager.UserContext.Person.EMP_ID).Select(l => l.PERSON_ID).ToList());
                if (respForList.Count > 0)
                {
                    // has escalation persons
                    List <TaskItem> escalateList = TaskMgr.IncidentTaskStatus(SessionManager.UserContext.HRLocation.Company.COMPANY_ID, respForList, new List <decimal>(), false);
                    uclTaskStrip.BindTaskStrip(escalateList.Where(l => !String.IsNullOrEmpty(l.LongTitle)).OrderBy(l => l.Task.DUE_DT).ToList());
                }
            }

            divTaskList.Visible = divEscalate.Visible = false;
            divCalendar.Visible = true;
        }
Exemplo n.º 24
0
        private void uclCaseEdit_OnSaveClick(string cmdArg)
        {
            bool bNotify;

            CaseCtl().problemCase.UpdateStatus = CaseUpdateStatus.Success;
            switch (cmdArg)
            {
            case "0":
                CaseCtl().problemCase = uclCaseEdit.UpdateCase0(CaseCtl().problemCase);
                if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success)
                {
                    CaseCtl().Update();
                    uclCaseEdit.BindCase0();
                }
                break;

            case "1":
                CaseCtl().problemCase = uclCaseEdit.UpdateCase1(CaseCtl().problemCase, out bNotify);
                if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success)
                {
                    CaseCtl().Update();
                    uclCaseEdit.BindCase1(bNotify);
                    if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success && bNotify)
                    {
                        try
                        {
                            string appUrl = SQMSettings.SelectSettingByCode(entities, "MAIL", "TASK", "MailURL").VALUE;
                            PERSON person = null;
                            PLANT  plant  = SQMModelMgr.LookupPlant((decimal)CaseCtl().problemCase.IncidentList[0].DETECT_PLANT_ID);
                            int    emailStatus;
                            bool   bUpdateTasks = false;
                            foreach (TASK_STATUS task in CaseCtl().problemCase.TeamTask.TaskList.Where(t => t.TASK_TYPE == "C" && t.TASK_SEQ == 0).ToList())
                            {
                                if (task.RESPONSIBLE_ID.HasValue && (person = SQMModelMgr.LookupPerson((decimal)task.RESPONSIBLE_ID, "")) != null && !task.NOTIFY_DT.HasValue)
                                {
                                    task.NOTIFY_DT = DateTime.UtcNow;
                                    List <TaskItem> taskList = new List <TaskItem>();
                                    TaskItem        taskItem = new TaskItem();
                                    taskItem.RecordID    = CaseCtl().problemCase.ProbCase.PROBCASE_ID;
                                    taskItem.RecordKey   = CaseCtl().problemCase.ProbCase.PROBCASE_ID.ToString();
                                    taskItem.RecordType  = 21;
                                    taskItem.NotifyType  = TaskNotification.Owner;
                                    taskItem.Taskstatus  = TaskMgr.CalculateTaskStatus(task);
                                    taskItem.Detail      = SQMModelMgr.FormatPersonListItem(person);
                                    taskItem.Description = WebSiteCommon.FormatID(CaseCtl().problemCase.ProbCase.PROBCASE_ID, 6) + " / " + WebSiteCommon.GetXlatValue("caseStep", task.TASK_STEP);
                                    taskItem.Plant       = plant;
                                    taskItem.Task        = task;
                                    //  taskItem.Task = task;
                                    taskList.Add(taskItem);
                                    Thread thread = new Thread(() => TaskMgr.MailTaskList(taskList, person.EMAIL, "web"));
                                    thread.IsBackground = true;
                                    thread.Start();
                                    bUpdateTasks = true;
                                    //  if ((emailStatus = TaskMgr.MailTaskList(taskList, person.EMAIL, "web")) > 0)
                                    //      bUpdateTasks = true;
                                }
                            }
                            if (bUpdateTasks)
                            {
                                CaseCtl().Update();     // save task notify dates
                            }
                        }
                        catch (Exception ex)
                        {
                            //  SQMLogger.LogException(ex);
                        }
                    }
                }
                break;

            case "2":
                CaseCtl().problemCase = uclCaseEdit.UpdateCase2(CaseCtl().problemCase);
                if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success)
                {
                    CaseCtl().Update();
                    uclCaseEdit.BindCase2();
                }
                break;

            case "3":
                CaseCtl().problemCase = uclCaseEdit.UpdateCase3(CaseCtl().problemCase);
                if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success)
                {
                    CaseCtl().Update();
                    uclCaseEdit.BindCase3();
                }
                break;

            case "4":
                CaseCtl().problemCase = uclCaseEdit.UpdateCase4(CaseCtl().problemCase);
                if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success)
                {
                    CaseCtl().Update();
                    uclCaseEdit.BindCase4();
                }
                break;

            case "5":
                CaseCtl().problemCase = uclCaseEdit.UpdateCase5(CaseCtl().problemCase);
                if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success)
                {
                    CaseCtl().Update();
                    uclCaseEdit.BindCase5();
                }
                break;

            case "6":
                CaseCtl().problemCase = uclCaseEdit.UpdateCase6(CaseCtl().problemCase);
                if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success)
                {
                    CaseCtl().Update();
                    uclCaseEdit.BindCase6();
                }
                break;

            case "7":
                CaseCtl().problemCase = uclCaseEdit.UpdateCase7(CaseCtl().problemCase, true);
                if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success)
                {
                    CaseCtl().Update();
                    uclCaseEdit.BindCase7();
                }
                break;

            case "8":
                CaseCtl().problemCase = uclCaseEdit.UpdateCase8(CaseCtl().problemCase, out bNotify);
                CaseCtl().Update();
                uclCaseEdit.BindCase8(bNotify);
                if (bNotify && CaseCtl().problemCase != null)
                {
                    List <decimal?> teamList = new List <decimal?>();
                    teamList = CaseCtl().problemCase.TeamTask.TaskList.Where(l => l.TASK_TYPE == "C" && l.RESPONSIBLE_ID > 0).Select(l => l.RESPONSIBLE_ID).Distinct().ToList();
                    PERSON person = null;
                    // string emailStatus;
                    foreach (decimal?personID in teamList)
                    {
                        if ((person = SQMModelMgr.LookupPerson((decimal)personID, "")) != null)
                        {
                            Thread thread = new Thread(() => WebSiteCommon.SendEmail(person.EMAIL, CaseCtl().problemCase.ProbCase.PROB_CLOSE.MESSAGE_TITLE, CaseCtl().problemCase.ProbCase.PROB_CLOSE.MESSAGE, ""));
                            thread.IsBackground = true;
                            thread.Start();
                        }
                    }
                }
                break;

            default:
                break;
            }

            if (CaseCtl().problemCase.UpdateStatus == CaseUpdateStatus.Success)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alertResult('hfAlertSaveSuccess');", true);
                SetupPage();
            }
            else
            {
                ErrorAlert(CaseCtl().problemCase.UpdateStatus);
            }
        }
Exemplo n.º 25
0
 //-------------------------------------------------------------------------
 public override void release()
 {
     TaskMgr = null;
 }
Exemplo n.º 26
0
 //-------------------------------------------------------------------------
 public TaskKillMonster(TaskMgr task_mgr, Entity et, TaskData task_data)
     : base(task_mgr, et, task_data)
 {
 }
Exemplo n.º 27
0
 //-------------------------------------------------------------------------
 public TaskKillMonster(TaskMgr task_mgr, Entity et, int task_id)
     : base(task_mgr, et, task_id)
 {
 }
Exemplo n.º 28
0
 //-------------------------------------------------------------------------
 public TaskCollectItem(TaskMgr task_mgr, Entity et, int task_id)
     : base(task_mgr, et, task_id)
 {
 }
Exemplo n.º 29
0
 //-------------------------------------------------------------------------
 public TaskCollectItem(TaskMgr task_mgr, Entity et, TaskData task_data)
     : base(task_mgr, et, task_data)
 {
 }
Exemplo n.º 30
0
        static string OverdueTaskNotifications(DateTime currentTime)
        {
            string   nextStep     = "";
            DateTime openFromDate = new DateTime(2000, 1, 1);
            DateTime localTime;
            int      execAtHour = 10;           // set exec time default to 5 am EST

            WriteLine("OVERDUE TASK NOTIFICATIONS Started: " + DateTime.UtcNow.ToString("hh:mm MM/dd/yyyy"));

            SETTINGS        setting = null;
            List <SETTINGS> sets    = SQMSettings.SelectSettingsGroup("AUTOMATE", "");

            try
            {
                // execute at specified hour of day (e.g. TASKNOTIFY_TIME == 01:00)
                if ((setting = sets.Where(x => x.SETTING_CD == "TASKNOTIFY_TIME").FirstOrDefault()) != null)
                {
                    // throwing an error here if the setting format was incorrect will be helpful for debugging
                    execAtHour = int.Parse(WebSiteCommon.SplitString(setting.VALUE, ':').First());
                }

                entities = new PSsqmEntities();

                List <PLANT> plantList = SQMModelMgr.SelectPlantList(entities, 1, 0);
                PLANT        plant     = null;

                List <TaskItem> openTaskList = TaskMgr.SelectOpenTasks(currentTime, openFromDate);
                if (openTaskList.Count > 0)
                {
                    WriteLine("Open Tasks ...");
                    foreach (TaskItem taskItem in openTaskList)
                    {
                        try
                        {
                            if (taskItem.Task.RECORD_TYPE == (int)TaskRecordType.HealthSafetyIncident)
                            {
                                INCIDENT incident = EHSIncidentMgr.SelectIncidentById(entities, taskItem.Task.RECORD_ID);
                                if (incident != null && (plant = plantList.Where(l => l.PLANT_ID == incident.DETECT_PLANT_ID).FirstOrDefault()) != null)
                                {
                                    if (execAtHour == WebSiteCommon.LocalTime(currentTime, plant.LOCAL_TIMEZONE).Hour)
                                    {
                                        WriteLine("Task: " + taskItem.Task.TASK_ID.ToString() + " RecordType:  " + taskItem.Task.RECORD_TYPE.ToString() + "  " + "RecordID:" + taskItem.Task.RECORD_ID.ToString() + "  Status = " + taskItem.Task.STATUS);
                                        // notify assigned person and escalation person if over-over due
                                        EHSNotificationMgr.NotifyIncidentTaskStatus(incident, taskItem, ((int)SysPriv.action).ToString());
                                        System.Threading.Thread.Sleep(timer);                                         //will wait for 2 seconds to allow Google Mail to process email requests

                                        if (taskItem.Taskstatus >= SQM.Website.TaskStatus.Overdue)
                                        {
                                            // send to notification list for plant, BU, ...
                                            //EHSNotificationMgr.NotifyIncidentStatus(incident, taskItem.Task.TASK_STEP, ((int)SysPriv.notify).ToString(), "");
                                            //System.Threading.Thread.Sleep(timer); //will wait for 2 seconds to allow Google Mail to process email requests
                                        }
                                    }
                                }
                                else
                                {
                                    WriteLine("Task: " + taskItem.Task.TASK_ID.ToString() + " RecordType:  " + taskItem.Task.RECORD_TYPE.ToString() + "  " + "RecordID:" + taskItem.Task.RECORD_ID.ToString() + "  Status = " + taskItem.Task.STATUS + "  This task does not have a corresponding incident or plant record");
                                }
                            }
                            else if (taskItem.Task.RECORD_TYPE == (int)TaskRecordType.PreventativeAction)
                            {
                                INCIDENT incident = EHSIncidentMgr.SelectIncidentById(entities, taskItem.Task.RECORD_ID);
                                if (incident != null && (plant = plantList.Where(l => l.PLANT_ID == incident.DETECT_PLANT_ID).FirstOrDefault()) != null)
                                {
                                    if (execAtHour == WebSiteCommon.LocalTime(currentTime, plant.LOCAL_TIMEZONE).Hour)
                                    {
                                        WriteLine("Task: " + taskItem.Task.TASK_ID.ToString() + " RecordType:  " + taskItem.Task.RECORD_TYPE.ToString() + "  " + "RecordID:" + taskItem.Task.RECORD_ID.ToString() + "  Status = " + taskItem.Task.STATUS);
                                        // notify assigned person and escalation person if over-over due
                                        EHSNotificationMgr.NotifyPrevActionTaskStatus(incident, taskItem, ((int)SysPriv.action).ToString());
                                        System.Threading.Thread.Sleep(timer);                                         //will wait for 2 seconds to allow Google Mail to process email requests
                                    }
                                }
                                else
                                {
                                    WriteLine("Task: " + taskItem.Task.TASK_ID.ToString() + " RecordType:  " + taskItem.Task.RECORD_TYPE.ToString() + "  " + "RecordID:" + taskItem.Task.RECORD_ID.ToString() + "  Status = " + taskItem.Task.STATUS + "  This task does not have a corresponding preventative action or plant record");
                                }
                            }
                            else if (taskItem.Task.RECORD_TYPE == (int)TaskRecordType.Audit)
                            {
                                AUDIT audit = EHSAuditMgr.SelectAuditById(entities, taskItem.Task.RECORD_ID);
                                if (audit != null && (plant = plantList.Where(l => l.PLANT_ID == audit.DETECT_PLANT_ID).FirstOrDefault()) != null)
                                {
                                    if (execAtHour == WebSiteCommon.LocalTime(currentTime, plant.LOCAL_TIMEZONE).Hour)
                                    {
                                        WriteLine("Task: " + taskItem.Task.TASK_ID.ToString() + " RecordType:  " + taskItem.Task.RECORD_TYPE.ToString() + "  " + "RecordID:" + taskItem.Task.RECORD_ID.ToString() + "  Status = " + taskItem.Task.STATUS);
                                        if (taskItem.Task.TASK_STEP == "0")
                                        {
                                            EHSNotificationMgr.NotifyAuditStatus(audit, taskItem);
                                            System.Threading.Thread.Sleep(timer);                                             //will wait for 2 seconds to allow Google Mail to process email requests
                                        }
                                        else
                                        {
                                            EHSNotificationMgr.NotifyAuditTaskStatus(audit, taskItem, ((int)SysPriv.action).ToString());
                                            System.Threading.Thread.Sleep(timer);                                             //will wait for 2 seconds to allow Google Mail to process email requests
                                        }
                                    }
                                }
                                else
                                {
                                    WriteLine("Task: " + taskItem.Task.TASK_ID.ToString() + " RecordType:  " + taskItem.Task.RECORD_TYPE.ToString() + "  " + "RecordID:" + taskItem.Task.RECORD_ID.ToString() + "  Status = " + taskItem.Task.STATUS + "  This task does not have a corresponding audit or plant record");
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            WriteLine("Error: " + ex.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLine("OVERDUE TASK NOTIFICATIONS Error - " + ex.ToString());
            }

            WriteLine("OVERDUE TASK NOTIFICATIONS Completed: " + DateTime.UtcNow.ToString("hh:mm MM/dd/yyyy"));

            return(nextStep);
        }