예제 #1
0
        public bool Del(risTabulky risContext)
        {
            bool success = false;

            try
            {
                var temp = risContext.jedlo_surovina.First(i => i.id_jedla == id_jedla && i.id_surovina == id_surovina);
                risContext.jedlo_surovina.Remove(temp);
                risContext.SaveChanges();
                success = true;
                this.Reset();
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Del()"), ex);
            }

            return success;
        }
예제 #2
0
 public static BUcet dajUcet(String login, risTabulky risContext)
 {
     return new BUcet(risContext.ucet.First(p => p.login==(login)));
 }
예제 #3
0
 public static BTyp_jedla dajTypJedla(int id, risTabulky risContext)
 {
     return new BTyp_jedla(risContext.typ_jedla.First(p => p.id_typu == id));
 }
예제 #4
0
 public static BSurovina dajSurovinu(int id, risTabulky risContext)
 {
     return new BSurovina(risContext.surovina.First(p => p.id_surovina == id));
 }
예제 #5
0
 public static BJedlo dajJedlo(int id, risTabulky risContext)
 {
     return new BJedlo(risContext.jedlo.First(p => p.id_jedla == id));
 }
예제 #6
0
        public bool Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                if (id_jedla == -1 && id_surovina == -1) // INSERT
                {
                    this.FillEntity();
                    risContext.jedlo_surovina.Add(entityJedloSurovina);
                    risContext.SaveChanges();
                    this.FillBObject();
                    success = true;
                }
                else // UPDATE
                {
                    var temp = from a in risContext.jedlo_surovina where a.id_jedla == id_jedla && a.id_surovina==id_surovina select a;
                    entityJedloSurovina = temp.Single();
                    this.FillEntity();
                    risContext.SaveChanges();

                    success = true;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex);
            }

            return success;
        }
예제 #7
0
        public bool Get(risTabulky risContext, int id)
        {
            bool success = false;
            try
            {
                var temp = from a in risContext.jedlo_surovina where a.id_jedla == id_jedla && a.id_surovina == id_surovina select a;
                entityJedloSurovina = temp.Single();
                this.FillBObject();
                success = true;
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Get()"), ex);
            }

            return success;
        }
예제 #8
0
 /// <summary>
 /// Vytvorí nový zoznam prihlasených uživateľov
 /// </summary>
 /// <param name="risContext">kontext databázy</param>
 public Sessions(risTabulky risContext)
 {
     this.risContext = risContext;
 }
예제 #9
0
 public DBDataExecutor()
 {
     aRisContext = new risTabulky();
 }