Example #1
0
        public void CRDUserIUsersAssignedTest()
        {
            ctrl.CreateProject("aProjectName", "A Description for my project", DateTime.Now);
            Project project = ctrl.Projects.Last();

            ctrl.CreateUser("a user name", project);
            User user = ctrl.Users.Last();

            Assert.IsTrue(ctrl.AddUserToIUsersAssigned(user, project));
            Assert.IsTrue(project.GetUsers().Contains(user));
            Assert.IsTrue(ctrl.RemoveUserFromIUsersAssigned(user, project));


            ctrl.CreateUserStory("aDescription", null, 2, ctrl.Priorities[0], ctrl.Types[0], project);
            UserStory userStory = project.AllUserStories[0];

            Assert.IsTrue(ctrl.AddUserToIUsersAssigned(user, userStory));
            Assert.IsTrue(userStory.GetUsers().Contains(user));
            Assert.IsTrue(ctrl.RemoveUserFromIUsersAssigned(user, userStory));

            Checklist checklist = ctrl.CreateCheckList("a bioutifoul name", userStory);

            ctrl.CreateCheckListItem("a better name", checklist);
            ChecklistItem checklistItem = checklist.ChecklistItems[0];

            Assert.IsTrue(ctrl.AddUserToIUsersAssigned(user, checklistItem));
            Assert.IsTrue(checklistItem.GetUsers().Contains(user));
            Assert.IsTrue(ctrl.RemoveUserFromIUsersAssigned(user, checklistItem));

            ctrl.Delete(user);
            ctrl.Delete(checklistItem);
            ctrl.Delete(checklist);
            ctrl.Delete(userStory);
            ctrl.Delete(project);
        }
Example #2
0
        public IActionResult PutReminder(int id, ReminderDTO reminder)
        {
            User     user        = _userRepository.GetBy(User.Identity.Name);
            Reminder oldReminder = _reminderRepository.GetById(id);

            if (oldReminder == null)
            {
                return(NotFound());
            }
            foreach (var tag in reminder.Tags)
            {
                bool notExist = oldReminder.Tags.FirstOrDefault(t => t.TagName == tag.Name) == null;
                if (notExist)
                {
                    Tag createTag = _tagRepository.GetByName(tag.Name);
                    if (createTag == null)
                    {
                        createTag = new Tag(tag.Name, tag.Color, user);
                        ReminderTag reminderTag = new ReminderTag(oldReminder, createTag);
                        oldReminder.AddTag(reminderTag, createTag);
                        _tagRepository.Add(createTag);
                    }
                    else
                    {
                        ReminderTag reminderTag = new ReminderTag(oldReminder, createTag);
                        oldReminder.AddTag(reminderTag, createTag);
                    }
                }
            }
            foreach (var checklist in reminder.CheckList)
            {
                ChecklistHeader oldHeader = oldReminder.Checklist.FirstOrDefault(c => c.Title == checklist.Title);
                bool            notExist  = oldHeader == null;
                if (notExist)
                {
                    ChecklistHeader createChecklistHeader = new ChecklistHeader(checklist.Title, checklist.Volgorde, oldReminder, checklist.Finished, checklist.Checked);
                    foreach (var item in checklist.Items)
                    {
                        ChecklistItem createChecklistItem = new ChecklistItem(item.Title, createChecklistHeader, item.Volgorde, item.Finished, item.Checked);
                    }
                }
                else
                {
                    oldHeader.Checked  = checklist.Checked;
                    oldHeader.Finished = checklist.Finished;
                    oldHeader.Volgorde = checklist.Volgorde;
                    foreach (var item in checklist.Items)
                    {
                        ChecklistItem oldItem = oldHeader.Items.FirstOrDefault(c => c.Title == item.Title);
                        oldItem.Checked  = item.Checked;
                        oldItem.Finished = item.Finished;
                        oldItem.Volgorde = item.Volgorde;
                    }
                }
            }
            oldReminder.RecalculateProcessBar();
            _reminderRepository.Update(oldReminder);
            _reminderRepository.SaveChanges();
            return(NoContent());
        }
