Beispiel #1
0
        private void btnPushToTest_Click(object sender, EventArgs e)
        {
            Material material = new Material();

            try
            {
                material.Name           = TxtName.Text;
                material.Qty            = UInt32.Parse(TxtQty.Text);
                material.Material_Cost  = float.Parse(TxtCost.Text);
                material.Markup         = float.Parse(TxtMarkup.Text);
                material.Setup_Cost     = UInt32.Parse(TxtSetupCost.Text);
                material.Setup_Hr       = float.Parse(TxtSetupHr.Text);
                material.Operation_Cost = UInt32.Parse(TxtOptCost.Text);
                material.Operation_Hr   = float.Parse(TxtOptHr.Text);

                //testQuotation.Name = TxtName.Text;
                //testQuotation.Qty = UInt32.Parse(TxtQty.Text);
                //testQuotation.Material_Cost = UInt32.Parse(TxtCost.Text);
                //testQuotation.Markup = float.Parse(TxtMarkup.Text);
                //testQuotation.Setup_Cost = UInt32.Parse(TxtSetupCost.Text);
                //testQuotation.Setup_Hr = float.Parse(TxtSetupHr.Text);
                //testQuotation.Operation_Cost = UInt32.Parse(TxtOptCost.Text);
                //testQuotation.Operation_Hr = float.Parse(TxtOptHr.Text);

                if (!lockModify)
                {
                    testQuotation.ModifyMaterial(oldName, material);
                    lockModify = true;
                }

                if (!lockAdd)
                {
                    testQuotation.AddMaterial(material);
                    lockAdd = true;
                }

                material.SetSubTotal();
                material.SetPricePerPiece();
                testQuotation.setTotal();


                TxtTotal.Text = testQuotation.Total.ToString();

                //TxtListofMaterials.Text = testQuotation.listMaterials();
                //var sb = new StringBuilder();
                //var listOfMaterials = testQuotation.GetMaterials();
                //foreach(Material material1 in listOfMaterials)
                //{
                //    sb.AppendLine(material1.Name);
                //    sb.Append("; Subtotal: " + material.SubTotal.ToString());
                //}

                //TxtListofMaterials.Text = sb.ToString();
                DisplayTable();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            //MessageBox.Show(testQuotation.ToString());
        }