private void EditSeasonProfile(GXDLMSActivityCalendar target, GXDLMSSeasonProfile[] list, int index, ListViewItem li, ListView lv)
        {
            GXDLMSSeasonProfile item = (GXDLMSSeasonProfile)li.Tag;
            GXDLMSActivityCalendarSeasonProfileDlg dlg = new GXDLMSActivityCalendarSeasonProfileDlg(item, index == 3 ? target.WeekProfileTableActive : target.WeekProfileTablePassive);

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                UpdateSeasonProfile(item, li, lv);
                errorProvider1.SetError(lv, Properties.Resources.ValueChangedTxt);
                Target.UpdateDirty(index, list);
            }
        }
        private void AddSeasonProfile(GXDLMSActivityCalendar target, int index, ListView li)
        {
            GXDLMSSeasonProfile item = new GXDLMSSeasonProfile();

            GXDLMSSeasonProfile[] list;
            if (index == 3)
            {
                list = target.SeasonProfileActive;
            }
            else
            {
                list = target.SeasonProfilePassive;
            }
            GXDLMSActivityCalendarSeasonProfileDlg dlg = new GXDLMSActivityCalendarSeasonProfileDlg(item, index == 3 ? target.WeekProfileTableActive : target.WeekProfileTablePassive);

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                List <GXDLMSSeasonProfile> items = new List <GXDLMSSeasonProfile>();
                if (list != null)
                {
                    items.AddRange(list);
                }
                items.Add(item);
                if (index == 3)
                {
                    target.SeasonProfileActive = items.ToArray();
                }
                else
                {
                    target.SeasonProfilePassive = items.ToArray();
                }
                UpdateSeasonProfile(item, null, li);
                errorProvider1.SetError(li, Properties.Resources.ValueChangedTxt);
                target.UpdateDirty(index, list);
            }
        }