コード例 #1
0
        private void SetDefaulValues()
        {
            tbEndAfter.Text    = "1";
            rbEndBy.Checked    = false;
            rbEndAfter.Checked = true;

            using (IDataReader reader = CalendarEntry.GetEventDates(EventId))
            {
                if (reader.Read())
                {
                    dtcDateStart.SelectedDate = (DateTime)reader["StartDate"];
                    dtcDateEnd.SelectedDate   = (DateTime)reader["FinishDate"];
                    dtcTimeStart.SelectedDate = (DateTime)reader["StartDate"];
                    dtcTimeEnd.SelectedDate   = (DateTime)reader["FinishDate"];
                }
                else
                {
                    dtcTimeStart.SelectedDate = UserDateTime.UserNow;
                    dtcTimeEnd.SelectedDate   = UserDateTime.UserNow.AddHours(1);
                }
            }

            for (byte i = 4; i >= 1; i--)
            {
                Pattern = i;
                for (byte j = 2; j >= 1; j--)
                {
                    SubPattern  = j;
                    Frequency   = 5;
                    Weekdays    = (byte)CalendarEntry.GetBitDayOfWeek(UserDateTime.UserNow.DayOfWeek);
                    MonthDay    = (byte)UserDateTime.UserNow.Day;
                    WeekNumber  = (byte)(UserDateTime.UserNow.Day / 7 + 1);
                    MonthNumber = (byte)UserDateTime.UserNow.Month;
                }
            }
        }
コード例 #2
0
        private void BindValues()
        {
            lstTimeZone.DataSource     = User.GetListTimeZone();
            lstTimeZone.DataTextField  = "DisplayName";
            lstTimeZone.DataValueField = "TimeZoneId";
            lstTimeZone.DataBind();
            string sTimeZoneId = Security.CurrentUser.TimeZoneId.ToString();

            ListItem[] liArray = new ListItem[5];
            liArray[0] = new ListItem(LocRM.GetString("First"), "1");
            liArray[1] = new ListItem(LocRM.GetString("Second"), "2");
            liArray[2] = new ListItem(LocRM.GetString("Third"), "3");
            liArray[3] = new ListItem(LocRM.GetString("Fourth"), "4");
            liArray[4] = new ListItem(LocRM.GetString("Last"), "8");
            WeekNumber32.Items.AddRange(liArray);
            WeekNumber42.Items.AddRange(liArray);

            liArray = new ListItem[7];
            int k = 0;

            foreach (System.DayOfWeek day in Enum.GetValues(typeof(System.DayOfWeek)))
            {
                liArray[k] = new ListItem(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.DayNames[(int)day], ((int)CalendarEntry.GetBitDayOfWeek(day)).ToString());
                k++;
            }

            Weekday32.Items.AddRange(liArray);
            Weekday42.Items.AddRange(liArray);

            liArray = new ListItem[12];
            for (int i = 1; i <= 12; i++)
            {
                liArray[i - 1] = new ListItem(System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i), i.ToString());
            }
            MonthNumber41.Items.AddRange(liArray);
            MonthNumber42.Items.AddRange(liArray);
            SetDefaulValues();
            if (EventId != 0)
            {
                using (IDataReader reader = CalendarEntry.GetRecurrence(EventId))
                {
                    ///		RecurrenceId, ObjectTypeId, ObjectId, StartTime,
                    ///		EndTime, Pattern, SubPattern, Frequency, Weekdays,
                    ///		DayOfMonth, WeekNumber, MonthNumber, EndAfter
                    if (reader.Read())
                    {
                        TimeStart   = (int)reader["StartTime"];
                        TimeEnd     = (int)reader["EndTime"];
                        Pattern     = (byte)reader["Pattern"];
                        SubPattern  = (byte)reader["SubPattern"];
                        Frequency   = (byte)reader["Frequency"];
                        Weekdays    = (byte)reader["Weekdays"];
                        MonthDay    = (byte)reader["DayOfMonth"];
                        WeekNumber  = (byte)reader["WeekNumber"];
                        MonthNumber = (byte)reader["MonthNumber"];
                        int iEndAfter = (int)reader["EndAfter"];
                        if (iEndAfter != 0)
                        {
                            rbEndBy.Checked    = false;
                            rbEndAfter.Checked = true;
                            tbEndAfter.Text    = iEndAfter.ToString();
                        }
                        else
                        {
                            rbEndAfter.Checked = false;
                            rbEndBy.Checked    = true;
                        }
                        if (reader["TimeZoneId"] != DBNull.Value)
                        {
                            sTimeZoneId = reader["TimeZoneId"].ToString();
                        }
                    }
                }
            }
            ListItem lItem = lstTimeZone.Items.FindByValue(sTimeZoneId);

            if (lItem != null)
            {
                lstTimeZone.ClearSelection();
                lItem.Selected = true;
            }
        }