Inheritance: INotifyPropertyChanged
Example #1
0
        public void LoadAllItems()
        {
            Items = new ObservableCollection<PisaModel>();

            foreach (var pisaInfo in _pisaDataContext.Items)
            {
                CategoryModel category = Categories.FirstOrDefault(c => c.ID == pisaInfo.Category);
                PaymentModel payment = Payments.FirstOrDefault(c => c.ID == pisaInfo.PaymentType);
                PisaModel pisaModel = new PisaModel()
                {
                    Date = DateTime.Parse(pisaInfo.Date),
                    Category = category,
                    ImagePath = pisaInfo.ImagePath,
                    Message = pisaInfo.Message,
                    Payment = payment,
                    Price = pisaInfo.Price
                };

                pisaModel.PropertyChanged += pisaModel_PropertyChanged;
                Items.Add(pisaModel);
            }

            Items.CollectionChanged += Items_CollectionChanged;
        }
Example #2
0
        public void AddPisa()
        {
            //TODO : 5�̷��� ī���ϴ� ������ ������
            PisaModel addedItem = new PisaModel()
            {
                Category = CurrentModel.Category,
                Date = CurrentModel.Date,
                ImagePath = CurrentModel.ImagePath,
                Message = CurrentModel.Message,
                Payment = CurrentModel.Payment,
                Price = CurrentModel.Price
            };

            ServiceLocator.Current.GetInstance<DBManager>().Items.Add(addedItem);
            _InitCurrentModel();
        }
Example #3
0
 PisaTable _GetPisaTable(PisaModel model)
 {
     return new PisaTable()
     {
         Category = model.Category.ID,
         Date = model.Date.ToString(),
         ImagePath = model.ImagePath,
         Message = model.Message,
         PaymentType = model.Payment.ID,
         Price = model.Price
     };
 }
Example #4
0
        private void _InitCurrentModel()
        {
            if (CurrentModel == null)
            {
                CurrentModel = new PisaModel();
            }

            CurrentModel.Date = DateTime.Now;
            CurrentModel.Category = this.Categories[0];
            CurrentModel.Payment = this.Payments[0];
            CurrentModel.Price = string.Empty;
            CurrentModel.Message = string.Empty;
        }