protected void setAutoComplete() { TaaliClasses.DataList data = new TaaliClasses.DataList(); var id = from c in data.ClassList() select c.ClassID.ToString(); if (id != null && id.Count() > 0) { boxID.AutoCompleteCustomSource.AddRange(id.ToArray()); } var department = from c in data.ClassList() where c.Department != null && !c.Department.Equals("") select c.Department; if (department != null && department.Count() > 0) { boxDepartment.AutoCompleteCustomSource.AddRange(department.ToArray()); } var floor = from c in data.ClassList() where c.BuildingFloor != null select c.BuildingFloor.ToString(); if (floor != null && floor.Count() > 0) { boxFloor.AutoCompleteCustomSource.AddRange(floor.ToArray()); } var capacity = from c in data.ClassList() select c.Capacity.ToString(); if (capacity != null && capacity.Count() > 0) { boxCapacity.AutoCompleteCustomSource.AddRange(capacity.ToArray()); } }
private void btnAddClass_Click(object sender, EventArgs e) { ClassCategory.BaseClassForm bcf = new ClassCategory.BaseClassForm(); bcf.MultiSelect = false; TaaliClasses.DataList data = new TaaliClasses.DataList(); bcf.Classes = data.ClassList() .Where(c => (from ti in this.Times join tt in this.TimeTableCells on ti.HoldingTimeID equals tt.TimeTeacher.TimeID where tt.ClassID == c.ClassID select ti).Count() == 0).ToList(); bcf.SetDontShowControls(); DialogResult dr = bcf.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { this.TheClass = taali.Classes.Where(c => c.ClassID == bcf.SelectedClasses .SelectedItems[0].ClassID).Single(); this.boxClass.Text = this.TheClass.ClassID.ToString(); this.btnAddClass.Enabled = false; this.btnDeleteClass.Enabled = true; } }