Пример #1
0
        public int AddToDo(ToDo item)
        {
            string query = "IF NOT EXISTS (select [ToDo].[Name], [ToDo].[StatusId] from [ToDo] where Name = @Name and StatusId <>3)" +
                        "INSERT INTO [ToDo] ([ToDo].[Name], [ToDo].[StatusId], [ToDo].[Level], [ToDo].[CreateDate])  " +
                        "VALUES( @Name, @StatusId, @Level, @CreateDate);";

             using (SqlConnection con = new SqlConnection(_connectionString))
             {
            SqlCommand cmd = new SqlCommand(query, con);
            con.Open();
            cmd.Parameters.Add("@Name", SqlDbType.NVarChar, 50).Value = item.Name;
            cmd.Parameters.Add("@StatusId", SqlDbType.Int, 50).Value = 1;
            cmd.Parameters.Add("@Level", SqlDbType.Int, 50).Value = item.Level;
            cmd.Parameters.Add("@CreateDate", SqlDbType.DateTime, 50).Value = DateTime.Now;
            cmd.Parameters.Add("@Id", SqlDbType.Int).Direction = ParameterDirection.Output;

            cmd.ExecuteNonQuery();
            cmd.Parameters.Clear();
            cmd.CommandText = "SELECT @@IDENTITY";

            int id = Convert.ToInt32(cmd.ExecuteScalar());

            return id;
             }
        }
 public void TestToDoCreatePost()
 {
     var newTask = new ToDo { Id = 7, IsDone = false, Description = "7th description" };
     var controller = CreateToDoController(newTask);
     var result = controller.Create(newTask).Result;
     Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult));
     Assert.AreEqual(true, MockingHelper.DBContext.ToDoes.Any(t => t.Id == newTask.Id));
 }
 public void TestToDoCreatePostInvalidModel()
 {
     var newTask = new ToDo { };
     var controller = CreateToDoController(newTask);
     controller.ModelState.AddModelError("Description", "Description is required.");
     var result = controller.Create(newTask).Result;
     Assert.IsInstanceOfType(result, typeof(ViewResult));
 }
Пример #4
0
 /// <summary>
 /// Handles the Click event of the btnAdd control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if(!string.IsNullOrEmpty(txtToDo.Text)) {
     ToDo toDo = new ToDo();
     toDo.ToDoX = txtToDo.Text;
     toDo.Save(WebUtility.GetUserName());
     LoadToDo();
     txtToDo.Text = string.Empty;
       }
 }
 public void TestToDoDelete()
 {
     var controller = CreateToDoController();
     var toDo = new ToDo { Id = 9, Description = "9th description", IsDone = false };
     MockingHelper.AddToDo(toDo);
     var result = controller.Delete(toDo.Id).Result;
     Assert.IsInstanceOfType(result, typeof(ViewResult));
     var dataModel = (result as ViewResult).Model as ToDo;
     Assert.AreEqual(toDo.Id, dataModel.Id);
 }
Пример #6
0
 private async void LoadToDo(int id = 0){
     if (id == 0)
     {
         DataContext = new ToDo();
     }
     else
     {
         var database = await GetDatabase();
         DataContext = await database.GetToDoById(id);
     }
 }
 public async Task <ToDo> UpdateToDo(ToDo todo)
 {
     return(await _toDoRepository.UpdateToDo(todo));
 }
Пример #8
0
        public ToDo Get(int id)
        {
            ToDo model = repository.GetById(id);

            return(model);
        }
