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; }
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(); }
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 }; }
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; }