Esempio n. 1
0
        public static void FillPeriodDate()
        {
            using (LinqMicajahDataContext dc = new LinqMicajahDataContext())
            {
                dc.ExecuteCommand("delete from D_PeriodDate");
                for (int FrequencyID = 1; FrequencyID <= 11; FrequencyID++)
                {
                    DateTime b = new DateTime(2000, 1, 1);
                    b = GetNormalizedDate(FrequencyID, b);
                    DateTime dt;
                    DateTime EndDt        = new DateTime(2075, 1, 1);
                    int      PeriodNumber = 0;

                    do
                    {
                        dt = AddPeriod(b, FrequencyID, PeriodNumber);
                        D_PeriodDate r = new D_PeriodDate()
                        {
                            FrequencyID  = FrequencyID,
                            Date         = dt,
                            PeriodNumber = PeriodNumber,
                            ShortName    = GetPeriodName(dt, FrequencyID, true),
                            LongName     = GetPeriodName(dt, FrequencyID, false)
                        };
                        dc.D_PeriodDate.InsertOnSubmit(r);
                        dc.SubmitChanges();
                        PeriodNumber++;
                    }while (dt <= EndDt);
                }
            }
        }