private void btnAdd_Click(object sender, EventArgs e) { var form = new AddCowOrderOutForm(); form.AddDead = this; form.IsDead = true; if (DialogResult.Yes == form.ShowDialog()) { foreach (AddCowOrderOutForm.CowPoJo cow in form.Cows) { dgvCowAdd.Rows.Add(); dgvCowAdd.Rows[dgvCowAdd.Rows.Count - 1].Cells["colID"].Value = dgvCowAdd.Rows.Count; dgvCowAdd.Rows[dgvCowAdd.Rows.Count - 1].Cells["colCowNO"].Value = cow.NO; dgvCowAdd.Rows[dgvCowAdd.Rows.Count - 1].Cells["colCorral"].Value = cow.CorralID; dgvCowAdd.Rows[dgvCowAdd.Rows.Count - 1].Cells["colGene"].Value = cow.GeneID; dgvCowAdd.Rows[dgvCowAdd.Rows.Count - 1].Cells["colSex"].Value = cow.SexID; dgvCowAdd.Rows[dgvCowAdd.Rows.Count - 1].Cells["colDescription"].Value = String.Empty; } } }
private void btnAddCow_Click(object sender, EventArgs e) { var form = new AddCowOrderOutForm(); form.OrderOutWizard = this; var result = form.ShowDialog(); if (result == System.Windows.Forms.DialogResult.Yes) { foreach (AddCowOrderOutForm.CowPoJo cow in form.Cows) { dgvCow.Rows.Add(); dgvCow.Rows[dgvCow.Rows.Count - 1].Cells["colID"].Value = dgvCow.Rows.Count; dgvCow.Rows[dgvCow.Rows.Count - 1].Cells["colCowNO"].Value = cow.NO; dgvCow.Rows[dgvCow.Rows.Count - 1].Cells["colCowCorral"].Value = cow.CorralID; dgvCow.Rows[dgvCow.Rows.Count - 1].Cells["colCowGene"].Value = cow.GeneID; dgvCow.Rows[dgvCow.Rows.Count - 1].Cells["colCowSex"].Value = cow.SexID; dgvCow.Rows[dgvCow.Rows.Count - 1].Cells["colCowProfitAmount"].Value = cow.OrderOutAmount - cow.OrderInAmount; dgvCow.Rows[dgvCow.Rows.Count - 1].Cells["colCowOrderInAmount"].Value = cow.OrderInAmount; dgvCow.Rows[dgvCow.Rows.Count - 1].Cells["colCowOrderOutAmount"].Value = cow.OrderOutAmount; } } }