コード例 #1
0
        public IList <TSurovina> surovinyJedla(int id_jedla, String id_jazyka)
        {
            risTabulky risContext = aDBExecutor.risContext;
            BJedlo     jedlo      = Zoznamy.dajJedlo(id_jedla, risContext);

            return(jedlo.PE_suroviny_jedla(id_jazyka));
        }
コード例 #2
0
        public bool Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                if (text_id == 0) // INSERT
                {
                    this.FillEntity();
                    risContext.text.Add(entityText);
                    risContext.SaveChanges();
                    text_id = entityText.text_id; //treba ostestovat automaticke vygenerovanie id po ulozeni
                    success = true;
                }
                else // UPDATE
                {
                    var temp = from a in risContext.text where a.text_id == text_id select a;
                    entityText = temp.Single();
                    this.FillEntity();
                    risContext.SaveChanges();
                    success = true;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex);
            }

            return(success);
        }
コード例 #3
0
        public bool Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                var temp = from a in risContext.objednavka_menu where a.id_objednavky == id_objednavky &&
                           a.id_menu == id_menu select a;

                if (!temp.Any()) // INSERT
                {
                    this.FillEntity();
                    risContext.objednavka_menu.Add(entityObjednavkaMenu);
                    risContext.SaveChanges();
                    success = true;
                }
                else // UPDATE
                {
                    entityObjednavkaMenu = temp.Single();
                    this.FillEntity();
                    risContext.SaveChanges();
                    success = true;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex);
            }

            return(success);
        }
コード例 #4
0
        public bool Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                if (zaciatok_platnosti == DateTime.MinValue) // INSERT
                {
                    this.FillEntity();
                    risContext.zmena_otvaracich_hodin.Add(entityZmenaOtvaracichHodin);
                    risContext.SaveChanges();
                    success = true;
                }
                else // UPDATE
                {
                    var temp = from a in risContext.zmena_otvaracich_hodin where a.zaciatok_platnosti == zaciatok_platnosti select a;
                    entityZmenaOtvaracichHodin = temp.Single();
                    this.FillEntity();
                    risContext.SaveChanges();
                    this.FillBObject();
                    success = true;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex);
            }

            return(success);
        }
コード例 #5
0
        public bool Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                var temp = from a in risContext.otvaracie_hodiny where a.id_podniku == id_podniku &&
                           a.cislo_dna == cislo_dna select a;

                if (!temp.Any()) // INSERT
                {
                    this.FillEntity();
                    risContext.otvaracie_hodiny.Add(entityOtvaracieHodiny);
                    risContext.SaveChanges();
                    success = true;
                }
                else // UPDATE
                {
                    entityOtvaracieHodiny = temp.Single();
                    this.FillEntity();
                    risContext.SaveChanges();
                    success = true;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex);
            }

            return(success);
        }
コード例 #6
0
ファイル: BJazyk.cs プロジェクト: LubomirKovalcik/RISSolution
        public bool Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                if (kod_jazyka == "") // INSERT
                {
                    this.FillEntity();
                    risContext.jazyk.Add(entityJazyk);
                    risContext.SaveChanges();
                    success = true;
                }
                else // UPDATE
                {
                    var temp = from a in risContext.jazyk where a.kod_jazyka == kod_jazyka select a;
                    entityJazyk = 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 Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                if (id_menu == 0) // INSERT
                {
                    this.FillEntity();
                    risContext.denne_menu.Add(entityDenneMenu);
                    risContext.SaveChanges();
                    id_menu = entityDenneMenu.id_menu;
                    success = true;
                }
                else // UPDATE
                {
                    var temp = from a in risContext.denne_menu where a.id_menu == id_menu select a;
                    entityDenneMenu = temp.Single();
                    this.FillEntity();
                    risContext.SaveChanges();
                    success = true;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex);
            }

            return(success);
        }
コード例 #8
0
        public bool Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                if (id_typu == -1) // INSERT
                {
                    this.FillEntity();
                    risContext.typ_jedla.Add(entityTypJedla);
                    risContext.SaveChanges();
                    this.FillBObject();
                    success = true;
                }
                else // UPDATE
                {
                    var temp = from a in risContext.typ_jedla where a.id_typu == id_typu select a;
                    entityTypJedla = temp.Single();
                    this.FillEntity();
                    risContext.SaveChanges();
                    success = true;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex);
            }

            return(success);
        }
コード例 #9
0
        public bool Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                if (typ_platnosti == 0) // INSERT
                {
                    this.FillEntity();
                    risContext.platnost_zaznamu.Add(entityPlatnostZaznamu);
                    risContext.SaveChanges();
                    typ_platnosti = entityPlatnostZaznamu.typ_platnosti;
                    success       = true;
                }
                else // UPDATE
                {
                    var temp = from a in risContext.platnost_zaznamu where a.typ_platnosti == typ_platnosti select a;
                    entityPlatnostZaznamu = temp.Single();
                    this.FillEntity();
                    risContext.SaveChanges();
                    success = true;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex);
            }

            return(success);
        }