Пример #9
0
        private void BindDataGrid()
        {
            dgComments.Columns[1].HeaderText = LocRM.GetString("Text");
            dgComments.Columns[2].HeaderText = LocRM.GetString("CreatedBy");
            dgComments.Columns[3].HeaderText = LocRM.GetString("CreationDate");


            foreach (DataGridColumn dgc in dgComments.Columns)
            {
                if (dgc.SortExpression == pcCurrentUser["c_SortColumn"].ToString())
                {
                    dgc.HeaderText += "&nbsp;<img border='0' align='absmiddle' width='9px' height='5px' src='../layouts/images/upbtnF.jpg'/>";
                }
                else if (dgc.SortExpression + " DESC" == pcCurrentUser["c_SortColumn"].ToString())
                {
                    dgc.HeaderText += "&nbsp;<img border='0' align='absmiddle' width='9px' height='5px' src='../layouts/images/downbtnF.jpg'/>";
                }
            }

            DataTable dt = new DataTable();

            switch (sType)
            {
            case "Project":
            {
                dt = Project.GetListDiscussionsDataTable(ProjID);
                break;
            }

            case "Task":
            {
                dt = Task.GetListDiscussionsDataTable(TaskID);
                break;
            }

            case "ToDo":
            {
                dt = ToDo.GetListDiscussionsDataTable(ToDoID);
                break;
            }

            case "Event":
            {
                dt = CalendarEntry.GetListDiscussionsDataTable(EventID);
                break;
            }

            case "Incident":
            {
                dt = Incident.GetListDiscussionsDataTable(IncidentID);
                break;
            }

            case "Document":
            {
                dt = Document.GetListDiscussionsDataTable(DocumentID);
                break;
            }

            default:
            {
                break;
            }
            }

            DataView dv = dt.DefaultView;

            try
            {
                dv.Sort = pcCurrentUser["c_SortColumn"];
            }
            catch
            {
                pcCurrentUser["c_SortColumn"] = "CreationDate DESC";
                dv.Sort = pcCurrentUser["c_SortColumn"];
            }
            dgComments.DataSource = dt.DefaultView;

            if (pcCurrentUser["c_PageSize"] != null)
            {
                dgComments.PageSize = int.Parse(pcCurrentUser["c_PageSize"]);
            }


            if (pcCurrentUser["c_Page"] != null)
            {
                int pageindex = int.Parse(pcCurrentUser["c_Page"]);
                int ppi       = dt.Rows.Count / dgComments.PageSize;
                if (dt.Rows.Count % dgComments.PageSize == 0)
                {
                    ppi = ppi - 1;
                }

                if (pageindex <= ppi)
                {
                    dgComments.CurrentPageIndex = pageindex;
                }
                else
                {
                    dgComments.CurrentPageIndex = 0;
                }
            }

            dgComments.DataBind();
            foreach (DataGridItem dgi in dgComments.Items)
            {
                ImageButton ib = (ImageButton)dgi.FindControl("ibDelete");
                if (ib != null)
                {
                    ib.Attributes.Add("onclick", "return confirm('" + LocRM.GetString("tWarning") + "')");
                }
            }
        }
Пример #10
0
 public int Post(ToDo newTodo)
 {
     return _repository.AddToDo(newTodo);
 }
 public void MovingNullToDoToLast_HasNoEffect()
 {
     ToDo nullToDo = new ToDo { ID = 0, UserName = null, OrderID = 0 };
     controller.MoveToDoDownToLastInPriority(nullToDo.ID, nullToDo.UserName);
     Assert.AreEqual(0, nullToDo.OrderID);
 }
 public void TestToDoEditPostInvalidModel()
 {
     var controller = CreateToDoController();
     var toDo = new ToDo { Id = 5,  IsDone = false };
     MockingHelper.AddToDo(toDo);
     controller.ModelState.AddModelError("Description", "Description is required.");
     var result = controller.Edit(toDo).Result;
     Assert.IsInstanceOfType(result, typeof(ViewResult));
 }
 public void MovingFirstToDoUpInPriority_HasNoEffectOnOrderID()
 {
     ToDo firstToDo = fakeToDoDBContext.ToDos.First();
     controller.MoveToDoUpInPriorityByToDo(firstToDo);
     Assert.AreEqual(1, firstToDo.OrderID);
 }
 public void MovingFirstToDoToLast_HasUpdatedOrderIDToMaxPlusOne()
 {
     ToDo firstToDo = fakeToDoDBContext.ToDos.First();
     controller.MoveToDoDownToLastInPriority(firstToDo.ID, firstToDo.UserName);
     Assert.AreEqual(5, firstToDo.OrderID);
 }
Пример #15
0
 private void SetCommand(int command)
 {
     Interlocked.Exchange(ref _command, command);
     ToDo.Set();
 }
