Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8767169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:44:31+00:00 2026-06-13T16:44:31+00:00

Okay, to explain this I’ll try to summarise what I’m doing At some point

  • 0

Okay, to explain this I’ll try to summarise what I’m doing

At some point I create a list of items in a class ‘Supplier’. In this example a list of parts is added to the list of Suppliers that exists in the masterclass.

At some point, I then want to choose a specific part to be added to a job (job class), this part has already been created, I would simply like to take the part and add it to the job.

That part has been added using this:
‘Previous to this, the supplier has been selected’

Class Supplier
public void AddParts( int PartNum, string PartName, string PartDescription, decimal      Cost, decimal CostWithVAT, decimal Price, short Quantity)
{          
    m_partUsed.Add(new Part(PartNum, PartName, PartDescription, Cost, Price, Quantity));         
}

Here is how I intend to implement this:

   private void btnAddJobPart_Click(object sender, EventArgs e)
    {
        //Select the job that the part is to be added too
        string selectedJob = cboJobPartRef.Text;
        List<Job> foundJob = Program.AuspexDo.SelectJob(selectedJob);

        //For the job found
        foreach (Job j in foundJob)
        {
            //Select the supplier
            string selectedSupplier = cboJobSupplier.Text;
            List<Supplier> foundSup = Program.AuspexDo.SelectSupplier(selectedSupplier);

            //For the supplier found, find the part to be added
            foreach (Supplier s in foundSup)
            {
                string selectedPart = cboJobParts.Text;
                List<Part> foundPart = s.SelectPart(selectedPart);

                //Get those part details

                //Add those details to the job

                j.AddParts //the part item here from the supplier list;


            }                   
        }
    }

Any help would be appreciated. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:44:33+00:00Added an answer on June 13, 2026 at 4:44 pm

    Why don’t you just change the AddParts method to (and call it AddPart since it adds only one part at a time):

    public void AddPart(Part part)
    {          
        m_partUsed.Add(part);         
    }
    

    You can then add a part with

    j.AddPart(somePart);
    

    or using an object initializer

    j.AddPart(new Part{Num=PartNum, Name=PartName, Description=PartDescription,
                       Cost=Cost, Price=Price, Quantity=Quantity});
    

    or using a constructor

    j.AddPart(new Part(PartNum, PartName, PartDescription,
                       Cost, Price, Quantity));
    

    If you prefer to keep your originial implementation you can have two AddPart methods side-by-side. This is called method overloading. You can then choose to add a part object or individual part values.

    public void AddPart(Part part) { ... }
    public void AddPart(int PartNum, string PartName,
                        string PartDescription, decimal Cost,
                        decimal CostWithVAT, decimal Price, short Quantity) { ... }
    

    You can have as many methods with the same name as you want, as long as their parameter lists differ. Either the number of parameters must be different or the parameter types must be different. The parameter names are not taken into account.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, this scenario is a little complicated, but I will try to explain it
Okay let me try to explain this.. So i have a player, that can
Okay this might sound simple but there's a catch. I'll try and explain the
Okay, I'll do my best to explain this. I have a list of company
Okay, this will be a bit hard to explain, but I'll try my best.
Okay so I'm going to try my best to explain this. Me and a
Okay this is very hard to explain, but i want to add padding to
Okay, this is going to be hard to explain but here goes nothing: Lately
Okay I edit my question, try to explain it more clearly: I have a
Okay let me see if I can explain this right. In wordpress we have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.