Beispiel #1
0
        /// <summary>
        /// Loads the day definition with the specified Id
        /// </summary>
        public void Load(string dayDefId)
        {
            if (_dtdaysdef != null)
            {
                return;                                                         // Call UnLoad first
            }
            CmpDaysDefDB cmp = new CmpDaysDefDB();

            _dtdaysdef = cmp.GetData(null, "DDAY_ID = @DAYS_DEF.DDAY_ID@", new object[] { dayDefId });
        }
Beispiel #2
0
        /// <summary>
        /// Loads all table days_def and stores all days_def that contains the date asasociated to that object, in its mask (dday_code)
        /// That method is automatically called when needed, but can be explicity called, too
        /// </summary>
        public void Load()
        {
            if (_dtdaysdef != null)
            {
                return;                                                         // Call UnLoad first
            }
            CmpDaysDefDB cmp = new CmpDaysDefDB();

            _dtdaysdef = cmp.GetData();
            foreach (DataRow daydef in _dtdaysdef.Rows)
            {
                // Get the row iif have one '1' on the position mask.
                DayOfWeek dw = _now.DayOfWeek;
                int       iw = -1;
                switch (dw)
                {
                case DayOfWeek.Monday:
                    iw = 0; break;

                case DayOfWeek.Tuesday:
                    iw = 1; break;

                case DayOfWeek.Wednesday:
                    iw = 2; break;

                case DayOfWeek.Thursday:
                    iw = 3; break;

                case DayOfWeek.Friday:
                    iw = 4; break;

                case DayOfWeek.Saturday:
                    iw = 5; break;

                case DayOfWeek.Sunday:
                    iw = 6; break;
                }
                string sdaydefmask = Convert.ToString(daydef["DDAY_CODE"]);
                if (sdaydefmask[iw] != '1')
                {
                    // The current day_def does not includes the _now date... so delete them.
                    daydef.Delete();
                }
            }
            _dtdaysdef.AcceptChanges();
        }