private void btnOK_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrEmpty(txtTaskName.Text) || String.IsNullOrEmpty(txtWorksheetUrl.Text)) { MessageBox.Show("Task Name or Worksheet URL cannot be empty"); return; } using (var context = new WorkDeskManager.Desktop.Data.WorkdeskContext()) { try { var task = new Data.Task { Name = txtTaskName.Text.Trim(), WorksheetUrl = txtWorksheetUrl.Text.Trim() }; context.Tasks.Add(task); context.SaveChanges(); MessageBox.Show(String.Format("Task -{0}- Added",txtTaskName.Text)); } catch (Exception ex) { MessageBox.Show(String.Format("Error adding new task: {0}",ex.Message)); } } Close(); }
public List <Data.Task> getPendingTasks(int codUser, int codTask) { List <Data.Task> pendingTasks = new List <Data.Task>(); using (DbConnection cn = b.CreateConnection()) { using (DbCommand cmd = b.CreateCommand(cn)) { cmd.CommandText = "wfSP_GET_PENDING_TASKS"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(CreateParameter("@CodUser", DbType.Int32, codUser)); cmd.Parameters.Add(CreateParameter("@CodTask", DbType.Int32, codTask)); cn.Open(); using (DbDataReader reader = b.ExecuteReader(cmd)) { while (reader.Read()) { Data.Task t = new Data.Task(); t.CodFlowExecuteTask = Util.Parse.ToInt(reader["CodFlowExecuteTask"]); t.CodFlow = Util.Parse.ToInt(reader["CodFlow"]); t.CodFlowExecute = Util.Parse.ToInt(reader["CodFlowExecute"]); t.CodTask = codTask; t.DsTask = Util.Parse.ToString(reader["DsTaskTitle"]); pendingTasks.Add(t); } } return(pendingTasks); } } }
public Data.Task getTaskInfo(int codFlowExecuteTask) { // Retorno Data.Task t = new Data.Task(); using (DbConnection cn = b.CreateConnection()) { using (DbCommand cmd = b.CreateCommand(cn)) { cmd.CommandText = "wfSP_GET_TASK_INFO"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(CreateParameter("@CodFlowExecuteTask", DbType.Int32, codFlowExecuteTask)); cn.Open(); using (DbDataReader reader = b.ExecuteReader(cmd)) { if (reader.Read()) { t.CodFlow = Util.Parse.ToInt(reader["CodFlow"]); t.CodFlowExecute = Util.Parse.ToInt(reader["CodFlowExecute"]); t.CodTask = Util.Parse.ToInt(reader["CodTask"]); t.DsTask = Util.Parse.ToString(reader["DsTaskTitle"]); } } } } return(t); }
async public static Task UpsertTask(Data.Task task, bool addToBacklog = true) { var taskJsonString = task.ToJson().ToString(); using (connection) { // TODO: handle SqliteException await connection.OpenAsync(); using (var tx = connection.BeginTransaction()) { var sql = "INSERT OR REPLACE INTO tasks (uuid, task) VALUES (@uuid, @task);"; if (addToBacklog) { sql += "\nINSERT INTO sync_backlog(sync_key, task) VALUES ((SELECT value FROM metadata WHERE key = 'sync_key'), @task);"; } var insert = new SqliteCommand(sql, connection, tx); insert.Parameters.AddWithValue("@uuid", task.Uuid.ToString()); insert.Parameters.AddWithValue("@task", taskJsonString); await insert.ExecuteNonQueryAsync(); tx.Commit(); } } }
public void WhenUpdatingTaskPropertiesAreSavedCorrectly() { // Assemble var dbContext = new InMemoryOCCDB() .WithEvent("Test Event") .WithEvent("Second Event") .WithTask("Test Task"); _expectedTask = new Services.Task { Description = "This is the Modified Task", Capacity = 5, StartTime = DateTime.Today, EndTime = DateTime.Now, EventID = 2 }; var service = TestHelper.GetTestService(dbContext); var originalTask = service.GetTaskById(1); originalTask.Description = _expectedTask.Description; originalTask.Capacity = _expectedTask.Capacity; originalTask.StartTime = _expectedTask.StartTime; originalTask.EndTime = _expectedTask.EndTime; originalTask.EventID = _expectedTask.EventID; // Act service.UpdateTask(originalTask); // Assert _actualTask = dbContext.Tasks.First(); }
public async Task <IActionResult> OnGetAsync(int?id) { Username = HttpContext.Session.GetString("username"); // establish session if (Username != null) { if (id == null) { return(NotFound()); } Task = await _context.Task .Include(t => t.Employee) .Include(t => t.Status).FirstOrDefaultAsync(m => m.Id == id); if (Task == null) { return(NotFound()); } return(Page()); } else { return(RedirectToPage("../Index")); } }
protected void Fetch(Data.Task data) { this.LoadProperty(TaskIdProperty, data.TaskId); this.LoadProperty(ProjectProperty, ProjectInfo.FetchProjectInfo(data.Project)); this.LoadProperty(ProjectIdProperty, data.ProjectId); this.LoadProperty(ProjectNameProperty, data.Project.Name); this.LoadProperty(SprintProperty, SprintInfo.FetchSprintInfo(data.Sprint)); this.LoadProperty(SprintIdProperty, data.SprintId); this.LoadProperty(SprintNameProperty, data.SprintName); this.LoadProperty(CategoryProperty, CategoryInfo.FetchCategoryInfo(data.Category)); this.LoadProperty(CategoryIdProperty, data.CategoryId); this.LoadProperty(CategoryNameProperty, data.Category.Name); this.LoadProperty(StatusProperty, StatusInfo.FetchStatusInfo(data.Status)); this.LoadProperty(StatusIdProperty, data.StatusId); this.LoadProperty(StatusNameProperty, data.Status.Name); this.LoadProperty(DescriptionProperty, data.Description); this.LoadProperty(AssignedToProperty, data.AssignedTo); this.LoadProperty(AssignedToNameProperty, data.AssignedToUser == null ? "No one" : data.AssignedToUser.Name); this.LoadProperty(AssignedDateProperty, data.AssignedDate); this.LoadProperty(StartDateProperty, data.StartDate); this.LoadProperty(CompletedDateProperty, data.CompletedDate); this.LoadProperty(EstimatedCompletedDateProperty, data.EstimatedCompletedDate); this.LoadProperty(DurationProperty, data.Duration); this.LoadProperty(EstimatedDurationProperty, data.EstimatedDuration); this.LoadProperty(LabelsProperty, data.Labels); this.LoadProperty(IsArchivedProperty, data.IsArchived); this.LoadProperty(NotesProperty, data.Notes); this.LoadProperty(ModifiedByProperty, data.ModifiedBy); this.LoadProperty(ModifiedByNameProperty, data.ModifiedByUser.Name); this.LoadProperty(ModifiedDateProperty, data.ModifiedDate); this.LoadProperty(CreatedByProperty, data.CreatedBy); this.LoadProperty(CreatedByNameProperty, data.CreatedByUser.Name); this.LoadProperty(CreatedDateProperty, data.CreatedDate); this.LoadProperty(TaskLabelsProperty, TaskLabels.FetchTaskLabels(this)); }
public TaskDTO GetTaskById(int taskId) { Data.Task tasks = _taskData.GetTaskById(taskId); TaskDTO DTOTasks = Mapper.Map <TaskDTO>(tasks); return(DTOTasks); }
public async Task <Data.Task> AddAsync(Data.Task task) { _dbContext.Tasks.Add(task); await _dbContext.SaveChangesAsync(); return(task); }
public async Task <IActionResult> PutTask([FromRoute] int id, [FromBody] Data.Task task) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != task.Id) { return(BadRequest()); } _context.Entry(task).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TaskExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void WhenUpdatingTaskPropertiesAreSavedCorrectly() { // Assemble var dbContext = new InMemoryOCCDB() .WithEvent("Test Event") .WithEvent("Second Event") .WithTask("Test Task"); _expectedTask = new Services.Task { Description = "This is the Modified Task", Capacity = 5, StartTime = DateTime.Today, EndTime = DateTime.Now, EventID = 2 }; var service = TestHelper.GetTestService(dbContext); var originalTask =service.GetTaskById(1); originalTask.Description = _expectedTask.Description; originalTask.Capacity = _expectedTask.Capacity; originalTask.StartTime = _expectedTask.StartTime; originalTask.EndTime = _expectedTask.EndTime; originalTask.EventID = _expectedTask.EventID; // Act service.UpdateTask(originalTask); // Assert _actualTask = dbContext.Tasks.First(); }
public Overview(Data.Task task) { TaskId = task.Id; TaskName = task.Name; TaskStartTime = task.StartTime; TaskEndTime = task.EndTime; CategoryName = task.Category.Name; if (task.Appointments != null) { AppointmentsCount = task.Appointments.Count(); } else { AppointmentsCount = 0; } if (task.Notes != null) { NotesCount = task.Notes.Count(); } else { NotesCount = 0; } if (task.Documents != null) { DocumentsCount = task.Documents.Count(); } else { DocumentsCount = 0; } }
/// <summary> /// Updates the all tasks cached query results when a task is updated /// </summary> void AllTasksOnTaskUpdated(object sender, TaskUpdatedEventArgs e) { QueryCacheItem cachedQuery = _appInfo.GlobalQueryCache.GetCacheItem(Constants.AllTasksCacheItem); if (cachedQuery != null) { // updated the query results if needed List <Data.Task> allTasks = (List <Data.Task>)cachedQuery.Value; Data.Task oldTask = allTasks.FirstOrDefault(t => t.TaskID == e.UpdatedTask.TaskId); Data.Task newTask = e.UpdatedDbTask; if (oldTask != null && newTask != null) { allTasks.Remove(oldTask); allTasks.Add(newTask); } else if (newTask != null) { allTasks.Add(newTask); } allTasks = SortList(allTasks); _appInfo.GlobalQueryCache.UpdateCacheItem(Constants.AllTasksCacheItem, allTasks); } }
public Details(ITaskData taskData, int taskId) : this() { Data.Task task = taskData.Get(taskId); TaskId = taskId; TaskCategoryId = task.CategoryId; TaskName = task.Name; TaskStartTime = task.StartTime; TaskEndTime = task.EndTime; CategoryName = task.Category.Name; if (task.Appointments != null) { foreach (Data.Appointment appointment in task.Appointments) { Appointments.Add(new Appointment(appointment)); } } if (task.Notes != null) { foreach (Data.Note note in task.Notes) { Notes.Add(new Note(note)); } } if (task.Documents != null) { foreach (Data.Document document in task.Documents) { Documents.Add(new Document(document)); } } }
protected void Insert(Data.Task data) { data.TaskId = this.ReadProperty(TaskIdProperty); data.CreatedBy = ((BusinessIdentity)Csla.ApplicationContext.User.Identity).UserId; data.CreatedDate = DateTime.Now; this.Update(data); }
public TaskDto Create(TaskDto dto) { Data.Task task = ConvertToEntity(dto); appContext.Task.Add(task); Save(); return(ConverToDto(task)); }
private void AddChildrenRecursive(List <Task> list, Data.Task task) { foreach (var childtask in task.ChildTasks) { list.Add(childtask); AddChildrenRecursive(list, childtask); } }
protected void Page_Load(object sender, EventArgs e) { t = new Business.Task().getTaskInfo(Convert.ToInt32(this.CodFlowExecuteTask)); this.DsTaskTitle = t.DsTask; checkAutomaticExecution(); runDecisionSupport(); }
protected void BtnActivate_Click(object sender, EventArgs e) { t = new Business.Task().getTaskInfo(Convert.ToInt32(this.CodFlowExecuteTask)); this.DsTaskTitle = t.DsTask; new Business.AutomaticTaskExecution().activateAutomaticExecution(t.CodTask, Convert.ToInt32(this.CodUser)); this.PhActvate.Visible = false; this.PhDeactivate.Visible = true; }
public static Data.Task InsertTask(InMemoryOCCDB context, string description) { var @event = context.Events.First(); var task = new Data.Task { Description = description, Event_ID = @event.ID }; context.Tasks.Add(task); return task; }
private TaskDto ConverToDto(Data.Task entity) { return(new TaskDto { Id = entity.Id, Subject = entity.Subject, Description = entity.Description, ToDoId = entity.ToDoId, //TaskDtos = }); }
public static Task Map(this Data.Task task) { return(new Task { Id = task.ID, Description = task.Description, Event = task.Event.Map(), StartTime = task.StartTime, EndTime = task.EndTime, Capacity = task.Capacity }); }
public static Data.Task InsertTask(InMemoryOCCDB context, string description) { var @event = context.Events.First(); var task = new Data.Task { Description = description, Event_ID = @event.ID }; context.Tasks.Add(task); return(task); }
internal static TaskInfo FetchTaskInfo( Data.Task data, decimal?duration, int?numberOfNotes, int?numberOfAttachments, int?numberOfInvoices) { var result = new TaskInfo(); result.Fetch(data, duration, numberOfNotes, numberOfAttachments, numberOfInvoices); return(result); }
public Data.Task Create(Data.Task task) { // validation if (string.IsNullOrWhiteSpace(task.Title)) { throw new AppException("Title is required"); } _context.Tasks.Add(task); _context.SaveChanges(); task.owner = _userProvider.getUser(); return(task); }
/// <summary> /// If the assigned unregisters from the task, the board get an email on this event. /// </summary> /// <param name="task">A task that have been revoked by the user and that needs to be reassigned</param> /// <param name="emailAddress">The board's email address</param> public void SendTaskRevokeMail(Data.Task task, string emailAddress) { string taskRevokeSubject = string.Format("Volunteer has unregistered from {0}", task.Description); var mailMessage = new StringBuilder(); mailMessage.Append("This email is to confirm this task is now available and needs to be re-assigned."); mailMessage.AppendFormat("<b> Volunteer Task: {0} </b>", task.Description); mailMessage.AppendFormat("<b> Start Time: {0} </b>", task.StartTime.ToShortTimeString()); mailMessage.AppendFormat("<b> End Time: {0}. </b>", task.EndTime.ToShortTimeString()); SendMail(mailMessage.ToString(), emailAddress, taskRevokeSubject); }
public static Data.Task Map(this Task dcTask) { var task = new Data.Task { ID = dcTask.Id, StartTime = dcTask.StartTime, EndTime = dcTask.EndTime, Capacity = dcTask.Capacity, Description = dcTask.Description, Event_ID = dcTask.EventID }; return(task); }
public ActionResult <Data.Task> PostTask([FromBody] Data.Task task) { // Calculation // task.KeyFigure = new Data.KeyFigure { AvgProcessingTime = 99, TotalProcessingTime = 88, VMax = 77, VMid = 66, VSum = 55 }; return(task); }
public async System.Threading.Tasks.Task UpdateAsync(Data.Task task) { var excluded = new[] { "StatusId", "StartDate", "EndDate" }; var entry = _dbContext.Entry(task); entry.State = EntityState.Modified; foreach (var item in excluded) { entry.Property(item).IsModified = false; } await _dbContext.SaveChangesAsync(); }
/// <summary> /// Returns a shallow-copied list of a single task by task id. /// </summary> public Task GetTaskByTaskId(int taskId) { Task requestedTask = null; Data.Task requestedDbTask = (from t in _appInfo.GcContext.Tasks where t.TaskID == taskId select t).FirstOrDefault(); if (requestedDbTask != null) { requestedTask = Task.CreateTask(requestedDbTask); } return(requestedTask); }
/// <summary> /// Updates the active tasks cached query results when a task is deleted /// </summary> void ActiveTasksOnTaskDeleted(object sender, TaskDeletedEventArgs e) { QueryCacheItem cachedQuery = _appInfo.GlobalQueryCache.GetCacheItem(Constants.ActiveTasksCacheItem); if (cachedQuery != null) { List <Data.Task> activeTasks = (List <Data.Task>)cachedQuery.Value; Data.Task deletedTask = activeTasks.FirstOrDefault(t => t.TaskID == e.DeletedTask.TaskId); if (deletedTask != null) { activeTasks.Remove(deletedTask); _appInfo.GlobalQueryCache.UpdateCacheItem(Constants.ActiveTasksCacheItem, activeTasks); } } }
public TaskDTO GetTaskById(int taskId) { Data.Task tasks = _appRepository.GetTaskById(taskId); TaskDTO DTOTasks = Mapper.Map <TaskDTO>(tasks); List <ParentTaskDTO> parentTaskDTOs = GetParentTasks(); if (parentTaskDTOs.Count > 0) { if (DTOTasks.Parent_Id != null) { DTOTasks.ParentTask = parentTaskDTOs.Where(a => a.Parent_Id == DTOTasks.Parent_Id).Select(a => a.Parent_Task).FirstOrDefault(); } } return(DTOTasks); }
protected override void DataPortal_DeleteSelf() { using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var data = new Data.Task { TaskId = this.ReadProperty(TaskIdProperty) }; ctx.ObjectContext.Tasks.DeleteObject(data); ctx.ObjectContext.SaveChanges(); } }
protected override void DataPortal_DeleteSelf() { using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var data = new Data.Task { TaskId = this.ReadProperty(TaskIdProperty) }; ctx.ObjectContext.Tasks.DeleteObject(data); ctx.ObjectContext.SaveChanges(); } }
protected override void DataPortal_Insert() { using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var data = new Data.Task(); this.Insert(data); ctx.ObjectContext.AddToTasks(data); ctx.ObjectContext.SaveChanges(); this.LoadProperty(TaskIdProperty, data.TaskId); this.LoadProperty(CreatedByProperty, data.CreatedBy); this.LoadProperty(CreatedDateProperty, data.CreatedDate); Csla.DataPortal.UpdateChild(this.ReadProperty(TaskLabelsProperty), this); } }
protected override void DataPortal_Update() { using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var data = new Data.Task { TaskId = this.ReadProperty(TaskIdProperty) }; ctx.ObjectContext.Tasks.Attach(data); this.Update(data); ctx.ObjectContext.SaveChanges(); this.LoadProperty(ModifiedByProperty, data.ModifiedBy); this.LoadProperty(ModifiedDateProperty, data.ModifiedDate); Csla.DataPortal.UpdateChild(this.ReadProperty(TaskLabelsProperty), this); } }
public static Data.Task Map(this Task dcTask) { var task = new Data.Task { ID = dcTask.Id, StartTime = dcTask.StartTime, EndTime = dcTask.EndTime, Capacity = dcTask.Capacity, Description = dcTask.Description, Event_ID = dcTask.EventID }; return task; }