Ejemplo n.º 1
0
        public AddProductViewModel(ProductModel model, AddProductView add_product_view, HomeViewModel home_view_model)
        {
            this.AddProductView        = add_product_view;
            this.HomeViewModel         = home_view_model;
            this.CreateOrUpdateCommand = new RelayCommand(addOrUpdateProduct);

            if (model != null)
            {
                this.UpdateOrCreate = "Update";
                this.ID             = Convert.ToInt32(model.ID.value);
                this.Name           = model.Name.value;
                this.Code           = Convert.ToInt32(model.Code.value);
                this.Description    = model.Description.value;
                this.Barcode        = model.Barcode.value;
                this.Price          = model.Price.value;
                this.IsService      = model.IsService.value;
                this.DateCreated    = model.DateCreated.value;
                this.DateUpdated    = model.DateUpdated.value;
            }
            else
            {
                this.UpdateOrCreate = "Create";
                this.Code           = ProductAccess.singleton.getLastProductCode() + 1;
            }
            CoreApp.logger.log("AddProductViewModel successfully initialized.");
        }
Ejemplo n.º 2
0
        public AddSupplierViewModel(SupplierModel model, AddSupplierView add_supplier_view, HomeViewModel home_view_model)
        {
            this.AddSupplierView       = add_supplier_view;
            this.HomeViewModel         = home_view_model;
            this.CreateOrUpdateCommand = new RelayCommand(addOrUpdateSupplier);

            if (model != null)
            {
                this.UpdateOrCreate = "Update";
                this.ID             = Convert.ToInt32(model.ID.value);
                this.FirstName      = model.FirstName.value;
                this.LastName       = model.LastName.value;
                this.Address        = model.Address.value;
                this.EMail          = model.EMail.value;
                this.Telephone      = model.Telephone.value;
                this.Comments       = model.Comments.value;
            }
            else
            {
                this.UpdateOrCreate = "Create";
            }
            CoreApp.logger.log("AddSupplierViewModel successfully initialized.");
        }