Example #3
0
        public void CRDUserChecklistItemTest()
        {
            //CreateChecklistItem
            List <Priority>     priorities = DB.GetPriorities();
            List <State>        states     = DB.GetStates();
            List <Classes.Type> types      = DB.GetTypes();
            List <Project>      projects   = DB.GetProjects();

            if (states.Count == 0)
            {
                DB.CreateState("AStateName");
                states = DB.GetStates();
            }
            if (projects.Count == 0)
            {
                DB.CreateProject("aProjectName", "A Description for my project", DateTime.Now);
                projects = DB.GetProjects();
            }
            UserStory     userStory     = DB.CreateUserStory("aDescription", null, 2, priorities[0], types[0], states[0], projects[0]);
            Checklist     checklist     = DB.CreateCheckList("a bioutifoul name", userStory);
            ChecklistItem checklistItem = DB.CreateCheckListItem("a better name", checklist);

            //CreateUser
            User user = DB.CreateUser("a user name");

            Assert.IsTrue(DB.AddUserToChecklistItem(user, checklistItem));
            Assert.IsNotNull(DB.GetUserChecklistItem());
            Assert.IsTrue(DB.RemoveUserFromChecklistItem(user, checklistItem));

            DB.Delete(user);
            DB.Delete(userStory);
            DB.Delete(checklistItem);
            DB.Delete(checklist);
        }
Example #4
0
        public bool Delete(ChecklistItem checklistItem)
        {
            checklistItem.Checklist.ChecklistItems.Remove(checklistItem);
            bool result = DB.Delete(checklistItem);

            return(result);
        }
Example #5
0
        public IActionResult Post(string ChecklistAction, int tripTypeId)
        {
            // var requestBody = new System.IO.StreamReader(HttpContext.Request.Body).ReadToEnd();
            var ChecklistItem = new ChecklistItem {
                ChecklistAction = ChecklistAction,
                TripTypeId      = tripTypeId
            };

            // Check if data matches the Model
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            // add ChecklistItem to the table
            _context.ChecklistItem.Add(ChecklistItem);
            // SAVE
            try {
                _context.SaveChanges();
            }
            // return an error statement
            catch (DbUpdateException) {
                if (ChecklistItemExists(ChecklistItem.ChecklistItemId))
                {
                    return(new StatusCodeResult(StatusCodes.Status409Conflict));
                }
                else
                {
                    throw;
                }
            }
            // return created ChecklistItem method
            return(CreatedAtRoute("GetSingleChecklistItem", new { id = ChecklistItem.ChecklistItemId }, ChecklistItem));
        }
