예제 #1
0
        // TEST - SAVED DATA IS BOUND IN LIST
        private void btnModPartSave_Click(object sender, EventArgs e)
        {
            // Exception Control Set 1.3
            if (ModPartMaxBoxText < ModPartMinBoxText)
            {
                MessageBox.Show("Minimum cannot be greate than the Maximum.");
                return;
            }

            if (radioModInhouse.Checked)
            {
                InHousePart inHouse = new InHousePart(ModPartIDBoxText, ModPartNameBoxText, ModPartInvBoxText, ModPartPriceBoxText, ModPartMaxBoxText, ModPartMinBoxText, int.Parse(ModPartMachComBoxText));
                Inventory.UpdateInHousePart(ModPartIDBoxText, inHouse);
                radioModInhouse.Checked = true;
            }
            else
            {
                OutsourcedPart outSourced = new OutsourcedPart(ModPartIDBoxText, ModPartNameBoxText, ModPartInvBoxText, ModPartPriceBoxText, ModPartMaxBoxText, ModPartMinBoxText, ModPartMachComBoxText);
                Inventory.UpdateOutsourcedPart(ModPartIDBoxText, outSourced);
                radioModOutsourced.Checked = true;
            }
            this.Close();

            MainForm.MainScreenFormLoad();
            MainForm.mainPartsGrid.Update();
            MainForm.mainPartsGrid.Refresh();
        }
예제 #2
0
        public ModifyPartScreen(InHousePart inPart)
        {
            InitializeComponent();

            ModPartIDBoxText      = inPart.PartID;
            ModPartNameBoxText    = inPart.Name;
            ModPartInvBoxText     = inPart.InStock;
            ModPartPriceBoxText   = decimal.Parse(inPart.Price.Substring(1));
            ModPartMaxBoxText     = inPart.Max;
            ModPartMinBoxText     = inPart.Min;
            ModPartMachComBoxText = inPart.MachineID.ToString();
        }
예제 #3
0
        // To finish - not all paths return a value
        public Part LookupAssociatedPart(int partID)
        {
            //TODO - return blank part on failure?
            foreach (Part part in AssociatedParts)
            {
                if (part.PartID == partID)
                {
                    return(part);
                }
            }
            InHousePart emptyInPart = new InHousePart();

            return(emptyInPart);
        }
예제 #4
0
 private void btnModifyPart_Click(object sender, EventArgs e)
 {
     // Opens the modify parts screen with selected part after checking part type
     if (mainPartsGrid.CurrentRow.DataBoundItem.GetType() == typeof(c968.InHousePart))
     {
         InHousePart inPart = (InHousePart)mainPartsGrid.CurrentRow.DataBoundItem;
         new ModifyPartScreen(inPart).ShowDialog();
     }
     else
     {
         OutsourcedPart outPart = (OutsourcedPart)mainPartsGrid.CurrentRow.DataBoundItem;
         new ModifyPartScreen(outPart).ShowDialog();
     }
 }
예제 #5
0
        public static void UpdateInHousePart(int partID, InHousePart inPart)
        {
            for (int i = 0; i < Parts.Count; i++)
            {
                if (Parts[i].GetType() == typeof(c968.InHousePart))
                {
                    InHousePart newPart = (InHousePart)Parts[i];

                    if (newPart.PartID == partID)
                    {
                        newPart.Name      = inPart.Name;
                        newPart.InStock   = inPart.InStock;
                        newPart.Price     = inPart.Price;
                        newPart.Max       = inPart.Max;
                        newPart.Min       = inPart.Min;
                        newPart.MachineID = inPart.MachineID;
                    }
                }
            }
        }
예제 #6
0
        public static void PopulateDummyLists()
        {
            Product dummyProd1 = new Product(1, "Product 1", 10, 12.00m, 20, 5);
            Product dummyProd2 = new Product(2, "Product 2", 10, 8.00m, 25, 5);
            Product dummyProd3 = new Product(3, "Product 3", 10, 5m, 25, 5);
            Product dummyProd4 = new Product(4, "Product 4", 10, 3m, 25, 5);

            Products.Add(dummyProd1);
            Products.Add(dummyProd2);
            Products.Add(dummyProd3);
            Products.Add(dummyProd4);

            // add mach ids and comp names
            Part dummyPart1A = new InHousePart(1, "Part 1.A", 15, 15.00m, 30, 10, 9001);
            Part dummyPart1B = new InHousePart(2, "Part 1.B", 10, 12.00m, 25, 10, 9001);
            Part dummyPart2A = new InHousePart(3, "Part 2.A", 12, 10.00m, 25, 10, 9002);
            Part dummyPart2B = new InHousePart(4, "Part 2.B", 15, 5.00m, 25, 10, 9002);
            Part dummyPart3A = new OutsourcedPart(5, "Part 3.A", 15, 15.00m, 30, 10, "ShopCorp");
            Part dummyPart3B = new OutsourcedPart(6, "Part 3.B", 10, 12.00m, 25, 10, "ShopCorp");
            Part dummyPart4A = new OutsourcedPart(7, "Part 4.A", 12, 10.00m, 25, 10, "PPI, LLC");
            Part dummyPart4B = new OutsourcedPart(8, "Part 4.B", 15, 5.00m, 25, 10, "PPI, LLC");

            Parts.Add(dummyPart1A);
            Parts.Add(dummyPart1B);
            Parts.Add(dummyPart2A);
            Parts.Add(dummyPart2B);
            Parts.Add(dummyPart3A);
            Parts.Add(dummyPart3B);
            Parts.Add(dummyPart4A);
            Parts.Add(dummyPart4B);

            // Add parts to respective Products
            dummyProd1.AssociatedParts.Add(dummyPart1A);
            dummyProd1.AssociatedParts.Add(dummyPart1B);
            dummyProd2.AssociatedParts.Add(dummyPart2A);
            dummyProd2.AssociatedParts.Add(dummyPart2B);
            dummyProd3.AssociatedParts.Add(dummyPart3A);
            dummyProd3.AssociatedParts.Add(dummyPart3B);
            dummyProd4.AssociatedParts.Add(dummyPart4A);
            dummyProd4.AssociatedParts.Add(dummyPart4B);
        }
예제 #7
0
        private void btnAddPartSave_Click(object sender, EventArgs e)
        {
            // Exception Control Set 1.3
            if (AddPartMaxBoxText < AddPartMinBoxText)
            {
                MessageBox.Show("Minimum cannot be greate than the Maximum.");
                return;
            }

            if (radioAddInHouse.Checked)
            {
                InHousePart inHouse = new InHousePart((Inventory.Parts.Count + 1), AddPartNameBoxText, AddPartInvBoxText, AddPartPriceBoxText, AddPartMaxBoxText, AddPartMinBoxText, int.Parse(AddPartMachComBoxText));
                Inventory.AddPart(inHouse);
            }
            else
            {
                OutsourcedPart outsourced = new OutsourcedPart((Inventory.Parts.Count + 1), AddPartNameBoxText, AddPartInvBoxText, AddPartPriceBoxText, AddPartMaxBoxText, AddPartMinBoxText, AddPartMachComBoxText);
                Inventory.AddPart(outsourced);
            }
            this.Close();
        }