Esempio n. 1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     foreach (ComboBox cb in tabPage2.Controls.OfType <ComboBox>())
     {
         cb.Items.Add("---Not Open---");
         cb.Items.Add("Every Week");
         cb.Items.Add("First and Third Week of the Month");
         cb.Items.Add("Second and Forth Week of the Month");
         cb.Items.Add("First Week of the Month");
         cb.Items.Add("Second Week of the Month");
         cb.Items.Add("Third Week of the Month");
         cb.Items.Add("Forth Week of the Month");
     }
     CCFBOpenDayOfWeek.OpenDOW();
     for (int i = 0; i < CCFBOpenDayOfWeek.DSetDOWRowsCount; i++)
     {
         for (int j = 0; j < cbList.Count; j++)
         {
             if (cbList[j].Tag.ToString() == CCFBOpenDayOfWeek.DSetDOW.Tables[0].Rows[i]["EditLabel"].ToString())
             {
                 cbList[j].SelectedIndex = Int32.Parse(CCFBOpenDayOfWeek.DSetDOW.Tables[0].Rows[i]["FldVal"].ToString());
                 break;
             }
         }
     }
     ChangeMode(1);
 }
Esempio n. 2
0
        private void YearlyForm_Load(object sender, EventArgs e)
        {
            DateTime dateTest;

            foreach (ComboBox cb in tabPage2.Controls.OfType <ComboBox>())
            {
                cb.Items.Add("---Not Open---");
                cb.Items.Add("Every Week");
                cb.Items.Add("First and Third Week of the Month");
                cb.Items.Add("Second and Forth Week of the Month");
                cb.Items.Add("First Week of the Month");
                cb.Items.Add("Second Week of the Month");
                cb.Items.Add("Third Week of the Month");
                cb.Items.Add("Forth Week of the Month");
            }
            CCFBOpenDayOfWeek.OpenDOW();
            for (int i = 0; i < CCFBOpenDayOfWeek.DSetDOWRowsCount; i++)
            {
                for (int j = 0; j < cbList.Count; j++)
                {
                    if (cbList[j].Tag.ToString() == CCFBOpenDayOfWeek.DSetDOW.Tables[0].Rows[i]["EditLabel"].ToString())
                    {
                        cbList[j].SelectedIndex = Int32.Parse(CCFBOpenDayOfWeek.DSetDOW.Tables[0].Rows[i]["FldVal"].ToString());
                        break;
                    }
                }
            }
            clsDaysOpen.openWhere("date = (SELECT MAX(date) From DaysOpen)");
            if (clsDaysOpen.RowCount > 0)
            {
                dateTest = clsDaysOpen.date;
            }
            else
            {
                dateTest = DateTime.Today;
            }
            dateTest = dateTest.AddMonths(1);
            string tmp = dateTest.Month.ToString() + "/01/" + dateTest.Year.ToString();

            dtpPeriodStart.Value = DateTime.Parse(tmp);
            dateTest             = dtpPeriodStart.Value.AddYears(1).AddDays(-1);
            dtpPeriodEnd.Value   = dateTest;
            ChangeMode(1);
        }