コード例 #10
0
        public bool Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                var temp = from a in risContext.preklad where a.kod_jazyka == kod_jazyka &&
                           a.text_id == text_id select a;

                if (!temp.Any()) // INSERT
                {
                    this.FillEntity();
                    risContext.preklad.Add(entityPreklad);
                    risContext.SaveChanges();
                    success = true;
                }
                else // UPDATE
                {
                    entityPreklad = temp.Single();
                    this.FillEntity();
                    risContext.SaveChanges();
                    success = true;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex);
            }

            return(success);
        }
コード例 #11
0
        /// <summary>
        ///  Všetky jedla začínajúce na zadaný reťazec v danom jazyku
        /// </summary>
        /// <param name="startingWith">zadaný reťazec</param>
        /// <param name="id_jazyka">id jazyka</param>
        /// <returns></returns>
        public ICollection <TJedlo> vsetkyJedla(String startingWith, String id_jazyka)
        {
            risTabulky risContext = aDBExecutor.risContext;

            BJedlo.BJedloCol result = new BJedlo.BJedloCol(risContext);
            result.GetNameStartingWith(startingWith);
            return((ICollection <TJedlo>)result.toTransferList(id_jazyka));
        }
コード例 #12
0
        public IList <TTypJedla> typyJedal(String id_jazyka)
        {
            risTabulky risContext = aDBExecutor.risContext;

            BTyp_jedla.BTypJedlaCol kolBTypJedlaCol = new BTyp_jedla.BTypJedlaCol(risContext);
            kolBTypJedlaCol.GetAll();
            return(kolBTypJedlaCol.toList(id_jazyka));
        }
コード例 #13
0
        public BSurovina(TSurovina surovina, risTabulky risContext)
        {
            BSurovina temp = Zoznamy.dajSurovinu(surovina.Id, risContext);

            if (temp != null)
            {
                entitySurovina = temp.entitySurovina;
            }
        }
コード例 #14
0
        /// <summary>
        /// Uloží zmeny do databázy
        /// </summary>
        /// <param name="risContext">kontext databázy</param>
        /// <returns></returns>
        public bool Save(risTabulky risContext)
        {
            bool success = false;

            try
            {
                risContext.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Save()"), ex);
            }

            return(success);
        }
コード例 #15
0
        static void Main(string[] args)
        {
            risTabulky risContext = new risTabulky();

            stol stol = new stol
            {
                id_stola    = 1,
                pocet_miest = 6
            };

            //insert
            risContext.stol.Add(stol);

            risContext.SaveChanges();

            //update

            try
            {
                stol stolUpdate = new stol
                {
                    id_stola    = 8,
                    pocet_miest = 10
                };
                risContext.stol.Attach(stolUpdate);

                var entry = risContext.Entry(stolUpdate);
                entry.State = EntityState.Modified;

                entry.Property(e => e.pocet_miest).IsModified = true;

                risContext.SaveChanges();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException.ToString());
            }


            //delete
            stol stolDelete = risContext.stol.First(i => i.id_stola == stol.id_stola);

            risContext.stol.Remove(stolDelete);
            risContext.SaveChanges();
        }
