Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 //Constructor with AccessToken as the only parameter.
 public FrmProduct(AccessToken acctoken)
 {
     InitializeComponent();
     _myAccessToken = acctoken;
     //Instantiates a ProductManager.
     _myProductManager = new ProductManager();
     Instance = this;
     RoleAccess = new RoleAccess(_myAccessToken, this);
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     //updates to the product at database level
     var _pManager = new ProductManager();
     _pManager.UpdateThreshold((int)numericROThreshold.Value, _curProduct.VendorSourceItem.ProductID);
     _pManager.UpdateReorderAmount((int)numericROAmount.Value, _curProduct.VendorSourceItem.ProductID);
     _curProduct.Product._reorderThreshold = (int)numericROThreshold.Value;
     _curProduct.Product._reorderAmount = (int)numericROAmount.Value;
     _curProduct.ReorderTotal = (double)_curProduct.VendorSourceItem.UnitCost * (double)_curProduct.Product._reorderAmount;
     this.Close();
 }
Ejemplo n.º 4
0
 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;
 }
        private void fillProductDropDown(Int32 vendorID)
        {
            cbProductName.Items.Clear();
            List<VendorSourceItem> vendorSourceItemList = new List<VendorSourceItem>();
            VendorSourceItemManager _vendorSourceItemManager = new VendorSourceItemManager();
            vendorSourceItemList = _vendorSourceItemManager.GetVendorSourceItemsByVendor(vendorID);
            ProductManager _productManager = new ProductManager();

            foreach (VendorSourceItem v in vendorSourceItemList)
            {
                cbProductName.Items.Add(v.ProductID + " " + _productManager.GetProduct(v.ProductID).Name);
            }
        }
 private void FrmUpdateReorderAmount_Load(object sender, EventArgs e)
 {
     _productManager = new ProductManager();
     txtAmount.Text = _currentAmount.ToString();
 }
Ejemplo n.º 7
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Text += "                         " + _myAccessToken.FirstName + " " + _myAccessToken.LastName + " logged in as a " + _myAccessToken.Role.Name;

             var vsiManager = new VendorSourceItemManager();
             fillListView(vnd,vsiManager.GetAllVendorSourceItems());
             var venManager = new VendorManager();
             fillVendorDropDown(vendorCb, venManager.GetVendors());

             var prodManager = new ProductManager();
             fillProductDropDown(productCb, prodManager.GetProducts());
        }
Ejemplo n.º 8
0
 private void btnReorder_Click(object sender, EventArgs e)
 {
     try
     {
         if (_vendorOrdered == false)
         {
             _vendorOrdered = _report.OrderReorders();
             _productManager = new ProductManager();
             foreach (Reorder reorder in _report.Reorders)
             {
                 _productManager.AddToOnOrder(reorder.CasesToOrder * reorder.VendorSourceItem.ItemsPerCase, reorder.VendorSourceItem.ProductID);
             }
             MessageBox.Show("Your order has been sent.", "Vendor Reorder");
             _vendorOrdered = true;
         }
     }
     catch (ApplicationException ex)
     {
         if (devState)
         { MessageBox.Show(ex.Message); }
     }
     catch (NullReferenceException ex)
     {
         MessageBox.Show("No Order to send.","Vendor Reorder");
     }
 }