예제 #1
0
        //standard initialize-stuff constructor
        //default for a new quote
        public NewQuoteInfo(string cust)
        {        
            InitializeComponent();
            localQuote = new Quote(cust);
            quoteOps = new QuotingOperations(localQuote, "save");
            quotePrice = new QuotingPricing(localQuote, "save");
            //since this is the form for a new quote, grab the current date to set as the quote date
            localQuote.QuoteDate = DateTime.Now;
            //display the date, in "weekday month day year" form.
            lblQuoteDate.Text = "Quote Date: " + localQuote.QuoteDate.ToLongDateString();
            txtCustomer.Text = OrderInfo.getNameFromId(cust);
            lblQuoteID.Text = "Quote ID: " + localQuote.QuoteID;

            //can't view pricing until its saved
            btnViewPricing.Enabled = false;

            insert = false;
        }
예제 #2
0
        //if we pass an id that means we're displaying a quote, not starting a new one.
        public NewQuoteInfo(string QuoteID, string mode)
        {
            InitializeComponent();
            insert = true;
            btnViewTraveler.Enabled = true;
            btnViewTraveler.Text = "View Traveler Info";
            displaying = true;
            localQuote = new Quote(QuoteID, mode);
            try
            {
                if (mode == "edit")
                {
                    quoteOps = new QuotingOperations(localQuote, "edit");
                    quotePrice = new QuotingPricing(localQuote, "edit");
                }
                else
                {
                    quoteOps = new QuotingOperations(localQuote, "display");
                    quotePrice = new QuotingPricing(localQuote, "display");
                }
            }
            catch (Exception q) { btnViewPricing.Enabled = false; btnEditOperations.Enabled = false; }
            lblQuoteDate.Text = "Quote Date: " + localQuote.QuoteDate.ToLongDateString();
            txtCustomer.Text = OrderInfo.getNameFromId(localQuote.CustID);
            lblQuoteID.Text = "Quote Number: " + localQuote.QuoteID;

            //tool type
            string tt = localQuote.ToolType;
            if (tt == "Drill") { radioDrills.Checked = true; }
            else if (tt == "Step-Drill") 
            { 
                radioStepDrills.Checked = true;
                txtNumberSteps.Text = localQuote.NoOfStep;
                int numsteps = Convert.ToInt32(txtNumberSteps.Text);
                if(numsteps >= 1)
                {
                    txtDia1.Text = localQuote.step1Dia;
                    txtLength1.Text = localQuote.step1Length;
                    txtAngle1.Text = localQuote.step1Angle;
                }
                if (numsteps >= 2)
                {
                    txtDia2.Text = localQuote.step2Dia;
                    txtLength2.Text = localQuote.step2Length;
                    txtAngle2.Text = localQuote.step2Angle;
                }
                if (numsteps >= 3)
                {
                    txtDia3.Text = localQuote.step3Dia;
                    txtLength3.Text = localQuote.step3Length;
                    txtAngle3.Text = localQuote.step3Angle;
                }

            }
            else if (tt == "Reamer") { radioReamers.Checked = true; }
            else if (tt == "Step-Reamer")
            {
                radioStepReamers.Checked = true;
                txtNumberSteps.Text = localQuote.NoOfStep;
                int numsteps = Convert.ToInt32(txtNumberSteps.Text);
                if (numsteps >= 1)
                {
                    txtDia1.Text = localQuote.step1Dia;
                    txtLength1.Text = localQuote.step1Length;
                    txtAngle1.Text = localQuote.step1Angle;
                }
                if (numsteps >= 2)
                {
                    txtDia2.Text = localQuote.step2Dia;
                    txtLength2.Text = localQuote.step2Length;
                    txtAngle2.Text = localQuote.step2Angle;
                }
                if (numsteps >= 3)
                {
                    txtDia3.Text = localQuote.step3Dia;
                    txtLength3.Text = localQuote.step3Length;
                    txtAngle3.Text = localQuote.step3Angle;
                }
            }
            else if (tt == "End-Mill Type") { radioEndMill.Checked = true; }
            else if (tt == "Profile") 
            { 
                radioProfile.Checked = true;
                txtNumProfiles.Text = localQuote.NoOfProf;
            }
            else 
            { 
                radioOther.Checked = true;
                txtOtherName.Text = localQuote.OtherToolName;
            }

            //tool info
            if (localQuote.CoolThru == 'Y') { chkCoolant.Checked = true; }
            txtShankDia.Text = localQuote.ShankDiam;
            txtFluteLength.Text = localQuote.FluteLength;
            txtOal.Text = localQuote.OAL;
            txtNumFlutes.Text = localQuote.NoOfFlute;
            txtHoursPerDay.Text = localQuote.HrPerDay.ToString();
            txtSafeTime.Text = localQuote.SafeT.ToString();
            txtDescription.Text = localQuote.Description;
            txtAdminNotes.Text = localQuote.AdminNote;

            //image
            try
            {
                MemoryStream stream = new MemoryStream(localQuote.ToolImage);
                picToolImage.Image = Image.FromStream(stream);
                picToolImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
            }
            catch (Exception q) { }

            //material tab
            txtMaterialVendor.Text = localQuote.MatVend;
            txtMaterialDescription.Text = localQuote.MatDesc;
            txtMaterialSize.Text = localQuote.MatSize;
            txtMaterialOrderNumber.Text = localQuote.MatOrderNo;
            txtMaterialGrade.Text = localQuote.MatGrade;
            txtMaterialLeadtime.Text = localQuote.MatLeadT.ToString();
            //qty breaks (only need to set material, changed triggers will handle rest)
            txtMatQty1.Text = localQuote.BreakDownQty1.ToString();
            txtMatQty2.Text = localQuote.BreakDownQty2.ToString();
            txtMatQty3.Text = localQuote.BreakDownQty3.ToString();
            txtMatQty4.Text = localQuote.BreakDownQty4.ToString();
            txtMatQty5.Text = localQuote.BreakDownQty5.ToString();
            txtMatQty6.Text = localQuote.BreakDownQty6.ToString();
            txtMatQty7.Text = localQuote.BreakDownQty7.ToString();
            txtMatCost1.Text = localQuote.matCost1.ToString();
            txtMatCost2.Text = localQuote.matCost2.ToString();
            txtMatCost3.Text = localQuote.matCost3.ToString();
            txtMatCost4.Text = localQuote.matCost4.ToString();
            txtMatCost5.Text = localQuote.matCost5.ToString();
            txtMatCost6.Text = localQuote.matCost6.ToString();
            txtMatCost7.Text = localQuote.matCost7.ToString();
            //blank prep
            txtBlankVendor.Text = localQuote.BPVend;
            txtBlankDescription.Text = localQuote.BPDesc;
            txtBlankLeadtime.Text = localQuote.BPLeadT.ToString();
            txtBPCost1.Text = localQuote.BPCost1.ToString();
            txtBPCost2.Text = localQuote.BPCost2.ToString();
            txtBPCost3.Text = localQuote.BPCost3.ToString();
            txtBPCost4.Text = localQuote.BPCost4.ToString();
            txtBPCost5.Text = localQuote.BPCost5.ToString();
            txtBPCost6.Text = localQuote.BPCost6.ToString();
            txtBPCost7.Text = localQuote.BPCost7.ToString();
            //coating
            if(localQuote.UseCoating == 'Y')
            {
                chkCoating.Checked = true;
                txtCoatingVendor.Text = localQuote.CoatVend;
                txtCoatingDescription.Text = localQuote.CoatDesc;
                txtCoatingLeadtime.Text = localQuote.CoatLeadT.ToString();
                txtCoatCost1.Text = localQuote.CoatCost1.ToString();
                txtCoatCost2.Text = localQuote.CoatCost2.ToString();
                txtCoatCost3.Text = localQuote.CoatCost3.ToString();
                txtCoatCost4.Text = localQuote.CoatCost4.ToString();
                txtCoatCost5.Text = localQuote.CoatCost5.ToString();
                txtCoatCost6.Text = localQuote.CoatCost6.ToString();
                txtCoatCost7.Text = localQuote.CoatCost7.ToString();
            }

            //machine operations are handled when we created our operations form.

            //change button text/remove buttons
            if (mode != "edit")
            {
                btnEditOperations.Text = "View Operations";
                btnSaveAndClose.Visible = false;
                btnSaveQuote.Visible = false;
            }

        }