Ejemplo n.º 1
0
        public TrendAdminstrator()
        {
            _completeControlSchedulesList = ModelGenerics.GetAll(new ControlSchedules());

            GraphType.Content       = "Vægt";
            GraphTimePeriod.Content = "En Uge";
            GraphComboboxSelectedMethod(GraphType.Content.ToString(), GraphTimePeriod.Content.ToString());
        }
Ejemplo n.º 2
0
        public void Filter <T>(T type, ObservableCollection <T> list, ObservableCollection <T> completeList, string property, string textBoxOutPut)
        {
            list.Clear();

            PropertyInfo prop = typeof(T).GetProperty(property);

            foreach (var f in completeList)
            {
                var v = prop.GetValue(f, null).ToString().ToLower();
                if (v.Contains(textBoxOutPut.ToLower()))
                {
                    list.Add(f);
                }
            }

            if (string.IsNullOrEmpty(textBoxOutPut))
            {
                list = ModelGenerics.GetLastTenInDatabasae(type);
            }
        }
Ejemplo n.º 3
0
        public void DeleteSelected <T>(T selectedItem, T type, ObservableCollection <T> completeList, ObservableCollection <T> list, string property)
        {
            if (selectedItem != null)
            {
                PropertyInfo prop = typeof(T).GetProperty(property);
                var          id   = prop.GetValue(selectedItem, null);

                ModelGenerics.DeleteById(type, (int)id);

                foreach (var item in completeList)
                {
                    var itemId = prop.GetValue(item, null);
                    if (itemId.Equals(id))
                    {
                        completeList.Remove(item);
                        break;
                    }
                }

                list.Remove(selectedItem);
            }
        }