コード例 #16
0
            public bool GetAll(risTabulky risContext)
            {
                try
                {
                    var temp = from a in risContext.objednavka_menu select a;
                    List <objednavka_menu> tempList = temp.ToList();
                    foreach (var a in tempList)
                    {
                        this.Add(a.id_menu + "," + a.id_objednavky, new BObjednavka_menu(a));
                    }

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
コード例 #17
0
            public bool GetAll(risTabulky risContext)
            {
                try
                {
                    var temp = from a in risContext.platnost_zaznamu select a;
                    List <platnost_zaznamu> tempList = temp.ToList();
                    foreach (var a in tempList)
                    {
                        this.Add(a.typ_platnosti, new BPlatnost_zaznamu(a));
                    }

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
コード例 #18
0
ファイル: BJazyk.cs プロジェクト: LubomirKovalcik/RISSolution
            public bool GetAll(risTabulky risContext)
            {
                try
                {
                    var          temp     = from a in risContext.jazyk select a;
                    List <jazyk> tempList = temp.ToList();
                    foreach (var a in tempList)
                    {
                        this.Add(a.kod_jazyka, new BJazyk(a));
                    }

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
コード例 #19
0
            public bool GetAll(risTabulky risContext)
            {
                try
                {
                    var temp = from a in risContext.denne_menu select a;
                    List <denne_menu> tempList = temp.ToList();
                    foreach (var a in tempList)
                    {
                        this.Add(a.id_menu, new BDenne_menu(a));
                    }

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
コード例 #20
0
        public bool Get(risTabulky risContext, int typ)
        {
            bool success = false;

            try
            {
                var temp = from a in risContext.platnost_zaznamu where a.typ_platnosti == typ select a;
                entityPlatnostZaznamu = temp.Single();
                this.FillBObject();
                success = true;
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Get()"), ex);
            }

            return(success);
        }
コード例 #21
0
ファイル: BUcet.cs プロジェクト: LubomirKovalcik/RISSolution
            public bool GetAll(risTabulky risContext)
            {
                try
                {
                    var         temp     = from a in risContext.ucet select a;
                    List <ucet> tempList = temp.ToList();
                    foreach (var a in tempList)
                    {
                        this.Add(a.id_uctu, new BUcet(a));
                    }

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
コード例 #22
0
            public bool GetAll(risTabulky risContext)
            {
                try
                {
                    var          temp     = from a in risContext.napoj select a;
                    List <napoj> tempList = temp.ToList();
                    foreach (var a in tempList)
                    {
                        this.Add(a.id_napoja, new BNapoj(a));
                    }

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
コード例 #23
0
        public bool Get(risTabulky risContext, int id)
        {
            bool success = false;

            try
            {
                var temp = from a in risContext.denne_menu where a.id_menu == id select a;
                entityDenneMenu = temp.Single();
                this.FillBObject();
                success = true;
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Get()"), ex);
            }

            return(success);
        }
コード例 #24
0
            public bool GetAll(risTabulky risContext)
            {
                try
                {
                    var temp = from a in risContext.zmena_otvaracich_hodin select a;
                    List <zmena_otvaracich_hodin> tempList = temp.ToList();
                    foreach (var a in tempList)
                    {
                        this.Add(a.zaciatok_platnosti, new BZmena_otvaracich_hodin(a));
                    }

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
コード例 #25
0
            public bool GetAll(risTabulky risContext)
            {
                try
                {
                    var temp = from a in risContext.otvaracie_hodiny select a;
                    List <otvaracie_hodiny> tempList = temp.ToList();
                    foreach (var a in tempList)
                    {
                        this.Add(a.id_podniku + "," + a.cislo_dna, new BOtvaracie_hodiny(a));
                    }

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
コード例 #26
0
        public bool Get(risTabulky risContext, int id)
        {
            bool success = false;

            try
            {
                var temp = from a in risContext.zmena_otvaracich_hodin where a.zaciatok_platnosti == zaciatok_platnosti select a;
                entityZmenaOtvaracichHodin = temp.Single();
                this.FillBObject();
                success = true;
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Get()"), ex);
            }

            return(success);
        }
コード例 #27
0
            public bool GetAll(risTabulky risContext)
            {
                try
                {
                    var         temp     = from a in risContext.text select a;
                    List <text> tempList = temp.ToList();
                    foreach (var a in tempList)
                    {
                        this.Add(a.text_id, new BText(a));
                    }

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
コード例 #28
0
            public bool GetAll(risTabulky risContext)
            {
                try
                {
                    var         temp     = from a in risContext.stol select a;
                    List <stol> tempList = temp.ToList();
                    foreach (var a in tempList)
                    {
                        this.Add(a.id_stola, new BStol(a));
                    }

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
コード例 #29
0
        public bool Get(risTabulky risContext, string kod, int idText)
        {
            bool success = false;

            try
            {
                var temp = from a in risContext.preklad where a.kod_jazyka == kod && a.text_id == text_id select a;
                entityPreklad = temp.Single();
                this.FillBObject();
                success = true;
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("{0}.{1}", this.GetType(), "Get()"), ex);
            }

            return(success);
        }
コード例 #30
0
            public bool GetAll(risTabulky risContext)
            {
                try
                {
                    var            temp     = from a in risContext.preklad select a;
                    List <preklad> tempList = temp.ToList();
                    foreach (var a in tempList)
                    {
                        this.Add(a.kod_jazyka + "," + a.text_id, new BPreklad(a));
                    }

                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
コード例 #31
0
        static void Main(string[] args)
        {
            risTabulky risContext = new risTabulky();

            stol stol = new stol
            {
                id_stola = 1,
                pocet_miest = 6
            };
            //insert
            risContext.stol.Add(stol);

            risContext.SaveChanges();

            //update

            try
            {
                stol stolUpdate = new stol
                {
                    id_stola = 8,
                    pocet_miest = 10

                };
                risContext.stol.Attach(stolUpdate);

                var entry = risContext.Entry(stolUpdate);
                entry.State = EntityState.Modified;

                entry.Property(e => e.pocet_miest).IsModified = true;

                risContext.SaveChanges();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException.ToString());
            }

            //delete
            stol stolDelete = risContext.stol.First(i => i.id_stola == stol.id_stola);
            risContext.stol.Remove(stolDelete);
            risContext.SaveChanges();
        }