void LoadCivilStatus() { cmbFatherCivilStatus.Items.Clear(); cmbMotherCivilStatus.Items.Clear(); using (Maintenance _maintain = new Maintenance()) { _maintain.GetCivilStatus().OrderBy(o => o.Status).ToList().ForEach(x => { cmbFatherCivilStatus.Items.Add(x.Status); cmbMotherCivilStatus.Items.Add(x.Status); }); } }
void dgCivilStatus_CellClick(object sender, DataGridViewCellEventArgs e) { using (Maintenance _maintain = new Maintenance()) { var value = _maintain.GetCivilStatus().Where(x => x.ID == Convert.ToInt64(dgCivilStatus.SelectedRows[0].Cells[0].Value)).FirstOrDefault(); if (value != null) { txtCivilStatus.Text = value.Status; cbActive.Checked = value.Active.Value; btnEdit = SystemProperties.BtnProperties(btnEdit, true, Imagename.Edit.ToString(), Imagename._edit.ToString()); btnDelete = SystemProperties.BtnProperties(btnDelete, true, Imagename.Delete.ToString(), Imagename._delete.ToString()); } } }
void GetCivilStatus() { dgCivilStatus.Rows.Clear(); int i = 1; using (Maintenance _maintain = new Maintenance()) { _maintain.GetCivilStatus().ForEach(x => { dgCivilStatus.Rows.Add(x.ID, i, x.Status, x.Active); i++; }); } ObjEnable(false); }