Ejemplo n.º 1
0
        public bool DeleteEntity(Feast feast)
        {
            if (ReadOnly)
            {
                return(false);
            }

            Feast f = feast;

            if (f == null || f.FeastDate < DateTime.Now.Date) // || UCCountryEdit.IsEstimationExist(f.FeastDate, Country.ID)
            {
                return(false);
            }

            try
            {
                ClientEnvironment.FeastService.DeleteByID(f.ID);
                ListOfFeasts.Remove(f);
                UpdateEnableButton();
                return(true);
            }
            catch (Exception ex)
            {
                ErrorMessage(ex.Message);
                return(false);
            }
        }
Ejemplo n.º 2
0
        public void ReloadFeasts()
        {
            if (m_weekDays.Count == 0)
            {
                m_weekDays[(int)DayOfWeek.Monday]    = GetLocalized(DayOfWeek.Monday.ToString());
                m_weekDays[(int)DayOfWeek.Tuesday]   = GetLocalized(DayOfWeek.Tuesday.ToString());
                m_weekDays[(int)DayOfWeek.Wednesday] = GetLocalized(DayOfWeek.Wednesday.ToString());
                m_weekDays[(int)DayOfWeek.Thursday]  = GetLocalized(DayOfWeek.Thursday.ToString());
                m_weekDays[(int)DayOfWeek.Friday]    = GetLocalized(DayOfWeek.Friday.ToString());
                m_weekDays[(int)DayOfWeek.Saturday]  = GetLocalized(DayOfWeek.Saturday.ToString());
                m_weekDays[(int)DayOfWeek.Sunday]    = GetLocalized(DayOfWeek.Sunday.ToString());
            }

            ListOfFeasts.Clear();

            if (Country != null)
            {
                DateTime EndCorrectDate = new DateTime(EndDate.Year, EndDate.Month, EndDate.Day, 23, 59, 59);
                ListOfFeasts.CopyList(ClientEnvironment.FeastService.GetFeastsFiltered(Country.ID, BeginDate, EndCorrectDate));
            }

            if (gridControlFeast.DataSource == null)
            {
                gridControlFeast.DataSource = ListOfFeasts;
            }

            UpdateEnableButton();
        }