protected override void btnEdit_Clicked(object o, EventArgs args) { int selectedRow = grid.FocusedRow; if (selectedRow < 0) { return; } ComplexRecipe recipe = entities [selectedRow]; selectedId = recipe.Id; // Added transaction to ensure that we are connected to the same server in case of // master-slave replication using (new DbMasterScope(BusinessDomain.DataAccessProvider)) { using (EditNewComplexRecipe dialog = new EditNewComplexRecipe(recipe)) { if (dialog.Run() == ResponseType.Ok) { dialog.GetRecipe().CommitChanges(); } } OnEntitiesChanged(); } }
protected override void btnNew_Clicked(object o, EventArgs args) { selectedId = null; // Added transaction to ensure that we are connected to the same server in case of // master-slave replication using (new DbMasterScope(BusinessDomain.DataAccessProvider)) { using (EditNewComplexRecipe dialog = new EditNewComplexRecipe(null)) { if (dialog.Run() != ResponseType.Ok) { return; } selectedId = dialog.GetRecipe().CommitChanges().Id; } OnEntitiesChanged(); } }