public List <CompanyVM> GetCompanyList() { List <CompanyVM> companiesVM = new List <CompanyVM>(); List <Company> companies = companyDL.GetCompanyList(); foreach (Company company in companies) { CompanyVM companyVM = new CompanyVM(); companyVM.AccountNumber = company.AccountNumber; companyVM.Address = company.Address; companyVM.BankName = company.BankName; companyVM.CINNum = company.CINNum; companyVM.City = company.City != null ? company.City.Name : String.Empty; companyVM.ContactPerson = company.ContactPerson; companyVM.Email = company.Email; companyVM.GSTINNUM = company.GSTINNUM; companyVM.ID = company.ID; companyVM.IFSCCode = company.IFSCCode; companyVM.IsActive = company.IsActive; companyVM.Name = company.Name; companyVM.PANNumber = company.PANNumber; companyVM.Phone = company.Phone; companyVM.State = company.State != null ? company.State.Name : string.Empty; companyVM.Type = company.Type != null ? company.Type.Type : string.Empty; companyVM.Zip = company.Zip; companiesVM.Add(companyVM); } return(companiesVM); }
void CompanyComboBox() { CompanyDL objCompanyDL = new CompanyDL(); List <CompanyEL> CompanyList = objCompanyDL.GetCompanyList(); cmbCompany.SelectedIndexChanged -= cmbCompany_SelectedIndexChanged; cmbCompany.DataSource = CompanyList; cmbCompany.DisplayMember = "company_name"; cmbCompany.ValueMember = "Company_id"; cmbCompany.SelectedIndexChanged += cmbCompany_SelectedIndexChanged; }
/// <summary> /// LoadDropDownList /// </summary> private void LoadDropDownList() { try { ddlCompany.DataSource = _company.GetCompanyList().Tables[0]; ddlCompany.DataTextField = "CompanyName"; ddlCompany.DataValueField = "CompanyID"; ddlCompany.DataBind(); ddlCompany.Items.Insert(0, "--Select One--"); ddlCompany.Items[0].Value = ""; } catch (Exception ex) { ErrorLog.LogErrorMessageToDB("UserPageSettings.aspx", "", "LoadDropDownList", ex.Message, new ACEConnection()); } }
void GridBind() { try { CompanyDL objCompanyDL = new CompanyDL(); List <CompanyEL> CompanyList = objCompanyDL.GetCompanyList(); dataGridView1.SelectionChanged -= dataGridView1_SelectionChanged; dataGridView1.Click -= dataGridView1_Click; for (int i = 0; i < CompanyList.Count; i++) { dataGridView1.Rows.Add(); dataGridView1.Rows[i].Cells["Company_id"].Value = CompanyList[i].Company_id; dataGridView1.Rows[i].Cells["company_name"].Value = CompanyList[i].company_name; dataGridView1.Rows[i].Cells["tin_no"].Value = CompanyList[i].tin_no; dataGridView1.Rows[i].Cells["pan_no"].Value = CompanyList[i].pan_no; dataGridView1.Rows[i].Cells["phone"].Value = CompanyList[i].phone; dataGridView1.Rows[i].Cells["address1"].Value = CompanyList[i].address1; dataGridView1.Rows[i].Cells["city"].Value = CompanyList[i].city; dataGridView1.Rows[i].Cells["state"].Value = CompanyList[i].state; dataGridView1.Rows[i].Cells["pincode"].Value = CompanyList[i].pincode; dataGridView1.Rows[i].Cells["email"].Value = CompanyList[i].email; dataGridView1.Rows[i].Cells["phone"].Value = CompanyList[i].phone; dataGridView1.Rows[i].Cells["Fax_No"].Value = CompanyList[i].Fax_No; dataGridView1.Rows[i].Cells["delivery_at"].Value = CompanyList[i].delivery_at; } dataGridView1.Columns["Company_id"].Visible = false; dataGridView1.SelectionChanged += dataGridView1_SelectionChanged; dataGridView1.Click += dataGridView1_Click; } catch { } ControlClear(); }