/// <summary> /// Add Hosting Unit /// </summary> /// <param name="H"></param> public void AddHostingUnit(BE.HostingUnit H) { if (H.HostingUnitKey == 0) { BE.Configuration.HostingUnitKeySt++; H.HostingUnitKey = BE.Configuration.HostingUnitKeySt; H.DiaryDto = new bool[31 * 12]; } HostingUnitsList.Add(H.Copy()); SaveToXML <List <BE.HostingUnit> >(HostingUnitsList, HostingUnitsPath); SaveConfigToXml(); }
/// <summary> /// Update Hosting Unit /// </summary> /// <param name="H"></param> public void UpdateHostingUnit(BE.HostingUnit H) { try { int index = HostingUnitsList.FindIndex(t => t.HostingUnitKey == H.HostingUnitKey); if (index == -1) { throw new MissingException("HostingUnitKey"); } HostingUnitsList[index] = H.Copy(); SaveToXML <List <BE.HostingUnit> >(HostingUnitsList, HostingUnitsPath); } catch (MissingException e) { throw e; } }