public override void ModifySpecialDayGroup(SpecialDayGroup SpecialDayGroup) { ConfStorageLoad(); EventServerLoad(); ServiceCapabilities capabilities = Simulator.SystemCapabilities.Instance.ScheduleCapabilities; //Check that Special Day Group exists if (!ConfStorage.SpecialDayGroupList.ContainsKey(SpecialDayGroup.token)) { string message = string.Format("SpecialDayGroup with specified token {0} does not exists.", SpecialDayGroup.token); LoggingService.LogMessage(message, DUT.PACS.Simulator.ExternalLogging.MessageType.Error); FaultLib.ReturnFault(message, new string[] { "Sender", "InvalidArgVal", "NotFound" }); } //TODO: Check MaxSpecialDaysInSpecialDayGroup capability //if (ConfStorage.ScheduleList.Values.SelectMany(schedule => schedule.SpecialDays).Count() >= capabilities.MaxSpecialDaysInSpecialDayGroup) //{ // string message = string.Format("There is not enough space to create new SpecialDayGroup, see the MaxSpecialDaysInSpecialDayGroup capability."); // LoggingService.LogMessage(message, DUT.PACS.Simulator.ExternalLogging.MessageType.Error); // FaultLib.ReturnFault(message, new string[] { "Sender", "CapabilityViolated", "MaxSpecialDaysInSpecialDayGroup" }); //} ConfStorage.SpecialDayGroupList.Remove(SpecialDayGroup.token); ConfStorage.SpecialDayGroupList.Add(SpecialDayGroup.token, SpecialDayGroup); EventServer.ConfigurationSpecialDayGroupChangedEvent(this, SpecialDayGroup.token); EventServerSave(); ConfStorageSave(); }
public static SpecialDayGroupInfo ToSpecialDayGroupInfo(SpecialDayGroup specialDayGroup) { SpecialDayGroupInfo specialDayGroupInfo = new SpecialDayGroupInfo(); specialDayGroupInfo.token = specialDayGroup.token; specialDayGroupInfo.Description = specialDayGroup.Description; specialDayGroupInfo.Name = specialDayGroup.Name; return(specialDayGroupInfo); }
private Dictionary <string, ServiceSchedule10.SpecialDayGroup> SpecialDayGroupInitialization() { Dictionary <string, ServiceSchedule10.SpecialDayGroup> res = new Dictionary <string, ServiceSchedule10.SpecialDayGroup>(); ServiceSchedule10.SpecialDayGroup item; for (int i = 1; i < 3; i++) { item = new ServiceSchedule10.SpecialDayGroup(); item.Days = "BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nSUMMARY:Test special days\r\nDTSTART:20150529T000000\r\nDTEND:20150530T000000\r\nUID:e2904e1e-079d-4927-b7d6-c7bad5a1ef22\r\nEND:VEVENT\r\nEND:VCALENDAR"; item.Description = "special day group days description"; item.Name = "special day group days name"; item.token = "specialdaygroup" + i.ToString(); res.Add(item.token, item); } return(res); }
public override string CreateSpecialDayGroup(SpecialDayGroup SpecialDayGroup) { ConfStorageLoad(); EventServerLoad(); if (SpecialDayGroup.token == "") { int i = 1; SpecialDayGroup.token = "specialdaygroup" + i.ToString(); while (ConfStorage.SpecialDayGroupList.Keys.Contains(SpecialDayGroup.token)) { SpecialDayGroup.token = "specialdaygroup" + i.ToString(); i++; } } else { string message = string.Format("Not empty token."); LoggingService.LogMessage(message, DUT.PACS.Simulator.ExternalLogging.MessageType.Error); FaultLib.ReturnFault(message, new string[] { "Sender", "InvalidArgs" }); } ServiceCapabilities capabilities = Simulator.SystemCapabilities.Instance.ScheduleCapabilities; string res = SpecialDayGroup.token; //Check that there is no schedule with the same token exists if (ConfStorage.SpecialDayGroupList.ContainsKey(SpecialDayGroup.token)) { string message = string.Format("SpecialDayGroup with token {0} aleady exist.", SpecialDayGroup.token); LoggingService.LogMessage(message, DUT.PACS.Simulator.ExternalLogging.MessageType.Error); FaultLib.ReturnFault(message, new string[] { "Sender", "InvalidArgVal" }); } //Check MaxSpecialDayGroups capability if (ConfStorage.SpecialDayGroupList.Count() >= capabilities.MaxSpecialDayGroups) { string message = string.Format("There is not enough space to create new SpecialDayGroup, see the MaxSpecialDayGroups capability."); LoggingService.LogMessage(message, DUT.PACS.Simulator.ExternalLogging.MessageType.Error); FaultLib.ReturnFault(message, new string[] { "Receiver", "CapabilityViolated", "MaxSpecialDayGroups" }); } //TODO: Check MaxSpecialDaysInSpecialDayGroup capability //if (ConfStorage.ScheduleList.Values.SelectMany(schedule => schedule.SpecialDays).Count() >= capabilities.MaxSpecialDaysInSpecialDayGroup) //{ // string message = string.Format("There is not enough space to create new SpecialDayGroup, see the MaxSpecialDaysInSpecialDayGroup capability."); // LoggingService.LogMessage(message, DUT.PACS.Simulator.ExternalLogging.MessageType.Error); // FaultLib.ReturnFault(message, new string[] { "Sender", "CapabilityViolated", "MaxSpecialDaysInSpecialDayGroup" }); //} ConfStorage.SpecialDayGroupList.Add(SpecialDayGroup.token, SpecialDayGroup); EventServer.ConfigurationSpecialDayGroupChangedEvent(this, SpecialDayGroup.token); EventServerSave(); ConfStorageSave(); return(res); }
public abstract void ModifySpecialDayGroup(SpecialDayGroup SpecialDayGroup);
public abstract string CreateSpecialDayGroup(SpecialDayGroup SpecialDayGroup);