public List <VW_Company> GetAllActiveVWCompany() { var cList = new List <VW_Company>(); using (WTCCeresEntities db = new WTCCeresEntities()) { foreach (Company c in db.Company.Where(c => c.IsActive == true).ToList()) { VW_Company cvw = new VW_Company(); cvw.CompanyId = c.CompanyId; cvw.CompanyCode = c.CompanyCode; cvw.CompanyName = c.CompanyName; cvw.Email = c.Email; cvw.Website = c.Website; cvw.Notes = c.Notes; cvw.Rating = c.Rating; cvw.Attention = c.Attention; cvw.CompanyCategoryId = c.CompanyCategoryId; cvw.CategoryName = c.CompanyCategory.Category; cList.Add(cvw); } } return(cList.OrderBy(c => c.CompanyName).ToList()); }
private void EditButton_Click(object sender, EventArgs e) { VW_Company c = (VW_Company)companiesBunifuDataGridView.CurrentRow.DataBoundItem; My.MyProject.Forms.FrmAddOrganization.loadForm(); My.MyProject.Forms.FrmAddOrganization.PopulateInfo(c.CompanyId); MdlLoadingSetting.showDialogForm(My.MyProject.Forms.FrmAddOrganization, My.MyProject.Forms.FrmParentScreen); companyList = new SortableBindingList <VW_Company>(CompanyService.GetAllActiveVWCompany().Where(cvw => cvw.CompanyId != 0).ToList()); VWCompanyBindingSource.DataSource = companyList; }