void LoadSemester() { cmbSemester.Items.Clear(); using (Maintenance maintain = new Maintenance()) { maintain.GetSemester().OrderBy(o => o.Semester).ToList().ForEach(x => { cmbSemester.Items.Add(x.Semester); }); } }
void dgSemester_CellClick(object sender, DataGridViewCellEventArgs e) { using (Maintenance _maintain = new Maintenance()) { var value = _maintain.GetSemester().Where(x => x.ID == Convert.ToInt64(dgSemester.SelectedRows[0].Cells[0].Value)).FirstOrDefault(); if (value != null) { txtSemester.Text = value.Semester; btnDelete = SystemProperties.BtnProperties(btnDelete, true, Imagename.Delete.ToString(), Imagename._delete.ToString()); btnEdit = SystemProperties.BtnProperties(btnEdit, true, Imagename.Edit.ToString(), Imagename._edit.ToString()); } } }
void LoadSemester() { dgSemester.Rows.Clear(); int i = 1; using (Maintenance _maintain = new Maintenance()) { _maintain.GetSemester().OrderBy(y => y.Semester).ToList().ForEach(x => { dgSemester.Rows.Add(x.ID, i, x.Semester); i++; }); } ObjEnable(false); dgSemester.Enabled = true; }