public void AddTaskTest3() { DateTime date; date = DateTime.Parse("16.02.1999 00:00:00"); TasksModel model = new TasksModel("TestTask3", date, 0); AddTask newTask = new AddTask(); newTask.Add(model, connection); var cmdText = $"SELECT * FROM Tasks WHERE [End_Date] = @EndDate " + $"AND [Task] = '{model.Task}' " + $"AND [Preority] = {model.Preority}"; connection.Open(); OleDbCommand TestCommand = new OleDbCommand(cmdText, connection); TestCommand.Parameters.Add(new OleDbParameter("@EndDate", OleDbType.Date)); TestCommand.Parameters["@EndDate"].Value = model.EndDate; if (TestCommand.ExecuteReader().HasRows) { connection.Close(); Assert.Pass(); } else { connection.Close(); Assert.Fail("В таблице нет записи"); } }
public void testGetTask_GetTask() { //Arrange AddTask task1 = new AddTask() { Task = "Task 1", Description = String.Empty, CompletedDate = DateTime.Now.ToString() }; AddTask task2 = new AddTask() { Task = "Task 2", Description = String.Empty, CompletedDate = DateTime.Now.ToString() }; service.addNewTask(task1); service.addNewTask(task2); //Act Task result = service.getTaskById(1); //Assert Assert.AreEqual("Task 1", result.Name); }
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { AddTask l = AddTask.getInstance(); l.Show(); this.Hide(); }
public void testDeleteTask_DeleteAllTasks() { //Arrange AddTask task1 = new AddTask() { Task = "Task 1", Description = String.Empty, CompletedDate = DateTime.Now.ToString() }; AddTask task2 = new AddTask() { Task = "Task 2", Description = String.Empty, CompletedDate = DateTime.Now.ToString() }; AddTask task3 = new AddTask() { Task = "Task 3", Description = String.Empty, CompletedDate = DateTime.Now.ToString() }; service.addNewTask(task1); service.addNewTask(task2); service.addNewTask(task3); //Act service.DeleteAllTasks(); //Assert Assert.AreEqual(0, service.getAllTasks().Count); }
public CustomerTaskContent CreateCustomerReminder(Guid custId, CustomerTaskContent content) { content.TaskId = Guid.NewGuid(); var commandService = _clientFactory.GetCommandServiceClient(); var command = new AddTask { CustomerFirstName = content.FirstName, CustomerId = custId, CustomerLastName = content.LastName, Description = content.Description, DueDateUtc = content.DueDateUtc.HasValue ? (DateTime?)content.DueDateUtc.Value.ToUniversalTime() : null, TaskId = content.TaskId, TaskType = TaskType.Customer, Title = content.Title }; try { commandService.Execute(command); content.TaskType = TaskType.Customer.ToString(); return content; } catch (CommandException ex) { throw ApiHelpers.ServerError(ex.Message, string.Join("\r\n", ex.Errors)); } }
//Reakcja na wciśnięcie przycisku dodaj task - otwiera nowe okno w którym tworzymy task (treść, priorytet, status itp.) private void openAddTaskWindow(object sender, RoutedEventArgs e) { AddTask add = new AddTask(connectionString); add.Owner = this; add.Show(); }
public void CreateAction_CheckAllEnumOptions_FindMissing() { var actionBases = new List <string>() { AddTask.GetInstance().GetType().ToString(), FindTasks.GetInstance().GetType().ToString(), FindYesterdayTasks.GetInstance().GetType().ToString(), FindTodayTasks.GetInstance().GetType().ToString(), }; string message = string.Empty; for (int i = 0; i < Enum.GetNames(typeof(EActionMethod)).Length; i++) { try { var enumChecker = (EActionMethod)i; message = $"Missing action {enumChecker.ToString()}"; var createActionTypeResult = mainController.CreateAction(enumChecker).GetType().ToString(); Assert.That(createActionTypeResult, Is.EqualTo(actionBases[i])); } catch (Exception) { Assert.Fail(message); } } }
public void testGetNextId_Check() { //Arrange AddTask task1 = new AddTask() { Task = "Task 1", Description = String.Empty, CompletedDate = DateTime.Now.ToString() }; AddTask task2 = new AddTask() { Task = "Task 2", Description = String.Empty, CompletedDate = DateTime.Now.ToString() }; service.addNewTask(task1); service.addNewTask(task2); //Act int id = service.getNextId(service.getAllTasks()); //Assert Assert.AreEqual(3, id); }
public ActionResult Edit(AddTask model) { if (model != null && model.Task != null && model.Task.Id > 0) { var ctx = new TaskAssignmentModel(); var task = ctx.Tasks.SingleOrDefault(t => t.Id == model.Task.Id); ctx.Assigns.RemoveRange(task.Assigns); task.ConditionId = model.Task.ConditionId; task.Content = model.Task.Content; task.Date = model.Task.Date; task.SubstationId = model.Task.SubstationId; task.TypeId = model.Task.TypeId; //task.Visible = model.Task.Visible; // Notice: Attendance cascaded delete has been implement in DB by trigger if (model.LeaderId > 0) { Assign leader = new Assign(); leader.MemberId = model.LeaderId; leader.IsLeader = true; leader.TaskId = task.Id; ctx.Assigns.Add(leader); Attendance att = new Attendance(); att.TaskId = model.Task.Id; att.MemberId = model.LeaderId; att.TypeId = Type4Outdoor; // The Type of outside work in DB is 2 (reffer to AttendanceType) att.StartDate = task.Date; att.FinishDate = task.Date; ctx.Attendances.Add(att); } foreach (var item in model.MemberId) { Assign asg = new Assign(); asg.MemberId = item; asg.IsLeader = false; asg.TaskId = task.Id; Attendance att = new Attendance(); att.TaskId = model.Task.Id; att.MemberId = item; att.TypeId = Type4Outdoor; // The Type of outside work in DB is 2 (reffer to AttendanceType) att.StartDate = task.Date; att.FinishDate = task.Date; ctx.Assigns.Add(asg); ctx.Attendances.Add(att); } ctx.SaveChanges(); } if (string.IsNullOrEmpty(model.ReturnAction)) { model.ReturnAction = "Add"; } return(RedirectToAction(model.ReturnAction)); }
public Scheduler.Task NewAddTask(Indexable indexable) { AddTask task; task = new AddTask(this, indexable); task.Source = this; return(task); }
public AddTaskShould() { _storageQueueService = new Mock <IStorageQueueService>(); var addTaskValidator = new Mock <IStorageTaskValidator>(); addTaskValidator.Setup(val => val.Validate(It.IsAny <StorageTask>())).Returns(true); _addTask = new AddTask(_storageQueueService.Object, addTaskValidator.Object); }
public ActionResult addTasks(AddTask task) { if (ModelState.IsValid) { return(Ok(service.addNewTask(task))); } return(BadRequest()); }
private void AddTaskCommandExecute() { CanAddTask = false; AddTaskVM dataContext = new AddTaskVM(changeCanAddTaskToTrue, logedUser); AddTask dialog = new AddTask(); dialog.DataContext = dataContext; dialog.Show(); }
public IActionResult addProject(AddTask proj) { using (SqlConnection con = new SqlConnection(ConString)) using (SqlCommand com = new SqlCommand()) { com.Connection = con; con.Open(); SqlTransaction transaction = con.BeginTransaction(); try { com.CommandText = "select * from tasktype where name=@name"; com.Transaction = transaction; com.Parameters.AddWithValue("@name", proj.TaskType.Name); SqlDataReader dr = null; try { dr = com.ExecuteReader(); } catch (Exception e) { return(NotFound("cos z obiektem tasktype jest nie tak")); } if (dr != null && !dr.HasRows) { dr.Close(); com.CommandText = "insert into tasktype values(@tskname)"; com.Parameters.AddWithValue("@tskname", proj.TaskType.Name); com.ExecuteNonQuery(); dr.Close(); } Console.WriteLine("JESTEM TU"); com.CommandText = "insert into task values((select Max(idtask)+1 from task),@name,@desc,@dedl,@idproj,(select idproject from tasktype where name =@name),@idass,@idcre,)"; com.Parameters.AddWithValue("@name", proj.Name); com.Parameters.AddWithValue("@desc", proj.Description); com.Parameters.AddWithValue("@dedl", proj.DeadLine); com.Parameters.AddWithValue("@idproj", proj.IdTeam); com.Parameters.AddWithValue("@idass", proj.IdAssignedTo); com.Parameters.AddWithValue("@idcre", proj.IdCreator); com.ExecuteNonQuery(); Console.WriteLine("A TERAZ TU"); transaction.Commit(); } catch (Exception e) { transaction.Rollback(); return(NotFound("cos jest nie tak\n" + e)); } transaction.Dispose(); } return(Ok()); }
public async Task CanExecuteSimpleWorkflow() { var serviceProvider = CreateServiceProvider(); var scriptEvaluator = CreateWorkflowScriptEvaluator(serviceProvider); var localizer = new Mock <IStringLocalizer <AddTask> >(); var stringBuilder = new StringBuilder(); var output = new StringWriter(stringBuilder); var addTask = new AddTask(scriptEvaluator, localizer.Object); var writeLineTask = new WriteLineTask(scriptEvaluator, localizer.Object, output); var setOutputTask = new SetOutputTask(scriptEvaluator, new Mock <IStringLocalizer <SetOutputTask> >().Object); var workflowType = new WorkflowType { Id = 1, WorkflowTypeId = IdGenerator.GenerateId(), Activities = new List <ActivityRecord> { new ActivityRecord { ActivityId = "1", IsStart = true, Name = addTask.Name, Properties = JObject.FromObject(new { A = new WorkflowExpression <double>("input(\"A\")"), B = new WorkflowExpression <double>("input(\"B\")"), }) }, new ActivityRecord { ActivityId = "2", Name = writeLineTask.Name, Properties = JObject.FromObject(new { Text = new WorkflowExpression <string>("lastResult().toString()") }) }, new ActivityRecord { ActivityId = "3", Name = setOutputTask.Name, Properties = JObject.FromObject(new { Value = new WorkflowExpression <string>("lastResult()"), OutputName = "Sum" }) } }, Transitions = new List <Transition> { new Transition { SourceActivityId = "1", SourceOutcomeName = "Done", DestinationActivityId = "2" }, new Transition { SourceActivityId = "2", SourceOutcomeName = "Done", DestinationActivityId = "3" } } }; var workflowManager = CreateWorkflowManager(serviceProvider, new IActivity[] { addTask, writeLineTask, setOutputTask }, workflowType); var a = 10d; var b = 22d; var expectedSum = a + b; var expectedResult = expectedSum.ToString() + System.Environment.NewLine; var workflowExecutionContext = await workflowManager.StartWorkflowAsync(workflowType, input : new RouteValueDictionary(new { A = a, B = b })); var actualResult = stringBuilder.ToString(); Assert.Equal(expectedResult, actualResult); Assert.True(workflowExecutionContext.Output.ContainsKey("Sum")); Assert.Equal(expectedSum, (double)workflowExecutionContext.Output["Sum"]); }
public void When(AddTask c) { var nextRecord = _state.GetNext(g => new TaskId(g)); if (!_state.StoryExists(c.StoryId)) { throw Error("Story {0} was not found", c.StoryId); } Apply(new TaskAdded(nextRecord, c.Text, c.StoryId)); }
private void ShowAddTask() { AddTask addTask = new AddTask { DataContext = new AddTaskViewModel(WindowMessenger) }; addTask.Owner = App.Current.MainWindow; App.Current.MainWindow = addTask; addTask.ShowDialog(); }
public IHttpActionResult addtask(AddTask t) { try { DataManager.addtask(t); return(Ok()); } catch (Exception) { return(InternalServerError()); } }
//--------------------------------------------------------------------------------Tasks editing private void button_AddTask_Click(object sender, EventArgs e) { AddTask addTask = new AddTask(); addTask.ShowDialog(); if (addTask.success()) { ActionRegistrator.addRecord(DateTime.Now, Misc.getMethodName(), userName, addTask.resultName); this.addTask(addTask.resultDate, addTask.resultName, addTask.description); savedInstanceManager.addTask(addTask.resultDate, addTask.resultName, addTask.description); } }
///TODO: Fix this. Remove field names and use viewmode and retrun to edit or list public ActionResult AddTask(AddTask task) { var newTask = sdnApps.Tasks.FirstOrDefault(m => m.Title == task.Title); newTask = new Task { Title = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(task.Title), DueDate = Convert.ToDateTime(task.DueDate), Done = false, PersonID = task.PersonID }; sdnApps.Tasks.Add(newTask); sdnApps.SaveChanges(); return(RedirectToAction("AddTask", new { taskName = task.Title })); }
private void addTask(Object sender, EventArgs args) { AddTask at = new AddTask(); if (at.ShowDialog(this) == DialogResult.OK) { System.Diagnostics.Debug.Write("TRUE" + System.Environment.NewLine); Program.getProgram().addTask(at.getNewTask()); refreshTasks(Program.getProgram().getTasks(System.DateTime.Now)); changeToTask(); this.task = true; } }
static void Main(string[] args) { List <TaskModel> tasksModel = new List <TaskModel>(); string comment = ""; ConsoleEx.WriteLine("Witam w Managerze Zadań ToDo".PadRight(50, '>').PadLeft(60, '<'), ConsoleColor.Red); //poprawic padleft i right ConsoleEx.WriteLine("W razie pomocy wpisz komendę HELP".PadRight(50, '>').PadLeft(60, '<'), ConsoleColor.Blue); do { ConsoleEx.Write("Wpisz komendę: ", ConsoleColor.Blue); comment = Console.ReadLine().ToLower(); if (Enum.GetNames(typeof(Comments)).Contains(comment)) { if (comment == Comments.help.ToString()) { ConsoleEx.Write("Lista dostępnych komend: ", ConsoleColor.Blue); ConsoleEx.WriteLine(string.Join("; ", Enum.GetNames(typeof(Comments))), ConsoleColor.Yellow); } if (comment == Comments.add.ToString()) { AddTask.Add(tasksModel); } if (comment == Comments.clear.ToString()) { Console.Clear(); } if (comment == Comments.remove.ToString()) { RemoveTask.Delete(tasksModel); } if (comment == Comments.load.ToString()) { LoaderTasks.Load(tasksModel); } if (comment == Comments.save.ToString()) { SaveTasks.Save(tasksModel); } if (comment == Comments.show.ToString()) { Show.ShowAll(tasksModel); } Console.WriteLine("hej"); } else { Console.WriteLine("Wpisałeś złą komendę"); } } while (comment != "exit"); }
public List <Task> addNewTask(AddTask task) { DateTime date = DateTime.Parse(task.CompletedDate); Task newTask = new Task( Id: getNextId(Tasks), Name: task.Task, Description: task.Description, CompletedDate: date, Jobs: new List <Job>(), Status: TasksModels.Status.ToDo); Tasks.Add(newTask); return(Tasks); }
/// <summary> /// clears the form /// </summary> private void Clear(object obj) { AddTask addTask = new AddTask { DataContext = this }; ErrorMessage = null; Message = null; ResetInputBoxes(); if (obj is System.Windows.Controls.UserControl) { (obj as System.Windows.Controls.UserControl).Content = addTask; } }
public ActionResult Add(AddTask model) { // Only invoke in Add.cshtml Task t = model.Task; var ctx = new TaskAssignmentModel(); t.Visible = true; ctx.Tasks.Add(t); if (model.LeaderId > 0) { Assign leader = new Assign(); leader.MemberId = model.LeaderId; leader.IsLeader = true; leader.TaskId = t.Id; ctx.Assigns.Add(leader); Attendance att = new Attendance(); att.TaskId = t.Id; att.MemberId = model.LeaderId; att.StartDate = t.Date; att.FinishDate = t.Date; ctx.Attendances.Add(att); } foreach (var item in model.MemberId) { Assign asg = new Assign(); asg.MemberId = item; asg.IsLeader = false; asg.TaskId = t.Id; Attendance att = new Attendance(); att.TaskId = t.Id; att.MemberId = item; att.TypeId = Type4Outdoor; // The Type of outside work in DB is 2 (reffer to AttendanceType) att.StartDate = t.Date; att.FinishDate = t.Date; ctx.Assigns.Add(asg); ctx.Attendances.Add(att); } ctx.SaveChanges(); ViewBag.Success = true; ViewBag.Message = "该工作已添加。"; return(View()); }
public void testUpdateTask_UpdateTaskStatus() { //Arrange AddTask addTask = new AddTask() { Task = "Task 1", Description = String.Empty, CompletedDate = DateTime.Now.ToString() }; service.addNewTask(addTask); //Act service.UpdateTaskStatus(1, Status.Done); Task result = service.getTaskById(1); //Assert Assert.AreEqual(Status.Done, result.Status); }
public void testupdateJob_UpdateStatusOfJob() { //Arrange AddTask addTask = new AddTask() { Task = "Task 1", Description = String.Empty, CompletedDate = DateTime.Now.ToString() }; service.addNewTask(addTask); service.AddJob(1, "Job 1"); //Act Task result = service.UpdateJobDone(1, 1, true).First(); //Assert Assert.IsTrue(result.Jobs.First().Done); }
public void testupdateJob_UpdateNameOfJob() { //Arrange AddTask addTask = new AddTask() { Task = "Task 1", Description = String.Empty, CompletedDate = DateTime.Now.ToString() }; service.addNewTask(addTask); service.AddJob(1, "Job 1"); //Act Task result = service.UpdateJobName(1, 1, "Job 2").First(); //Assert Assert.AreEqual("Job 2", result.Jobs.First().Name); }
public void Setup() { connection.Open(); OleDbCommand TruncateCommand = new OleDbCommand("DELETE FROM Tasks", connection); TruncateCommand.ExecuteNonQuery(); connection.Close(); DateTime date; date = DateTime.Today; TasksModel model; AddTask newTask = new AddTask(); for (int Item = 0; Item < 100; Item++) { model = new TasksModel($"TestTask №{Item}", date, Item); newTask.Add(model, connection); } }
/// <summary> /// shows the add task user control /// </summary> private void AddTasks(object obj) { LeftUserControl = null; if (LeftUserControl == null) { AddTaskViewModel addTaskViewModel = new AddTaskViewModel(CurrentUser); AddTask addTasks = new AddTask { DataContext = addTaskViewModel }; LeftUserControl = addTasks; WelcomeMessage = null; } else { LeftUserControl = null; } }
public TaskModelRecursive AddTask(AddTask taskToAdd) { var task = mapper.Map<Task>(taskToAdd); var taskReturn = mapper.Map<TaskModelRecursive>(taskToAdd); if (taskToAdd.MainPerformer != null) { var mainPerformer = unitOfWork.UserRepository.GetByID(taskToAdd.MainPerformer); task.MainPerformer = mainPerformer; } else { task.MainPerformer = null; } var project = unitOfWork.ProjectRepository.GetByID(taskToAdd.ProjectId); task.Project = project; var taskStatus = unitOfWork.TaskStatusRepository.Get(x => (int)x.Name == taskToAdd.TaskStatusId).SingleOrDefault(); task.TaskStatus = taskStatus; if (taskToAdd.ParentTaskId != null) { var parentTask = unitOfWork.TaskRepository.GetByID(taskToAdd.ParentTaskId); task.ParenTask = parentTask; } else { task.ParenTask = null; } unitOfWork.TaskRepository.Insert(task); unitOfWork.Save(); taskReturn.ID = task.ID; taskReturn.Children = new List<TaskModelRecursive>(); return taskReturn; }
public Scheduler.Task NewAddTask (Indexable indexable) { AddTask task; task = new AddTask (this, indexable); task.Source = this; return task; }
public ActionResult Save(SampleRequestSaveViewModel model) { if (model.SampleRequestId == null) throw new InvalidOperationException("SampleRequstid is null"); if (model.FollowUpDate == DateTime.MinValue) throw new InvalidOperationException("FollowUpDate is incorrect"); if (model.DeliveryDate == DateTime.MinValue) throw new InvalidOperationException("DeliveryDate is incorrect"); var sampleRequest = _customersQuery.GetSampleRequest(model.SampleRequestId); var completeSrCommand = new CompleteSampleRequest { SampleRequestId = sampleRequest.SampleRequestId, DeliveryDateUtc = model.DeliveryDate.ToUniversalTime() }; _clientFactory.GetCommandServiceClient().Execute(completeSrCommand); var followUpTask = new AddTask { TaskId = Guid.NewGuid(), SampleRequestId = sampleRequest.SampleRequestId, TaskType = TaskType.ProductSampleRequestFollowUp, CustomerFirstName = sampleRequest.FirstName, CustomerLastName = sampleRequest.LastName, CustomerId = sampleRequest.CustomerId, DueDateUtc = model.FollowUpDate.ToUniversalTime(), Title = "[NL] SampleRequestFollow-Up" }; sampleRequest.FollowUpTaskId = followUpTask.TaskId; _clientFactory.GetCommandServiceClient().Execute(followUpTask); var deliveryTask = new AddTask { TaskId = Guid.NewGuid(), SampleRequestId = sampleRequest.SampleRequestId, TaskType = TaskType.ProductSampleDelivery, CustomerFirstName = sampleRequest.FirstName, CustomerLastName = sampleRequest.LastName, CustomerId = sampleRequest.CustomerId, DueDateUtc = model.DeliveryDate.ToUniversalTime(), Title = "[NL] Product Sample Delivery" }; _clientFactory.GetCommandServiceClient().Execute(deliveryTask); return Json("Tasks were created"); }