public ChooseDepartments(string DepartMentIds) : this() { IList <Model.Department> deplist = new BL.DepartmentManager().Select(); if (string.IsNullOrEmpty(DepartMentIds)) { foreach (Model.Department de in deplist) { de.IsChecked = true; } } else { foreach (Model.Department de in deplist) { if (DepartMentIds.Contains(de.DepartmentId)) { de.IsChecked = true; } else { de.IsChecked = false; } } } this._allCount = deplist.Count; this.bindingSource1.DataSource = deplist; }