Пример #1
0
        private void EditData()
        {
            Festival editFestival = new Festival();
            editFestival.Name = Festival.Name;
            editFestival.StartDate = Festival.StartDate;
            editFestival.EndDate = Festival.EndDate;


            Boolean TeVroeg = false;
            Boolean TeLaat = false;

            foreach (LineUp lu in _lineups) {
                if (lu.Date < editFestival.StartDate) { 
                    TeVroeg = true;
                }
                if (lu.Date > editFestival.EndDate)
                {
                    TeLaat = true;
                }
            }
            if (TeVroeg == true)
            {
                MessageBox.Show("De wijzigingen werden niet toegepast. Bepaalde Optredens vallen voor de startdatum.");
            }
            else {
                if (TeLaat == true)
                {
                    MessageBox.Show("De wijzigingen werden niet toegepast. Bepaalde Optredens vallen na de einddatum.");
                }
                else {
                    Festival.EditData(editFestival);
                }
            }
            LineUpPageVM.UpdateAll();

        }
Пример #2
0
        public static void EditData(Festival festival) {
            String sSQL = "UPDATE Festival SET Name = @Name, StartDate = @StartDate, EndDate = @EndDate";

            DbParameter par1 = Database.AddParameter("@Name", festival._Name);
            DbParameter par2 = Database.AddParameter("@StartDate", festival._StartDate);
            DbParameter par3 = Database.AddParameter("@EndDate", festival._EndDate);

            Database.ModifyData(sSQL, par1, par2, par3);
        }
Пример #3
0
        //string IDataErrorInfo.Error
        //{
        //    get { return "Model not valid"; }
        //}

        //string IDataErrorInfo.this[string columnName]
        //{
        //    get
        //    {
        //        try
        //        {
        //            object value = this.GetType().GetProperty(columnName).GetValue(this);
        //            Validator.ValidateProperty(value, new ValidationContext(this, null, null)
        //            {
        //                MemberName = columnName
        //            });
        //        }
        //        catch (ValidationException ex)
        //        {
        //            return ex.Message;
        //        }
        //        return String.Empty;
        //    }
        //}

        #endregion


        public static Festival GetData() {
            Festival festival = new Festival();

            String sSQL = "SELECT * FROM Festival";

            DbDataReader reader = Database.GetData(sSQL);
            while (reader.Read()) {

                festival._Name = reader["Name"].ToString();
                festival._StartDate = Convert.ToDateTime(reader["StartDate"].ToString());
                festival._EndDate = Convert.ToDateTime(reader["EndDate"].ToString());

            }

            return festival;
        }