private void AddButton_Click(object sender, EventArgs e) { if (CustomerDropdown.SelectedIndex == -1) { return; } //var form = new AddInvoiceForm() //{ // CustomerId = (int)CustomerDropdown.SelectedValue, // CustomerName = CustomerDropdown.Text, //}; var form = new AddCounterItemForm() { CustomerId = (int)CustomerDropdown.SelectedValue, CustomerName = CustomerDropdown.Text, InvoiceIds = invoiceList.Where(a => a.SaleId != null && a.SaleId != 0).ToDictionary(a => a.SaleId, b => b.Amount), ReturnIds = invoiceList.Where(a => a.ReturnId != null && a.ReturnId != 0) .ToDictionary(a => a.ReturnId, b => b.Amount), Type = PaymentType.Sales }; form.SelectionComplete += new EventHandler <SelectionCompleteEventArgs>(form_SelectionComplete); form.Show(); }
private void AddButton_Click(object sender, EventArgs e) { //if (this.PaymentId != 0 && // this.poList.Count > 0 && // ClientHelper.ShowConfirmMessage("Adding new invoices will clear the current list. Do you want to continue?") != DialogResult.Yes) // return; if (SupplierDropdown.SelectedIndex != -1) { //if (revertCount == 0) // RevertOriginalList(); //this.poList.Clear(); //BindPOs(); //AddPOForm form = new AddPOForm(); //form.SupplierId = CashCheckbox.Checked ? 0 : (int)SupplierDropdown.SelectedValue; //form.SupplierName = SupplierDropdown.Text; AddCounterItemForm form = new AddCounterItemForm() { CustomerId = CashCheckbox.Checked ? 0 : (int)SupplierDropdown.SelectedValue, CustomerName = SupplierDropdown.SelectedText, InvoiceIds = poList.Where(a => a.PurchaseId != null && a.PurchaseId != 0).ToDictionary(a => a.PurchaseId, b => b.Amount), ReturnIds = poList.Where(a => a.ReturnId != null && a.ReturnId != 0) .ToDictionary(a => a.ReturnId, b => b.Amount), Type = PaymentType.Purchase }; form.SelectionComplete += new EventHandler <SelectionCompleteEventArgs>(form_SelectionComplete); form.Show(); } }