Example #1
0
 private void Editing_performance_Load(object sender, EventArgs e)
 {
     changed_performance = db.GetTable <TAfisha>().Where(k => k.Id == performance_id).First();
     panel_Images_Load();
     panel_Text_Load();
     panel_Dates_Load();
     button1.PerformClick();
 }
Example #2
0
        public static int Update(int ID, TAfisha performance)
        {
            DataContext db   = new DataContext(DB_connection.connectionString);
            TAfisha     perf = db.GetTable <TAfisha>().Where(k => k.Id == ID).First();

            perf = performance;
            try
            {
                db.SubmitChanges();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(1);
            }
            return(0);
        }
Example #3
0
        public static int Delete(int ID)
        {
            DataContext db = new DataContext(DB_connection.connectionString);
            IQueryable <TAfisha_dates> dates = db.GetTable <TAfisha_dates>().Where(k => k.Id_performance == ID && k.Date > DateTime.Now);

            foreach (TAfisha_dates d in dates)
            {
                d.Cancelled = true;
            }
            TAfisha performance = db.GetTable <TAfisha>().Where(k => k.Id == ID).First();

            performance.Is_relevant = false;
            try
            {
                db.SubmitChanges();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return(1);
            }
            return(0);
        }