Esempio n. 1
0
        public override void Search(SPSBox box)
        {
            if (box == null)
            {
                throw new ArgumentNullException(paramName: nameof(box));
            }
            if (box.ListView == null)
            {
                throw new ArgumentNullException(paramName: nameof(box.ListStrings));
            }
            if (box.Tasks == null)
            {
                throw new ArgumentNullException(paramName: nameof(box.Tasks));
            }

            if (box.Search == SPSSearchBy.Priority)
            {
                foreach (var item in box.Tasks)
                {
                    if (item.PriorityTask == box.SPSTask.PriorityTask)
                    {
                        box.ListView.Items.Add(item.ToString());
                    }
                }
            }

            if (box.ListView.Items.Count == 0)
            {
                box.ListView.Items.Add("No search result...");
            }
        }
Esempio n. 2
0
        public override void Search(SPSBox box)
        {
            if (box == null)
            {
                throw new ArgumentNullException(paramName: nameof(box));
            }
            if (box.ListView == null)
            {
                throw new ArgumentNullException(paramName: nameof(box.ListStrings));
            }
            if (box.Tasks == null)
            {
                throw new ArgumentNullException(paramName: nameof(box.Tasks));
            }

            if (box.Search == SPSSearchBy.Info)
            {
                foreach (var item in box.Tasks)
                {
                    if (string.Compare(item.InfoAboutTask, box.SPSTask.InfoAboutTask) == 0 ||
                        item.InfoAboutTask.Contains(box.SPSTask.InfoAboutTask))
                    {
                        box.ListView.Items.Add(item.ToString());
                    }
                }
            }

            if (box.ListView.Items.Count == 0)
            {
                box.ListView.Items.Add("No search result...");
            }
        }
Esempio n. 3
0
 public DeleteSPSTask(SPSBox box)
 {
     if (box == null)
     {
         throw new ArgumentNullException(paramName: nameof(box));
     }
     if (box.Tasks == null)
     {
         throw new ArgumentNullException(paramName: nameof(box.Tasks));
     }
     this.box = box;
 }
Esempio n. 4
0
 public UpdateListTasks(SPSBox box)
 {
     if (box == null)
     {
         throw new ArgumentNullException(paramName: nameof(box));
     }
     if (box.Tasks == null)
     {
         throw new ArgumentNullException(paramName: nameof(box.Tasks));
     }
     this.box = box;
 }
Esempio n. 5
0
 public ChangeSPSTaskPriority(SPSBox box)
 {
     if (box == null)
     {
         throw new ArgumentNullException(paramName: nameof(box));
     }
     if (box.Tasks == null)
     {
         throw new ArgumentNullException(paramName: nameof(box.Tasks));
     }
     this.box = box;
 }
        static public SPSTask GetCopyByIndex(this SPSBox box, int index)
        {
            var _box = box ?? throw new ArgumentNullException(paramName: nameof(box));
            var _db  = _box.Tasks ?? throw new ArgumentNullException(paramName: nameof(_box.Tasks));

            return(new SPSTask(
                       _db[index].Id,
                       _db[index].StatusTask,
                       _db[index].PriorityTask,
                       _db[index].TagTask,
                       _db[index].InfoAboutTask,
                       _db[index].DateTimeStartTask,
                       _db[index].DateTimeEndTask));
        }
        static public void SPSDeleteItem(this List <SPSTask> list, SPSBox box)
        {
            var list_temp = list ?? throw new ArgumentNullException(paramName: nameof(list));
            var _box      = box ?? throw new ArgumentNullException(paramName: nameof(box));

            for (int i = 0; i < list_temp.Count; i++)
            {
                if (list_temp[i].Id == _box.SPSTask.Id)
                {
                    list_temp.RemoveAt(i);
                    break;
                }
            }
        }
        static public Guid GetGuidByIndex(this SPSBox box, int index)
        {
            var _box = box ?? throw new ArgumentNullException(paramName: nameof(box));
            var _db  = _box.Tasks ?? throw new ArgumentNullException(paramName: nameof(_box.Tasks));

            if (index < 0 || index > _db.Count - 1)
            {
                throw new IndexOutOfRangeException("Incorrect index");
            }
            Guid output = new Guid();

            output = _db[index].Id;

            return(output);
        }
        static public SPSTask ConvertStringToSPSTask(this string recordSPSTask, SPSBox box)
        {
            var task_str = recordSPSTask ?? throw new ArgumentNullException(paramName: nameof(recordSPSTask));
            var _box     = box ?? throw new ArgumentNullException(paramName: nameof(box));
            var _db      = _box.Tasks ?? throw new ArgumentNullException(paramName: nameof(_box.Tasks));
            var list     = task_str.Trim().Split('|').ToList();
            int index;

            int.TryParse(list[0], out index);
            if (index < 0 || index > _db.Count - 1)
            {
                throw new IndexOutOfRangeException("Incorrect index");
            }
            return(new SPSTask(
                       _db[index].Id,
                       _db[index].StatusTask,
                       _db[index].PriorityTask,
                       _db[index].TagTask,
                       _db[index].InfoAboutTask,
                       _db[index].DateTimeStartTask,
                       _db[index].DateTimeEndTask));
        }
Esempio n. 10
0
        public override void Change(SPSBox box)
        {
            if (box == null)
            {
                throw new ArgumentNullException(paramName: nameof(box));
            }
            if (box.Tasks == null)
            {
                throw new ArgumentNullException(paramName: nameof(box.Tasks));
            }

            if (box.Change == SPSChange.Info)
            {
                for (int i = 0; i < box.Tasks.Count; i++)
                {
                    if (box.Tasks[i].Id == box.SPSTask.Id)
                    {
                        box.Tasks[i].InfoAboutTask = box.SPSTask.InfoAboutTask; break;
                    }
                }
            }
        }
Esempio n. 11
0
 public abstract void Change(SPSBox box);
Esempio n. 12
0
 public abstract void Search(SPSBox box);