好的,为了解释这一点,我将尝试总结我在做什么
在某些时候,我在“供应商”类中创建了一个项目列表。在此示例中,将零件列表添加到主类中存在的供应商列表中。
在某些时候,我想选择一个特定的部分添加到作业(作业类),这个部分已经创建,我只是想把它添加到作业中。
该部分已使用以下内容添加:“在此之前,已选择供应商”
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));
}
这是我打算如何实现的:
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;
}
}
}
任何帮助,将不胜感激。谢谢。