さて、これを説明するために、私がやっていることを要約しようと思います
ある時点で、クラス「サプライヤー」にアイテムのリストを作成します。この例では、パーツのリストが、マスタークラスに存在するサプライヤーのリストに追加されます。
ある時点で、ジョブ (ジョブ クラス) に追加する特定のパーツを選択したいと思います。このパーツは既に作成されています。単純にパーツを取り出してジョブに追加したいと思います。
その部分はこれを使用して追加されました: 「これより前に、サプライヤーが選択されました」
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;
}
}
}
どんな助けでも大歓迎です。ありがとう。