public ProductView(AccessToken accToken) { InitializeComponent(); var RoleAccess = new RoleAccess(accToken, this); _myAccessToken = accToken; _productManager = new ProductManager(); _vendorManager = new VendorManager(); _vendorSourceManager = new VendorSourceItemManager(); this.Text = "Add Product"; btMorph.Text = "Add Product"; PopulateLocationCombo(); PopulateActiveCombo(); tbProductID.Enabled = false; tbProductID.Text = "The ID will automatically be created."; this.lblVendors.Visible = false; this.lvVendors.Visible = false; this.btAddVendor.Visible = false; lblPriceDisplay.Text = String.Format("{0:C}", 0); lblWeightDisplay.Text = "0.0 lbs"; tbProductID.Focus(); Instance = this; }
public ProductView(AccessToken accToken, Product ProductInfo) { InitializeComponent(); _myAccessToken = accToken; _productManager = new ProductManager(); _vendorManager = new VendorManager(); _vendorSourceManager = new VendorSourceItemManager(); _currentProduct = ProductInfo; //Assigning the current product values to the appropriate controls. this.Text = "Update Product"; btMorph.Text = "Update Product"; tbProductID.Text = ProductInfo.Id.ToString(); tbDescription.Text = ProductInfo.description; tbItemName.Text = ProductInfo.Name; nudUnitPrice.Value = ProductInfo.unitPrice; nudAvailableQty.Value = ProductInfo.available; nudOnHandQty.Value = ProductInfo.reserved; nudReorderThreshold.Value = (decimal)ProductInfo._reorderThreshold; nudReorderAmount.Value = (decimal)ProductInfo._reorderAmount; nudOnOrderAmount.Value = ProductInfo._onOrder; txtDimensions.Text = ProductInfo._shippingDemensions; nudWeight.Value = (decimal)ProductInfo._shippingWeight; PopulateActiveCombo(); PopulateLocationCombo(); PopulateListView(lvVendors, ProductInfo.Id); this.btnClear.Enabled = false; lblPriceDisplay.Text = String.Format("{0:C}", ProductInfo.unitPrice); tbItemName.Focus(); Instance = this; }
//Need to make sure that this links up with Nathan's code correctly. private void btnAdd_Click(object sender, EventArgs e) { ProductView frm = new ProductView(_myAccessToken); frm.ShowDialog(); findActiveSelection(); }
private void ProductView_FormClosed(object sender, FormClosedEventArgs e) { Instance = null; }
//Need to make sure that this links up with Nathan's code correctly. private void btnUpdateProduct_Click(object sender, EventArgs e) { int currentIndex = this.lvProducts.SelectedIndices[0]; Product thisProduct = _myProductManager.Products[currentIndex]; ProductView frm = new ProductView(_myAccessToken, thisProduct); frm.ShowDialog(); findActiveSelection(); }