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;
 }
 public FrmAttachVendorSource(Product product, AccessToken _myAccessToken)
 {
     InitializeComponent();
     _currentProduct = product;
     _vendorSource = new VendorSourceItemManager();
     _vendorManager = new VendorManager();
     _vendors = _vendorManager.GetVendors();
     var RoleAccess = new RoleAccess(_myAccessToken, this);
 }
 public FrmAttachVendorSource(Product product, VendorSourceItem currentVendorSourceItem)
 {
     InitializeComponent();
     _vendorSource = new VendorSourceItemManager();
     _vendorManager = new VendorManager();
     _currentVendorSourceItem = currentVendorSourceItem;
     _vendors = _vendorManager.GetVendors();
     _currentProduct = product;
     nudCase.Value = _currentVendorSourceItem.ItemsPerCase;
     nudMinnimum.Value = _currentVendorSourceItem.MinQtyToOrder;
     nudUnitPrice.Value = _currentVendorSourceItem.UnitCost;
     btnAdd.Text = "Update Vendor";
     comboVendors.Enabled = false;
 }
        public FrmAddLineItemToVendorOrder(VendorOrder vendorOrder, AccessToken acctkn)
        {
            InitializeComponent();
            _myAccessToken = acctkn;
            var RoleAccess = new RoleAccess(acctkn, this);
            this.vendorOrder = vendorOrder;
            txtVendorOrderID.Text = vendorOrder.Id.ToString();
            VendorManager _vendorManager = new VendorManager();

            var vendor = vendorOrder.VendorID;
            txtVendorName.Text = _vendorManager.GetVendor(vendorOrder.VendorID).Name;
            txtVendorID.Text = vendorOrder.VendorID.ToString();
            txtVendorName.ReadOnly = true;
            txtVendorID.ReadOnly = true;
            fillProductDropDown(vendorOrder.VendorID);
        }
        public frmReceiving(VendorOrder vendorOrder, AccessToken acctkn)
        {
            InitializeComponent();
            _myAccessToken = acctkn;

             VendorManager _vendorManager = new VendorManager();
             this.vendorOrder = vendorOrder;

            txtVendorOrderID.Text = vendorOrder.Id.ToString();
            txtVendorName.Text = _vendorManager.GetVendor(vendorOrder.VendorID).Name.ToString();
            txtVendorID.Text = _vendorManager.GetVendor(vendorOrder.VendorID).Id.ToString();
            txtNumberofShipments.Text = _vendorOrderManager.getVendorOrder(vendorOrder.Id).NumberOfShipments.ToString();
            txtDateOrdered.Text = _vendorOrderManager.getVendorOrder(vendorOrder.Id).DateOrdered.ToString();
            vendorOrder = new VendorOrder(Int32.Parse(txtVendorOrderID.Text.ToString()), Int32.Parse(txtVendorID.Text.ToString()));
            populateListView();
            //try
            //{
            //    lvReceiving.Clear();
            //    vendorOrderLineItemList = _receivingManager.GetAllLineItemsByVendorOrder(vendorOrder);
            //    foreach (var vendorOrderLineItem in vendorOrderLineItemList)
            //    {
            //        var item = new ListViewItem();
            //        item.Text = vendorOrderLineItem.ProductID.ToString();
            //        item.SubItems.Add(_productManager.GetProduct(vendorOrderLineItem.ProductID).Name.ToString());
            //        item.SubItems.Add(vendorOrderLineItem.QtyOrdered.ToString());
            //        item.SubItems.Add(vendorOrderLineItem.QtyReceived.ToString());
            //        item.SubItems.Add(vendorOrderLineItem.QtyDamaged.ToString());
            //        item.SubItems.Add(vendorOrderLineItem.Note);
            //        lvReceiving.Items.Add(item);
            //    }
            //    lvReceiving.Columns.Add("ProductID");
            //    lvReceiving.Columns.Add("Product Name");
            //    lvReceiving.Columns.Add("Quantity Ordered");
            //    lvReceiving.Columns.Add("Quantity Received");
            //    lvReceiving.Columns.Add("Quantity Damaged");
            //    lvReceiving.Columns.Add("Note");

            //    lvReceiving.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("An error occured while loading the vendor listView. " + ex.ToString());
            //}
        }
 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 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());
        }
        private void btnUpdateOrder_Click(object sender, EventArgs e)
        {
            ListView.SelectedListViewItemCollection selectedVendorOrderLineItem = this.lvReceiving.SelectedItems;
            if (selectedVendorOrderLineItem.Count > 0)
            {
                //int vendorID = Convert.ToInt32(selectedVendor[0].SubItems[0].Text);
                //Vendor thisVendor = _myVendorManager.GetVendor(vendorID);
                //FrmVendorAddUpdate frm = new FrmVendorAddUpdate(_myAccessToken, thisVendor);
                //frm.ShowDialog();
                //findActiveSelection();
                VendorManager _vendorManager = new VendorManager();
                int productID = Convert.ToInt32(selectedVendorOrderLineItem[0].SubItems[0].Text);
                int id = Convert.ToInt32(txtVendorOrderID.Text);
                string vendorName = txtVendorName.Text;
                int vendorID = Convert.ToInt32(txtVendorID.Text);

                VendorOrderLineItem item = new VendorOrderLineItem(id, productID);
                item.ProductID = productID;
                item.Name = selectedVendorOrderLineItem[0].SubItems[1].Text;
                item.QtyOrdered = Convert.ToInt32(selectedVendorOrderLineItem[0].SubItems[2].Text);
                item.QtyReceived = Convert.ToInt32(selectedVendorOrderLineItem[0].SubItems[3].Text);
                item.QtyDamaged = Convert.ToInt32(selectedVendorOrderLineItem[0].SubItems[4].Text);
                item.Note = selectedVendorOrderLineItem[0].SubItems[5].Text;

                _frmUpdateVendorOrderLineItem = new FrmUpdateVendorOrderLineItem(item, vendorName, vendorID, _myAccessToken);
                _frmUpdateVendorOrderLineItem.ShowDialog();
                populateListView();
            }
        }
