private void ContactForm_Load(object sender, EventArgs e) { ContactBindingList contactList = new ContactBindingList(); using (Ambient.DbSession.Activate()) { contactList.Add(OrderingRepositories.Contact.GetAll()); } mHelper.AddAllColumns(); mHelper.DataSource = contactList; }
private void VendorForm_Load(object sender, EventArgs e) { VendorBindingList vendorList = new VendorBindingList(); ContactBindingList contactList = new ContactBindingList(); contactList.AddNew(); using (Ambient.DbSession.Activate()) { vendorList.Add(OrderingRepositories.Vendor.GetAll()); contactList.Add(OrderingRepositories.Contact.GetAll()); } mHelper.AddAllColumns(contactList); mHelper.DataSource = vendorList; }
public void AddAllColumns(ContactBindingList contactList) { AddTextBoxColumn("VendorName", "Vendor Name", 14, false).Frozen = true; AddTextBoxColumn("Terms", "Terms", 4, false); AddTextBoxColumn("Shipping", "Shipping", 4, false); AddTextBoxColumn("SortCode", "Sort Code", 3, false); mPriceCodeCol = AddTextBoxColumn("PriceCode", "Price Code", 3, false); AddComboBoxColumn("RepContactId", "Sales Rep", 10, false, contactList, "ContactName", "Id"); AddComboBoxColumn("OrdContactId", "Order Contact", 10, false, contactList, "ContactName", "Id"); AddComboBoxColumn("ShpContactId", "Ship Contact", 10, false, contactList, "ContactName", "Id"); AddComboBoxColumn("ActContactId", "Accounting", 10, false, contactList, "ContactName", "Id"); AddCurrencyColumn("MinimumOrder", "Min Order", 6, false); AddCheckBoxColumn("PreferredVendor", "Preferred", 3, false); AddCheckBoxColumn("IsActive", "Active", 3, false); AddTextBoxColumn("Notes", "Notes", 30, false).DefaultCellStyle.WrapMode = DataGridViewTriState.True; AddTextBoxColumn("Id", "ID", 5, true); AddTextBoxColumn("CreateDate", "Created", 10, true); AddTextBoxColumn("ModifyDate", "Modified", 10, true); }