public ClientsForm() { InitializeComponent(); ReceiptTypeRepository receiptTypeRepository = new ReceiptTypeRepository(); Expression <Func <ReceiptType, bool> > predicate = rt => rt.Status == true; IEnumerable <ReceiptType> receiptTypes = receiptTypeRepository.GetAll(predicate); foreach (ReceiptType receiptType in receiptTypes) { ComboBoxItem comboBoxItem = new ComboBoxItem(); comboBoxItem.Content = receiptType.Name; comboBoxItem.DataContext = receiptType; ReceiptTypes.Items.Add(comboBoxItem); } }
private void EditCustomerForm_Load(object sender, EventArgs e) { Text = $@"Editing Customer {Customer.Name}"; ////Change the title of the dialog box NameTextBox.Text = Customer.Name; EmailTextBox.Text = Customer.Email; RNCTextBox.Text = Customer.RNC; PhNumTextBox.Text = Customer.PhoneNumber; var receiptTypeRep = new ReceiptTypeRepository(Context); ReceiptTypes = receiptTypeRep.GetAll(rt => rt.Status == true).ToList(); foreach (var type in ReceiptTypes) { CustTypeComboBox.Items.Add(type.Name); } CustTypeComboBox.SelectedText = Customer.ReceiptType.Name; }
private void YodaCoffeeShop_Load(object sender, EventArgs e) { orderRep = new OrderRepository(Context); var custRep = new ClientRepository(Context); var prodRep = new ItemRepository(Context); var receiptRep = new ReceiptTypeRepository(Context); ReceiptTypes = receiptRep.GetAll(rt => rt.Status == true).ToList(); foreach (var receiptType in ReceiptTypes) { CustTypeComboBox.Items.Add(receiptType.Name); } CustTypeComboBox.SelectedIndex = 1; Hello(); CustomerList = custRep.GetAll(cl => cl.State).ToList(); ProductList = prodRep.GetAll(prod => prod.State).ToList(); PopulateClientListBox(); PopulateProductListBox(); }