public NewProductRadForm(ProductRadForm currentParentForm, StateForm stateForm) { InitializeComponent(); this._stateForm = stateForm; this._serviceProductBL = new ProductBL(); this._serviceCategoryBL = new CategoryBL(); this._serviceUnitBL = new UnitBL(); this._serviceTaxBL = new TaxBL(); this._currentParentForm = currentParentForm; this.CategoryIDComboBox.DataSource = this._serviceCategoryBL.GetCategories(); this.CategoryIDComboBox.DisplayMember = "CategoryName"; this.CategoryIDComboBox.ValueMember = "CategoryID"; this.UnitIDComboBox.DataSource = this._serviceUnitBL.Sp_GetUnits(); this.UnitIDComboBox.DisplayMember = "UnitDescription"; this.UnitIDComboBox.ValueMember = "UnitID"; this.TaxIDComboBox.DataSource = this._serviceTaxBL.Sp_Taxes(); this.TaxIDComboBox.DisplayMember = "TaxDescription"; this.TaxIDComboBox.ValueMember = "TaxID"; }
private void InitForm() { InitializeComponent(); _invoiceDetailGridModel = new List <InvoiceDetailGridModel>(); this._serviceTaxBL = new TaxBL(); this._serviceTypeOfPayBL = new TypeOfPayBL(); this._serviceCustomerBL = new CustomerBL(); this._serviceEmployeeBL = new EmployeeBL(); this._serviceInvoiceBL = new InvoiceBL(); this._serviceProductBL = new ProductBL(); _sbErrores = new StringBuilder(); var listOfEmployeeToComboBox = this._serviceEmployeeBL.SpGetEmployeeToComboBox(); EmployeesComboBox.DataSource = listOfEmployeeToComboBox; EmployeesComboBox.DisplayMember = "FullName"; EmployeesComboBox.ValueMember = "EmployeeID"; EmployeesComboBox.SelectedIndex = 1; listOfCustomeresToComboBox = this._serviceCustomerBL.Sp_GetAllCustomerToSearch(); SearchCustomerComboBox.DataSource = listOfCustomeresToComboBox; SearchCustomerComboBox.DisplayMember = "CompanyName"; SearchCustomerComboBox.ValueMember = "CustomerID"; SearchCustomerComboBox.SelectedIndex = -1; AutoCompleteStringCollection ac = new AutoCompleteStringCollection(); foreach (var item in listOfCustomeresToComboBox) { ac.Add(item.CompanyName); } SearchCustomerComboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend; SearchCustomerComboBox.AutoCompleteSource = AutoCompleteSource.CustomSource; SearchCustomerComboBox.AutoCompleteCustomSource = ac; SearchCustomerComboBox.Focus(); listOfProducts = this._serviceProductBL.ProductToSearching(); SearchProductComboBox.DataSource = listOfProducts; SearchProductComboBox.DisplayMember = "ProductName"; SearchProductComboBox.ValueMember = "ProductID"; SearchProductComboBox.SelectedIndex = -1; AutoCompleteStringCollection acproducts = new AutoCompleteStringCollection(); foreach (var item in listOfProducts) { acproducts.Add(item.ProductName); } SearchProductComboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend; SearchProductComboBox.AutoCompleteSource = AutoCompleteSource.CustomSource; SearchProductComboBox.AutoCompleteCustomSource = acproducts; SearchProductComboBox.SelectedIndexChanged += SearchProductComboBox_SelectedIndexChanged; //SearchProductComboBox.SelectedValueChanged += new System.EventHandler(this.SearchProductComboBox_SelectedValueChanged); SearchCustomerComboBox.SelectedIndexChanged += SearchCustomerComboBox_SelectedIndexChanged; SearchCustomerComboBox.SelectedValueChanged += new System.EventHandler(this.SearchCustomerComboBox_SelectedValueChanged); this.TypeOfPayComboBox.DataSource = this._serviceTypeOfPayBL.SpTypeOfPay(); this.TypeOfPayComboBox.DisplayMember = "Description"; this.TypeOfPayComboBox.ValueMember = "TypeOfPayID"; this.TypeOfPayComboBox.SelectedValue = 2; this.InvoiceDateRadDateTimePicker.ValueChanged += new System.EventHandler(this.InvoiceDateRadDateTimePicker_ValueChanged); InvoiceDateRadDateTimePicker.Value = DateTime.Now; this.TaxIDComboBox.DataSource = this._serviceTaxBL.Sp_Taxes(); this.TaxIDComboBox.DisplayMember = "TaxDescription"; this.TaxIDComboBox.ValueMember = "TaxID"; this.TaxIDComboBox.TextChanged += new System.EventHandler(this.TaxIDComboBox_TextChanged); this.TypeOfPayComboBox.TextChanged += TypeOfPayComboBox_TextChanged; if (this._stateForm == StateForm.NEW) { InvoiceNumberRadTextBox.Text = this._serviceInvoiceBL.SpGetLastInvoiceNumber().Value.GetInvoiceNumberExt(); } }