private void SaveToDatabase() { // save importation ImportationModel.SaveToDatabase(newImportation); // save detail importation foreach (DetailImportationItemViewModel item in ListDetailImportation) { DetailImportationModel.SaveToDatabase(item.DetailImportationModel); } }
public void CreateImportation() { InitImportation(); (new ConfirmDialog("XÁC NHẬN", "Thêm phiếu nhập hàng?", (Action) delegate { ImportationModel.SaveToDatabase(newImportation); foreach (DetailImportationItemViewModel item in ListDetailImportation) { DetailImportationModel.SaveToDatabase(item.DetailImportationModel); } })).ShowDialog(); listExpenditureModel.List.Clear(); listExpenditureModel.LoadAllExpenditure(); }
public AddImportationViewModel() : base() { listExpenditureModel = ListExpenditureModel.GetInstance(); listDetailImportation = new ListDetailImportationModel(); IngridientSelectionChangeCommand = new DelegateCommand <IngridientModel>(IngridientChange); CreateImportationCommand = new DelegateCommand(CreateImportation); ClearImportationCommand = new DelegateCommand(ClearImportation); newImportation = new ImportationModel(); newImportation.ID = ImportationModel.GenerateID(ListImportationModel.GetInstance().List); SelectedIndex = 0; SelectedIndex = -1; NotifyChanged("SelectedIndex"); }
public ListIngridientViewModel(Action <object, object[]> navigate, object[] parameters) : this() { this.navigate = navigate; if (parameters == null) { newImportation = new ImportationModel(); newImportation.ID = ImportationModel.GenerateID(ListImportationModel.GetInstance().List); } else { index = (int)parameters[0]; newImportation = (ImportationModel)ListGeneralImportationModel.GetInstance().List[index].Importation; listDetailImportation = (ListDetailImportationModel)ListGeneralImportationModel.GetInstance().List[index].ListDetailImportation; } }
public GeneralImportationModel(ImportationModel importation, ListDetailImportationModel list) { this.Importation = importation; this.ListDetailImportation = list; }
public GeneralImportationModel() { Importation = new ImportationModel(); ListDetailImportation = new ListDetailImportationModel(); }