protected void FillDays()
    {
        List <string> days = new List <string>();

        for (int i = 1; i <= 31; i++)
        {
            days.Add(i.ToString());
        }

        DDLday.DataSource = days;
        DDLday.DataBind();
        DDLday.Items.Insert(0, new ListItem("יום"));
    }
Esempio n. 2
0
        private void attachDDL(int id)
        {
            list l = BLL.BLL.getCommand(id);

            ArrayList     yearList           = new ArrayList();
            ArrayList     dayList            = new ArrayList();
            List <string> monthList          = months.ToList();
            ArrayList     hourList           = new ArrayList();
            ArrayList     minutesSecondsList = new ArrayList();

            for (int i = 1; i < 99; i++)
            {
                yearList.Add(i + 2000);
                if (i <= 30)
                {
                    dayList.Add(i);
                }
                if (i <= 24)
                {
                    hourList.Add(i - 1);
                }
                if (i <= 60)
                {
                    minutesSecondsList.Add(i - 1);
                }
            }


            DDLyear.DataSource    = yearList;
            DDLyear.SelectedValue = l.time.Year.ToString();
            DDLyear.DataBind();

            DDLmonth.DataSource    = monthList;
            DDLmonth.SelectedValue = months[l.time.Month - 1];
            DDLmonth.DataBind();


            DDLday.DataSource    = dayList;
            DDLday.SelectedValue = l.time.Day.ToString();
            DDLday.DataBind();

            DDLhour.DataSource    = hourList;
            DDLhour.SelectedValue = l.time.Hour.ToString();
            DDLhour.DataBind();


            DDLminute.DataSource    = minutesSecondsList;
            DDLminute.SelectedValue = l.time.Minute.ToString();
            DDLminute.DataBind();

            DDLsecond.DataSource    = minutesSecondsList;
            DDLsecond.SelectedValue = l.time.Second.ToString();
            DDLsecond.DataBind();

            ArrayList states = new ArrayList();

            states.Add("ON");
            states.Add("OFF");
            DDLstate.DataSource    = states;
            DDLstate.SelectedValue = l.state ? "ON" : "OFF";
            DDLstate.DataBind();
        }