private void lsvBillExport_Click(object sender, EventArgs e) { if (lsvBillExport.SelectedItems.Count > 0) { DetailOfBillExport detail = detailOfBillExports.ElementAt(lsvBillExport.SelectedItems[0].Index); int count = detail.Count; foreach (Material material in materials) { if (material.IDMaterial == detail.IDMaterial) { count += material.AmountLeft; } } fChangeNumberOfMaterialExport f = new fChangeNumberOfMaterialExport(count); f.Changed += ChangedDetailBillExport; f.ShowDialog(); } }
private void ChangedDetailBillExport(object sender, EventArgs e) { fChangeNumberOfMaterialExport f = sender as fChangeNumberOfMaterialExport; if (f != null) { DetailOfBillExport detail = detailOfBillExports.ElementAt(lsvBillExport.SelectedItems[0].Index); int count = f.Value; int numberBack = detail.Count - count; detail.Count = count; foreach (Material item in materials) { if (item.IDMaterial == detail.IDMaterial) { item.AmountLeft += numberBack; } } LoadLsvBillExport(); LoadLsvMaterial(); } }