Example #6
0
        //private DueCalculationType GetDueCalculationType(string dsioCalcType)
        //{
        //    DueCalculationType returnVal = DueCalculationType.Unknown;

        //    Dictionary<string, DueCalculationType> lookup = new Dictionary<string, DueCalculationType>();

        //    lookup.Add(DsioChecklistItem.InitialCalcType, DueCalculationType.Initial);
        //    lookup.Add(DsioChecklistItem.WeeksGaCalcType, DueCalculationType.WeeksGa);
        //    lookup.Add(DsioChecklistItem.TrimesterGaCalcType, DueCalculationType.TrimesterGa);
        //    lookup.Add(DsioChecklistItem.WeeksPostpartumCalcType, DueCalculationType.WeeksPostpartum);

        //    if (lookup.ContainsKey(dsioCalcType))
        //        returnVal = lookup[dsioCalcType];

        //    return returnVal;
        //}

        //private ChecklistItemType GetChecklistItemType(string dsioItemType)
        //{
        //    ChecklistItemType returnVal = ChecklistItemType.Unknown;

        //    Dictionary<string, ChecklistItemType> lookup = new Dictionary<string, ChecklistItemType>();

        //    lookup.Add(DsioChecklistItem.MccCallType, ChecklistItemType.MccCall);
        //    lookup.Add(DsioChecklistItem.EdItemType, ChecklistItemType.EducationItem);
        //    lookup.Add(DsioChecklistItem.LabType, ChecklistItemType.Lab);
        //    lookup.Add(DsioChecklistItem.UltrasoundType, ChecklistItemType.Ultrasound);
        //    lookup.Add(DsioChecklistItem.ConsultType, ChecklistItemType.Consult);
        //    lookup.Add(DsioChecklistItem.CdaExchangeType, ChecklistItemType.CdaExchange);
        //    lookup.Add(DsioChecklistItem.VisitType, ChecklistItemType.Visit);
        //    lookup.Add(DsioChecklistItem.OtherType, ChecklistItemType.Other);

        //    if (lookup.ContainsKey(dsioItemType))
        //        returnVal = lookup[dsioItemType];

        //    return returnVal;
        //}

        private PregnancyChecklistItem GetPatientChecklistItem(DsioPatientChecklistItem dsioItem)
        {
            PregnancyChecklistItem returnItem;

            ChecklistItem baseItem = this.GetChecklistItem(dsioItem);

            returnItem = new PregnancyChecklistItem(baseItem);

            returnItem.PatientDfn       = dsioItem.PatientDfn;
            returnItem.PregnancyIen     = dsioItem.PregnancyIen;
            returnItem.ItemDate         = VistaDates.ParseDateString(dsioItem.ItemDate, VistaDates.VistADateFormatSix);
            returnItem.SpecificDueDate  = VistaDates.ParseDateString(dsioItem.SpecificDueDate, VistaDates.VistADateOnlyFormat);
            returnItem.CompletionStatus = dsioItem.CompletionStatus;

            returnItem.CompleteDate = VistaDates.ParseDateString(dsioItem.CompleteDate, VistaDates.VistADateFormatFour);
            if (returnItem.CompleteDate == DateTime.MinValue)
            {
                if (!string.IsNullOrWhiteSpace(dsioItem.CompleteDate))
                {
                    returnItem.CompleteDate = VistaDates.ParseDateString(dsioItem.CompleteDate, VistaDates.VistADateFormatSeven);
                }
            }

            returnItem.CompletionLink = dsioItem.CompletionLink;
            returnItem.CompletedBy    = dsioItem.CompletedBy;
            returnItem.StoredNote     = dsioItem.Note;
            returnItem.User           = dsioItem.User;
            returnItem.InProgress     = (dsioItem.InProgress == "1") ? true : false;

            returnItem.EducationItemIen = dsioItem.EducationIen;

            return(returnItem);
        }
