コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ItemGuid = ParmParser.GetGuidIDFromQuery();

            btnCopyButton.Visible   = !(ItemGuid == Guid.Empty);
            btnDeleteButton.Visible = !(ItemGuid == Guid.Empty);
            btnCopy.Visible         = !(ItemGuid == Guid.Empty);
            btnDelete.Visible       = !(ItemGuid == Guid.Empty);

            if (!IsPostBack)
            {
                CalendarHelper.BindRepeater(rpDays, CalendarHelper.DaysOfTheWeek);

                Dictionary <Guid, string> colors = (from c in CalendarHelper.GetCalendarCategories(SiteID)
                                                    select new KeyValuePair <Guid, string>(c.CalendarEventCategoryID, string.Format("{0}|{1}", c.CategoryBGColor, c.CategoryFGColor)))
                                                   .ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

                CalendarHelper.BindDropDownList(ddlColors, colors);

                var freq = CalendarFrequencyHelper.GetCalendarFrequencies();
                var cat  = CalendarHelper.GetCalendarCategories(SiteID);

                txtEventStartDate.Text = SiteData.CurrentSite.Now.ToShortDateString();
                txtEventEndDate.Text   = SiteData.CurrentSite.Now.ToShortDateString();

                CalendarHelper.BindDropDownList(ddlRecurr, freq, CalendarFrequencyHelper.GetIDByFrequencyType(CalendarFrequencyHelper.FrequencyType.Once).ToString());
                CalendarHelper.BindDropDownList(ddlCategory, cat);

                var itm = CalendarHelper.GetProfile(ItemGuid);

                if (itm != null)
                {
                    selectedDatePattern = itm.EventRepeatPattern;
                    CalendarHelper.BindRepeater(rpDays, CalendarHelper.DaysOfTheWeek);

                    txtEventTitle.Text = itm.EventTitle;
                    reContent.Text     = itm.EventDetail;

                    chkIsPublic.Checked          = itm.IsPublic;
                    chkIsAllDayEvent.Checked     = itm.IsAllDayEvent;
                    chkIsCancelled.Checked       = itm.IsCancelled;
                    chkIsCancelledPublic.Checked = itm.IsCancelledPublic;

                    txtEventStartDate.Text = itm.EventStartDate.ToShortDateString();
                    txtEventEndDate.Text   = itm.EventEndDate.ToShortDateString();

                    txtRecursEvery.Text = itm.RecursEvery.ToString();

                    CalendarHelper.SetTextboxToTimeSpan(txtEventStartTime, itm.EventStartTime);
                    CalendarHelper.SetTextboxToTimeSpan(txtEventEndTime, itm.EventEndTime);

                    ddlRecurr.SelectedValue   = itm.CalendarFrequencyID.ToString();
                    ddlCategory.SelectedValue = itm.CalendarEventCategoryID.ToString();
                }
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ItemGuid = ParmParser.GetGuidIDFromQuery();

            if (!IsPostBack)
            {
                CalendarHelper.BindDropDownList(ddlFGColor, CalendarHelper.ColorCodes, CalendarHelper.HEX_Black);
                CalendarHelper.BindDropDownList(ddlBGColor, CalendarHelper.ColorCodes, CalendarHelper.HEX_White);

                var itm = CalendarHelper.GetCalendarCategory(ItemGuid);

                if (itm != null)
                {
                    txtCategoryName.Text     = itm.CategoryName;
                    ddlFGColor.SelectedValue = itm.CategoryFGColor;
                    ddlBGColor.SelectedValue = itm.CategoryBGColor;
                }
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Calendar1.CalendarDate = SiteData.CurrentSite.Now.Date;

                SetCalendar();

                SiteData site = SiteData.CurrentSite;

                List <int> lstYears = new List <int>();
                lstYears = Enumerable.Range(DateTime.Now.Year - 10, 20).ToList();
                List <string> monthNames = CultureInfo.CurrentCulture.DateTimeFormat.MonthGenitiveNames.Where(x => x.Length > 0).ToList();

                CalendarHelper.BindDropDownList(ddlYear, lstYears);
                CalendarHelper.BindDropDownList(ddlMonth, monthNames);

                SetDDLSelections();
            }
        }