Пример #16
0
        /// <summary>
        /// The thread of the Mutex. This whole complex logic is needed because we have serious problems
        /// with releasing the mutex from a separate thread. Mutex.Dispose() silently fails when you try to
        /// release the mutex so you have to use Mutex.ReleaseMutex(). It is not possible to release the mutex
        /// from another thread and this was something hard to achieve in an async/await environment with
        /// multi-platform compatibility. For example Semaphore is not supporting linux.
        /// So to ensure that the mutex is created and released on the same thread we have created
        /// a separate thread and control it from outside.
        /// </summary>
        private void HoldLock(object cancellationTokenObj)
        {
            CancellationToken ct = cancellationTokenObj is CancellationToken token
                                ? token
                                : CancellationToken.None;

            while (true)
            {
                try
                {
                    // Wait for until we have something to do. The procedure is to set _command variable then
                    // signal with ToDo then wait until the Done is set.
                    ToDo.WaitOne();

                    if (Interlocked.CompareExchange(ref _command, 0, 1) == 1)
                    {
                        // Create the mutex and acquire it. InitiallyOwned means that if the mutex is not
                        // exists then create it and immediately acquire it.
                        Mutex = new Mutex(initiallyOwned: true, FullName, out bool createdNew);
                        if (createdNew)
                        {
                            continue;
                        }
                        else
                        {
                            // The mutex already exists so we will try to acquire it.
                            var  start    = DateTimeOffset.UtcNow;
                            bool acquired = false;

                            // Timeout logic.
                            while (true)
                            {
                                if (DateTimeOffset.UtcNow - start > TimeSpan.FromSeconds(90))
                                {
                                    throw new TimeoutException("Could not acquire mutex in time.");
                                }

                                // Block for n ms and try to acquire the mutex. Blocking is not a problem
                                // we are on our own thread.
                                acquired = Mutex.WaitOne(1000);

                                if (acquired)
                                {
                                    break;
                                }

                                if (ct != CancellationToken.None)
                                {
                                    if (ct.IsCancellationRequested)
                                    {
                                        throw new OperationCanceledException();
                                    }
                                }
                            }

                            if (acquired)
                            {
                                // Go to finally.
                                continue;
                            }

                            // Let it go and throw the exception...
                        }
                    }
                    else if (Interlocked.CompareExchange(ref _command, 0, 2) == 2)
                    {
                        // Command 2 is releasing the mutex.
                        Mutex?.ReleaseMutex();
                        Mutex?.Dispose();
                        Mutex = null;
                        return;                         // End of the Thread.
                    }

                    // If we get here something went wrong.
                    throw new NotImplementedException($"{nameof(AsyncMutex)} thread operation failed in {ShortName}.");
                }
                catch (Exception ex)
                {
                    // We had an exception so store it and jump to finally.
                    lock (LatestHoldLockExceptionLock)
                    {
                        LatestHoldLockException = ex;
                    }

                    // Terminate the Thread.
                    return;
                }
                finally
                {
                    ToDo.Reset();
                    Done.Set();                     // Indicate that we are ready with the current command.
                }
            }
        }
Пример #17
0
        public IActionResult DeleteTask(int id)
        {
            ToDo item = TaskDB.GetTask(context, id);

            return(View(item));
        }
Пример #18
0
        // PUT api/todo/5
        public ToDo Put(ToDo todo, string id)
        {
            Guid guid;
            Guid.TryParse(id, out guid);

            if (todo != null && todo.Id != null)
                todo.Id = guid;

            var result = todoRepository.Update(todo);
            return todo;
        }
Пример #19
0
        protected void lbDeleteToDoAll_Click(object sender, System.EventArgs e)
        {
            int ToDoId = int.Parse(hdnID.Value);

            ToDo.Delete(ToDoId);
        }
Пример #20
0
 public void WhenICreate()
 {
     this.Todo = new ToDo("uma descrição qualquer");
 }
 public void Update(ObjectId id, ToDo p)
 {
 }