Example #7
0
        public IActionResult Put(int id, [FromBody] ChecklistItem ChecklistItem)
        {
            // Check if data matches the Model
            if (!ModelState.IsValid)
            {
                // return 404
                return(BadRequest(ModelState));
            }

            // Check for id match, if true, update the table
            if (id != ChecklistItem.ChecklistItemId)
            {
                // return 404
                return(BadRequest());
            }
            // update table method
            _context.ChecklistItem.Update(ChecklistItem);
            // save changes
            try {
                _context.SaveChanges();
            }
            // Error message for something .net
            catch (DbUpdateConcurrencyException) {
                if (!ChecklistItemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(new StatusCodeResult(StatusCodes.Status204NoContent));
        }
Example #8
0
        public IActionResult Get(int id)
        {
            // Check if data matches the Model
            if (!ModelState.IsValid)
            {
                // error msg
                return(BadRequest(ModelState));
            }
            // Check DB to ensure referenced tables exist
            try {
                ChecklistItem ChecklistItem = _context.ChecklistItem.Single(g => g.ChecklistItemId == id);
                // Return 404 if null
                if (ChecklistItem == null)
                {
                    return(NotFound());
                }

                return(Ok(ChecklistItem));
            }
            // Catch statement return 404 for some reason
            catch (System.InvalidOperationException)
            {
                return(NotFound());
            }
        }
        private void NoteChecklistItemTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            TextBox       textBox = sender as TextBox;
            ChecklistItem item    = textBox.DataContext as ChecklistItem;

            textBox.Tag = textBox.Text;

            //int position = (NoteChecklistListView.ItemsSource as Checklist).IndexOf(item);

            //if (string.IsNullOrEmpty(textBox.Text))
            //{
            //    int count = NoteChecklistListView.Items.Count;
            //    int new_position = position > 0 ? position - 1 : position + 1;

            //    if (new_position > 0 && new_position < count)
            //    {
            //        FrameworkElement listViewItem2 = NoteChecklistListView.ContainerFromIndex(new_position) as FrameworkElement;
            //        TextBox textBox2 = FindFirstElementInVisualTree<TextBox>(listViewItem2);

            //        if (textBox2 != null)
            //        {
            //            textBox2.Focus(FocusState.Programmatic);
            //            textBox2.Select(textBox2.Text.Length, 0);
            //        }
            //    }

            //    if (count > 1)
            //    {
            //        textBox.ClearValue(TextBox.TextProperty);
            //        (NoteChecklistListView.ItemsSource as Checklist).Remove(item);
            //    }
            //}
        }
Example #10
0
        public ChecklistHistory Map(ChecklistHistory history,
                                    ChecklistCategory category,
                                    ChecklistItem item)
        {
            if (!_historyCache.TryGetValue(history.ID, out ChecklistHistory result))
            {
                history.Categories = new List <ChecklistCategory>();

                _historyCache[history.ID] = history;
                result = history;
            }

            if ((category?.ID ?? 0L) != 0)
            {
                if (!_categoryCache.TryGetValue(category.ID, out ChecklistCategory categoryCache))
                {
                    category.Items = new List <ChecklistItem>();
                    _categoryCache[category.ID] = category;
                    categoryCache = category;

                    result.Categories.Add(category);
                }

                if ((item?.ID ?? 0L) != 0L)
                {
                    categoryCache.Items.Add(item);
                }
            }

            return(result);
        }
        private void ChecklistItem_Checked(object sender, RoutedEventArgs e)
        {
            ChecklistItem item = (sender as CheckBox).Tag as ChecklistItem;

            item.Done = (sender as CheckBox).IsChecked == true;
            controller.UpdateCheckListItem(item.NameItem, item.Done, item);
        }
Example #12
0
        private bool RemoveUserFromChecklistItem(User user, ChecklistItem checklistItem)
        {
            bool result = DB.RemoveUserFromChecklistItem(user, checklistItem);

            checklistItem.RemoveUser(user);
            return(result);
        }
Example #13
0
        public void CRUDChecklistItem()
        {
            //Test Create
            string           aName      = "checlistItem first name";
            List <Checklist> checklists = DB.GetChecklists();
            Checklist        checklist;

            if (checklists.Count == 0)
            {
                List <UserStory> userStories = DB.GetUserStories();
                UserStory        userStory;
                if (userStories.Count == 0)
                {
                    List <Priority>     priorities = DB.GetPriorities();
                    List <State>        states     = DB.GetStates();
                    List <Classes.Type> types      = DB.GetTypes();
                    List <Project>      projects   = DB.GetProjects();
                    if (states.Count == 0)
                    {
                        DB.CreateState("AStateName");
                        states = DB.GetStates();
                    }
                    if (projects.Count == 0)
                    {
                        DB.CreateProject("aProjectName", "A Description for my project", DateTime.Now);
                        projects = DB.GetProjects();
                    }


                    userStory = DB.CreateUserStory("aDescription", null, 2, priorities[0], types[0], states[0], projects[0]);
                }
                else
                {
                    userStory = userStories.Last();
                }

                checklist = DB.CreateCheckList("the name of a checklist", userStory);
            }
            else
            {
                checklist = checklists[0];
            }
            ChecklistItem checklistItem = DB.CreateCheckListItem(aName, checklist);

            Assert.AreEqual(aName, checklistItem.NameItem);
            Assert.IsFalse(checklistItem.Done);
            Assert.AreEqual(checklist.Id, checklistItem.ChecklistId);

            //Test Update
            string afterName = "checklistItem second name";

            DB.UpdateCheckListItem(afterName, true, checklistItem);
            checklistItem = DB.GetChecklistItems().First(c => c.Id == checklistItem.Id);

            Assert.AreEqual(afterName, checklistItem.NameItem);
            Assert.IsTrue(checklistItem.Done);

            //Test Remove
            Assert.IsTrue(DB.Delete(checklistItem));
        }
Example #14
0
        public IActionResult PutChecklistItem(int id, [FromBody] ChecklistItem entity)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != entity.Id)
            {
                return(BadRequest());
            }

            try
            {
                _service.Update(id, entity);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_service.ChecklistItemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw new AppException("Update failed");
                }
            }
            return(NoContent());
        }
