void LoadApplication() { cmbApplication.Items.Clear(); using (Maintenance _maintain = new Maintenance()) { _maintain.GetApplication().OrderBy(o => o.Application).ToList().ForEach(x => { cmbApplication.Items.Add(x.Application); }); } }
void GetApplication() { dgApplication.Rows.Clear(); int i = 1; using (Maintenance _maintain = new Maintenance()) { _maintain.GetApplication().ForEach(x => { dgApplication.Rows.Add(x.ID, i, x.Application, x.Description, x.Active); i++; }); } ObjEnable(false); }
void dgApplication_CellClick(object sender, DataGridViewCellEventArgs e) { if (dgApplication.Rows.Count > 0) { using (Maintenance _maintain = new Maintenance()) { var value = _maintain.GetApplication().Where(x => x.ID == Convert.ToInt64(dgApplication.SelectedRows[0].Cells[0].Value)).FirstOrDefault(); if (value != null) { txtApplication.Text = value.Application; txtDescription.Text = value.Description; cbActive.Checked = value.Active.Value; btnDelete = SystemProperties.BtnProperties(btnDelete, true, Imagename.Delete.ToString(), Imagename._delete.ToString()); btnEdit = SystemProperties.BtnProperties(btnEdit, true, Imagename.Edit.ToString(), Imagename._edit.ToString()); } } } }