private void ApplyEdit()
        {
            l                = new Accessor.LengthAccess();
            l.MaterialID     = MaterialIDtxt.Text;
            l.NumPieces      = Convert.ToDecimal(NumMidPanelNumOne.Text);
            l.TotalLength    = Convert.ToDecimal(NumMidPanelNumTwo.Text);
            l.TotalCost      = decimal.Parse(MiddlePaneltxt.Text, System.Globalization.NumberStyles.Currency);
            l.LengthPerPiece = decimal.Parse(LowerPanelNumOnetxt.Text);
            l.PricePerMeter  = decimal.Parse(LowerPanelNumTwotxt.Text, System.Globalization.NumberStyles.Currency);

            d.SaveLength(costID, l);
            CmbMat.DataSource = d.GetLength();
        }
        private void SetDisplay()
        {
            l      = new Accessor.LengthAccess();
            l      = CmbMat.SelectedItem as Accessor.LengthAccess;
            costID = l.LengthCostID;
            Descriptiontxt.Text = l.Description;
            MaterialIDtxt.Text  = l.MaterialID;
            //Middel pane
            MiddlePanelNumOnelbl.Text   = "Number of Pieces";
            MiddlePanelNumTwolbl.Text   = "Length Per Piece(Meters";
            MiddlePanelNumThreelbl.Text = "Cost of all Pieces";

            string numPieces = string.Format("{0:0.00}", l.NumPieces);

            NumMidPanelNumOne.Text = numPieces;

            string lenghtPerPiece = string.Format("{0:0.00}", l.LengthPerPiece);

            NumMidPanelNumTwo.Text = lenghtPerPiece;

            string costAllPieces = string.Format("{0:C}", l.TotalCost);

            MiddlePaneltxt.Text = costAllPieces;

            //Lower pane
            LowerPanelNumOnelbl.Text = "Total Length";
            LowerPanelNumTwolbl.Text = "Price per Meter";

            string totLength = string.Format("{0:0.00}", l.TotalLength);

            LowerPanelNumOnetxt.Text = totLength;

            string pricePerM = string.Format("{0:C}", l.PricePerMeter);

            LowerPanelNumTwotxt.Text = pricePerM;
        }
예제 #3
0
        private void ApplyEdit()
        {
            switch (CostType)
            {
            case myCostType.Lenght:     //Length
                l                = new Accessor.LengthAccess();
                l.MaterialID     = txtMaterialID.Text;
                l.NumPieces      = Convert.ToDecimal(numMidPanelNumberOne.Text);
                l.TotalLength    = Convert.ToDecimal(numMidPanelNumberTwo.Text);
                l.TotalCost      = decimal.Parse(txtMiddlePanel.Text, System.Globalization.NumberStyles.Currency);
                l.LengthPerPiece = decimal.Parse(txtLowerPanelNumOne.Text);
                l.PricePerMeter  = decimal.Parse(txtLowerPanelNumTwo.Text, System.Globalization.NumberStyles.Currency);

                d.SaveLength(costID, l);
                //SetDisplay(false);
                break;

            case myCostType.Area:
                a                = new Accessor.AreaAccess();
                a.MaterialID     = txtMaterialID.Text;
                a.TotalLenght    = Convert.ToDecimal(numMidPanelNumberOne.Text);
                a.TotalWidth     = Convert.ToDecimal(numMidPanelNumberTwo.Text);
                a.TotalCost      = decimal.Parse(txtMiddlePanel.Text, System.Globalization.NumberStyles.Currency);
                a.TotalArea      = Convert.ToDecimal(txtLowerPanelNumOne.Text);
                a.PricePSqrMeter = decimal.Parse(txtLowerPanelNumTwo.Text, System.Globalization.NumberStyles.Currency);

                d.SaveArea(costID, a);
                //SetDisplay(false);
                //todo call savearea
                //TODO ENTER VOLUME CASE
                break;

            default:
                break;
            }
        }
 private void CmbMat_SelectedIndexChanged(object sender, EventArgs e)
 {
     l = CmbMat.SelectedItem as Accessor.LengthAccess;
     SetDisplay();
 }