Пример #1
0
 private void grdGiorni_SelectionChanged(object sender, EventArgs e)
 {
     if (grdGiorni.SelectedRows.Count == 1)
     {
         DateTime data = (DateTime)grdGiorni.SelectedRows[0].Cells["DataGiorno"].Value;
         using (databaseContext = CreateDatabaseContext())
         {
             EventiManagerNew manager   = new EventiManagerNew(databaseContext);
             EventoGiorni     singleDay = manager.GetSingleDay(cdEvento, data);
             txtCosto.Text      = singleDay.CostoGiorno.ToString();
             mstxPunti.Text     = singleDay.PuntiAssegnati.ToString();
             dtOraInGioco.Value = singleDay.OraInGioco;
             dtOraFg.Value      = singleDay.OraFuoriGioco;
             EnableControls(true);
         }
     }
     else
     {
         txtCosto.Text      = string.Empty;
         mstxPunti.Text     = string.Empty;
         dtOraInGioco.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 0, 0, 0);
         dtOraFg.Value      = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 0, 0, 0);
         EnableControls(false);
     }
 }
Пример #2
0
 public bool SaveSingleDay(long eventNumber, DateTime giorno, long?punti, DateTime inGioco, DateTime fuoriGioco, float?costo)
 {
     try
     {
         EventoGiorni myDay = GetSingleDay(eventNumber, giorno);
         myDay.PuntiAssegnati = punti;
         myDay.OraInGioco     = inGioco;
         myDay.CostoGiorno    = costo;
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #3
0
 public bool AddDayToEvent(long eventNumber, DateTime giorno)
 {
     try
     {
         Evento       myEvent = GetEventFromNumber(eventNumber);
         EventoGiorni newDay  = new EventoGiorni();
         newDay.DataGiorno    = giorno;
         newDay.OraInGioco    = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 10, 0, 0);
         newDay.OraFuoriGioco = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 2, 0, 0);
         myEvent.EventoGiornis.Add(newDay);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #4
0
 public bool DeleteSingleDay(long eventNumber, DateTime giorno)
 {
     try
     {
         EventoGiorni myDay = GetSingleDay(eventNumber, giorno);
         context.EventoGiornis.DeleteObject(myDay);
         var subscriptions = from iscrizioni in context.EventoGiorniPersonaggios
                             where iscrizioni.CdEvento == eventNumber &&
                             iscrizioni.DataGiorno == giorno
                             select iscrizioni;
         foreach (var item in subscriptions)
         {
             context.EventoGiorniPersonaggios.DeleteObject(item);
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #5
0
 public bool InsertNewEventComplete(string title, string description, double costo, int totalPx, List <DateTime> days, DateTime InGame, DateTime OutGame, DateTime standardInGame, DateTime standardOutGame)
 {
     try
     {
         Evento res = new Evento();
         res.Costo          = (float)costo;
         res.DataEvento     = days[0].Date;
         res.Descrizione    = description;
         res.PuntiAssegnati = totalPx;
         res.TitoloEvento   = title;
         for (int i = 0; i < days.Count; i++)
         {
             EventoGiorni singleDay = new EventoGiorni();
             singleDay.DataGiorno = days[i];
             if (i == 0)
             {
                 singleDay.OraInGioco = InGame;
             }
             else
             {
                 singleDay.OraInGioco = standardInGame;
             }
             if (i == days.Count - 1)
             {
                 singleDay.OraFuoriGioco = OutGame;
             }
             else
             {
                 singleDay.OraFuoriGioco = standardOutGame;
             }
             res.EventoGiornis.Add(singleDay);
         }
         context.Eventoes.AddObject(res);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #6
0
        public Evento InsertNewEventComplete(string title, string description, int totalPx, List <DateTime> days, DateTime InGame, DateTime OutGame, DateTime standardInGame, DateTime standardOutGame)
        {
            Evento res = null;

            using (HolonetEntities context = new HolonetEntities(_connectionString))
            {
                res                = new Evento();
                res.Costo          = totalPx;
                res.DataEvento     = days[0].Date;
                res.Descrizione    = description;
                res.PuntiAssegnati = totalPx;
                res.TitoloEvento   = title;
                for (int i = 0; i < days.Count; i++)
                {
                    EventoGiorni singleDay = new EventoGiorni();
                    singleDay.DataGiorno = days[i];
                    if (i == 0)
                    {
                        singleDay.OraInGioco = InGame;
                    }
                    else
                    {
                        singleDay.OraInGioco = standardInGame;
                    }
                    if (i == days.Count - 1)
                    {
                        singleDay.OraFuoriGioco = OutGame;
                    }
                    else
                    {
                        singleDay.OraFuoriGioco = standardOutGame;
                    }
                    res.EventoGiornis.Add(singleDay);
                }
                context.Eventoes.AddObject(res);
                context.SaveChanges();
            }
            return(res);
        }