Example #1
0
 //grab the name of the customer from the combobox and save it to our local copy of the quote. Then open the quoting info form
 private void btnSubmitExisting_Click(object sender, EventArgs e)
 {
     if (cmbCustomerName.Text != "")
     {
         //grab customer name
         custID = getCustID(custName);
         if (target == "quote")
         {
             NewQuoteInfo newQuote = new NewQuoteInfo(custID);
             newQuote.Show();
             newQuote.BringToFront();
         }
         else if(target == "po")
         {
             ViewPO vpo = new ViewPO(custID);
             vpo.Show();
             vpo.BringToFront();
         }
         this.Close();
     }
 }
Example #2
0
 private void btnViewJobQuote_Click(object sender, EventArgs e)
 {
     string target = listJobs.SelectedItem.ToString();
     Job j = new Job(target, "load");
     target = j.QuoteID;
      
     NewQuoteInfo nq = new NewQuoteInfo(target, "display");
     nq.Show();
     nq.BringToFront();
 }
Example #3
0
        private void btnViewQuote_Click(object sender, EventArgs e)
        {
            try
            {
                //launch quoteinfo page with a passed id and fill the form
                string target = listQuotesAndJobs.SelectedItem.ToString();

                //check to see if its a quote (will have Q in front)
                if (target.Substring(0, 1) != "Q")
                {
                    //if its not a quote its a job, but we need the quote
                    //so make a job object, it will fetch its quoteid
                    Job j = new Job(target, "load");
                    //then grab it
                    target = j.QuoteID;
                }

                NewQuoteInfo nq = new NewQuoteInfo(target, "display");
                nq.Show();
                nq.BringToFront();
            }
            catch(Exception q)
            { }
        }
Example #4
0
        private void btnEditQuote_Click(object sender, EventArgs e)
        {
            try
            {
                string targetquote = listQuotes.SelectedItem.ToString();
                NewQuoteInfo viewquote = new NewQuoteInfo(targetquote, "edit");
                viewquote.ShowDialog();
            }
            catch (Exception q)
            {

            }
        }
Example #5
0
        //grab the new customer info and send it to the database
        private void btnNewCustomer_Click(object sender, EventArgs e)
        {
            if(txtNewCustomerCode.Text.Substring(0,1) == "Q")
            {
                MessageBox.Show("Cannot have a leading Q in the customer code");
                return;
            }
            try
            {
                DBConnection conn = new DBConnection();
                if (conn.OpenConnection())
                {
                    MySqlCommand command = conn.getConnection().CreateCommand();
                    command.CommandText = "INSERT INTO customer(CustID, Name, Address, Phone, Fax, Email, Contact, OtherInfo) VALUES (?CustID, ?Name, ?Address, ?Phone, ?Fax, ?Email, ?Contact, ?OtherInfo)";
                    command.Parameters.Add("?CustID", MySqlDbType.VarChar).Value = txtNewCustomerCode.Text;
                    command.Parameters.Add("?Name", MySqlDbType.VarChar).Value = txtNewCustomerName.Text;
                    command.Parameters.Add("?Address", MySqlDbType.VarChar).Value = txtNewCustomerAddress.Text;
                    command.Parameters.Add("?Phone", MySqlDbType.VarChar).Value = txtNewCustomerPhone.Text;
                    command.Parameters.Add("?Fax", MySqlDbType.VarChar).Value = txtNewCustomerFax.Text;
                    command.Parameters.Add("?Email", MySqlDbType.VarChar).Value = txtNewCustomerEmail.Text;
                    command.Parameters.Add("?Contact", MySqlDbType.VarChar).Value = txtNewContactPerson.Text;
                    command.Parameters.Add("?OtherInfo", MySqlDbType.Text).Value = txtAdditionalInfo.Text;
                    command.ExecuteNonQuery();
                    conn.CloseConnection();
                    custID = txtNewCustomerCode.Text;
                    NewQuoteInfo newQuote = new NewQuoteInfo(custID);
                    newQuote.Show();
                    newQuote.BringToFront();
                    this.Close();

                }
                else
                {
                    MessageBox.Show("There was an error connecting to the database");
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show("There was an error while saving to the database.\n\n Text: " + ex.StackTrace);
            }
        }