public void GetCustomer() { Error = ""; var result = new ObjectParameter("Result", typeof(Int32)); var tranDt = new ObjectParameter("TranDT", typeof(DateTime)); try { using (var context = new QuoteLogContext()) { var collection = context.usp_QT_Customer_Get(_view.cbxCode.Text); foreach (var item in collection) { _view.tbxName.Text = item.CustomerName; _view.tbxAddress1.Text = item.Address1; _view.tbxAddress2.Text = item.Address2; _view.tbxAddress3.Text = item.Address3; _view.tbxCity.Text = item.City; _view.cbxState.Text = item.State; _view.tbxCountry.Text = item.Country; _view.tbxPostalCode.Text = item.PostalCode; _view.cbxTerms.Text = item.Terms; _view.cbxLtaType.Text = item.LtaType; } } } catch (Exception ex) { Error = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message; } }