public override void EditObject() { DataGridViewRow dgvRow = base.getSelectedDataRow(); if (dgvRow != null) { int editId = (int)dgvRow.Cells["Id"].Value; NoteTemplate note = new NoteTemplate(editId); NoteTemplateForm frm = new NoteTemplateForm(note); DialogResult result = frm.ShowDialog(); AppFuncs.dialogCloseResult(frm.GetType().Name, result); if (result == DialogResult.OK) { bool dbResult = DBContext.UpdateEntity(note); if (dbResult) { this.LoadDataToGrid(); base.selectGridRowById(editId); MessageBox.Show("Шаблон службової оновлен", "Оновлення шаблону службової", MessageBoxButtons.OK, MessageBoxIcon.Information); } AppFuncs.saveToDBResult(dbResult); } base.EditObject(); } }
public override void EditObject() { DataGridViewRow dgvRow = base.getSelectedDataRow(); if (dgvRow != null) { int editId = (int)dgvRow.Cells["Id"].Value; Department dep = new Department() { Id = editId, Name = (string)dgvRow.Cells["Name"].Value }; DepartmentForm frm = new DepartmentForm(dep); DialogResult result = frm.ShowDialog(); AppFuncs.dialogCloseResult(frm.GetType().Name, result); if (result == DialogResult.OK) { bool dbResult = DBContext.UpdateEntity(frm.Department); if (dbResult) { this.LoadDataToGrid(); base.selectGridRowById(frm.Department.Id); } AppFuncs.saveToDBResult(dbResult); } base.EditObject(); } }
public override void EditObject() { DataGridViewRow dgvRow = base.getSelectedDataRow(); if (dgvRow != null) { int editId = (int)dgvRow.Cells["Id"].Value; ScheduleModel sched = new ScheduleModel() { Id = editId, DepartmentName = Convert.ToString(dgvRow.Cells["Відділ"].Value), DepartmentId = Convert.ToInt32(dgvRow.Cells["DepartmentId"].Value), Approved = Convert.ToBoolean(dgvRow.Cells["Затверджений"].Value), Date = Convert.ToDateTime(dgvRow.Cells["Дата"].Value), Dir = Convert.ToString(dgvRow.Cells["Ким"].Value) }; Schedule frm = new Schedule(sched); DialogResult result = frm.ShowDialog(); AppFuncs.dialogCloseResult(frm.GetType().Name, result); if (result == DialogResult.OK) { bool dbResult = DBContext.UpdateSchedule(sched); if (dbResult) { this.LoadDataToGrid(); base.selectGridRowById(editId); } AppFuncs.saveToDBResult(dbResult); } base.EditObject(); } }
public override void EditObject() { if (base.AllowEdit == false) { base.notAllowEditAction(); return; } DataGridViewRow dgvRow = base.getSelectedDataRow(); if (dgvRow != null) { int editId = (int)dgvRow.Cells["Id"].Value; PhoneModel phone = new PhoneModel(editId); NewPhone frm = new NewPhone(phone); DialogResult result = frm.ShowDialog(); AppFuncs.dialogCloseResult(frm.GetType().Name, result); if (result == DialogResult.OK) { bool dbResult = DBContext.UpdateEntity(phone); if (dbResult) { this.LoadDataToGrid(); base.selectGridRowById(editId); } AppFuncs.saveToDBResult(dbResult); } base.EditObject(); } }//Edit
}//Edit public override void CreateNewObject() { if (base.AllowEdit == false) { base.notAllowEditAction(); return; } NewPhone frm = new NewPhone(null); DialogResult result = frm.ShowDialog(); AppFuncs.dialogCloseResult(frm.GetType().Name, result); if ((result == DialogResult.OK) && (frm.PhoneModel != null)) { bool dbResult = DBContext.InsertEntity(frm.PhoneModel); if (dbResult) { this.LoadDataToGrid(); base.selectGridRowById(frm.PhoneModel.Id); } AppFuncs.saveToDBResult(dbResult); } frm.Dispose(); base.CreateNewObject(); }
public override void EditObject() { DataGridViewRow dgvRow = base.getSelectedDataRow(); if (dgvRow != null) { int editId = (int)dgvRow.Cells["Id"].Value; User user = new User(editId); UserForm frm = new UserForm(user); DialogResult result = frm.ShowDialog(); AppFuncs.dialogCloseResult(frm.GetType().Name, result); if (result == DialogResult.OK) { bool dbResult = DBContext.UpdateEntity(user); if (dbResult) { this.LoadDataToGrid(); base.selectGridRowById(editId); } AppFuncs.saveToDBResult(dbResult); } base.EditObject(); } }
public override void CreateNewObject() { if (base.AllowEdit == false) { base.notAllowEditAction(); return; } NewNote frm = new NewNote(null); DialogResult result = frm.ShowDialog(); AppFuncs.dialogCloseResult(frm.GetType().Name, result); if ((result == DialogResult.OK) && (frm.Note != null)) { bool dbResult = DBContext.InsertNotes(frm.Note); if (dbResult) { this.LoadDataToGrid(); base.selectGridRowById(frm.Note.Id); MessageBox.Show("Створена нова службова за № " + frm.Note.Id.ToString(), "Строверення службової", MessageBoxButtons.OK, MessageBoxIcon.Information); } AppFuncs.saveToDBResult(dbResult); } frm.Dispose(); base.CreateNewObject(); }
public override void EditObject() { if (base.AllowEdit == false) { base.notAllowEditAction(); return; } DataGridViewRow dgvRow = base.getSelectedDataRow(); if (dgvRow != null) { int editId = (int)dgvRow.Cells["Id"].Value; Note note = new Note(editId); NewNote frm = new NewNote(note); DialogResult result = frm.ShowDialog(); AppFuncs.dialogCloseResult(frm.GetType().Name, result); if (result == DialogResult.OK) { bool dbResult = DBContext.UpdateNotes(note); if (dbResult) { this.LoadDataToGrid(); base.selectGridRowById(editId); MessageBox.Show("Службова оновлена", "Оновлення службової", MessageBoxButtons.OK, MessageBoxIcon.Information); } AppFuncs.saveToDBResult(dbResult); } base.EditObject(); } }
public override void CreateNewObject() { DepartmentForm frm = new DepartmentForm(); DialogResult result = frm.ShowDialog(); AppFuncs.dialogCloseResult(frm.GetType().Name, result); if ((result == DialogResult.OK) && (frm.Department != null)) { bool dbResult = DBContext.InsertEntity(frm.Department); if (dbResult) { this.LoadDataToGrid(); base.selectGridRowById(frm.Department.Id); } AppFuncs.saveToDBResult(dbResult); } frm.Dispose(); base.CreateNewObject(); }
public override void CreateNewObject() { Schedule frm = new Schedule(null); DialogResult result = frm.ShowDialog(); AppFuncs.dialogCloseResult(frm.GetType().Name, result); if ((result == DialogResult.OK) && (frm.ScheduleModel != null)) { int newId = 0; bool dbResult = DBContext.InsertSchedule(frm.ScheduleModel, out newId); if (dbResult) { this.LoadDataToGrid(); base.selectGridRowById(newId); } AppFuncs.saveToDBResult(dbResult); } frm.Dispose(); base.CreateNewObject(); }