/// <summary> /// Gets group with required groupName or creates new group which is immediately added to the persistence. /// </summary> /// <param name="persistence">Not null persistence, where to search for groups</param> /// <param name="groupName">Name of the group to search in persistence.</param> /// <returns>Not null value of Group obtained from persistence or newly created group</returns> internal static IGroup GetOrAddNewGroup(IPersistence persistence, string groupName) { IGroups groups = persistence.Groups; IGroup group = groups[groupName]; if (group == null) { group = persistence.Factory.CreateGroup(groupName); groups.Add(group); } return(group); }
public void AddNewInvoice() { InvoiceGroup newGroup = new InvoiceGroup(); newGroup.DefaultBillFilePath = (string)AccessSettings.GetValue("DefaultBillPath"); if (DB.OracleSession == null) { return; } newGroup.ChangedBy = DB.OracleSession.UserName; if (IGroups == null) { IGroups = new ObservableCollection <InvoiceGroup>(); } IGroups.Add(newGroup); CurrentGroupItem = newGroup; AddWeakEventListener(CurrentGroupItem, IGroupListener); // Make it dirty CurrentGroupItem.Description = "Please fill out the description"; }