Exemplo n.º 1
0
        public GXDLMSActivityCalendarSeasonProfileDlg(GXDLMSSeasonProfile target, GXDLMSWeekProfile[] weekProfiles)
        {
            InitializeComponent();
            Target           = target;
            WeekProfile      = weekProfiles;
            AsciiBtn.Checked = GXHelpers.IsAscii(Target.Name);
            NameTb.Text      = GXHelpers.GetString(Target.Name);
            if (Target.Start != DateTime.MinValue)
            {
                StartTb.Text = Target.Start.ToFormatString();
            }
            int pos, selected = -1;

            if (weekProfiles != null)
            {
                foreach (GXDLMSWeekProfile it in weekProfiles)
                {
                    pos = WeekNameCb.Items.Add(it);
                    if (selected == -1 && StructuralComparisons.StructuralEqualityComparer.Equals(Target.WeekName, it.Name))
                    {
                        selected = pos;
                    }
                }
                if (selected != -1)
                {
                    WeekNameCb.SelectedIndex = selected;
                }
            }
            OkBtn.Enabled = weekProfiles != null && weekProfiles.Length != 0;
        }
Exemplo n.º 2
0
        public GXDLMSActivityCalendarWeekProfileDlg(GXDLMSWeekProfile target, GXDLMSDayProfile[] days)
        {
            InitializeComponent();
            Target           = target;
            AsciiBtn.Checked = GXHelpers.IsAscii(Target.Name);
            NameTb.Text      = GXHelpers.GetString(Target.Name);
            if (days == null || days.Length == 0)
            {
                MondayCb.Enabled     = TuesdayCb.Enabled = WednesdayCb.Enabled = ThursdayCb.Enabled =
                    FridayCb.Enabled = SaturdayCb.Enabled = SundayCb.Enabled = OkBtn.Enabled = false;
            }
            else
            {
                MondayCb.Items.AddRange(days);
                TuesdayCb.Items.AddRange(days);
                WednesdayCb.Items.AddRange(days);
                ThursdayCb.Items.AddRange(days);
                FridayCb.Items.AddRange(days);
                SaturdayCb.Items.AddRange(days);
                SundayCb.Items.AddRange(days);

                foreach (GXDLMSDayProfile it in days)
                {
                    if (it.DayId == Target.Monday)
                    {
                        MondayCb.SelectedItem = it;
                        break;
                    }
                }
                foreach (GXDLMSDayProfile it in days)
                {
                    if (it.DayId == Target.Tuesday)
                    {
                        TuesdayCb.SelectedItem = it;
                        break;
                    }
                }
                foreach (GXDLMSDayProfile it in days)
                {
                    if (it.DayId == Target.Wednesday)
                    {
                        WednesdayCb.SelectedItem = it;
                        break;
                    }
                }
                foreach (GXDLMSDayProfile it in days)
                {
                    if (it.DayId == Target.Thursday)
                    {
                        ThursdayCb.SelectedItem = it;
                        break;
                    }
                }
                foreach (GXDLMSDayProfile it in days)
                {
                    if (it.DayId == Target.Friday)
                    {
                        FridayCb.SelectedItem = it;
                        break;
                    }
                }
                foreach (GXDLMSDayProfile it in days)
                {
                    if (it.DayId == Target.Saturday)
                    {
                        SaturdayCb.SelectedItem = it;
                        break;
                    }
                }
                foreach (GXDLMSDayProfile it in days)
                {
                    if (it.DayId == Target.Sunday)
                    {
                        SundayCb.SelectedItem = it;
                        break;
                    }
                }
            }
        }