protected override Entity OnAdd() { var newItem = new Dll.Student.Student(); using (var frm = new frmStudent_Add()) { frm.ItemData = newItem; if (frm.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return(null); } } App.LogAction("Student", "Created Student : " + newItem.StudentNumber.ToString()); ItemDataCollection.Add(newItem); return(newItem); }
protected override bool OnEdit(Entity item) { var selectedItem = (Dll.Student.Student)item; using (var frm = new frmStudent_Add()) { if (selectedItem.Id != 0) { selectedItem.RowStatus = RecordStatus.ModifiedRecord; } frm.ItemData = selectedItem; if (frm.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return(false); } } App.LogAction("Student", "Updated Student : " + selectedItem.StudentNumber.ToString()); return(true); }