Пример #22
0
        private static void TestToDoOperations()
        {
            var job1 = new ToDo()
            {
                Title = "iTracker on App Store",
                Description = "A GPS based telemetry logger that stores real-time location data at user defined intervals. Journey information can be displayed on an interactive map or through the built-in CSV and GPX viewer. Routes exported via email can be imported into third party software that support both Comma-separated and GPS eXchange file formats. Waypoints can be graphically or manually bookmarked, then imported and exported via the clipboard.",
                Uuid = "FA507E77-D86D-46FE-885F-A2E4E48266E4",
                AssignedDate = "16/10/13",
                EstimatedDate = "01/11/13",
                CompletedDate = "03/12/2013",
                Status = "Ready for Sale",
                Image = "",
                Signature = "iPhone"
            };

            var job1b = new ToDo()
            {
                Title = "iTracker on App Store",
                Description = "A GPS based telemetry logger that stores real-time location data at user defined intervals. Journey information can be displayed on an interactive map or through the built-in CSV and GPX viewer. Routes exported via email can be imported into third party software that support both Comma-separated and GPS eXchange file formats. Waypoints can be graphically or manually bookmarked, then imported and exported via the clipboard.",
                Uuid = "DFD00AD7-BD17-4528-B6AD-DBBC44AE7FC9",
                AssignedDate = "16/10/13",
                EstimatedDate = "01/11/13",
                CompletedDate = "03/12/2013",
                Status = "Ready for Sale",
                Image = "",
                Signature = "iOS Simulator"
            };

            var job2 = new ToDo()
            {
                Title = "iWebsearch on App Store",
                Description = "Designed to speed up the process required when submitting a single search term to multiple search engines. By simply tapping on the desired search engine the user can scroll through the list then repeat the process by navigating back and tapping an alternative search engine. Bookmarked results can be viewed then exported via email in a Comma-separated format.",
                Uuid = "FA507E77-D86D-46FE-885F-A2E4E48266E4",
                AssignedDate = "03/12/2013",
                EstimatedDate = "06/12/2013",
                CompletedDate = "12/12/2013",
                Status = "Ready for Sale",
                Image = "",
                Signature = "iPhone"
            };

            var job2b = new ToDo()
            {
                Title = "iWebsearch on App Store",
                Description = "Designed to speed up the process required when submitting a single search term to multiple search engines. By simply tapping on the desired search engine the user can scroll through the list then repeat the process by navigating back and tapping an alternative search engine. Bookmarked results can be viewed then exported via email in a Comma-separated format.",
                Uuid = "DFD00AD7-BD17-4528-B6AD-DBBC44AE7FC9",
                AssignedDate = "03/12/2013",
                EstimatedDate = "06/12/2013",
                CompletedDate = "-",
                Status = "In Review",
                Image = "",
                Signature = "iOS Simulator"
            };

            var jobRepository = new MongoDbRepository<ToDo>();

            Console.WriteLine("Inserting job1 for iPhone");
            var insertResult1 = jobRepository.Insert(job1);

            Console.WriteLine("Inserting job1b for iOS Simulator");
            var insertResult3 = jobRepository.Insert(job1b);

            Console.WriteLine("Inserting job2 for iPhone");
            var insertResult2 = jobRepository.Insert(job2);

            Console.WriteLine("Inserting job2b for iOS Simulator");
            var insertResult4 = jobRepository.Insert(job2b);

            Console.WriteLine("Updating job2B status");
            job2b.Status = "Ready for Sale";
            var updateResult = jobRepository.Update(job2b);

            Console.WriteLine("Updating job2B completed date");
            job2b.CompletedDate = "12/12/2013";
            var updateResult2 = jobRepository.Update(job2b);

            Console.WriteLine("Searching jobs for 'In Review' Status");
            var searchResult = jobRepository.SearchFor(c => c.Status == "Ready for Sale");

            Console.WriteLine("Get all jobs");
            var getAllResult = jobRepository.GetAll();

            Console.WriteLine("Getting job by id");
            var getByIdResult = jobRepository.GetById(job1.Id);

            //Console.WriteLine("Deleting job");
            //var deleteResult = jobRepository.Delete(job2b);
        }
Пример #23
0
        public async Task <IEnumerable <ToDo> > GetAllToDoList(ToDo model)
        {
            _result = await _context.ToDo.ToListAsync();

            return(_result);
        }
Пример #24
0
 public async Task<int> AddNewToDo(ToDo item)
 {
     var result = await _dbConnection.InsertAsync(item);
     return result;
 }
Пример #25
0
        public async Task <IEnumerable <ToDo> > GetAllToDoListAsUser(ToDo model)
        {
            _result = await _context.ToDo.Where(todo => todo.UserId == model.UserId).ToListAsync();

            return(_result);
        }
Пример #26
0
        public void Insert(string ToDoX,string CreatedBy,DateTime CreatedOn,string ModifiedBy,DateTime ModifiedOn)
        {
            ToDo item = new ToDo();

            item.ToDoX = ToDoX;

            item.CreatedBy = CreatedBy;

            item.CreatedOn = CreatedOn;

            item.ModifiedBy = ModifiedBy;

            item.ModifiedOn = ModifiedOn;

            item.Save(UserName);
        }
Пример #27
0
 public void Create(ToDo obj)
 {
     throw new System.NotImplementedException();
 }
