Exemple #1
0
        public ImportationManagementViewModel() : base()
        {
            listGeneralImportationModel = ListGeneralImportationModel.GetInstance();
            listExpenditureModel        = ListExpenditureModel.GetInstance();
            listExpenditureModel.List.Clear();
            listExpenditureModel.LoadAllExpenditure();


            ////test
            //ListImportation.Add(new ImportationModel("1", DateTime.Now, 125000));
            //ListImportation.Add(new ImportationModel("2", DateTime.Now, 5000));
            //ListImportation.Add(new ImportationModel("3", DateTime.Now, 75000));
            //ListImportation.Add(new ImportationModel("4", DateTime.Now, 25000));
            //ListImportation.Add(new ImportationModel("4", DateTime.Now, 25000));
            //ListImportation.Add(new ImportationModel("4", DateTime.Now, 25000));
            //ListImportation.Add(new ImportationModel("4", DateTime.Now, 25000));
            //ListImportation.Add(new ImportationModel("4", DateTime.Now, 25000));
            //ListImportation.Add(new ImportationModel("4", DateTime.Now, 25000));
            //ListImportation.Add(new ImportationModel("4", DateTime.Now, 25000));

            //listGeneralImportationModel.Add(new GeneralImportationModel(new ImportationModel("1", DateTime.Now, 125000), new ListDetailImportationModel()));
            //listGeneralImportationModel.Add(new GeneralImportationModel(new ImportationModel("2", DateTime.Now, 12000), new ListDetailImportationModel()));
            //listGeneralImportationModel.Add(new GeneralImportationModel(new ImportationModel("3", DateTime.Now, 25000), new ListDetailImportationModel()));
            //listGeneralImportationModel.Add(new GeneralImportationModel(new ImportationModel("4", DateTime.Now, 15000), new ListDetailImportationModel()));
            //listGeneralImportationModel.Add(new GeneralImportationModel(new ImportationModel("5", DateTime.Now, 5000), new ListDetailImportationModel()));
            //listGeneralImportationModel.Add(new GeneralImportationModel(new ImportationModel("6", DateTime.Now, 15000), new ListDetailImportationModel()));
            //listGeneralImportationModel.Add(new GeneralImportationModel(new ImportationModel("7", DateTime.Now, 25000), new ListDetailImportationModel()));


            CreateImportationCommand = new DelegateCommand(CreateImportation);
            DetailCommand            = new DelegateCommand(ShowDetail);
            CheckoutCommand          = new DelegateCommand(ShowCheckoutDialog);
        }
 private void ClearImportation()
 {
     (new ConfirmDialog("XÁC NHẬN", "Phiếu nhập hàng đang tạo hoặc đang chờ thanh toán. Xác nhận xóa?", (Action) delegate
     {
         ListDetailImportation.Clear();
         if (index >= 0)
         {
             ListGeneralImportationModel.GetInstance().List.Remove(ListGeneralImportationModel.GetInstance().List[index]);
             ListGeneralImportationModel.GetInstance().NotifyListChange();
         }
         NotifyChanged("SumPrice");
     })).ShowDialog();
 }
 private void CreateImportation()
 {
     InitImportation();
     if (index >= 0)
     {
         ListGeneralImportationModel.GetInstance().List[index].Importation           = newImportation;
         ListGeneralImportationModel.GetInstance().List[index].ListDetailImportation = listDetailImportation;
     }
     else
     {
         ListGeneralImportationModel.GetInstance().List.Add(new GeneralImportationModel(newImportation, listDetailImportation));
     }
     navigate.Invoke("ImportationManagementViewModel", null);
 }
        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;
            }
        }