public void ShowTasksView(Line line) { currentView = ViewLabel.Tasks; TasksView view = (TasksView)_views[ViewLabel.Tasks]; view.line = line; }
public TaskManagementModule(IRegionManager regionManager, IModuleManager moduleManager, IEventAggregator eventAggregator) : base(regionManager, moduleManager, eventAggregator) { m_TabItemView = new RibbonTabItemView(this); m_ProjectsView = new ProjectsView(this); m_TasksView = new TasksView(this); }
public TasksViewItemProxy[] LoadSubtasks(int taskID) { TasksView subtasks = new TasksView(TSAuthentication.GetLoginUser()); subtasks.LoadByParentID(taskID); return(subtasks.GetTasksViewItemProxies()); }
public void OnTaskSelected(Line line, Task task) { currentView = ViewLabel.Tasks; TasksView view = (TasksView)_views[ViewLabel.Tasks]; view.line = line; view.AddTask(task); }
/* * Contructor for DetailsPage to encapsulate current user information and truth value * * PARAM * user: parse the user to be used within this class * truth: parse truth to notify Device.StartTimer to stop whenever truthtime is off * * RETURN Nothing */ public TasksViewModel(UserModel user, TasksView page) { this.Currentuser = user; UserModel.Rewrite("Updated:", DateTime.Now.ToString(), Currentuser.LocalLogin); Tasks = "Current Tasks"; AddTime = new Command(async() => await this.Navigation.PushModalAsync(new DatePickerView(page, false))); // Name.Text = Currentuser.Username; }
/// <summary> /// /// </summary> public MainWindow() { InitializeComponent(); Current = this; JobsView = new JobsView(); TasksView = new TasksView(); ContentGrid.Children.Add(JobsView); }
public static string GetTasksViewItem(RestCommand command, int) { TasksViewItem tasksViewItem = TasksView.GetTasksViewItem(command.LoginUser, ); if (tasksViewItem.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } return(tasksViewItem.GetXml("TasksViewItem", true)); }
public TasksViewItemProxy GetTask(int taskID) { TasksViewItem task = TasksView.GetTasksViewItem(TSAuthentication.GetLoginUser(), taskID); if (task.OrganizationID != TSAuthentication.OrganizationID) { return(null); } return(task.GetProxy()); }
public void RefreshDiaryEvents() { logger.Trace("RefreshDiaryEvents()..."); TasksView.Refresh(); RaisePropertyChanged("TasksView"); logger.Trace("RefreshDiaryEvents()...Done"); }
public IActionResult Tasks(int y, int m, int d) { using (TaskContext db = new TaskContext()) { List <Task> tasks = (from t in db.Tasks where t.Month == m && t.Year == y && t.Day == d select t).ToList(); TasksView tasksView = new TasksView(tasks, new DateTime(y, m, d)); return(View("~/views/Tasks.cshtml", tasksView)); } }
private static void ExecutedUpdateTaskCommand(object sender, ExecutedRoutedEventArgs e) { object[] args = e.Parameter as object[]; UserTask task = args[0] as UserTask; bool dateChanged = (bool)args[1]; string id = task.ID; TasksPeekContent _sender = sender as TasksPeekContent; foreach (TreeViewItem each in _sender.tasksTreeView.Items) { foreach (TreeViewItem t in each.Items) { if ((t.Header as UserTask).ID == id) { if (dateChanged) { // Delete the task from the tree TreeViewItem parent = t.Parent as TreeViewItem; parent.Items.Remove(t); if (!parent.HasItems) { _sender.tasksTreeView.Items.Remove(parent); } // Re-add the task to the tree string header = "No Date"; if (task.DueDate.HasValue) { header = TasksView.GetFriendlyName(task.DueDate.Value); } TreeViewItem group = new TreeViewItem(); group.Header = header; _sender.AddTask(task, group); } else { t.Header = new UserTask(false); t.Header = task; } return; } } } }
public static string GetTasksView(RestCommand command) { TasksView tasksView = new TasksView(command.LoginUser); tasksView.LoadByOrganizationID(command.Organization.OrganizationID); if (command.Format == RestFormat.XML) { return(tasksView.GetXml("TasksView", "TasksViewItem", true, command.Filters)); } else { throw new RestException(HttpStatusCode.BadRequest, "Invalid data format"); } }
private void CreateTasksView() { if (tasksView == null) { showCompleted.IsChecked = Settings.ShowCompletedTasks; tasksView = new TasksView(); tasksView.OnBeginEditEvent += tasksView_OnBeginEditEvent; tasksView.OnEndEditEvent += tasksView_OnEndEditEvent; tasksView.OnCompletedChangedEvent += tasksView_OnCompletedChangedEvent; tasksView.OnPriorityChangedEvent += tasksView_OnPriorityChangedEvent; tasksView.OnShowCompletedChangedEvent += tasksView_OnShowCompletedChangedEvent; panelsGrid.Children.Add(tasksView); tasksView.UpdateLayout(); } }
override protected void GetNextRecord() { TasksViewItem task = TasksView.GetTasksViewItem(_loginUser, _itemIDList[_rowIndex]); _lastItemID = task.TaskID; UpdatedItems.Add((int)_lastItemID); StringBuilder builder = new StringBuilder(); builder.AppendLine(task.Description + " " + task.Name + " " + task.DateCreated + " " + task.DateModified); DocText = builder.ToString(); _docFields.Clear(); AddDocField("TaskID", task.TaskID); AddDocField("Name", task.Name); DocDisplayName = task.Name; TaskSearch taskItem = new TaskSearch(task); AddDocField("**JSON", JsonConvert.SerializeObject(taskItem)); // How do we handle associations indexing? //TaskAssociationsView associations = new TaskAssociationsView(_loginUser); //associations.LoadByTaskIDOnly(task.TaskID); //foreach (TaskAssociationsViewItem association in associations) //{ // object o = value.Row["CustomValue"]; // string s = o == null || o == DBNull.Value ? "" : o.ToString(); // AddDocField(value.Row["Name"].ToString(), s); //} DocFields = _docFields.ToString(); DocIsFile = false; DocName = task.TaskID.ToString(); try { DocCreatedDate = (DateTime)task.Row["DateCreated"]; DocModifiedDate = (DateTime)task.Row["DateModified"]; } catch (Exception) { } }
public async Task <IActionResult> UpdateTasksGen([FromBody] TasksView model) { if (model.model != null) { foreach (TaskViewModel task in model.model) { var item = _appDbContext.CTasks.Find(task.cTaskId); item.Descr = task.descr; item.Status = task.status; item.Note = task.note; _appDbContext.CTasks.Update(item); } await _appDbContext.SaveChangesAsync(); } return(new OkObjectResult(new { message = "success!" })); }
public IActionResult ShowCalendar(int?y, int?m) { using (TaskContext db = new TaskContext()) { string path = "~/views/Calendar.cshtml"; DateTime date; if (y.HasValue && m.HasValue) { date = new DateTime(y.Value, m.Value, 1); } else { date = DateTime.Now; } List <Task> tasks = (from t in db.Tasks where t.Month == date.Month && t.Year == date.Year select t).ToList(); TasksView tasksView = new TasksView(tasks, date, Calendar.getCalendar(date)); return(View(path, tasksView)); } }
public TasksView GetViewModel() { var model = new TasksView { Languages = _db.Fetch <Language>(new Sql().Select("*").From("dbo.umbracoLanguage")) }; var tasksQuery = new Sql() .Select("t.*, l.languageCultureName AS language, d.[key] AS [key]") .From("dbo.simpleTranslationTasks t LEFT OUTER JOIN dbo.umbracoLanguage l ON t.languageId=l.id LEFT OUTER JOIN dbo.cmsDictionary d ON t.id=d.id"); // Only translators are limited to languages they are responsible for. Administrators and Editors can view tasks for all languages. if (_urh.IsTranslator(UmbracoContext.Security.GetUserId())) { tasksQuery = tasksQuery.Where("t.languageId IN (select languageId from dbo.simpleTranslationUserLanguages where id=@tag)", new { tag = UmbracoContext.Security.GetUserId() }); } var tasks = _db.Fetch <TranslationTask>(tasksQuery); // Skip further processing if there are no tasks. if (!tasks.Any()) { return(model); } var currentTranslations = _db.Fetch <TranslationText>(new Sql("select * from dbo.cmsLanguageText where UniqueId in (@ids)", new { ids = tasks.Select(x => x.UniqueId).Distinct() })).ToLookup(x => x.UniqueId, x => x); var latestPersonalProposals = _db.Fetch <TranslationProposal>( new Sql("select p1.* from dbo.simpleTranslationProposals p1 INNER JOIN" + "(select MAX(pk) AS pk, id, languageId from dbo.simpleTranslationProposals where userId=@userId GROUP BY id, languageId)" + "AS p2 ON p1.pk=p2.pk", new { userId = UmbracoContext.Security.GetUserId() })).ToDictionary(x => new { x.UniqueId, x.LanguageId }, x => x); foreach (var v in tasks) { TranslationProposal p; latestPersonalProposals.TryGetValue(new { v.UniqueId, v.LanguageId }, out p); v.LatestPersonalProposal = p; v.CurrentTranslations = currentTranslations[v.UniqueId].ToDictionary(x => x.LanguageId, x => x.Value); } model.Tasks = tasks; model.IsEditor = _urh.IsEditor(UmbracoContext.Security.GetUserId()); return(model); }
private void ProcessTaskAssigned(int taskID, int modifierID) { TasksViewItem task = TasksView.GetTasksViewItem(LoginUser, taskID); try { User modifier = Users.GetUser(LoginUser, modifierID); if (task == null) { Logs.WriteEvent("Unable to find Task, TaskID: " + taskID.ToString()); return; } if (modifier == null) { Logs.WriteEvent("Unable to find Modifying User, UserID: " + modifierID.ToString()); return; } if (task.UserID == null) { Logs.WriteEvent("Assigned Task User is null"); return; } Organization taskOrganization = Organizations.GetOrganization(LoginUser, task.OrganizationID); if (taskOrganization == null) { Logs.WriteEvent("Task's Organization IS NULL!!!!"); return; } User owner = Users.GetUser(LoginUser, (int)task.UserID); if (owner.UserID == modifier.UserID) { Logs.WriteEvent("Modifier and Owner are the same person."); return; } if (Emails.IsEmailDisabled(LoginUser, owner.UserID, "Tasks")) { return; } MailMessage message = EmailTemplates.GetTaskAssigned(LoginUser, UsersView.GetUsersViewItem(LoginUser, modifierID), UsersView.GetUsersViewItem(LoginUser, (int)task.UserID), task); message.To.Add(GetMailAddress(owner.Email, owner.FirstLastName)); //message.Subject = message.Subject + " [pvt]"; EmailTemplates.ReplaceMailAddressParameters(message); String description = String.Format("Task assigned notification sent to {0} for Task {1}", message.To.ToString(), task.Name); ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, ReferenceType.Tasks, task.TaskID, description); ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, ReferenceType.Users, (int)task.UserID, description); //string emailReplyToAddress = GetEmailReplyToAddress(LoginUser, ticket); //AddMessage(taskOrganization, "Ticket Update Request [" + ticket.TicketNumber.ToString() + "]", message, emailReplyToAddress); Emails.AddEmail(LoginUser, task.OrganizationID, null, message.Subject, message); Logs.WriteEvent("Message queued"); } catch (Exception ex) { Logs.WriteEvent("Error with ProcessTaskAssigned"); Logs.WriteException(ex); ExceptionLogs.LogException(LoginUser, ex, "ProcessTaskModified", task.Row); } }
private void ProcessOldUser(int taskID, int modifierID, int oldUserID) { TasksViewItem task = TasksView.GetTasksViewItem(LoginUser, taskID); try { User modifier = Users.GetUser(LoginUser, modifierID); if (task == null) { Logs.WriteEvent("Unable to find Task, TaskID: " + taskID.ToString()); return; } if (modifier == null) { Logs.WriteEvent("Unable to find Modifying User, UserID: " + modifierID.ToString()); return; } Organization taskOrganization = Organizations.GetOrganization(LoginUser, task.OrganizationID); if (taskOrganization == null) { Logs.WriteEvent("Task's Organization IS NULL!!!!"); return; } User oldUser = Users.GetUser(LoginUser, oldUserID); UsersViewItem owner = null; if (task.UserID != null) { owner = UsersView.GetUsersViewItem(LoginUser, (int)task.UserID); } if (Emails.IsEmailDisabled(LoginUser, oldUser.UserID, "Tasks")) { return; } MailMessage message = EmailTemplates.GetTaskOldUser(LoginUser, UsersView.GetUsersViewItem(LoginUser, modifierID), UsersView.GetUsersViewItem(LoginUser, (int)oldUserID), owner, task); //if (oldUser.UserID == modifier.UserID) //{ // User creator = Users.GetUser(LoginUser, (int)task.CreatorID); // message.To.Add(GetMailAddress(creator.Email, creator.FirstLastName)); //} //else //{ message.To.Add(GetMailAddress(oldUser.Email, oldUser.FirstLastName)); //} //message.Subject = message.Subject + " [pvt]"; //EmailTemplates.ReplaceEmailRecipientParameters(LoginUser, message, ticket, owner.UserID, owner.OnlyEmailAfterHours); EmailTemplates.ReplaceMailAddressParameters(message); String description = String.Format("Task old user notification sent to {0} for Task {1}", message.To.ToString(), task.Name); ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, ReferenceType.Tasks, task.TaskID, description); ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, ReferenceType.Users, (int)task.UserID, description); //string emailReplyToAddress = GetEmailReplyToAddress(LoginUser, ticket); //AddMessage(taskOrganization, "Ticket Update Request [" + ticket.TicketNumber.ToString() + "]", message, emailReplyToAddress); Emails.AddEmail(LoginUser, task.OrganizationID, null, message.Subject, message); Logs.WriteEvent("Message queued"); } catch (Exception ex) { Logs.WriteEvent("Error with ProcessTaskComplete"); Logs.WriteException(ex); ExceptionLogs.LogException(LoginUser, ex, "ProcessTaskComplete", task.Row); } }
private void additems(UserTask[] tasks) { if (tasks != null) { foreach (UserTask each in tasks) { if (_showCompleted || each.Status != UserTask.StatusPhase.Completed) { string header = "No Date"; if (each.DueDate != null) { header = TasksView.GetFriendlyName((DateTime)each.DueDate); } TreeViewItem group = new TreeViewItem(); group.Header = header; AddTask(each, group); } } if (!tasksTreeView.HasItems) { statusText.Text = "We didn't find anything to show here."; if (Settings.AnimationsEnabled) { new AnimationHelpers.Fade(statusText, AnimationHelpers.FadeDirection.In); } else { statusText.Opacity = 1; statusText.Visibility = Visibility.Visible; } } else { if (Settings.AnimationsEnabled) { new AnimationHelpers.Fade(statusText, AnimationHelpers.FadeDirection.Out, true); } else { statusText.Visibility = Visibility.Hidden; } } } else { statusText.Text = "We didn't find anything to show here."; if (Settings.AnimationsEnabled) { new AnimationHelpers.Fade(statusText, AnimationHelpers.FadeDirection.In); } else { statusText.Opacity = 1; statusText.Visibility = Visibility.Visible; } } }
private static void ExecutedTaskReorderCommand(object sender, ExecutedRoutedEventArgs e) { ItemReorderEventArgs args = (ItemReorderEventArgs)e.Parameter; TasksPeekContent _sender = (TasksPeekContent)sender; UserTask _peekTask = (UserTask)args.Item.Header; TreeViewItem tvItem = null; foreach (TreeViewItem parent in _sender.tasksTreeView.Items) { foreach (TreeViewItem child in parent.Items) { if (((DatabaseObject)child.Header).ID == _peekTask.ID) { tvItem = child; break; } } if (tvItem != null) { break; } } if (tvItem == null) { UserTask task = (UserTask)args.Item.Header; int newIndex = ((ItemsControl)args.Item.Parent).Items.IndexOf(args.Item); string header = "No Date"; if (task.DueDate != null) { header = TasksView.GetFriendlyName(task.DueDate.Value); } TreeViewItem group = new TreeViewItem() { Header = header }; _sender.AddTask(new UserTask(task), group, true, newIndex); } else { UserTask task = (UserTask)tvItem.Header; task.DueDate = _peekTask.DueDate; task.StartDate = _peekTask.StartDate; string header = "No Date"; if (task.DueDate != null) { header = TasksView.GetFriendlyName(task.DueDate.Value); } TreeViewItem group = new TreeViewItem(); group.Header = header; int origIndex = ((ItemsControl)tvItem.Parent).Items.IndexOf(tvItem); int newIndex = ((ItemsControl)args.Item.Parent).Items.IndexOf(args.Item); if (origIndex < newIndex && args.NewParent == args.OldParent && Settings.AnimationsEnabled) { newIndex++; } _sender.deleteTask(tvItem, false); _sender.AddTask(task, group, true, newIndex); if (task.IsOverdue && task.Status != UserTask.StatusPhase.Completed) { tvItem.Foreground = new SolidColorBrush(Color.FromArgb(255, 218, 17, 17)); } else { tvItem.Foreground = Brushes.Black; } } }
/// <summary> /// /// </summary> /// <param name="view"></param> public TaskLogService(TasksView view) { View = view; }
public override void UIThreadInitialize() { base.UIThreadInitialize(); TasksView.Refresh(); }
private void ProcessReminder(Reminder reminder) { Logs.WriteLine(); Logs.WriteEvent("***********************************************************************************"); Logs.WriteEvent("Processing Reminder ReminderID: " + reminder.ReminderID.ToString()); Logs.WriteData(reminder.Row); Logs.WriteLine(); Logs.WriteEvent("***********************************************************************************"); MailMessage message; UsersViewItem user = UsersView.GetUsersViewItem(LoginUser, (int)reminder.UserID); if (user == null) { return; } string description = ""; switch (reminder.RefType) { case ReferenceType.Organizations: OrganizationsViewItem org = OrganizationsView.GetOrganizationsViewItem(LoginUser, reminder.RefID); if (org == null) { return; } message = EmailTemplates.GetReminderCustomerEmail(LoginUser, reminder, user, org); description = String.Format("Reminder sent to {0} for Organization {1}", message.To.ToString(), org.Name); Logs.WriteEvent(description); ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, reminder.RefType, reminder.RefID, description); ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, ReferenceType.Organizations, org.OrganizationID, description); break; case ReferenceType.Tickets: TicketsViewItem ticket = TicketsView.GetTicketsViewItem(LoginUser, reminder.RefID); if (ticket == null) { return; } message = EmailTemplates.GetReminderTicketEmail(LoginUser, reminder, user, ticket); EmailTemplates.ReplaceEmailRecipientParameters(LoginUser, message, Tickets.GetTicket(LoginUser, ticket.TicketID), reminder.UserID); //vv TeamSupport.Data.Action action = (new Actions(LoginUser)).AddNewAction(); action.ActionTypeID = null; action.Name = "Reminder"; action.ActionSource = "Reminder"; action.SystemActionTypeID = SystemActionType.Reminder; action.Description = String.Format("<p>The following is a reminder for {0} {1}:</p><p> </p><p>{2}</p>", user.FirstName, user.LastName, reminder.Description); action.IsVisibleOnPortal = false; action.IsKnowledgeBase = false; action.TicketID = ticket.TicketID; action.Collection.Save(); description = String.Format("Reminder sent to {0} for Ticket {1}", message.To.ToString(), ticket.TicketNumber.ToString()); Logs.WriteEvent(description); ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, reminder.RefType, reminder.RefID, description); ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, ReferenceType.Tickets, ticket.TicketID, description); break; case ReferenceType.Contacts: ContactsViewItem contact = ContactsView.GetContactsViewItem(LoginUser, reminder.RefID); if (contact == null) { return; } message = EmailTemplates.GetReminderContactEmail(LoginUser, reminder, user, contact); description = String.Format("Reminder sent to {0} for Contact {1}", message.To.ToString(), contact.FirstName + " " + contact.LastName); Logs.WriteEvent(description); ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, reminder.RefType, reminder.RefID, description); ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, ReferenceType.Users, contact.UserID, description); break; case ReferenceType.Tasks: TasksViewItem task = TasksView.GetTasksViewItem(LoginUser, reminder.RefID); if (task == null || task.IsComplete) { reminder.IsDismissed = true; reminder.Collection.Save(); return; } message = EmailTemplates.GetReminderTaskEmail(LoginUser, reminder, user, task); description = String.Format("Reminder sent to {0} for Task {1}", message.To.ToString(), task.Name); Logs.WriteEvent("ver. 05162017: " + description); ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, ReferenceType.Tasks, task.TaskID, description); ActionLogs.AddActionLog(LoginUser, ActionLogType.Insert, ReferenceType.Users, (int)reminder.UserID, description); TaskAssociations taskAssociations = new TaskAssociations(LoginUser); taskAssociations.LoadByTaskIDOnly(task.TaskID); foreach (TaskAssociation taskAssociation in taskAssociations) { if (taskAssociation.RefType == (int)ReferenceType.Tickets) { TeamSupport.Data.Action taskAction = (new Actions(LoginUser)).AddNewAction(); taskAction.ActionTypeID = null; taskAction.Name = "Reminder"; taskAction.ActionSource = "Reminder"; taskAction.SystemActionTypeID = SystemActionType.Reminder; taskAction.Description = String.Format("<p>The following is a reminder for {0} {1}:</p><p> </p><p>{2}</p>", user.FirstName, user.LastName, reminder.Description); taskAction.IsVisibleOnPortal = false; taskAction.IsKnowledgeBase = false; taskAction.TicketID = taskAssociation.RefID; try { taskAction.Collection.Save(); } catch (Exception ex) { Logs.WriteEvent("Ex Reminder Action.Save: " + ex.StackTrace); } } } break; default: message = null; break; } if (message == null) { return; } reminder.HasEmailSent = true; reminder.Collection.Save(); if (Emails.IsEmailDisabled(LoginUser, user.UserID, "Reminders")) { Logs.WriteEvent("Message skipped due to disabled user setting."); } else { MailAddress address = new MailAddress(user.Email, user.FirstName + " " + user.LastName); Logs.WriteEvent("Mail Address: " + address.ToString()); message.To.Add(address); EmailTemplates.ReplaceMailAddressParameters(message); Emails.AddEmail(LoginUser, reminder.OrganizationID, null, message.Subject, message); Logs.WriteEvent("Message queued"); } }
private void Refresh() { TasksView.Refresh(); }
/// <summary> /// /// </summary> /// <param name="view"></param> public TaskCustomizedLogService(TasksView view) { View = view; }