Пример #28
0
        /// <summary>
        /// The post.
        /// </summary>
        /// <param name="model">
        /// The model.
        /// </param>
        /// <returns>
        /// The <see cref="HttpResponseMessage"/>.
        /// </returns>
        public HttpResponseMessage Post(ToDoModel model)
        {
            var todo = new ToDo(model.Description);

            try
            {
                this.service.CreateToDo(todo);
            }
            catch (Exception)
            {
                return new HttpResponseMessage(HttpStatusCode.BadRequest);
            }

            return new HttpResponseMessage(HttpStatusCode.Created);
        }
 public IActionResult Update(ToDo toDo)
 {
     _toDoRepository.Update(toDo);
     return(View("Index", _toDoRepository.GetAll()));
 }
Пример #30
0
 public void put([FromBody] ToDo value)
 {
     repository.Update(value);
     repository.Save();
 }
Пример #31
0
 // Update Todos
 public Task <int> UpdateTodosAsync(ToDo taskr)
 {
     return(_toDosDatabase.UpdateAsync(taskr));
 }
Пример #32
0
 public void post([FromBody] ToDo value)
 {
     repository.Insert(value);
     repository.Save();
 }
Пример #33
0
 public void Remove(ToDo todo)
 {
     context.Remove(todo);
 }
Пример #34
0
 protected void btnResumeToDo_ServerClick(object sender, System.EventArgs e)
 {
     ToDo.ResumeToDo(ToDoID);
     Util.CommonHelper.ReloadTopFrame("ActiveWork.ascx", GetLink(), Response);
 }
Пример #35
0
 // POST api/todo
 public HttpResponseMessage Post(ToDo todo)
 {
     var result = todoRepository.Insert(todo);
     var response = Request.CreateResponse<ToDo>(HttpStatusCode.Created, todo);
     return response;
 }
Пример #36
0
 // Save registers
 public Task <int> SaveTodosAsync(ToDo taskr)
 {
     return(_toDosDatabase.InsertAsync(taskr));
 }
Пример #37
0
 // Use this for initialization
 void Start()
 {
     table    = GetComponent <SpriteRenderer>().sprite;
     toDoList = GameObject.Find("ToDoText").GetComponent <ToDo>();
 }
Пример #38
0
 public void Add(ToDo todo)
 {
     context.ToDos.Add(todo);
 }
Пример #39
0
        public IActionResult AddTask()
        {
            var newTask = new ToDo();

            return(this.PartialView("PartialTask"));
        }
Пример #40
0
 public void Add(ToDo item)
 {
     _table.InsertOnSubmit(item);
     _context.SubmitChanges();
 }
Пример #41
0
 public void Delete(ToDo toDo)
 {
     UnitOfWork.ToDos.Remove(toDo);
     UnitOfWork.Complete();
 }
 public void TestToDoEditPost()
 {
     var controller = CreateToDoController();
     var toDo = new ToDo { Id = 6, Description = "6th description", IsDone = false };
     MockingHelper.AddToDo(toDo);
     toDo.IsDone = true;
     var result = controller.Edit(toDo).Result;
     Assert.IsInstanceOfType(result, typeof(RedirectToRouteResult));
 }
Пример #43
0
        public IActionResult DeleteTask(int Id)
        {
            ToDo td = _db.ToDo.Find(Id);

            return(View(td));
        }
 public void TestToDoIndex()
 {
     var controller = CreateToDoController();
     var toDo = new ToDo { Id = 1, Description = "Test desc", IsDone = false};
     MockingHelper.AddToDo(toDo);
     var result = controller.Index();
     Assert.IsInstanceOfType(result, typeof(ViewResult));
     var model = (result as ViewResult).Model as IEnumerable<ToDo>;
     Assert.IsNotNull(model);
     Assert.AreEqual(true, model.Any(t => t.Id == toDo.Id));
 }
Пример #45
0
 public IActionResult DeleteTask(ToDo td)
 {
     _db.ToDo.Remove(td);
     _db.SaveChanges();
     return(RedirectToAction("TaskList"));
 }
Пример #46
0
 private async void ClipBoard(object sender, EventArgs e)
 {
     var  mi   = ((MenuItem)sender);
     ToDo item = (ToDo)mi.CommandParameter;
     await Clipboard.SetTextAsync(item.Body);
 }
