Пример #1
0
        public void buildQuoteList()
        {
            DBConnection db = new DBConnection();
            string cmdString = "SELECT QuoteID from quote";


            if (db.OpenConnection())
            {
                MySqlCommand cmd = new MySqlCommand(cmdString, db.getConnection());
                MySqlDataReader dataReader = cmd.ExecuteReader();

                //loop through results, and pull out the info and save it to the quote object
                while (dataReader.Read())
                {
                    try
                    {
                        string quoteid = dataReader["QuoteID"].ToString();
                        stringlist.Add(quoteid);
                    }
                    catch (Exception q) { }
                }

                //close everything
                dataReader.Close();
                db.CloseConnection();

                foreach(string s in stringlist)
                {
                    Quote newquote = new Quote(s, "load");
                    quotelist.Add(newquote);
                }
            }
        }
Пример #2
0
 public Job(string pQuoteID, bool revision)
 {
     isRevision = revision;
     QuoteID = pQuoteID;
     myQuote = new Quote(pQuoteID, "load");
     JobID = createJobID();
 }
Пример #3
0
        public QuotingPricing(Quote pQUote, string mode)
        {
            InitializeComponent();
            localQuote = pQUote;
            if (mode == "save")
            {
                saveLocal();
            }
            else
            {

            }

            setValues();
            
        }
Пример #4
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;
        }
Пример #5
0
        //quote is the quote object we're loading from or saving to
        public QuotingOperations(Quote quote, string pmode)
        {
            InitializeComponent();

            localQuote = quote;
            mode = pmode;
            //mode of "display" means display info already in quote
            if(mode == "display")
            {
                populateOperations();
                btnAddNewOperation.Visible = false;
                btnRemoveOperation.Visible = false;
                btnSaveOperations.Visible = false;
                btnClose.Visible = true;
                
                //set all of the controls to read only so they cant be changed
                SetReadonlyControls(grpOp1.Controls);
                SetReadonlyControls(grpOp2.Controls);
                SetReadonlyControls(grpOp3.Controls);
                SetReadonlyControls(grpOp4.Controls);
                SetReadonlyControls(grpOp5.Controls);
                SetReadonlyControls(grpOp6.Controls);
                SetReadonlyControls(grpOp7.Controls);
            }
            else if(mode == "edit")
            {
                populateOperations();
            }
            //otherwise we show blank and save back into the quote object.


            //build lists of machines and operator levels
            machines = new List<string>();
            levels = new List<string>();
            costs = new List<decimal>();
            buildLists();
        }
Пример #6
0
        private void btnAddJob_Click(object sender, EventArgs e)
        {
            //take selected from listQuotesAndJobs
            //if job get the quoteid
            //create new job 

            //if quote then make folder and job
            try
            {
                string target = listQuotesAndJobs.SelectedItem.ToString();
                Job newjob;
                if (target.Substring(0, 1) == "Q" || chkRevision.Checked == true)
                {
                    newjob = new Job(target, chkRevision.Checked);
                    Quote targetQuote = new Quote(target, "load");
                    try
                    {
                        System.IO.Directory.CreateDirectory("C:\\xampp\\htdocs\\AcuTwistJobs\\" + newjob.myQuote.CustID + "\\" + newjob.JobID);
                    }
                    catch (Exception q)
                    {

                    }
                    DBConnection conn = new DBConnection();
                    if (conn.OpenConnection())
                    {
    
                            try
                            {
                                MySqlCommand command = conn.getConnection().CreateCommand();
                                command.CommandText = "UPDATE quote_info SET FirstJobID = '" + newjob.JobID + "' WHERE InfoID = '" + targetQuote.InfoID + "'";
                                command.ExecuteNonQuery();
                            }
                            catch (Exception q) { }
                        }
                        conn.CloseConnection();

                }
                else
                {
                    newjob = new Job(target, "load");
                }

                po.associatedJobs.Add(newjob);
                listAssociatedJobs.Items.Add(newjob.JobID);
                listJobs.Items.Add(newjob.JobID);
                po.PO_Status = cmbPOStatus.Text;
                po.SaveToDatabase();

                DBConnection connect = new DBConnection();
                if (connect.OpenConnection())
                {
                    foreach (string j in listAssociatedJobs.Items)
                    {
                        try
                        {
                            MySqlCommand command = connect.getConnection().CreateCommand();
                            command.CommandText = "INSERT INTO po_job(PO_No, JobID) VALUES(?PO_No, ?JobID)";

                            command.Parameters.Add("?PO_No", MySqlDbType.VarChar).Value = po.PO_No;
                            command.Parameters.Add("?JobID", MySqlDbType.VarChar).Value = j;
                            command.ExecuteNonQuery();
                        }
                        catch (Exception q) { }
                    }
                    connect.CloseConnection();
                }
                buildLists();
            }
            catch (Exception q) { }
        }
Пример #7
0
 public Job(string pQuoteID)
 {
     QuoteID = pQuoteID;
     myQuote = new Quote(pQuoteID, "load");
     JobID = createJobID();
 }
Пример #8
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;
            }

        }