private void SavePaymentStaging() { try { List <Data_PaymentStaging> payments = bsRecords.DataSource as List <Data_PaymentStaging>; if (payments != null) { Data_PaymentStaging.SavePaymentStaging(Global.Username, payments); } } catch (Exception ex) { Utils.ShowException(ex); } }
private void grdRecords_CellEndEdit(object sender, DataGridViewCellEventArgs e) { try { Data_PaymentStaging payment = grdRecords.Rows[e.RowIndex].DataBoundItem as Data_PaymentStaging; if (payment != null) { Data_PaymentStaging.SavePaymentStaging(payment); } } catch (Exception ex) { Utils.ShowException(ex); } }
private void btnSave_Click(object sender, EventArgs e) { try { List <Data_PaymentStaging> staging = new List <Data_PaymentStaging>(); foreach (DataGridViewRow i in grdSuppliers.Rows) { DataGridViewCheckBoxCell cell = i.Cells["Selected"] as DataGridViewCheckBoxCell; bool isSelected = Convert.ToBoolean(cell.Value); if (isSelected) { Data_Supplier supplier = i.DataBoundItem as Data_Supplier; if (supplier != null) { staging.Add(new Data_PaymentStaging() { Username = Global.Username, SuppplierId = supplier.SupplierID, Amount = amount }); } } } Data_PaymentStaging.SavePaymentStaging(Global.Username, staging); DialogResult = DialogResult.OK; } catch (Exception ex) { Utils.ShowException(ex); } }