Пример #47
0
 public AddNoteViewModel(ToDo toDo, User currentUser)
 {
     _toDo = toDo;
     _user = currentUser;
     model = new DataModel(_user);
 }
 public void TestToDoDeleteWithValidIdAndUnauthorizedUser()
 {
     var controller = CreateToDoController();
     var toDo = new ToDo { Id = 8, Description = "8th description", IsDone = false };
     MockingHelper.AddToDo(toDo, false);
     var result = controller.Delete(toDo.Id).Result;
     Assert.IsInstanceOfType(result, typeof(HttpStatusCodeResult));
     var httpResult = result as HttpStatusCodeResult;
     Assert.AreEqual((int)HttpStatusCode.Unauthorized, httpResult.StatusCode);
 }
Пример #49
0
        public IEnumerable<ToDo> GetAllToDoS()
        {
            List<ToDo> toDoS = new List<ToDo>();
             string query = string.Format("SELECT ToDo.Id, ToDo.Name, Status.StatusName, ToDo.Level, ToDo.CreateDate" +
                                      " FROM [ToDo]  LEFT JOIN [Status]  ON [ToDo].[StatusId] = [Status].[Id] " +
                                      "where [ToDo].[StatusId] <> 3");

             using (SqlConnection con = new SqlConnection(_connectionString))
             {
            SqlCommand cmd = new SqlCommand(query, con);
            {
               con.Open();
               SqlDataReader reader = cmd.ExecuteReader();
               while (reader.Read())
               {
                  var toDo = new ToDo
                              {
                                 Id = reader.GetInt32(0),
                                 Name = reader.GetString(1),
                                 StatusName = reader.GetString(2),
                                 Level = reader.GetInt32(3),
                                 CreateDate = reader.GetDateTime(4)
                              };
                  toDoS.Add(toDo);
               }
            }
             }
             return toDoS.ToArray();
        }
Пример #50
0
 public async Task<int> DeleteToDo(ToDo item)
 {
     var result = await _dbConnection.DeleteAsync(item);
     return result;
 }
Пример #51
0
        public IEnumerable<ToDo> GetToDosByStatusName(string statusName)
        {
            List<ToDo> toDoS = new List<ToDo>();

             SqlParameter param = new SqlParameter { ParameterName = "@StatusName", Value = statusName };
             string query = string.Format("SELECT [ToDo].[Id], [ToDo].[Name], [ToDo].[StatusId],  [Status].[StatusName]" +
                                      "FROM [ToDo] LEFT JOIN [Status]  ON [ToDo].[StatusId] = [Status].[Id]" +
                                      "WHERE [Status].[StatusName] = @StatusName;");

             using (SqlConnection con = new SqlConnection(_connectionString))
             {
            SqlCommand cmd = new SqlCommand(query, con);
            con.Open();
            cmd.Parameters.Add(param);
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
               ToDo toDo = new ToDo();
               toDo.Id = reader.GetInt32(0);
               toDo.Name = reader.GetString(1);
               toDo.StatusName = reader.GetString(3);

               toDoS.Add(toDo);
            }
             }
             return toDoS.ToArray();
        }
Пример #52
0
        public void Update(int ToDoId,string ToDoX,string CreatedBy,DateTime CreatedOn,string ModifiedBy,DateTime ModifiedOn)
        {
            ToDo item = new ToDo();

                item.ToDoId = ToDoId;

                item.ToDoX = ToDoX;

                item.CreatedBy = CreatedBy;

                item.CreatedOn = CreatedOn;

                item.ModifiedBy = ModifiedBy;

                item.ModifiedOn = ModifiedOn;

            item.MarkOld();
            item.Save(UserName);
        }
Пример #53
0
 public bool UpdateToDo(ToDo item)
 {
     throw new NotImplementedException();
 }
Пример #54
0
        public void GetNextThingToDo_WhenAllActive_ReturnsNextToDo()
        {
            //Arrange
            var manager = MakeToDoListManager();
            manager.Add(new ToDo("Go out with the dog", new DateTime(2010, 1, 1, 14, 30, 0)));
            manager.Add(new ToDo("Wash dishes", new DateTime(2010, 1, 1, 11, 30, 0)));
            SystemTime.Now = () => new DateTime(2010, 1, 1, 10, 0, 0);

            //Act
            var result = manager.GetNextThingToDo();

            //Assert
            var expected = new ToDo("Wash dishes", new DateTime(2010, 1, 1, 11, 30, 0));
            Assert.AreEqual(expected, result);
        }
Пример #55
0
 /// <summary>
 /// The create To Do.
 /// </summary>
 /// <param name="todo">
 /// The To Do.
 /// </param>
 public void CreateToDo(ToDo todo)
 {
     this.toDoRepository.Add(todo);
     this.SaveToDo();
 }