private void AddDayAction(GXDLMSActivityCalendar c, GXDLMSDayProfile target, int index, ListView li) { GXDLMSDayProfileAction item = new GXDLMSDayProfileAction(); GXDLMSActivityCalendarActionDlg dlg = new GXDLMSActivityCalendarActionDlg(item, Target.Parent.GetObjects(ObjectType.ScriptTable)); if (dlg.ShowDialog(this) == DialogResult.OK) { List <GXDLMSDayProfileAction> items = new List <GXDLMSDayProfileAction>(); if (target.DaySchedules != null) { items.AddRange(target.DaySchedules); } items.Add(item); target.DaySchedules = items.ToArray(); if (index == 5) { ActiveDaysList_SelectedIndexChanged(null, null); } else { PassiveDaysList_SelectedIndexChanged(null, null); } errorProvider1.SetError(li, Properties.Resources.ValueChangedTxt); c.UpdateDirty(index, target.DaySchedules); } }
private void AddWeekProfile(GXDLMSActivityCalendar target, int index, ListView li) { GXDLMSWeekProfile item = new GXDLMSWeekProfile(); GXDLMSWeekProfile[] list; GXDLMSDayProfile[] days; if (index == 3) { list = target.WeekProfileTableActive; days = target.DayProfileTableActive; } else { list = target.WeekProfileTablePassive; days = target.DayProfileTablePassive; } GXDLMSActivityCalendarWeekProfileDlg dlg = new GXDLMSActivityCalendarWeekProfileDlg(item, days); if (dlg.ShowDialog(this) == DialogResult.OK) { List <GXDLMSWeekProfile> items = new List <GXDLMSWeekProfile>(); if (list != null) { items.AddRange(list); } items.Add(item); if (index == 4) { target.WeekProfileTableActive = items.ToArray(); } else { target.WeekProfileTablePassive = items.ToArray(); } UpdateWeekProfile(item, null, li); errorProvider1.SetError(li, Properties.Resources.ValueChangedTxt); target.UpdateDirty(index, list); } }