Example #15
0
        public ChecklistItem Create(ChecklistItem entity)
        {
            _db.ChecklistItems.Add(entity);
            _db.SaveChanges();

            return(entity);
        }
Example #16
0
        public bool UpdateCheckListItem(string nameItem, bool done, ChecklistItem item)
        {
            bool result = DB.UpdateCheckListItem(nameItem, done, item);

            item.NameItem = nameItem;
            item.Done     = done;
            return(result);
        }
Example #17
0
        private bool AddUserToChecklistItem(User user, ChecklistItem checklistItem)
        {
            //create, check, assign values and return
            bool result = DB.AddUserToChecklistItem(user, checklistItem);

            checklistItem.AddUser(user);
            return(result);
        }
Example #18
0
        public ChecklistItem Adicionar(ChecklistItem checklist)
        {
            var result = _checklistServicoRepository.AdicionarComRetorno(checklist);

            _unitOfWork.Commit();

            return(result);
        }
Example #19
0
    public void AddItem(string text, bool isCompleted)
    {
        ChecklistItem newItem = Instantiate(itemPrototype.gameObject, itemPrototype.transform.parent).GetComponent <ChecklistItem>();

        newItem.gameObject.SetActive(true);
        newItem.SetCompletionState(isCompleted);
        newItem.SetText(text);
        items.Add(newItem);
    }
 protected override int GetValueFromChecklistItem(ChecklistItem item)
 {
     var item2 = item as DataChecklistItem;
     Assert.IsNotNull(item2, "Checklist item {0} is not bound to a Sitecore item.", item.Header);
     var flagItem = Sitecore.Context.ContentDatabase.GetItem(new ID(item2.ItemID));
     var flagValue = GetFlagValue(flagItem["Value"]);
     Assert.IsTrue(flagValue.HasValue, "Value field on item {0} is not a valid flag.", item2.ItemID);
     return flagValue.GetValueOrDefault(0);
 }
    public void UpdateLists(Checklist c)
    {
        GameObject l = Instantiate(checklistObject, gridObject) as GameObject;

        l.SetActive(true);
        ChecklistItem item = l.GetComponent <ChecklistItem> ();

        item.list = c;
        l.transform.Find("TitleText").GetComponent <Text>().text = c.name;
    }
Example #22
0
        public ChecklistItemEdit(ChecklistItem aChecklistItem, UserStory aUserStory, Controller aController)
        {
            checklistItem = aChecklistItem;
            controller    = aController;
            userStory     = aUserStory;

            InitializeComponent();

            tbxObjet.Text       = checklistItem.NameItem;
            chkbxDone.IsChecked = checklistItem.Done;
        }
Example #23
0
        public IActionResult GetChecklistItem(int id)
        {
            ChecklistItem item = _service.GetById(id);

            if (item == null)
            {
                return(NotFound());
            }

            return(Ok(item));
        }
