示例#1
0
        public void InitializeEntities()
        {
            coatings  = new List <Coating>();
            tooltypes = new List <ToolType>();

            drytreatmentBefore   = new DryTreatment();
            watertreatmentBefore = new WaterTreatment();

            drytreatmentAfter   = new DryTreatment();
            watertreatmentAfter = new WaterTreatment();
        }
示例#2
0
        public void ReadDryTreatments()
        {
            string           startupPath = Environment.CurrentDirectory;
            IExcelDataReader excelReader = ReadExcel(startupPath + @"\toerstraaling.xlsx");

            excelReader.Read();

            while (excelReader.Read())
            {
                DryTreatment DT = new DryTreatment();
                DT.ToVolume     = excelReader.GetDouble(0);
                DT.QuantityLow  = excelReader.GetDouble(1);
                DT.QuantityMid  = excelReader.GetDouble(2);
                DT.QuantityHigh = excelReader.GetDouble(3);

                DryTreatments.Add(DT);
            }

            excelReader.Close();
        }
示例#3
0
        private void Calculate_Click(object sender, EventArgs e)
        {
            InitializeEntities();

            try
            {
                // Coating
                if (dropdown1.SelectedItem != null && dropdown1.SelectedItem.ToString() != "")
                {
                    coatings.Add(CR.GetCoating(dropdown1.SelectedItem.ToString()));
                }
                if (dropdown2.SelectedItem != null && dropdown2.SelectedItem.ToString() != "")
                {
                    coatings.Add(CR.GetCoating(dropdown2.SelectedItem.ToString()));
                }
                if (dropdown3.SelectedItem != null && dropdown3.SelectedItem.ToString() != "")
                {
                    coatings.Add(CR.GetCoating(dropdown3.SelectedItem.ToString()));
                }
                if (dropdown4.SelectedItem != null && dropdown4.SelectedItem.ToString() != "")
                {
                    coatings.Add(CR.GetCoating(dropdown4.SelectedItem.ToString()));
                }
                if (dropdown5.SelectedItem != null && dropdown5.SelectedItem.ToString() != "")
                {
                    coatings.Add(CR.GetCoating(dropdown5.SelectedItem.ToString()));
                }

                // Stråling before
                if (VådstrålingFør.Checked)
                {
                    watertreatmentBefore = WTR.GetWaterTreatment(steel);
                }
                if (TørstrålingFør.Checked)
                {
                    drytreatmentBefore = DTR.GetDryTreatment(steel);
                }

                // Stråling after
                if (VådstrålingEfter.Checked)
                {
                    watertreatmentAfter = WTR.GetWaterTreatment(steel);
                }
                if (TørstrålingEfter.Checked)
                {
                    drytreatmentAfter = DTR.GetDryTreatment(steel);
                }

                // Tool types
                if (tooltypes1.SelectedItem != null)
                {
                    tooltypes.Add(TTR.GetToolType(tooltypes1.SelectedItem.ToString()));
                }

                double totalprice = 0;

                totalprice = steel.GetFinalPrice(
                    coatings, watertreatmentBefore, drytreatmentBefore, tooltypes, watertreatmentAfter, drytreatmentAfter
                    );

                /////////////////////////////////////////////////////////////////////////////////////////////

                if (stripning1.Checked)
                {
                    totalprice += (0.4 * steel.BasePrice * steel.Quantity);
                }

                if (stripning2.Checked)
                {
                    totalprice += (0.4 * steel.BasePrice * steel.Quantity);
                }

                if (efterpolering.Checked)
                {
                    totalprice += ((0.02 * steel.BasePrice) + 25) * steel.Quantity;
                }

                //////////////////////////////////////////////////////////////////////////////////////////////

                string[] custom = custombox.Text.Split('+');

                foreach (var item in custom)
                {
                    totalprice += Convert.ToInt32(item);
                }

                this.Price.Text = Convert.ToString(Math.Round(totalprice, 2));
            }
            catch { }
        }