Exemple #9
0
 private void frmReorder_Load(object sender, EventArgs e)
 {
     var venManager = new VendorManager();
     fillVendorsComboBox();
 }
Exemple #10
0
 //populates Vendor Combobox with list of Vendors
 private void fillVendorsComboBox()
 {
     _vendorManager = new VendorManager();
     List<Vendor> lVendors = new List<Vendor>();
     lVendors = _vendorManager.GetVendors();
     cbVendors.DataSource = lVendors;
     cbVendors.DisplayMember = "Name";
     cbVendors.ValueMember = "ID";
        // cbVendors.SelectedIndex = 0;
 }
        private void btSaveOrder_Click(object sender, EventArgs e)
        {
            try
            {
                List<VendorOrderLineItem> lineItemList = new List<VendorOrderLineItem>();
                int index = comboVendor.SelectedItem.ToString().IndexOf(" ");
                int id = Convert.ToInt32(comboVendor.SelectedItem.ToString().Substring(0, index));
                _myVendorManager = new VendorManager();

                var vendorName = _myVendorManager.GetVendor(id).Name;

                //VendorOrder myVendorOrder = new VendorOrder(int.Parse(id));
                VendorOrder myVendorOrder = new VendorOrder(id);
                myVendorOrder.NumberOfShipments = Convert.ToInt32(comboShipments.SelectedItem.ToString());
                myVendorOrder.DateOrdered = Convert.ToDateTime(tbOrderDate.Text);
                myVendorOrder.Name = vendorName;

                for (int i = 0; i < lvOrderItems.Items.Count;i++)
                {

                    Int32 productId = Int32.Parse(lvOrderItems.Items[i].SubItems[0].Text);
                    VendorOrderLineItem item = new VendorOrderLineItem(id, productId);
                    item.Name = lvOrderItems.Items[i].SubItems[1].Text;
                    item.QtyOrdered = Int32.Parse(lvOrderItems.Items[i].SubItems[3].Text);
                    lineItemList.Add(item);

                }
                myVendorOrder.LineItems = lineItemList;

                Boolean success = _myVendorOrderManager.AddVendorOrder(myVendorOrder);
                if (success == true)
                {
                    MessageBox.Show("Order Added.");
                    populateListView();
                    comboProduct.Items.Clear();
                }
                else
                {
                    MessageBox.Show("A field is not filled in. Please verify all fields are correct.");
                }

            }
            catch(Exception ex)
            {
                MessageBox.Show("A Generic error as occured. You should fix this message " + ex.ToString());
            }
        }