Example #24
0
        public IActionResult DeleteChecklistItem(int id)
        {
            ChecklistItem item = _service.Delete(id);

            if (item == null)
            {
                return(NotFound());
            }

            return(Ok(item));
        }
Example #25
0
        public IActionResult PostChecklistItem([FromBody] ChecklistItem entity)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ChecklistItem item = _service.Create(entity);

            return(Ok(item));
        }
Example #26
0
        public bool CreateCheckListItem(string aName, Checklist checklist)
        {
            //create and verify
            ChecklistItem checklistItem = DB.CreateCheckListItem(aName, checklist);
            bool          result        = checklistItem != null;

            //assign values and return
            checklistItem.Checklist = checklist;
            checklist.ChecklistItems.Add(checklistItem);
            return(result);
        }
        /// <summary>
        /// Moves to the next item in checklist (sets it to Active) if available
        /// Refreshes the version/git information
        /// </summary>
        /// <param name="currentItem"></param>
        private void MoveToNext(ChecklistItem currentItem)
        {
            var idx = Checklists.Current.Items.IndexOf(currentItem);

            idx++;
            if (idx < Checklists.Current.Items.Count)
            {
                Checklists.Current.Items[idx].Status = ChecklistItemStatusEnum.Active;
            }

            RefreshInfo();
        }
Example #28
0
        private void OnItemSwiped(object sender, EventArgs e)
        {
            ChecklistItem item = (sender as FrameworkElement).DataContext as ChecklistItem;

            if (item == null)
            {
                return;
            }

            Debug.WriteLine("Swiped checklist item ");
            viewModel.Note.Checklist.Remove(item);
        }
        private void BtnAddItem_Click(object sender, EventArgs e)
        {
            ChecklistItemCreate checklistItemCreate = new ChecklistItemCreate();

            if (checklistItemCreate.ShowDialog() == true)
            {
                ChecklistItem checklistItem = new ChecklistItem(-1, checklistItemCreate.tbxObjet.Text.Trim(), false, -1);

                itemsToAdd.Add(checklistItem);
                Refresh();
            }
        }
        public IActionResult RemoveItem(int checklistId, int itemId)
        {
            ChecklistItem checklistItem = context.ChecklistItems.Single(cl => cl.ItemID == itemId && cl.ChecklistID == checklistId);

            context.ChecklistItems.Remove(checklistItem);


            context.SaveChanges();


            return(Redirect("/Checklist/ViewChecklist/" + checklistId));
        }
Example #31
0
    void SaveJSONdata()
    {
        string content = "";

        for (int i = 0; i < checkNotes.Count; i++)
        {
            ChecklistItem temp = new ChecklistItem(checkNotes[i].NoteName, checkNotes[i].icons, checkNotes[i].index1);
            content += JsonUtility.ToJson(temp) + "\n";
            Debug.Log("chi");
        }
        File.WriteAllText(filePath, content);
    }
        /// <summary>
        /// Fills the template list with applicable templates.
        /// </summary>
        protected void FillTemplateList()
        {
            TemplateList.Controls.Clear();

            List<Item> templateSubitems = TemplateUtil.GetTemplateSubitems(this.templateFolder, this.masterDb);
            foreach (Item item in templateSubitems)
            {
                ChecklistItem clItem = new ChecklistItem();
                clItem.ID = Control.GetUniqueID("I");
                clItem.Value = item.ID.ToString();
                clItem.Header = item.Name;
                TemplateList.Controls.Add(clItem);
            }

            TemplateList.CheckAll();
        }
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (! Sitecore.Context.ClientPage.IsEvent)
     {
         foreach (var day in Enum.GetValues(typeof (DaysOfWeek)).Cast<DaysOfWeek>())
         {
             if (day != DaysOfWeek.None)
             {
                 var item = new ChecklistItem();
                 item.Header = day.ToString();
                 item.Value = day.ToString();
                 this.Days.Controls.Add(item);
             }
         }
         var handle = UrlHandle.Get();
         SetControlValues(handle["value"]);
     }
 }